Awn

Merge lp:~awn-core/awn/gutted-core-icons into lp:awn/0.4

Proposed by Michal Hruby
Status: Merged
Merged at revision: 715
Proposed branch: lp:~awn-core/awn/gutted-core-icons
Merge into: lp:awn/0.4
Diff against target: 1656 lines (+612/-569)
19 files modified
Makefile.am (+0/-2)
applets/quick-prefs/applet.vala (+3/-3)
applets/taskmanager/dock-manager-api.vala (+2/-2)
configure.in (+6/-19)
src/Makefile.am (+31/-16)
src/awn-app-dbus.xml (+0/-16)
src/awn-app.c (+0/-223)
src/awn-app.h (+0/-83)
src/awn-app.vala (+162/-0)
src/awn-background-lucido.c (+1/-1)
src/awn-background.c (+10/-1)
src/awn-main.c (+2/-5)
src/awn-monitor.c (+12/-0)
src/awn-panel-dbus.xml (+0/-102)
src/awn-panel-dispatcher.vala (+222/-0)
src/awn-panel.c (+100/-86)
src/awn-panel.h (+14/-8)
src/awn-panel.vapi (+47/-0)
tests/Makefile.am (+0/-2)
To merge this branch: bzr merge lp:~awn-core/awn/gutted-core-icons
Reviewer Review Type Date Requested Status
Awn-core Pending
Review via email: mp+30352@code.launchpad.net

Description of the change

Implements support for on-the-fly addition and removal of panels.

To post a comment you must log in.
lp:~awn-core/awn/gutted-core-icons updated
1928. By Michal Hruby

Merge 1940

Revision history for this message
Alberto Aldegheri (albyrock87) wrote :

If those warnigs are not important, I approve :)

awn-panel-dispatcher.vala:84.18-84.52: warning: unhandled error `DBus.Error'
      var conn = DBus.Bus.get (DBus.BusType.SESSION);
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
awn-panel-dispatcher.vala:91.7-91.37: warning: unhandled error `GLib.Error'
      panel.add_applet (desktop_file);
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
awn-panel-dispatcher.vala:95.7-95.31: warning: unhandled error `GLib.Error'
      panel.delete_applet (uid);
      ^^^^^^^^^^^^^^^^^^^^^^^^^
awn-panel-dispatcher.vala:100.14-100.61: warning: unhandled error `GLib.Error'
      return panel.docklet_request (min_size, shrink, expand);
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
awn-panel-dispatcher.vala:113.7-113.34: warning: unhandled error `GLib.Error'
      panel.get_snapshot (out val);
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation succeeded - 5 warning(s)
awn-app.vala:45.21-45.42: warning: unhandled error `GLib.Error'
      this.client = Config.get_default (0);
                    ^^^^^^^^^^^^^^^^^^^^^^
awn-app.vala:49.25-49.49: warning: unhandled error `DBus.Error'
      this.connection = Bus.get (BusType.SESSION);

Revision history for this message
Michal Hruby (mhr3) wrote :

As a reminder for me, here are a couple of things I noticed that don't work:
- Setting applet / docklet flags via DBus
- DBus method GetSnapshot doesn't return anything

lp:~awn-core/awn/gutted-core-icons updated
1929. By Michal Hruby

A few DBus fixes

1930. By Michal Hruby

Fix compability with vala 0.9.x

1931. By Michal Hruby

Fix critical in Lucido, clip drawing to background helper surface

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile.am'
--- Makefile.am 2010-03-09 21:10:09 +0000
+++ Makefile.am 2010-07-24 23:31:47 +0000
@@ -1,8 +1,6 @@
1NULL = 1NULL =
22
3if HAVE_VALA
4VALA_BINDINGS = bindings/vala3VALA_BINDINGS = bindings/vala
5endif
64
7SUBDIRS = \5SUBDIRS = \
8 libawn \6 libawn \
97
=== modified file 'applets/quick-prefs/applet.vala'
--- applets/quick-prefs/applet.vala 2010-05-28 21:49:08 +0000
+++ applets/quick-prefs/applet.vala 2010-07-24 23:31:47 +0000
@@ -54,9 +54,9 @@
5454
55 public PrefsApplet (string canonical_name, string uid, int panel_id)55 public PrefsApplet (string canonical_name, string uid, int panel_id)
56 {56 {
57 this.canonical_name = canonical_name;57 GLib.Object (canonical_name: canonical_name,
58 this.uid = uid;58 uid: uid,
59 this.panel_id = panel_id;59 panel_id: panel_id);
60 }60 }
6161
62 construct62 construct
6363
=== modified file 'applets/taskmanager/dock-manager-api.vala'
--- applets/taskmanager/dock-manager-api.vala 2010-04-11 12:41:57 +0000
+++ applets/taskmanager/dock-manager-api.vala 2010-07-24 23:31:47 +0000
@@ -66,7 +66,7 @@
66 });66 });
67 */67 */
6868
69 var conn = Bus.get (BusType.SESSION);69 var conn = DBus.Bus.get (DBus.BusType.SESSION);
70 string obj_path = "/org/freedesktop/DockManager";70 string obj_path = "/org/freedesktop/DockManager";
71 conn.register_object (obj_path, this);71 conn.register_object (obj_path, this);
72 }72 }
@@ -244,7 +244,7 @@
244 {244 {
245 this.icon = icon;245 this.icon = icon;
246246
247 var conn = Bus.get (BusType.SESSION);247 var conn = DBus.Bus.get (DBus.BusType.SESSION);
248 this.object_path = "/org/freedesktop/DockManager/Item%d".printf (counter++);248 this.object_path = "/org/freedesktop/DockManager/Item%d".printf (counter++);
249 conn.register_object (this.object_path, this);249 conn.register_object (this.object_path, this);
250250
251251
=== modified file 'configure.in'
--- configure.in 2010-04-11 17:06:01 +0000
+++ configure.in 2010-07-24 23:31:47 +0000
@@ -60,20 +60,11 @@
60dnl Vala support60dnl Vala support
61dnl ==============================================61dnl ==============================================
6262
63AC_ARG_WITH(vala, AS_HELP_STRING([--with-vala],[Enables installation of the Vala bindings]),,[with_vala=yes])63VALA_PROG_VALAC(0.8.1)
6464if test "$USE_MAINTAINER_MODE" = "yes"; then
65if test "$with_vala" != "no"; then65 AC_PATH_PROG(VALA_GEN_INTROSPECT, vala-gen-introspect, vala-gen-introspect, [])
66 VALA_PROG_VALAC(0.7.10)66 AC_PATH_PROG(VAPIGEN, vapigen, vapigen, [])
67 if test -n "$VALAC"; then
68 if test "$USE_MAINTAINER_MODE" = "yes"; then
69 AC_PATH_PROG(VALA_GEN_INTROSPECT, vala-gen-introspect, vala-gen-introspect, [])
70 AC_PATH_PROG(VAPIGEN, vapigen, vapigen, [])
71 fi
72 else
73 with_vala=no
74 fi
75fi67fi
76AM_CONDITIONAL(HAVE_VALA, test -n "$VALAC")
7768
78dnl ==============================================69dnl ==============================================
79dnl Check for Python modules70dnl Check for Python modules
@@ -145,10 +136,8 @@
145LDA_DEFSDIR=`$PKG_CONFIG --variable=defsdir desktop-agnostic`136LDA_DEFSDIR=`$PKG_CONFIG --variable=defsdir desktop-agnostic`
146AC_SUBST(LDA_DEFSDIR)137AC_SUBST(LDA_DEFSDIR)
147138
148if test "$with_vala" != "no"; then139LDA_VAPIDIR="`$PKG_CONFIG --variable=vapidir desktop-agnostic`"
149 LDA_VAPIDIR="`$PKG_CONFIG --variable=vapidir desktop-agnostic`"140AC_SUBST(LDA_VAPIDIR)
150 AC_SUBST(LDA_VAPIDIR)
151fi
152141
153AC_CHECK_LIB(m, lround)142AC_CHECK_LIB(m, lround)
154143
@@ -238,7 +227,5 @@
238echo ""227echo ""
239echo " prefix: ${prefix}"228echo " prefix: ${prefix}"
240echo ""229echo ""
241echo " Vala Support: ${with_vala}"
242echo ""
243echo " Documentation: ${enable_gtk_doc}"230echo " Documentation: ${enable_gtk_doc}"
244echo ""231echo ""
245232
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-05-16 19:12:31 +0000
+++ src/Makefile.am 2010-07-24 23:31:47 +0000
@@ -13,6 +13,30 @@
13 -I$(builddir) \13 -I$(builddir) \
14 $(NULL)14 $(NULL)
1515
16VALA_FILES = \
17 awn-panel-dispatcher.vala \
18 awn-app.vala \
19 $(NULL)
20
21VALA_FLAGS = \
22 $(top_builddir)/bindings/vala/awn.vapi \
23 awn-panel.vapi \
24 --pkg dbus-glib-1 \
25 --pkg gtk+-2.0 \
26 --pkg desktop-agnostic-cfg \
27 $(NULL)
28
29awn-core.vala.stamp: $(VALA_FILES)
30 $(foreach vala_file,$(VALA_FILES),\
31 $(VALAC) -C -H $(vala_file:.vala=.h) $(vala_file) $(VALA_FLAGS) && \
32 $(SED) -i -r 's/^#include <(awn.+h)>$$/#include "\1"/' $(vala_file:.vala=.)[ch] || exit 1;)
33 touch "$@"
34
35VALA_GENERATED_FILES = \
36 $(VALA_FILES:.vala=.c) \
37 $(VALA_FILES:.vala=.h) \
38 $(NULL)
39
16bin_PROGRAMS = avant-window-navigator40bin_PROGRAMS = avant-window-navigator
1741
18avant_window_navigator_LDADD = \42avant_window_navigator_LDADD = \
@@ -22,9 +46,6 @@
2246
23avant_window_navigator_SOURCES = \47avant_window_navigator_SOURCES = \
24 awn-main.c \48 awn-main.c \
25 awn-app.c \
26 awn-app.h \
27 awn-app-glue.h \
28 awn-applet-manager.c \49 awn-applet-manager.c \
29 awn-applet-manager.h \50 awn-applet-manager.h \
30 awn-applet-proxy.c \51 awn-applet-proxy.c \
@@ -50,7 +71,6 @@
50 awn-monitor.h \71 awn-monitor.h \
51 awn-panel.c \72 awn-panel.c \
52 awn-panel.h \73 awn-panel.h \
53 awn-panel-glue.h \
54 awn-separator.c \74 awn-separator.c \
55 awn-separator.h \75 awn-separator.h \
56 awn-throbber.c \76 awn-throbber.c \
@@ -62,27 +82,22 @@
62 inlinepixbufs.h \82 inlinepixbufs.h \
63 xutils.h \83 xutils.h \
64 xutils.c \84 xutils.c \
85 $(VALA_GENERATED_FILES) \
65 $(NULL)86 $(NULL)
6687
67# DBus glue
68awn-app-glue.h: awn-app-dbus.xml Makefile
69 $(QUIET_GEN)$(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_app --mode=glib-server --output=$@ $<
70
71awn-panel-glue.h: awn-panel-dbus.xml Makefile
72 $(QUIET_GEN)$(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_panel --mode=glib-server --output=$@ $<
73
74BUILT_SOURCES = \88BUILT_SOURCES = \
75 awn-app-glue.h \89 awn-core.vala.stamp \
76 awn-panel-glue.h \
77 $(MARSHALFILES) \90 $(MARSHALFILES) \
78 $(NULL)91 $(NULL)
7992
80CLEANFILES = $(BUILT_SOURCES)93CLEANFILES = \
94 $(BUILT_SOURCES) \
95 $(VALA_GENERATED_FILES) \
96 $(NULL)
8197
82EXTRA_DIST = \98EXTRA_DIST = \
83 awn-app-dbus.xml \
84 awn-panel-dbus.xml \
85 awn-marshal.list \99 awn-marshal.list \
100 $(VALA_GENERATED_FILES) \
86 $(NULL)101 $(NULL)
87102
88# vim: set ts=8 sts=8 sw=8 :103# vim: set ts=8 sts=8 sw=8 :
89104
=== removed file 'src/awn-app-dbus.xml'
--- src/awn-app-dbus.xml 2009-11-09 00:45:42 +0000
+++ src/awn-app-dbus.xml 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1<?xml version="1.0"?>
2<node name="/org/awnproject/Awn/App">
3<interface name="org.awnproject.Awn.App">
4 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_app"/>
5
6 <method name="GetPanels">
7 <arg name="panels" type="ao" direction="out" />
8 </method>
9
10 <method name="RemovePanel">
11 <arg name="panel_id" type="i" direction="in" />
12 </method>
13
14</interface>
15</node>
16
170
=== removed file 'src/awn-app.c'
--- src/awn-app.c 2010-04-09 23:58:31 +0000
+++ src/awn-app.c 1970-01-01 00:00:00 +0000
@@ -1,223 +0,0 @@
1/*
2 * Copyright (C) 2008 Neil J. Patel <njpatel@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 *
19 * Authored by Neil Jagdish Patel <njpatel@gmail.com>
20 *
21 */
22
23/*
24 * AwnApp is the 'controller' for the panel. It will launch the panel with the
25 * correct settings.
26 *
27 * In the future, AwnApp will be responsible for launching each Awn panel
28 * separately, and dealing with the configuration backend for each panel.
29 */
30
31#include <glib.h>
32
33#include <stdio.h>
34#include <string.h>
35
36#include <dbus/dbus-glib.h>
37#include <dbus/dbus-glib-bindings.h>
38
39#include <libawn/libawn.h>
40
41#include "awn-app.h"
42#include "awn-defines.h"
43#include "awn-panel.h"
44#include "awn-app-glue.h"
45#include <libawn/awn-utils.h>
46
47
48G_DEFINE_TYPE (AwnApp, awn_app, G_TYPE_OBJECT)
49
50#define AWN_APP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
51 AWN_TYPE_APP, AwnAppPrivate))
52
53struct _AwnAppPrivate
54{
55 DBusGConnection *connection;
56 DesktopAgnosticConfigClient *client;
57
58 GHashTable *panels;
59};
60
61/* GObject functions */
62static void
63awn_app_finalize (GObject *app)
64{
65 AwnAppPrivate *priv;
66
67 g_return_if_fail (AWN_IS_APP (app));
68 priv = AWN_APP (app)->priv;
69
70 g_object_unref (priv->client);
71
72 G_OBJECT_CLASS (awn_app_parent_class)->finalize (app);
73}
74
75static void
76awn_app_class_init (AwnAppClass *klass)
77{
78 GObjectClass *obj_class = G_OBJECT_CLASS (klass);
79
80 obj_class->finalize = awn_app_finalize;
81
82 g_type_class_add_private (obj_class, sizeof (AwnAppPrivate));
83
84 dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
85 &dbus_glib_awn_app_object_info);
86}
87
88static void
89awn_app_init (AwnApp *app)
90{
91 AwnAppPrivate *priv;
92 GError *error = NULL;
93 GValueArray *panels = NULL;
94
95 priv = app->priv = AWN_APP_GET_PRIVATE (app);
96
97 priv->panels = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
98
99 priv->client = awn_config_get_default (0, &error);
100
101 if (error)
102 {
103 g_warning ("Unable to retrieve the configuration client: %s",
104 error->message);
105 g_error_free (error);
106 gtk_main_quit ();
107 }
108
109 gtk_window_set_default_icon_name ("avant-window-navigator");
110
111 /* Grab a connection to the bus */
112 priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
113 if (priv->connection == NULL)
114 {
115 g_warning ("Unable to make connection to the D-Bus session bus: %s",
116 error->message);
117 g_error_free (error);
118 gtk_main_quit ();
119 }
120
121 panels = desktop_agnostic_config_client_get_list (priv->client,
122 AWN_GROUP_PANELS,
123 AWN_PANELS_IDS,
124 &error);
125
126 if (error)
127 {
128 g_error ("Unable to retrieve panels config value: %s",
129 error->message);
130 g_error_free (error);
131 return;
132 }
133
134 if (panels->n_values == 0)
135 {
136 gboolean is_gconf = FALSE;
137 GType config_type = desktop_agnostic_config_get_type (NULL);
138
139 if (config_type)
140 {
141 const gchar *config_backend = g_type_name (config_type);
142 is_gconf = strstr (config_backend, "GConf") != NULL;
143 }
144 g_error ("No panels to create! %s", is_gconf ?
145 "\n** Please check that the gconf-schema is installed."
146 "\n** You might also try to run `killall gconfd-2`." : "");
147 return;
148 }
149
150 // FIXME: we could check here if there are any values in the panel_list
151 // and show a "Restart gconfd-2? dialog" if there aren't
152
153 for (guint i=0; i < panels->n_values; i++)
154 {
155 GtkWidget *panel;
156
157 GValue *value = g_value_array_get_nth (panels, i);
158
159 gint panel_id = g_value_get_int (value);
160 panel = awn_panel_new_with_panel_id (panel_id);
161
162 gchar *object_path = g_strdup_printf (AWN_DBUS_PANEL_PATH "%d", panel_id);
163
164 dbus_g_connection_register_g_object (priv->connection,
165 object_path, G_OBJECT (panel));
166
167 g_hash_table_insert (priv->panels, object_path, panel);
168
169 gtk_widget_show (panel);
170 }
171
172 g_value_array_free (panels);
173}
174
175gboolean
176awn_app_remove_panel (AwnApp *app, gint panel_id, GError *error)
177{
178 // remove the panel for real once we do multiple panels
179 if (panel_id == AWN_PANEL_ID_DEFAULT)
180 {
181 gtk_main_quit ();
182 }
183
184 return TRUE;
185}
186
187gboolean
188awn_app_get_panels (AwnApp *app, GPtrArray **panels)
189{
190 AwnAppPrivate *priv;
191 GList *list, *l;
192
193 priv = app->priv;
194
195 *panels = g_ptr_array_sized_new (g_hash_table_size (priv->panels));
196
197 list = l = g_hash_table_get_keys (priv->panels); // list should be freed
198
199 while (list)
200 {
201 g_ptr_array_add (*panels, g_strdup (list->data));
202
203 list = list->next;
204 }
205
206 g_list_free (l);
207
208 return TRUE;
209}
210
211AwnApp*
212awn_app_get_default (void)
213{
214 static AwnApp *app = NULL;
215
216 if (app == NULL)
217 {
218 app = g_object_new (AWN_TYPE_APP, NULL);
219 }
220
221 return app;
222}
223
2240
=== removed file 'src/awn-app.h'
--- src/awn-app.h 2009-11-09 00:45:42 +0000
+++ src/awn-app.h 1970-01-01 00:00:00 +0000
@@ -1,83 +0,0 @@
1/*
2 * Copyright (C) 2008 Neil Jagdish Patel
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 *
19 * Authored by Neil Jagdish Patel <njpatel@gmail.com>
20 *
21 */
22
23#ifndef _HAVE_AWN_APP_H
24#define _HAVE_AWN_APP_H
25
26#include <glib.h>
27#include <gtk/gtk.h>
28
29G_BEGIN_DECLS
30
31#define AWN_TYPE_APP (awn_app_get_type ())
32
33#define AWN_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
34 AWN_TYPE_APP, AwnApp))
35
36#define AWN_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
37 AWN_TYPE_APP, AwnAppClass))
38
39#define AWN_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
40 AWN_TYPE_APP))
41
42#define AWN_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
43 AWN_TYPE_APP))
44
45#define AWN_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
46 AWN_TYPE_APP, AwnAppClass))
47
48typedef struct _AwnApp AwnApp;
49typedef struct _AwnAppClass AwnAppClass;
50typedef struct _AwnAppPrivate AwnAppPrivate;
51
52
53struct _AwnApp
54{
55 GObject parent;
56
57 /*< private >*/
58 AwnAppPrivate *priv;
59};
60
61struct _AwnAppClass
62{
63 /*< private >*/
64 GObjectClass parent_class;
65
66 /*< private >*/
67 void (*_awn_app_1) (void);
68 void (*_awn_app_2) (void);
69 void (*_awn_app_3) (void);
70 void (*_awn_app_4) (void);
71};
72
73GType awn_app_get_type (void) G_GNUC_CONST;
74
75AwnApp * awn_app_get_default (void);
76
77gboolean awn_app_remove_panel (AwnApp *app, gint panel_id, GError *error);
78
79gboolean awn_app_get_panels (AwnApp *app, GPtrArray **panels);
80
81G_END_DECLS
82
83#endif /* _HAVE_AWN_APP_H */
840
=== added file 'src/awn-app.vala'
--- src/awn-app.vala 1970-01-01 00:00:00 +0000
+++ src/awn-app.vala 2010-07-24 23:31:47 +0000
@@ -0,0 +1,162 @@
1/*
2 * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Authored by Michal Hruby <michal.mhr@gmail.com>
19 *
20 */
21
22using DBus;
23
24namespace Awn
25{
26 [DBus (name="org.awnproject.Awn.App")]
27 public interface AppDBusInterface: GLib.Object
28 {
29 public abstract ObjectPath[] get_panels () throws DBus.Error;
30 public abstract void remove_panel (int panel_id) throws DBus.Error;
31 }
32
33 public class Application: GLib.Object, AppDBusInterface
34 {
35 private static Application instance;
36
37 private HashTable<string, Panel> panels;
38 private Connection connection;
39 private DesktopAgnostic.Config.Client client;
40
41 private Application ()
42 {
43 this.panels = new HashTable<string, Panel>.full (str_hash, str_equal,
44 g_free, g_object_unref);
45 this.client = Config.get_default (0);
46
47 Gtk.Window.set_default_icon_name ("avant-window-navigator");
48
49 this.connection = DBus.Bus.get (DBus.BusType.SESSION);
50 this.connection.register_object ("/org/awnproject/Awn", this);
51
52 try
53 {
54 var panel_ids = this.client.get_list ("panels", "panel_list");
55
56 if (panel_ids.n_values == 0)
57 {
58 bool is_gconf = false;
59 Type config_type = DesktopAgnostic.Config.get_type ();
60 if (config_type > 0)
61 {
62 is_gconf = config_type.name ().str ("GConf") != null;
63 }
64 error ("No panels to create! %s", is_gconf ?
65 "\n** Please check that the gconf-schema is installed." +
66 "\n** You might want to try running `killall gconfd-2`." : "");
67 }
68
69 foreach (Value val in panel_ids)
70 {
71 int panel_id = val.get_int ();
72 string path = "/org/awnproject/Awn/Panel%d".printf (panel_id);
73
74 Panel panel = new Panel.with_panel_id (panel_id);
75
76 this.panels.insert ((owned)path, panel);
77
78 panel.show ();
79 }
80
81 this.client.notify_add ("panels", "panel_list", this.panels_changed);
82 }
83 catch (GLib.Error e)
84 {
85 error ("Unable to retrieve panels config value: %s", e.message);
86 }
87 }
88
89 private void panels_changed (string key, string group, Value val)
90 {
91 List<unowned Panel> untouched_panels = new List<unowned Panel> ();
92 foreach (var p in this.panels.get_values ())
93 {
94 untouched_panels.append (p);
95 }
96
97 unowned ValueArray arr = (ValueArray) val.get_boxed ();
98 foreach (Value v in arr)
99 {
100 int panel_id = v.get_int ();
101 string path = "/org/awnproject/Awn/Panel%d".printf (panel_id);
102 unowned Panel? p = this.panels.lookup (path);
103
104 if (p == null)
105 {
106 var panel = new Panel.with_panel_id (panel_id);
107 this.panels.insert ((owned)path, panel);
108
109 panel.show ();
110 }
111 else
112 {
113 untouched_panels.remove (p);
114 }
115 }
116
117 foreach (unowned Panel p in untouched_panels)
118 {
119 string path = "/org/awnproject/Awn/Panel%d".printf (p.panel_id);
120 this.panels.remove (path);
121 p.destroy ();
122 }
123 }
124
125 public ObjectPath[] get_panels () throws DBus.Error
126 {
127 var keys = this.panels.get_keys ();
128 keys.sort (strcmp);
129
130 ObjectPath[] paths = new ObjectPath[keys.length ()];
131 int i = 0;
132 foreach (unowned string path in keys)
133 {
134 paths[i++] = new ObjectPath (path);
135 }
136
137 return paths;
138 }
139
140 public void remove_panel (int panel_id) throws DBus.Error
141 {
142 if (panel_id == 1)
143 {
144 Gtk.main_quit ();
145 }
146 else
147 {
148 // TODO
149 }
150 }
151
152 public static unowned Application get_default ()
153 {
154 if (instance == null)
155 {
156 instance = new Application ();
157 }
158 return instance;
159 }
160 }
161}
162
0163
=== modified file 'src/awn-background-lucido.c'
--- src/awn-background-lucido.c 2010-07-16 10:51:33 +0000
+++ src/awn-background-lucido.c 2010-07-24 23:31:47 +0000
@@ -160,6 +160,7 @@
160 g_return_if_fail (manager);160 g_return_if_fail (manager);
161 g_signal_connect_swapped (manager, "applets-refreshed",161 g_signal_connect_swapped (manager, "applets-refreshed",
162 G_CALLBACK (awn_background_lucido_applets_refreshed), bg);162 G_CALLBACK (awn_background_lucido_applets_refreshed), bg);
163 awn_background_lucido_applets_refreshed (AWN_BACKGROUND (bg));
163}164}
164165
165static void166static void
@@ -234,7 +235,6 @@
234 priv->tid = 0;235 priv->tid = 0;
235 priv->pos = g_array_new (FALSE, TRUE, sizeof (gfloat));236 priv->pos = g_array_new (FALSE, TRUE, sizeof (gfloat));
236 priv->pos_size = 0;237 priv->pos_size = 0;
237 awn_background_lucido_applets_refreshed (AWN_BACKGROUND (bg));
238}238}
239239
240AwnBackground *240AwnBackground *
241241
=== modified file 'src/awn-background.c'
--- src/awn-background.c 2010-07-16 10:51:33 +0000
+++ src/awn-background.c 2010-07-24 23:31:47 +0000
@@ -714,7 +714,7 @@
714714
715void 715void
716awn_background_draw (AwnBackground *bg,716awn_background_draw (AwnBackground *bg,
717 cairo_t *cr, 717 cairo_t *cr,
718 GtkPositionType position,718 GtkPositionType position,
719 GdkRectangle *area)719 GdkRectangle *area)
720{720{
@@ -735,9 +735,12 @@
735 if (klass->get_needs_redraw (bg, position, area))735 if (klass->get_needs_redraw (bg, position, area))
736 {736 {
737 cairo_t *temp_cr;737 cairo_t *temp_cr;
738 gdouble clip_x1, clip_x2, clip_y1, clip_y2;
738 gint full_width = area->x + area->width;739 gint full_width = area->x + area->width;
739 gint full_height = area->y + area->height;740 gint full_height = area->y + area->height;
740741
742 cairo_clip_extents (cr, &clip_x1, &clip_y1, &clip_x2, &clip_y2);
743
741 gboolean realloc_needed = bg->helper_surface == NULL ||744 gboolean realloc_needed = bg->helper_surface == NULL ||
742 cairo_image_surface_get_width (bg->helper_surface) != full_width ||745 cairo_image_surface_get_width (bg->helper_surface) != full_width ||
743 cairo_image_surface_get_height (bg->helper_surface) != full_height;746 cairo_image_surface_get_height (bg->helper_surface) != full_height;
@@ -753,10 +756,16 @@
753 full_width,756 full_width,
754 full_height);757 full_height);
755 temp_cr = cairo_create (bg->helper_surface);758 temp_cr = cairo_create (bg->helper_surface);
759 cairo_rectangle (temp_cr, clip_x1, clip_y1,
760 clip_x2-clip_x1, clip_y2-clip_y1);
761 cairo_clip (temp_cr);
756 }762 }
757 else763 else
758 {764 {
759 temp_cr = cairo_create (bg->helper_surface);765 temp_cr = cairo_create (bg->helper_surface);
766 cairo_rectangle (temp_cr, clip_x1, clip_y1,
767 clip_x2-clip_x1, clip_y2-clip_y1);
768 cairo_clip (temp_cr);
760 cairo_set_operator (temp_cr, CAIRO_OPERATOR_CLEAR);769 cairo_set_operator (temp_cr, CAIRO_OPERATOR_CLEAR);
761 cairo_paint (temp_cr);770 cairo_paint (temp_cr);
762 cairo_set_operator (temp_cr, CAIRO_OPERATOR_OVER);771 cairo_set_operator (temp_cr, CAIRO_OPERATOR_OVER);
763772
=== modified file 'src/awn-main.c'
--- src/awn-main.c 2010-04-21 22:03:42 +0000
+++ src/awn-main.c 2010-07-24 23:31:47 +0000
@@ -70,7 +70,7 @@
70gint 70gint
71main (gint argc, gchar *argv[])71main (gint argc, gchar *argv[])
72{72{
73 AwnApp *app;73 AwnApplication *app;
74 GOptionContext *context;74 GOptionContext *context;
75 DBusGConnection *connection;75 DBusGConnection *connection;
76 DBusGProxy *proxy;76 DBusGProxy *proxy;
@@ -147,10 +147,7 @@
147 textdomain (GETTEXT_PACKAGE);147 textdomain (GETTEXT_PACKAGE);
148148
149 /* Launch Awn */149 /* Launch Awn */
150 app = awn_app_get_default ();150 app = awn_application_get_default ();
151 dbus_g_connection_register_g_object (connection,
152 AWN_DBUS_APP_PATH,
153 G_OBJECT (app));
154151
155 g_unsetenv ("DESKTOP_AUTOSTART_ID");152 g_unsetenv ("DESKTOP_AUTOSTART_ID");
156 gtk_main ();153 gtk_main ();
157154
=== modified file 'src/awn-monitor.c'
--- src/awn-monitor.c 2010-05-29 17:17:22 +0000
+++ src/awn-monitor.c 2010-07-24 23:31:47 +0000
@@ -242,6 +242,18 @@
242242
243 priv = AWN_MONITOR_GET_PRIVATE (object);243 priv = AWN_MONITOR_GET_PRIVATE (object);
244244
245 if (priv->size_signal_id)
246 {
247 g_signal_handler_disconnect (priv->screen, priv->size_signal_id);
248 priv->size_signal_id = 0;
249 }
250
251 if (priv->monitors_signal_id)
252 {
253 g_signal_handler_disconnect (priv->screen, priv->monitors_signal_id);
254 priv->monitors_signal_id = 0;
255 }
256
245 desktop_agnostic_config_client_unbind_all_for_object (priv->client,257 desktop_agnostic_config_client_unbind_all_for_object (priv->client,
246 object, NULL);258 object, NULL);
247259
248260
=== removed file 'src/awn-panel-dbus.xml'
--- src/awn-panel-dbus.xml 2010-01-01 12:50:38 +0000
+++ src/awn-panel-dbus.xml 1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
1<?xml version="1.0"?>
2<node name="/org/awnproject/Awn/Panel">
3 <interface name="org.awnproject.Awn.Panel">
4 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_panel"/>
5
6 <!-- Methods -->
7 <method name="AddApplet">
8 <arg name="desktop_file" type="s" direction="in" />
9 </method>
10
11 <method name="DeleteApplet">
12 <arg name="uid" type="s" direction="in" />
13 </method>
14
15 <method name="SetAppletFlags">
16 <arg name="uid" type="s" direction="in" />
17 <arg name="flags" type="i" direction="in" />
18 </method>
19
20 <method name="InhibitAutohide">
21 <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
22 <arg name="app_name" type="s" direction="in" />
23 <arg name="reason" type="s" direction="in" />
24 <arg name="cookie" type="u" direction="out" />
25 </method>
26
27 <method name="UninhibitAutohide">
28 <arg name="cookie" type="u" direction="in" />
29 </method>
30
31 <method name="GetInhibitors">
32 <arg name="inhibitors" type="as" direction="out" />
33 </method>
34
35 <method name="DockletRequest">
36 <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
37 <arg name="min_size" type="i" direction="in" />
38 <arg name="shrink" type="b" direction="in" />
39 <arg name="expand" type="b" direction="in" />
40 <arg name="window_id" type="x" direction="out" />
41 </method>
42
43 <method name="GetSnapshot">
44 <arg name="pixbuf" type="v" direction="out" />
45 </method>
46
47 <!-- Signals -->
48 <signal name="SizeChanged">
49 <arg name="size" type="i" />
50 </signal>
51
52 <signal name="PositionChanged">
53 <arg name="position" type="i" />
54 </signal>
55
56 <signal name="OffsetChanged">
57 <arg name="offset" type="i" />
58 </signal>
59
60 <signal name="PropertyChanged">
61 <arg name="uid" type="s" />
62 <arg name="prop-name" type="s" />
63 <arg name="value" type="v" />
64 </signal>
65
66 <signal name="DestroyNotify"></signal>
67
68 <signal name="DestroyApplet">
69 <arg name="uid" type="s" />
70 </signal>
71
72 <!-- Properties -->
73 <property name="Size" type="i" access="read" />
74 <property name="MaxSize" type="i" access="read" />
75 <property name="Position" type="i" access="read" />
76 <property name="Offset" type="i" access="read" />
77 <property name="PathType" type="i" access="read" />
78 <property name="OffsetModifier" type="d" access="read" />
79 <property name="PanelXid" type="x" access="read" />
80
81 </interface>
82
83 <interface name="org.awnproject.Awn.UA">
84 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_panel"/>
85
86 <!-- Methods -->
87 <method name="add_applet">
88 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_panel_ua_add_applet"/>
89 <arg name="name" type="s" direction="in" />
90 <arg name="uid" type="x" direction="in" />
91 <arg name="width" type="i" direction="in" />
92 <arg name="height" type="i" direction="in" />
93 <arg name="size_type" type="s" direction="in" />
94 </method>
95
96 <method name="get_all_server_flags">
97 <arg name="name" type="s" direction="in" />
98 <arg name="hash" type="a{ss}" direction="out" />
99 </method>
100
101 </interface>
102</node>
1030
=== added file 'src/awn-panel-dispatcher.vala'
--- src/awn-panel-dispatcher.vala 1970-01-01 00:00:00 +0000
+++ src/awn-panel-dispatcher.vala 2010-07-24 23:31:47 +0000
@@ -0,0 +1,222 @@
1/*
2 * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Authored by Michal Hruby <michal.mhr@gmail.com>
19 *
20 */
21
22namespace Awn
23{
24 public struct ImageStruct
25 {
26 int width;
27 int height;
28 int rowstride;
29 bool has_alpha;
30 int bits_per_sample;
31 int num_channels;
32 char[] pixel_data;
33 }
34
35 [DBus (name="org.awnproject.Awn.Panel")]
36 public interface PanelDBusInterface: Object
37 {
38 public abstract void add_applet (string desktop_file) throws DBus.Error;
39 public abstract void delete_applet (string uid) throws DBus.Error;
40
41 public abstract int64 docklet_request (int min_size,
42 bool shrink,
43 bool expand) throws DBus.Error;
44
45 public abstract string[] get_inhibitors () throws DBus.Error;
46 public abstract ImageStruct get_snapshot () throws DBus.Error;
47
48 public abstract uint inhibit_autohide (DBus.BusName sender,
49 string app_name,
50 string reason) throws DBus.Error;
51 public abstract void uninhibit_autohide (uint cookie) throws DBus.Error;
52
53 // FIXME: do we really need this?
54 public abstract void set_applet_flags (string uid,
55 int flags) throws DBus.Error;
56
57 public abstract double offset_modifier { get; }
58 public abstract int max_size { get; }
59 public abstract int offset { get; set; }
60 public abstract int path_type { get; }
61 public abstract int position { get; set; }
62 public abstract int size { get; set; }
63 public abstract int64 panel_xid { get; }
64
65 public signal void destroy_applet (string uid);
66 public signal void destroy_notify ();
67 public signal void property_changed (string prop_name, Value value);
68 }
69
70 public class PanelDispatcher: Object, PanelDBusInterface
71 {
72 public unowned Panel panel { get; construct; }
73
74 public PanelDispatcher (Panel panel)
75 {
76 Object (panel: panel);
77
78 panel.size_changed.connect ( (p, s) =>
79 {
80 this.property_changed ("size", s);
81 });
82 panel.position_changed.connect ( (p, pos) =>
83 {
84 this.property_changed ("position", pos);
85 });
86 panel.offset_changed.connect ( (p, o) =>
87 {
88 this.property_changed ("offset", o);
89 });
90 panel.property_changed.connect ( (p, pn, v) =>
91 {
92 this.property_changed (pn, v);
93 });
94
95 var conn = DBus.Bus.get (DBus.BusType.SESSION);
96 string obj_path = "/org/awnproject/Awn/Panel%d".printf(panel.panel_id);
97 conn.register_object (obj_path, this);
98 }
99
100 public void add_applet (string desktop_file) throws DBus.Error
101 {
102 panel.add_applet (desktop_file);
103 }
104 public void delete_applet (string uid) throws DBus.Error
105 {
106 panel.delete_applet (uid);
107 }
108
109 // FIXME: break this API and add the docklet flags from
110 // set_applet_flags () method here
111 public int64 docklet_request (int min_size, bool shrink, bool expand) throws DBus.Error
112 {
113 return panel.docklet_request (min_size, shrink, expand);
114 }
115
116 public string[] get_inhibitors () throws DBus.Error
117 {
118 string[] reasons = panel.get_inhibitors ();
119
120 return reasons;
121 }
122
123 public ImageStruct get_snapshot () throws DBus.Error
124 {
125 var result = ImageStruct ();
126 panel.get_snapshot (out result.width,
127 out result.height,
128 out result.rowstride,
129 out result.has_alpha,
130 out result.bits_per_sample,
131 out result.num_channels,
132 out result.pixel_data);
133
134 return result;
135 }
136
137 public uint inhibit_autohide (DBus.BusName sender,
138 string app_name,
139 string reason) throws DBus.Error
140 {
141 return panel.inhibit_autohide (sender, app_name, reason);
142 }
143
144 public void uninhibit_autohide (uint cookie) throws DBus.Error
145 {
146 panel.uninhibit_autohide (cookie);
147 }
148
149 public void set_applet_flags (string uid, int flags) throws DBus.Error
150 {
151 panel.set_applet_flags (uid, flags);
152 }
153
154 public double offset_modifier
155 {
156 get
157 {
158 return panel.offset_modifier;
159 }
160 }
161
162 public int max_size
163 {
164 get
165 {
166 return panel.max_size;
167 }
168 }
169
170 public int offset
171 {
172 get
173 {
174 return panel.offset;
175 }
176 set
177 {
178 panel.offset = value;
179 }
180 }
181
182 public int path_type
183 {
184 get
185 {
186 return panel.path_type;
187 }
188 }
189
190 public int position
191 {
192 get
193 {
194 return panel.position;
195 }
196 set
197 {
198 panel.position = value;
199 }
200 }
201
202 public int size
203 {
204 get
205 {
206 return panel.size;
207 }
208 set
209 {
210 panel.size = value;
211 }
212 }
213
214 public int64 panel_xid
215 {
216 get
217 {
218 return panel.panel_xid;
219 }
220 }
221 }
222}
0223
=== modified file 'src/awn-panel.c'
--- src/awn-panel.c 2010-07-07 15:40:09 +0000
+++ src/awn-panel.c 2010-07-24 23:31:47 +0000
@@ -48,6 +48,7 @@
48#include "awn-defines.h"48#include "awn-defines.h"
49#include "awn-marshal.h"49#include "awn-marshal.h"
50#include "awn-monitor.h"50#include "awn-monitor.h"
51#include "awn-panel-dispatcher.h"
51#include "awn-throbber.h"52#include "awn-throbber.h"
52#include "awn-x.h"53#include "awn-x.h"
5354
@@ -68,6 +69,7 @@
68 GHashTable *inhibits;69 GHashTable *inhibits;
69 guint startup_inhibit_cookie;70 guint startup_inhibit_cookie;
7071
72 AwnPanelDispatcher *dbus_proxy;
71 AwnBackground *bg;73 AwnBackground *bg;
7274
73 GtkWidget *alignment;75 GtkWidget *alignment;
@@ -296,7 +298,9 @@
296 GdkEventButton *event);298 GdkEventButton *event);
297static gboolean awn_panel_resize_timeout (gpointer data);299static gboolean awn_panel_resize_timeout (gpointer data);
298300
299static void awn_panel_add (GtkContainer *window, 301static void awn_panel_add (GtkContainer *window,
302 GtkWidget *widget);
303static void awn_panel_remove (GtkContainer *window,
300 GtkWidget *widget);304 GtkWidget *widget);
301305
302static void awn_panel_set_offset (AwnPanel *panel,306static void awn_panel_set_offset (AwnPanel *panel,
@@ -362,6 +366,11 @@
362static gboolean awn_panel_set_drag_proxy (AwnPanel *panel,366static gboolean awn_panel_set_drag_proxy (AwnPanel *panel,
363 gboolean check_mouse_pos);367 gboolean check_mouse_pos);
364368
369static void dbus_inhibitor_lost (AwnDBusWatcher *watcher,
370 gchar *name,
371 AwnInhibitItem *item);
372
373
365/*374/*
366 * GOBJECT CODE 375 * GOBJECT CODE
367 */376 */
@@ -494,6 +503,7 @@
494 return priv->dnd_proxy_win != NULL;503 return priv->dnd_proxy_win != NULL;
495}504}
496505
506#if !GTK_CHECK_VERSION(2, 19, 5)
497static gboolean507static gboolean
498awn_panel_drag_motion (GtkWidget *widget, GdkDragContext *context, 508awn_panel_drag_motion (GtkWidget *widget, GdkDragContext *context,
499 gint x, gint y, guint time_)509 gint x, gint y, guint time_)
@@ -512,6 +522,7 @@
512522
513 return TRUE;523 return TRUE;
514}524}
525#endif
515526
516static gboolean527static gboolean
517on_startup_complete (AwnPanel *panel)528on_startup_complete (AwnPanel *panel)
@@ -606,6 +617,9 @@
606 G_CALLBACK (on_window_state_event), NULL);617 G_CALLBACK (on_window_state_event), NULL);
607 g_signal_connect (panel, "delete-event",618 g_signal_connect (panel, "delete-event",
608 G_CALLBACK (gtk_true), NULL);619 G_CALLBACK (gtk_true), NULL);
620
621 /* DBus interface */
622 priv->dbus_proxy = awn_panel_dispatcher_new (AWN_PANEL (object));
609 623
610 /* Contents */624 /* Contents */
611 priv->manager = awn_applet_manager_new_from_config (priv->client);625 priv->manager = awn_applet_manager_new_from_config (priv->client);
@@ -1299,6 +1313,11 @@
1299{1313{
1300 AwnInhibitItem *item = data;1314 AwnInhibitItem *item = data;
13011315
1316 // remove the dbus watcher
1317 g_signal_handlers_disconnect_by_func (awn_dbus_watcher_get_default (),
1318 G_CALLBACK (dbus_inhibitor_lost),
1319 item);
1320
1302 if (item->description) g_free (item->description);1321 if (item->description) g_free (item->description);
13031322
1304 g_free (item);1323 g_free (item);
@@ -1352,7 +1371,7 @@
1352static gboolean awn_panel_check_mouse_pos (AwnPanel *panel,1371static gboolean awn_panel_check_mouse_pos (AwnPanel *panel,
1353 MouseCheckType check_type)1372 MouseCheckType check_type)
1354{1373{
1355 g_return_val_if_fail(AWN_IS_PANEL(panel), FALSE);1374 g_return_val_if_fail (AWN_IS_PANEL (panel), FALSE);
13561375
1357 GtkWidget *widget = GTK_WIDGET (panel);1376 GtkWidget *widget = GTK_WIDGET (panel);
1358 AwnPanelPrivate *priv = panel->priv;1377 AwnPanelPrivate *priv = panel->priv;
@@ -1361,8 +1380,14 @@
13611380
1362 gint x, y, window_x, window_y, width, height;1381 gint x, y, window_x, window_y, width, height;
1363 /* FIXME: probably needs some love to work on multiple monitors */1382 /* FIXME: probably needs some love to work on multiple monitors */
1383 panel_win = gtk_widget_get_window (widget);
1384
1385 if (!panel_win)
1386 {
1387 return FALSE;
1388 }
1389
1364 gdk_display_get_pointer (gdk_display_get_default (), NULL, &x, &y, NULL);1390 gdk_display_get_pointer (gdk_display_get_default (), NULL, &x, &y, NULL);
1365 panel_win = gtk_widget_get_window (widget);
1366 gdk_window_get_root_origin (panel_win, &window_x, &window_y);1391 gdk_window_get_root_origin (panel_win, &window_x, &window_y);
13671392
1368 switch (check_type)1393 switch (check_type)
@@ -1535,7 +1560,7 @@
1535static gboolean1560static gboolean
1536autohide_start_timeout (gpointer data)1561autohide_start_timeout (gpointer data)
1537{1562{
1538 g_return_val_if_fail(AWN_IS_PANEL(data), FALSE);1563 g_return_val_if_fail (AWN_IS_PANEL (data), FALSE);
1539 gboolean signal_ret = FALSE;1564 gboolean signal_ret = FALSE;
15401565
1541 AwnPanel *panel = AWN_PANEL (data);1566 AwnPanel *panel = AWN_PANEL (data);
@@ -1733,6 +1758,12 @@
1733 priv->resize_timer_id = 0;1758 priv->resize_timer_id = 0;
1734 }1759 }
17351760
1761 if (priv->dbus_proxy)
1762 {
1763 g_object_unref (priv->dbus_proxy);
1764 priv->dbus_proxy = NULL;
1765 }
1766
1736 desktop_agnostic_config_client_unbind_all_for_object (priv->client,1767 desktop_agnostic_config_client_unbind_all_for_object (priv->client,
1737 object, NULL);1768 object, NULL);
17381769
@@ -1750,11 +1781,15 @@
1750 priv->inhibits = NULL;1781 priv->inhibits = NULL;
1751 }1782 }
17521783
1784 if (priv->monitor)
1785 {
1786 g_object_unref (priv->monitor);
1787 priv->monitor = NULL;
1788 }
1789
1753 G_OBJECT_CLASS (awn_panel_parent_class)->finalize (object);1790 G_OBJECT_CLASS (awn_panel_parent_class)->finalize (object);
1754}1791}
17551792
1756#include "awn-panel-glue.h"
1757
1758static void1793static void
1759awn_panel_class_init (AwnPanelClass *klass)1794awn_panel_class_init (AwnPanelClass *klass)
1760{1795{
@@ -1769,6 +1804,7 @@
1769 obj_class->set_property = awn_panel_set_property;1804 obj_class->set_property = awn_panel_set_property;
17701805
1771 cont_class->add = awn_panel_add;1806 cont_class->add = awn_panel_add;
1807 cont_class->remove = awn_panel_remove;
1772 1808
1773 wid_class->expose_event = awn_panel_expose;1809 wid_class->expose_event = awn_panel_expose;
1774 wid_class->show = awn_panel_show;1810 wid_class->show = awn_panel_show;
@@ -2024,9 +2060,6 @@
2024 0);2060 0);
20252061
2026 g_type_class_add_private (obj_class, sizeof (AwnPanelPrivate));2062 g_type_class_add_private (obj_class, sizeof (AwnPanelPrivate));
2027
2028 dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
2029 &dbus_glib_awn_panel_object_info);
2030}2063}
20312064
2032static gboolean2065static gboolean
@@ -2927,6 +2960,28 @@
2927}2960}
29282961
2929static void2962static void
2963awn_panel_remove (GtkContainer *panel, GtkWidget *widget)
2964{
2965 AwnPanelPrivate *priv;
2966
2967 g_return_if_fail (AWN_IS_PANEL (panel));
2968 g_return_if_fail (GTK_IS_WIDGET (widget));
2969 priv = AWN_PANEL (panel)->priv;
2970
2971 if (widget == priv->eventbox)
2972 {
2973 /* the eventbox was added using the base method,
2974 so it also has to be removed using that way */
2975 GtkContainerClass *klass = GTK_CONTAINER_CLASS (awn_panel_parent_class);
2976 klass->remove (GTK_CONTAINER (panel), widget);
2977 }
2978 else
2979 {
2980 gtk_container_remove (GTK_CONTAINER (priv->viewport), widget);
2981 }
2982}
2983
2984static void
2930on_theme_changed (AwnBackground *bg, AwnPanel *panel)2985on_theme_changed (AwnBackground *bg, AwnPanel *panel)
2931{2986{
2932 g_return_if_fail (AWN_IS_BACKGROUND (bg));2987 g_return_if_fail (AWN_IS_BACKGROUND (bg));
@@ -3213,9 +3268,9 @@
3213 if (offset_mod != 1.0)3268 if (offset_mod != 1.0)
3214 {3269 {
3215 GValue mod_value = {0};3270 GValue mod_value = {0};
3216 g_value_init (&mod_value, G_TYPE_FLOAT);3271 g_value_init (&mod_value, G_TYPE_DOUBLE);
3217 /* FIXME: we also need to calculate our dimensions based on offset_mod */3272 /* FIXME: we also need to calculate our dimensions based on offset_mod */
3218 g_value_set_float (&mod_value, offset_mod);3273 g_value_set_double (&mod_value, offset_mod);
32193274
3220 priv->offset_mod = offset_mod;3275 priv->offset_mod = offset_mod;
3221 g_object_notify (G_OBJECT (panel), "offset-modifier");3276 g_object_notify (G_OBJECT (panel), "offset-modifier");
@@ -3674,11 +3729,11 @@
3674 awn_panel_uninhibit_autohide (item->panel, item->cookie);3729 awn_panel_uninhibit_autohide (item->panel, item->cookie);
3675}3730}
36763731
3677void3732guint
3678awn_panel_inhibit_autohide (AwnPanel *panel,3733awn_panel_inhibit_autohide (AwnPanel *panel,
3734 const gchar *sender,
3679 const gchar *app_name,3735 const gchar *app_name,
3680 const gchar *reason,3736 const gchar *reason)
3681 DBusGMethodInvocation *context)
3682{3737{
3683 AwnPanelPrivate *priv = panel->priv;3738 AwnPanelPrivate *priv = panel->priv;
36843739
@@ -3686,7 +3741,6 @@
36863741
3687 // watch the sender on dbus and remove all its inhibits when it3742 // watch the sender on dbus and remove all its inhibits when it
3688 // disappears (to be sure that we don't misbehave due to crashing app)3743 // disappears (to be sure that we don't misbehave due to crashing app)
3689 gchar *sender = dbus_g_method_get_sender (context);
3690 gchar *detailed_signal = g_strdup_printf ("name-disappeared::%s", sender);3744 gchar *detailed_signal = g_strdup_printf ("name-disappeared::%s", sender);
3691 g_signal_connect (awn_dbus_watcher_get_default (), detailed_signal,3745 g_signal_connect (awn_dbus_watcher_get_default (), detailed_signal,
3692 G_CALLBACK (dbus_inhibitor_lost),3746 G_CALLBACK (dbus_inhibitor_lost),
@@ -3694,9 +3748,8 @@
3694 GINT_TO_POINTER (cookie)));3748 GINT_TO_POINTER (cookie)));
36953749
3696 g_free (detailed_signal);3750 g_free (detailed_signal);
3697 g_free (sender);
36983751
3699 dbus_g_method_return (context, cookie);3752 return cookie;
3700}3753}
37013754
3702gboolean3755gboolean
@@ -3709,11 +3762,6 @@
37093762
3710 if (!item) return TRUE; // we could set an error3763 if (!item) return TRUE; // we could set an error
37113764
3712 // remove the dbus watcher
3713 g_signal_handlers_disconnect_by_func (awn_dbus_watcher_get_default (),
3714 G_CALLBACK (dbus_inhibitor_lost),
3715 item);
3716
3717 g_hash_table_remove (priv->inhibits, GINT_TO_POINTER (cookie));3765 g_hash_table_remove (priv->inhibits, GINT_TO_POINTER (cookie));
37183766
3719 if (g_hash_table_size (priv->inhibits) == 0)3767 if (g_hash_table_size (priv->inhibits) == 0)
@@ -3730,13 +3778,14 @@
3730 return TRUE;3778 return TRUE;
3731}3779}
37323780
3733gboolean3781GStrv
3734awn_panel_get_inhibitors (AwnPanel *panel, GStrv *reasons)3782awn_panel_get_inhibitors (AwnPanel *panel)
3735{3783{
3736 AwnPanelPrivate *priv = panel->priv;3784 AwnPanelPrivate *priv = panel->priv;
3737 GList *list, *l;3785 GList *list, *l;
3786 GStrv reasons;
37383787
3739 *reasons = g_new0 (char*, g_hash_table_size (priv->inhibits) + 1);3788 reasons = g_new0 (char*, g_hash_table_size (priv->inhibits) + 1);
37403789
3741 list = l = g_hash_table_get_values (priv->inhibits); // list should be freed3790 list = l = g_hash_table_get_values (priv->inhibits); // list should be freed
3742 int i=0;3791 int i=0;
@@ -3744,14 +3793,14 @@
3744 while (list)3793 while (list)
3745 {3794 {
3746 AwnInhibitItem *item = list->data;3795 AwnInhibitItem *item = list->data;
3747 (*reasons)[i++] = g_strdup (item->description);3796 reasons[i++] = g_strdup (item->description);
37483797
3749 list = list->next;3798 list = list->next;
3750 }3799 }
37513800
3752 g_list_free (l);3801 g_list_free (l);
37533802
3754 return TRUE;3803 return reasons;
3755}3804}
37563805
3757static void3806static void
@@ -3945,12 +3994,12 @@
3945 gtk_widget_hide (priv->docklet_closer);3994 gtk_widget_hide (priv->docklet_closer);
3946}3995}
39473996
3948void3997gint64
3949awn_panel_docklet_request (AwnPanel *panel,3998awn_panel_docklet_request (AwnPanel *panel,
3950 gint min_size,3999 gint min_size,
3951 gboolean shrink,4000 gboolean shrink,
3952 gboolean expand,4001 gboolean expand,
3953 DBusGMethodInvocation *context)4002 GError **error)
3954{4003{
3955 AwnPanelPrivate *priv = panel->priv;4004 AwnPanelPrivate *priv = panel->priv;
3956 GtkAllocation alloc;4005 GtkAllocation alloc;
@@ -4035,50 +4084,23 @@
40354084
4036 window_id = gtk_socket_get_id (GTK_SOCKET (priv->docklet));4085 window_id = gtk_socket_get_id (GTK_SOCKET (priv->docklet));
40374086
4038 dbus_g_method_return (context, window_id);4087 return window_id;
4039}
4040
4041static void
4042value_array_append_int (GValueArray *array, gint i)
4043{
4044 GValue *value = g_new0 (GValue, 1);
4045
4046 g_value_init (value, G_TYPE_INT);
4047 g_value_set_int (value, i);
4048
4049 g_value_array_append (array, value);
4050}
4051
4052static void
4053value_array_append_bool (GValueArray *array, gboolean b)
4054{
4055 GValue *value = g_new0 (GValue, 1);
4056
4057 g_value_init (value, G_TYPE_BOOLEAN);
4058 g_value_set_boolean (value, b);
4059
4060 g_value_array_append (array, value);
4061}
4062
4063static void
4064value_array_append_array (GValueArray *array, guchar *data, gsize data_len)
4065{
4066 GArray *byte_array;
4067 GValue *value = g_new0 (GValue, 1);
4068
4069 byte_array = g_array_sized_new (FALSE, FALSE, sizeof(guchar), data_len);
4070 g_array_append_vals (byte_array, data, data_len);
4071
4072 g_value_init (value, dbus_g_type_get_collection ("GArray", G_TYPE_CHAR));
4073 g_value_take_boxed (value, byte_array);
4074
4075 g_value_array_append (array, value);
4076}4088}
40774089
4078gboolean4090gboolean
4079awn_panel_get_snapshot (AwnPanel *panel, GValue *value, GError **error)4091awn_panel_get_snapshot (AwnPanel *panel,
4092 gint *width,
4093 gint *height,
4094 gint *rowstride,
4095 gboolean *has_alpha,
4096 gint *bits_per_sample,
4097 gint *num_channels,
4098 gchar **pixels,
4099 gint *pixels_length,
4100 GError **error)
4080{4101{
4081 GdkRectangle rect;4102 GdkRectangle rect;
4103 guint data_len;
4082 g_return_val_if_fail (AWN_IS_PANEL (panel), FALSE);4104 g_return_val_if_fail (AWN_IS_PANEL (panel), FALSE);
40834105
4084 awn_panel_get_draw_rect (panel, &rect, 0, 0);4106 awn_panel_get_draw_rect (panel, &rect, 0, 0);
@@ -4102,28 +4124,20 @@
4102 cairo_surface_flush (surface); 4124 cairo_surface_flush (surface);
41034125
4104 // stuff the pixbuf to our out param4126 // stuff the pixbuf to our out param
4105 gint width = rect.width;4127 *width = rect.width;
4106 gint height = rect.height;4128 *height = rect.height;
4107 gint rowstride = cairo_image_surface_get_stride (surface);4129 *rowstride = cairo_image_surface_get_stride (surface);
4108 gint n_channels = 4;4130 *has_alpha = TRUE;
4109 gint bits_per_sample = 8;4131 *bits_per_sample = 8;
4132 *num_channels = 4;
4133
4134 data_len = rect.height * cairo_image_surface_get_stride (surface);
4110 //gint image_len = (height - 1) * rowstride + width *4135 //gint image_len = (height - 1) * rowstride + width *
4111 // ((n_channels * bits_per_sample + 7) / 8);4136 // ((n_channels * bits_per_sample + 7) / 8);
41124137
4113 guchar *image = cairo_image_surface_get_data (surface);4138 guchar *image = cairo_image_surface_get_data (surface);
41144139 *pixels = g_memdup (image, data_len);
4115 GValueArray *image_struct = g_value_array_new (1);4140 *pixels_length = data_len;
4116
4117 value_array_append_int (image_struct, width);
4118 value_array_append_int (image_struct, height);
4119 value_array_append_int (image_struct, rowstride);
4120 value_array_append_bool (image_struct, TRUE);
4121 value_array_append_int (image_struct, bits_per_sample);
4122 value_array_append_int (image_struct, n_channels);
4123 value_array_append_array (image_struct, image, height * rowstride);
4124
4125 g_value_init (value, G_TYPE_VALUE_ARRAY);
4126 g_value_take_boxed (value, image_struct);
41274141
4128 cairo_surface_destroy (surface);4142 cairo_surface_destroy (surface);
41294143
41304144
=== modified file 'src/awn-panel.h'
--- src/awn-panel.h 2010-07-07 15:34:01 +0000
+++ src/awn-panel.h 2010-07-24 23:31:47 +0000
@@ -94,27 +94,33 @@
94 gint flags,94 gint flags,
95 GError **error);95 GError **error);
9696
97void awn_panel_inhibit_autohide (AwnPanel *panel,97guint awn_panel_inhibit_autohide (AwnPanel *panel,
98 const gchar *sender,
98 const gchar *app_name,99 const gchar *app_name,
99 const gchar *reason,100 const gchar *reason);
100 DBusGMethodInvocation *context);
101101
102gboolean awn_panel_uninhibit_autohide (AwnPanel *panel,102gboolean awn_panel_uninhibit_autohide (AwnPanel *panel,
103 guint cookie);103 guint cookie);
104104
105gboolean awn_panel_get_inhibitors (AwnPanel *panel,105GStrv awn_panel_get_inhibitors (AwnPanel *panel);
106 GStrv *reasons);
107106
108void awn_panel_docklet_request (AwnPanel *panel,107gint64 awn_panel_docklet_request (AwnPanel *panel,
109 gint min_size,108 gint min_size,
110 gboolean shrink,109 gboolean shrink,
111 gboolean expand,110 gboolean expand,
112 DBusGMethodInvocation *context);111 GError **error);
113112
114gboolean awn_panel_get_docklet_mode (AwnPanel *panel);113gboolean awn_panel_get_docklet_mode (AwnPanel *panel);
115114
116gboolean awn_panel_get_snapshot (AwnPanel *panel,115gboolean awn_panel_get_snapshot (AwnPanel *panel,
117 GValue *value,116 gint *width,
117 gint *height,
118 gint *rowstride,
119 gboolean *has_alpha,
120 gint *bits_per_sample,
121 gint *num_channels,
122 gchar **pixels,
123 gint *pixels_length,
118 GError **error);124 GError **error);
119125
120gboolean awn_panel_get_all_server_flags(AwnPanel *panel,126gboolean awn_panel_get_all_server_flags(AwnPanel *panel,
121127
=== added file 'src/awn-panel.vapi'
--- src/awn-panel.vapi 1970-01-01 00:00:00 +0000
+++ src/awn-panel.vapi 2010-07-24 23:31:47 +0000
@@ -0,0 +1,47 @@
1/* awn-panel.vapi stub (manually generated) */
2
3[CCode (cprefix = "Awn", lower_case_cprefix = "awn_")]
4namespace Awn {
5 [CCode (cheader_filename = "awn-panel.h")]
6 public class Panel : Gtk.Window, Atk.Implementor, Gtk.Buildable {
7 [CCode (type = "GtkWidget*", has_construct_function = false)]
8 public Panel.with_panel_id (int panel_id);
9 public bool add_applet (string desktop_file) throws GLib.Error;
10 public bool delete_applet (string uid) throws GLib.Error;
11 public bool set_applet_flags (string uid, int flags) throws GLib.Error;
12 public uint inhibit_autohide (string sender, string app_name, string reason);
13 public bool uninhibit_autohide (uint cookie);
14
15 [CCode (array_length = false, array_null_terminated = true)]
16 public string[] get_inhibitors ();
17
18 public bool get_snapshot (out int width, out int height, out int rowstride, out bool has_alpha, out int bits_per_sample, out int num_channels, out char[] pixel_data) throws GLib.Error;
19
20 public int64 docklet_request (int min_size, bool shrink, bool expand) throws GLib.Error;
21
22 [NoAccessorMethod]
23 public int panel_id { get; construct; }
24 [NoAccessorMethod]
25 public int64 panel_xid { get; }
26 [NoAccessorMethod]
27 public int position { get; set construct; }
28 [NoAccessorMethod]
29 public int size { get; set construct; }
30 [NoAccessorMethod]
31 public int offset { get; set construct; }
32 [NoAccessorMethod]
33 public int max_size { get; }
34 [NoAccessorMethod]
35 public int path_type { get; set construct; }
36 [NoAccessorMethod]
37 public float offset_modifier { get; set construct; }
38
39 public virtual signal void size_changed (int size);
40 public virtual signal void position_changed (int position);
41 public virtual signal void offset_changed (int offset);
42 public virtual signal void property_changed (string prop_name, GLib.Value val);
43
44 public virtual signal void destroy_applet (string uid);
45 public virtual signal void destroy_notify ();
46 }
47}
048
=== modified file 'tests/Makefile.am'
--- tests/Makefile.am 2010-01-11 21:30:13 +0000
+++ tests/Makefile.am 2010-07-24 23:31:47 +0000
@@ -41,7 +41,6 @@
41 test-taskmanager-dnd.py \41 test-taskmanager-dnd.py \
42 test-taskmanager-windows.py42 test-taskmanager-windows.py
4343
44if HAVE_VALA
45noinst_PROGRAMS += test-vala-awn-dialog44noinst_PROGRAMS += test-vala-awn-dialog
4645
47VALA_FILES = \46VALA_FILES = \
@@ -58,4 +57,3 @@
5857
59EXTRA_DIST += $(VALA_FILES)58EXTRA_DIST += $(VALA_FILES)
60CLEANFILES = test-vala-awn-dialog.c59CLEANFILES = test-vala-awn-dialog.c
61endif

Subscribers

People subscribed via source and target branches