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
1=== modified file 'Makefile.am'
2--- Makefile.am 2010-03-09 21:10:09 +0000
3+++ Makefile.am 2010-07-24 23:31:47 +0000
4@@ -1,8 +1,6 @@
5 NULL =
6
7-if HAVE_VALA
8 VALA_BINDINGS = bindings/vala
9-endif
10
11 SUBDIRS = \
12 libawn \
13
14=== modified file 'applets/quick-prefs/applet.vala'
15--- applets/quick-prefs/applet.vala 2010-05-28 21:49:08 +0000
16+++ applets/quick-prefs/applet.vala 2010-07-24 23:31:47 +0000
17@@ -54,9 +54,9 @@
18
19 public PrefsApplet (string canonical_name, string uid, int panel_id)
20 {
21- this.canonical_name = canonical_name;
22- this.uid = uid;
23- this.panel_id = panel_id;
24+ GLib.Object (canonical_name: canonical_name,
25+ uid: uid,
26+ panel_id: panel_id);
27 }
28
29 construct
30
31=== modified file 'applets/taskmanager/dock-manager-api.vala'
32--- applets/taskmanager/dock-manager-api.vala 2010-04-11 12:41:57 +0000
33+++ applets/taskmanager/dock-manager-api.vala 2010-07-24 23:31:47 +0000
34@@ -66,7 +66,7 @@
35 });
36 */
37
38- var conn = Bus.get (BusType.SESSION);
39+ var conn = DBus.Bus.get (DBus.BusType.SESSION);
40 string obj_path = "/org/freedesktop/DockManager";
41 conn.register_object (obj_path, this);
42 }
43@@ -244,7 +244,7 @@
44 {
45 this.icon = icon;
46
47- var conn = Bus.get (BusType.SESSION);
48+ var conn = DBus.Bus.get (DBus.BusType.SESSION);
49 this.object_path = "/org/freedesktop/DockManager/Item%d".printf (counter++);
50 conn.register_object (this.object_path, this);
51
52
53=== modified file 'configure.in'
54--- configure.in 2010-04-11 17:06:01 +0000
55+++ configure.in 2010-07-24 23:31:47 +0000
56@@ -60,20 +60,11 @@
57 dnl Vala support
58 dnl ==============================================
59
60-AC_ARG_WITH(vala, AS_HELP_STRING([--with-vala],[Enables installation of the Vala bindings]),,[with_vala=yes])
61-
62-if test "$with_vala" != "no"; then
63- VALA_PROG_VALAC(0.7.10)
64- if test -n "$VALAC"; then
65- if test "$USE_MAINTAINER_MODE" = "yes"; then
66- AC_PATH_PROG(VALA_GEN_INTROSPECT, vala-gen-introspect, vala-gen-introspect, [])
67- AC_PATH_PROG(VAPIGEN, vapigen, vapigen, [])
68- fi
69- else
70- with_vala=no
71- fi
72+VALA_PROG_VALAC(0.8.1)
73+if test "$USE_MAINTAINER_MODE" = "yes"; then
74+ AC_PATH_PROG(VALA_GEN_INTROSPECT, vala-gen-introspect, vala-gen-introspect, [])
75+ AC_PATH_PROG(VAPIGEN, vapigen, vapigen, [])
76 fi
77-AM_CONDITIONAL(HAVE_VALA, test -n "$VALAC")
78
79 dnl ==============================================
80 dnl Check for Python modules
81@@ -145,10 +136,8 @@
82 LDA_DEFSDIR=`$PKG_CONFIG --variable=defsdir desktop-agnostic`
83 AC_SUBST(LDA_DEFSDIR)
84
85-if test "$with_vala" != "no"; then
86- LDA_VAPIDIR="`$PKG_CONFIG --variable=vapidir desktop-agnostic`"
87- AC_SUBST(LDA_VAPIDIR)
88-fi
89+LDA_VAPIDIR="`$PKG_CONFIG --variable=vapidir desktop-agnostic`"
90+AC_SUBST(LDA_VAPIDIR)
91
92 AC_CHECK_LIB(m, lround)
93
94@@ -238,7 +227,5 @@
95 echo ""
96 echo " prefix: ${prefix}"
97 echo ""
98-echo " Vala Support: ${with_vala}"
99-echo ""
100 echo " Documentation: ${enable_gtk_doc}"
101 echo ""
102
103=== modified file 'src/Makefile.am'
104--- src/Makefile.am 2010-05-16 19:12:31 +0000
105+++ src/Makefile.am 2010-07-24 23:31:47 +0000
106@@ -13,6 +13,30 @@
107 -I$(builddir) \
108 $(NULL)
109
110+VALA_FILES = \
111+ awn-panel-dispatcher.vala \
112+ awn-app.vala \
113+ $(NULL)
114+
115+VALA_FLAGS = \
116+ $(top_builddir)/bindings/vala/awn.vapi \
117+ awn-panel.vapi \
118+ --pkg dbus-glib-1 \
119+ --pkg gtk+-2.0 \
120+ --pkg desktop-agnostic-cfg \
121+ $(NULL)
122+
123+awn-core.vala.stamp: $(VALA_FILES)
124+ $(foreach vala_file,$(VALA_FILES),\
125+ $(VALAC) -C -H $(vala_file:.vala=.h) $(vala_file) $(VALA_FLAGS) && \
126+ $(SED) -i -r 's/^#include <(awn.+h)>$$/#include "\1"/' $(vala_file:.vala=.)[ch] || exit 1;)
127+ touch "$@"
128+
129+VALA_GENERATED_FILES = \
130+ $(VALA_FILES:.vala=.c) \
131+ $(VALA_FILES:.vala=.h) \
132+ $(NULL)
133+
134 bin_PROGRAMS = avant-window-navigator
135
136 avant_window_navigator_LDADD = \
137@@ -22,9 +46,6 @@
138
139 avant_window_navigator_SOURCES = \
140 awn-main.c \
141- awn-app.c \
142- awn-app.h \
143- awn-app-glue.h \
144 awn-applet-manager.c \
145 awn-applet-manager.h \
146 awn-applet-proxy.c \
147@@ -50,7 +71,6 @@
148 awn-monitor.h \
149 awn-panel.c \
150 awn-panel.h \
151- awn-panel-glue.h \
152 awn-separator.c \
153 awn-separator.h \
154 awn-throbber.c \
155@@ -62,27 +82,22 @@
156 inlinepixbufs.h \
157 xutils.h \
158 xutils.c \
159+ $(VALA_GENERATED_FILES) \
160 $(NULL)
161
162-# DBus glue
163-awn-app-glue.h: awn-app-dbus.xml Makefile
164- $(QUIET_GEN)$(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_app --mode=glib-server --output=$@ $<
165-
166-awn-panel-glue.h: awn-panel-dbus.xml Makefile
167- $(QUIET_GEN)$(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_panel --mode=glib-server --output=$@ $<
168-
169 BUILT_SOURCES = \
170- awn-app-glue.h \
171- awn-panel-glue.h \
172+ awn-core.vala.stamp \
173 $(MARSHALFILES) \
174 $(NULL)
175
176-CLEANFILES = $(BUILT_SOURCES)
177+CLEANFILES = \
178+ $(BUILT_SOURCES) \
179+ $(VALA_GENERATED_FILES) \
180+ $(NULL)
181
182 EXTRA_DIST = \
183- awn-app-dbus.xml \
184- awn-panel-dbus.xml \
185 awn-marshal.list \
186+ $(VALA_GENERATED_FILES) \
187 $(NULL)
188
189 # vim: set ts=8 sts=8 sw=8 :
190
191=== removed file 'src/awn-app-dbus.xml'
192--- src/awn-app-dbus.xml 2009-11-09 00:45:42 +0000
193+++ src/awn-app-dbus.xml 1970-01-01 00:00:00 +0000
194@@ -1,16 +0,0 @@
195-<?xml version="1.0"?>
196-<node name="/org/awnproject/Awn/App">
197-<interface name="org.awnproject.Awn.App">
198- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_app"/>
199-
200- <method name="GetPanels">
201- <arg name="panels" type="ao" direction="out" />
202- </method>
203-
204- <method name="RemovePanel">
205- <arg name="panel_id" type="i" direction="in" />
206- </method>
207-
208-</interface>
209-</node>
210-
211
212=== removed file 'src/awn-app.c'
213--- src/awn-app.c 2010-04-09 23:58:31 +0000
214+++ src/awn-app.c 1970-01-01 00:00:00 +0000
215@@ -1,223 +0,0 @@
216-/*
217- * Copyright (C) 2008 Neil J. Patel <njpatel@gmail.com>
218- *
219- * This program is free software; you can redistribute it and/or
220- * modify it under the terms of the GNU General Public
221- * License as published by the Free Software Foundation; either
222- * version 2 of the License, or (at your option) any later version.
223- *
224- * This library is distributed in the hope that it will be useful,
225- * but WITHOUT ANY WARRANTY; without even the implied warranty of
226- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
227- * Lesser General Public License for more details.
228- *
229- * You should have received a copy of the GNU General Public
230- * License along with this library; if not, write to the
231- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
232- * Boston, MA 02111-1307, USA.
233- *
234- * Authored by Neil Jagdish Patel <njpatel@gmail.com>
235- *
236- */
237-
238-/*
239- * AwnApp is the 'controller' for the panel. It will launch the panel with the
240- * correct settings.
241- *
242- * In the future, AwnApp will be responsible for launching each Awn panel
243- * separately, and dealing with the configuration backend for each panel.
244- */
245-
246-#include <glib.h>
247-
248-#include <stdio.h>
249-#include <string.h>
250-
251-#include <dbus/dbus-glib.h>
252-#include <dbus/dbus-glib-bindings.h>
253-
254-#include <libawn/libawn.h>
255-
256-#include "awn-app.h"
257-#include "awn-defines.h"
258-#include "awn-panel.h"
259-#include "awn-app-glue.h"
260-#include <libawn/awn-utils.h>
261-
262-
263-G_DEFINE_TYPE (AwnApp, awn_app, G_TYPE_OBJECT)
264-
265-#define AWN_APP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
266- AWN_TYPE_APP, AwnAppPrivate))
267-
268-struct _AwnAppPrivate
269-{
270- DBusGConnection *connection;
271- DesktopAgnosticConfigClient *client;
272-
273- GHashTable *panels;
274-};
275-
276-/* GObject functions */
277-static void
278-awn_app_finalize (GObject *app)
279-{
280- AwnAppPrivate *priv;
281-
282- g_return_if_fail (AWN_IS_APP (app));
283- priv = AWN_APP (app)->priv;
284-
285- g_object_unref (priv->client);
286-
287- G_OBJECT_CLASS (awn_app_parent_class)->finalize (app);
288-}
289-
290-static void
291-awn_app_class_init (AwnAppClass *klass)
292-{
293- GObjectClass *obj_class = G_OBJECT_CLASS (klass);
294-
295- obj_class->finalize = awn_app_finalize;
296-
297- g_type_class_add_private (obj_class, sizeof (AwnAppPrivate));
298-
299- dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
300- &dbus_glib_awn_app_object_info);
301-}
302-
303-static void
304-awn_app_init (AwnApp *app)
305-{
306- AwnAppPrivate *priv;
307- GError *error = NULL;
308- GValueArray *panels = NULL;
309-
310- priv = app->priv = AWN_APP_GET_PRIVATE (app);
311-
312- priv->panels = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
313-
314- priv->client = awn_config_get_default (0, &error);
315-
316- if (error)
317- {
318- g_warning ("Unable to retrieve the configuration client: %s",
319- error->message);
320- g_error_free (error);
321- gtk_main_quit ();
322- }
323-
324- gtk_window_set_default_icon_name ("avant-window-navigator");
325-
326- /* Grab a connection to the bus */
327- priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
328- if (priv->connection == NULL)
329- {
330- g_warning ("Unable to make connection to the D-Bus session bus: %s",
331- error->message);
332- g_error_free (error);
333- gtk_main_quit ();
334- }
335-
336- panels = desktop_agnostic_config_client_get_list (priv->client,
337- AWN_GROUP_PANELS,
338- AWN_PANELS_IDS,
339- &error);
340-
341- if (error)
342- {
343- g_error ("Unable to retrieve panels config value: %s",
344- error->message);
345- g_error_free (error);
346- return;
347- }
348-
349- if (panels->n_values == 0)
350- {
351- gboolean is_gconf = FALSE;
352- GType config_type = desktop_agnostic_config_get_type (NULL);
353-
354- if (config_type)
355- {
356- const gchar *config_backend = g_type_name (config_type);
357- is_gconf = strstr (config_backend, "GConf") != NULL;
358- }
359- g_error ("No panels to create! %s", is_gconf ?
360- "\n** Please check that the gconf-schema is installed."
361- "\n** You might also try to run `killall gconfd-2`." : "");
362- return;
363- }
364-
365- // FIXME: we could check here if there are any values in the panel_list
366- // and show a "Restart gconfd-2? dialog" if there aren't
367-
368- for (guint i=0; i < panels->n_values; i++)
369- {
370- GtkWidget *panel;
371-
372- GValue *value = g_value_array_get_nth (panels, i);
373-
374- gint panel_id = g_value_get_int (value);
375- panel = awn_panel_new_with_panel_id (panel_id);
376-
377- gchar *object_path = g_strdup_printf (AWN_DBUS_PANEL_PATH "%d", panel_id);
378-
379- dbus_g_connection_register_g_object (priv->connection,
380- object_path, G_OBJECT (panel));
381-
382- g_hash_table_insert (priv->panels, object_path, panel);
383-
384- gtk_widget_show (panel);
385- }
386-
387- g_value_array_free (panels);
388-}
389-
390-gboolean
391-awn_app_remove_panel (AwnApp *app, gint panel_id, GError *error)
392-{
393- // remove the panel for real once we do multiple panels
394- if (panel_id == AWN_PANEL_ID_DEFAULT)
395- {
396- gtk_main_quit ();
397- }
398-
399- return TRUE;
400-}
401-
402-gboolean
403-awn_app_get_panels (AwnApp *app, GPtrArray **panels)
404-{
405- AwnAppPrivate *priv;
406- GList *list, *l;
407-
408- priv = app->priv;
409-
410- *panels = g_ptr_array_sized_new (g_hash_table_size (priv->panels));
411-
412- list = l = g_hash_table_get_keys (priv->panels); // list should be freed
413-
414- while (list)
415- {
416- g_ptr_array_add (*panels, g_strdup (list->data));
417-
418- list = list->next;
419- }
420-
421- g_list_free (l);
422-
423- return TRUE;
424-}
425-
426-AwnApp*
427-awn_app_get_default (void)
428-{
429- static AwnApp *app = NULL;
430-
431- if (app == NULL)
432- {
433- app = g_object_new (AWN_TYPE_APP, NULL);
434- }
435-
436- return app;
437-}
438-
439
440=== removed file 'src/awn-app.h'
441--- src/awn-app.h 2009-11-09 00:45:42 +0000
442+++ src/awn-app.h 1970-01-01 00:00:00 +0000
443@@ -1,83 +0,0 @@
444-/*
445- * Copyright (C) 2008 Neil Jagdish Patel
446- *
447- * This program is free software; you can redistribute it and/or
448- * modify it under the terms of the GNU General Public
449- * License as published by the Free Software Foundation; either
450- * version 2 of the License, or (at your option) any later version.
451- *
452- * This library is distributed in the hope that it will be useful,
453- * but WITHOUT ANY WARRANTY; without even the implied warranty of
454- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
455- * Lesser General Public License for more details.
456- *
457- * You should have received a copy of the GNU General Public
458- * License along with this library; if not, write to the
459- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
460- * Boston, MA 02111-1307, USA.
461- *
462- * Authored by Neil Jagdish Patel <njpatel@gmail.com>
463- *
464- */
465-
466-#ifndef _HAVE_AWN_APP_H
467-#define _HAVE_AWN_APP_H
468-
469-#include <glib.h>
470-#include <gtk/gtk.h>
471-
472-G_BEGIN_DECLS
473-
474-#define AWN_TYPE_APP (awn_app_get_type ())
475-
476-#define AWN_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
477- AWN_TYPE_APP, AwnApp))
478-
479-#define AWN_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
480- AWN_TYPE_APP, AwnAppClass))
481-
482-#define AWN_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
483- AWN_TYPE_APP))
484-
485-#define AWN_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
486- AWN_TYPE_APP))
487-
488-#define AWN_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
489- AWN_TYPE_APP, AwnAppClass))
490-
491-typedef struct _AwnApp AwnApp;
492-typedef struct _AwnAppClass AwnAppClass;
493-typedef struct _AwnAppPrivate AwnAppPrivate;
494-
495-
496-struct _AwnApp
497-{
498- GObject parent;
499-
500- /*< private >*/
501- AwnAppPrivate *priv;
502-};
503-
504-struct _AwnAppClass
505-{
506- /*< private >*/
507- GObjectClass parent_class;
508-
509- /*< private >*/
510- void (*_awn_app_1) (void);
511- void (*_awn_app_2) (void);
512- void (*_awn_app_3) (void);
513- void (*_awn_app_4) (void);
514-};
515-
516-GType awn_app_get_type (void) G_GNUC_CONST;
517-
518-AwnApp * awn_app_get_default (void);
519-
520-gboolean awn_app_remove_panel (AwnApp *app, gint panel_id, GError *error);
521-
522-gboolean awn_app_get_panels (AwnApp *app, GPtrArray **panels);
523-
524-G_END_DECLS
525-
526-#endif /* _HAVE_AWN_APP_H */
527
528=== added file 'src/awn-app.vala'
529--- src/awn-app.vala 1970-01-01 00:00:00 +0000
530+++ src/awn-app.vala 2010-07-24 23:31:47 +0000
531@@ -0,0 +1,162 @@
532+/*
533+ * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
534+ *
535+ * This program is free software; you can redistribute it and/or modify
536+ * it under the terms of the GNU General Public License as published by
537+ * the Free Software Foundation; either version 2 of the License, or
538+ * (at your option) any later version.
539+ *
540+ * This program is distributed in the hope that it will be useful,
541+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
542+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
543+ * GNU General Public License for more details.
544+ *
545+ * You should have received a copy of the GNU General Public License
546+ * along with this program; if not, write to the Free Software
547+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
548+ *
549+ * Authored by Michal Hruby <michal.mhr@gmail.com>
550+ *
551+ */
552+
553+using DBus;
554+
555+namespace Awn
556+{
557+ [DBus (name="org.awnproject.Awn.App")]
558+ public interface AppDBusInterface: GLib.Object
559+ {
560+ public abstract ObjectPath[] get_panels () throws DBus.Error;
561+ public abstract void remove_panel (int panel_id) throws DBus.Error;
562+ }
563+
564+ public class Application: GLib.Object, AppDBusInterface
565+ {
566+ private static Application instance;
567+
568+ private HashTable<string, Panel> panels;
569+ private Connection connection;
570+ private DesktopAgnostic.Config.Client client;
571+
572+ private Application ()
573+ {
574+ this.panels = new HashTable<string, Panel>.full (str_hash, str_equal,
575+ g_free, g_object_unref);
576+ this.client = Config.get_default (0);
577+
578+ Gtk.Window.set_default_icon_name ("avant-window-navigator");
579+
580+ this.connection = DBus.Bus.get (DBus.BusType.SESSION);
581+ this.connection.register_object ("/org/awnproject/Awn", this);
582+
583+ try
584+ {
585+ var panel_ids = this.client.get_list ("panels", "panel_list");
586+
587+ if (panel_ids.n_values == 0)
588+ {
589+ bool is_gconf = false;
590+ Type config_type = DesktopAgnostic.Config.get_type ();
591+ if (config_type > 0)
592+ {
593+ is_gconf = config_type.name ().str ("GConf") != null;
594+ }
595+ error ("No panels to create! %s", is_gconf ?
596+ "\n** Please check that the gconf-schema is installed." +
597+ "\n** You might want to try running `killall gconfd-2`." : "");
598+ }
599+
600+ foreach (Value val in panel_ids)
601+ {
602+ int panel_id = val.get_int ();
603+ string path = "/org/awnproject/Awn/Panel%d".printf (panel_id);
604+
605+ Panel panel = new Panel.with_panel_id (panel_id);
606+
607+ this.panels.insert ((owned)path, panel);
608+
609+ panel.show ();
610+ }
611+
612+ this.client.notify_add ("panels", "panel_list", this.panels_changed);
613+ }
614+ catch (GLib.Error e)
615+ {
616+ error ("Unable to retrieve panels config value: %s", e.message);
617+ }
618+ }
619+
620+ private void panels_changed (string key, string group, Value val)
621+ {
622+ List<unowned Panel> untouched_panels = new List<unowned Panel> ();
623+ foreach (var p in this.panels.get_values ())
624+ {
625+ untouched_panels.append (p);
626+ }
627+
628+ unowned ValueArray arr = (ValueArray) val.get_boxed ();
629+ foreach (Value v in arr)
630+ {
631+ int panel_id = v.get_int ();
632+ string path = "/org/awnproject/Awn/Panel%d".printf (panel_id);
633+ unowned Panel? p = this.panels.lookup (path);
634+
635+ if (p == null)
636+ {
637+ var panel = new Panel.with_panel_id (panel_id);
638+ this.panels.insert ((owned)path, panel);
639+
640+ panel.show ();
641+ }
642+ else
643+ {
644+ untouched_panels.remove (p);
645+ }
646+ }
647+
648+ foreach (unowned Panel p in untouched_panels)
649+ {
650+ string path = "/org/awnproject/Awn/Panel%d".printf (p.panel_id);
651+ this.panels.remove (path);
652+ p.destroy ();
653+ }
654+ }
655+
656+ public ObjectPath[] get_panels () throws DBus.Error
657+ {
658+ var keys = this.panels.get_keys ();
659+ keys.sort (strcmp);
660+
661+ ObjectPath[] paths = new ObjectPath[keys.length ()];
662+ int i = 0;
663+ foreach (unowned string path in keys)
664+ {
665+ paths[i++] = new ObjectPath (path);
666+ }
667+
668+ return paths;
669+ }
670+
671+ public void remove_panel (int panel_id) throws DBus.Error
672+ {
673+ if (panel_id == 1)
674+ {
675+ Gtk.main_quit ();
676+ }
677+ else
678+ {
679+ // TODO
680+ }
681+ }
682+
683+ public static unowned Application get_default ()
684+ {
685+ if (instance == null)
686+ {
687+ instance = new Application ();
688+ }
689+ return instance;
690+ }
691+ }
692+}
693+
694
695=== modified file 'src/awn-background-lucido.c'
696--- src/awn-background-lucido.c 2010-07-16 10:51:33 +0000
697+++ src/awn-background-lucido.c 2010-07-24 23:31:47 +0000
698@@ -160,6 +160,7 @@
699 g_return_if_fail (manager);
700 g_signal_connect_swapped (manager, "applets-refreshed",
701 G_CALLBACK (awn_background_lucido_applets_refreshed), bg);
702+ awn_background_lucido_applets_refreshed (AWN_BACKGROUND (bg));
703 }
704
705 static void
706@@ -234,7 +235,6 @@
707 priv->tid = 0;
708 priv->pos = g_array_new (FALSE, TRUE, sizeof (gfloat));
709 priv->pos_size = 0;
710- awn_background_lucido_applets_refreshed (AWN_BACKGROUND (bg));
711 }
712
713 AwnBackground *
714
715=== modified file 'src/awn-background.c'
716--- src/awn-background.c 2010-07-16 10:51:33 +0000
717+++ src/awn-background.c 2010-07-24 23:31:47 +0000
718@@ -714,7 +714,7 @@
719
720 void
721 awn_background_draw (AwnBackground *bg,
722- cairo_t *cr,
723+ cairo_t *cr,
724 GtkPositionType position,
725 GdkRectangle *area)
726 {
727@@ -735,9 +735,12 @@
728 if (klass->get_needs_redraw (bg, position, area))
729 {
730 cairo_t *temp_cr;
731+ gdouble clip_x1, clip_x2, clip_y1, clip_y2;
732 gint full_width = area->x + area->width;
733 gint full_height = area->y + area->height;
734
735+ cairo_clip_extents (cr, &clip_x1, &clip_y1, &clip_x2, &clip_y2);
736+
737 gboolean realloc_needed = bg->helper_surface == NULL ||
738 cairo_image_surface_get_width (bg->helper_surface) != full_width ||
739 cairo_image_surface_get_height (bg->helper_surface) != full_height;
740@@ -753,10 +756,16 @@
741 full_width,
742 full_height);
743 temp_cr = cairo_create (bg->helper_surface);
744+ cairo_rectangle (temp_cr, clip_x1, clip_y1,
745+ clip_x2-clip_x1, clip_y2-clip_y1);
746+ cairo_clip (temp_cr);
747 }
748 else
749 {
750 temp_cr = cairo_create (bg->helper_surface);
751+ cairo_rectangle (temp_cr, clip_x1, clip_y1,
752+ clip_x2-clip_x1, clip_y2-clip_y1);
753+ cairo_clip (temp_cr);
754 cairo_set_operator (temp_cr, CAIRO_OPERATOR_CLEAR);
755 cairo_paint (temp_cr);
756 cairo_set_operator (temp_cr, CAIRO_OPERATOR_OVER);
757
758=== modified file 'src/awn-main.c'
759--- src/awn-main.c 2010-04-21 22:03:42 +0000
760+++ src/awn-main.c 2010-07-24 23:31:47 +0000
761@@ -70,7 +70,7 @@
762 gint
763 main (gint argc, gchar *argv[])
764 {
765- AwnApp *app;
766+ AwnApplication *app;
767 GOptionContext *context;
768 DBusGConnection *connection;
769 DBusGProxy *proxy;
770@@ -147,10 +147,7 @@
771 textdomain (GETTEXT_PACKAGE);
772
773 /* Launch Awn */
774- app = awn_app_get_default ();
775- dbus_g_connection_register_g_object (connection,
776- AWN_DBUS_APP_PATH,
777- G_OBJECT (app));
778+ app = awn_application_get_default ();
779
780 g_unsetenv ("DESKTOP_AUTOSTART_ID");
781 gtk_main ();
782
783=== modified file 'src/awn-monitor.c'
784--- src/awn-monitor.c 2010-05-29 17:17:22 +0000
785+++ src/awn-monitor.c 2010-07-24 23:31:47 +0000
786@@ -242,6 +242,18 @@
787
788 priv = AWN_MONITOR_GET_PRIVATE (object);
789
790+ if (priv->size_signal_id)
791+ {
792+ g_signal_handler_disconnect (priv->screen, priv->size_signal_id);
793+ priv->size_signal_id = 0;
794+ }
795+
796+ if (priv->monitors_signal_id)
797+ {
798+ g_signal_handler_disconnect (priv->screen, priv->monitors_signal_id);
799+ priv->monitors_signal_id = 0;
800+ }
801+
802 desktop_agnostic_config_client_unbind_all_for_object (priv->client,
803 object, NULL);
804
805
806=== removed file 'src/awn-panel-dbus.xml'
807--- src/awn-panel-dbus.xml 2010-01-01 12:50:38 +0000
808+++ src/awn-panel-dbus.xml 1970-01-01 00:00:00 +0000
809@@ -1,102 +0,0 @@
810-<?xml version="1.0"?>
811-<node name="/org/awnproject/Awn/Panel">
812- <interface name="org.awnproject.Awn.Panel">
813- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_panel"/>
814-
815- <!-- Methods -->
816- <method name="AddApplet">
817- <arg name="desktop_file" type="s" direction="in" />
818- </method>
819-
820- <method name="DeleteApplet">
821- <arg name="uid" type="s" direction="in" />
822- </method>
823-
824- <method name="SetAppletFlags">
825- <arg name="uid" type="s" direction="in" />
826- <arg name="flags" type="i" direction="in" />
827- </method>
828-
829- <method name="InhibitAutohide">
830- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
831- <arg name="app_name" type="s" direction="in" />
832- <arg name="reason" type="s" direction="in" />
833- <arg name="cookie" type="u" direction="out" />
834- </method>
835-
836- <method name="UninhibitAutohide">
837- <arg name="cookie" type="u" direction="in" />
838- </method>
839-
840- <method name="GetInhibitors">
841- <arg name="inhibitors" type="as" direction="out" />
842- </method>
843-
844- <method name="DockletRequest">
845- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
846- <arg name="min_size" type="i" direction="in" />
847- <arg name="shrink" type="b" direction="in" />
848- <arg name="expand" type="b" direction="in" />
849- <arg name="window_id" type="x" direction="out" />
850- </method>
851-
852- <method name="GetSnapshot">
853- <arg name="pixbuf" type="v" direction="out" />
854- </method>
855-
856- <!-- Signals -->
857- <signal name="SizeChanged">
858- <arg name="size" type="i" />
859- </signal>
860-
861- <signal name="PositionChanged">
862- <arg name="position" type="i" />
863- </signal>
864-
865- <signal name="OffsetChanged">
866- <arg name="offset" type="i" />
867- </signal>
868-
869- <signal name="PropertyChanged">
870- <arg name="uid" type="s" />
871- <arg name="prop-name" type="s" />
872- <arg name="value" type="v" />
873- </signal>
874-
875- <signal name="DestroyNotify"></signal>
876-
877- <signal name="DestroyApplet">
878- <arg name="uid" type="s" />
879- </signal>
880-
881- <!-- Properties -->
882- <property name="Size" type="i" access="read" />
883- <property name="MaxSize" type="i" access="read" />
884- <property name="Position" type="i" access="read" />
885- <property name="Offset" type="i" access="read" />
886- <property name="PathType" type="i" access="read" />
887- <property name="OffsetModifier" type="d" access="read" />
888- <property name="PanelXid" type="x" access="read" />
889-
890- </interface>
891-
892- <interface name="org.awnproject.Awn.UA">
893- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_panel"/>
894-
895- <!-- Methods -->
896- <method name="add_applet">
897- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_panel_ua_add_applet"/>
898- <arg name="name" type="s" direction="in" />
899- <arg name="uid" type="x" direction="in" />
900- <arg name="width" type="i" direction="in" />
901- <arg name="height" type="i" direction="in" />
902- <arg name="size_type" type="s" direction="in" />
903- </method>
904-
905- <method name="get_all_server_flags">
906- <arg name="name" type="s" direction="in" />
907- <arg name="hash" type="a{ss}" direction="out" />
908- </method>
909-
910- </interface>
911-</node>
912
913=== added file 'src/awn-panel-dispatcher.vala'
914--- src/awn-panel-dispatcher.vala 1970-01-01 00:00:00 +0000
915+++ src/awn-panel-dispatcher.vala 2010-07-24 23:31:47 +0000
916@@ -0,0 +1,222 @@
917+/*
918+ * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
919+ *
920+ * This program is free software; you can redistribute it and/or modify
921+ * it under the terms of the GNU General Public License as published by
922+ * the Free Software Foundation; either version 2 of the License, or
923+ * (at your option) any later version.
924+ *
925+ * This program is distributed in the hope that it will be useful,
926+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
927+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
928+ * GNU General Public License for more details.
929+ *
930+ * You should have received a copy of the GNU General Public License
931+ * along with this program; if not, write to the Free Software
932+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
933+ *
934+ * Authored by Michal Hruby <michal.mhr@gmail.com>
935+ *
936+ */
937+
938+namespace Awn
939+{
940+ public struct ImageStruct
941+ {
942+ int width;
943+ int height;
944+ int rowstride;
945+ bool has_alpha;
946+ int bits_per_sample;
947+ int num_channels;
948+ char[] pixel_data;
949+ }
950+
951+ [DBus (name="org.awnproject.Awn.Panel")]
952+ public interface PanelDBusInterface: Object
953+ {
954+ public abstract void add_applet (string desktop_file) throws DBus.Error;
955+ public abstract void delete_applet (string uid) throws DBus.Error;
956+
957+ public abstract int64 docklet_request (int min_size,
958+ bool shrink,
959+ bool expand) throws DBus.Error;
960+
961+ public abstract string[] get_inhibitors () throws DBus.Error;
962+ public abstract ImageStruct get_snapshot () throws DBus.Error;
963+
964+ public abstract uint inhibit_autohide (DBus.BusName sender,
965+ string app_name,
966+ string reason) throws DBus.Error;
967+ public abstract void uninhibit_autohide (uint cookie) throws DBus.Error;
968+
969+ // FIXME: do we really need this?
970+ public abstract void set_applet_flags (string uid,
971+ int flags) throws DBus.Error;
972+
973+ public abstract double offset_modifier { get; }
974+ public abstract int max_size { get; }
975+ public abstract int offset { get; set; }
976+ public abstract int path_type { get; }
977+ public abstract int position { get; set; }
978+ public abstract int size { get; set; }
979+ public abstract int64 panel_xid { get; }
980+
981+ public signal void destroy_applet (string uid);
982+ public signal void destroy_notify ();
983+ public signal void property_changed (string prop_name, Value value);
984+ }
985+
986+ public class PanelDispatcher: Object, PanelDBusInterface
987+ {
988+ public unowned Panel panel { get; construct; }
989+
990+ public PanelDispatcher (Panel panel)
991+ {
992+ Object (panel: panel);
993+
994+ panel.size_changed.connect ( (p, s) =>
995+ {
996+ this.property_changed ("size", s);
997+ });
998+ panel.position_changed.connect ( (p, pos) =>
999+ {
1000+ this.property_changed ("position", pos);
1001+ });
1002+ panel.offset_changed.connect ( (p, o) =>
1003+ {
1004+ this.property_changed ("offset", o);
1005+ });
1006+ panel.property_changed.connect ( (p, pn, v) =>
1007+ {
1008+ this.property_changed (pn, v);
1009+ });
1010+
1011+ var conn = DBus.Bus.get (DBus.BusType.SESSION);
1012+ string obj_path = "/org/awnproject/Awn/Panel%d".printf(panel.panel_id);
1013+ conn.register_object (obj_path, this);
1014+ }
1015+
1016+ public void add_applet (string desktop_file) throws DBus.Error
1017+ {
1018+ panel.add_applet (desktop_file);
1019+ }
1020+ public void delete_applet (string uid) throws DBus.Error
1021+ {
1022+ panel.delete_applet (uid);
1023+ }
1024+
1025+ // FIXME: break this API and add the docklet flags from
1026+ // set_applet_flags () method here
1027+ public int64 docklet_request (int min_size, bool shrink, bool expand) throws DBus.Error
1028+ {
1029+ return panel.docklet_request (min_size, shrink, expand);
1030+ }
1031+
1032+ public string[] get_inhibitors () throws DBus.Error
1033+ {
1034+ string[] reasons = panel.get_inhibitors ();
1035+
1036+ return reasons;
1037+ }
1038+
1039+ public ImageStruct get_snapshot () throws DBus.Error
1040+ {
1041+ var result = ImageStruct ();
1042+ panel.get_snapshot (out result.width,
1043+ out result.height,
1044+ out result.rowstride,
1045+ out result.has_alpha,
1046+ out result.bits_per_sample,
1047+ out result.num_channels,
1048+ out result.pixel_data);
1049+
1050+ return result;
1051+ }
1052+
1053+ public uint inhibit_autohide (DBus.BusName sender,
1054+ string app_name,
1055+ string reason) throws DBus.Error
1056+ {
1057+ return panel.inhibit_autohide (sender, app_name, reason);
1058+ }
1059+
1060+ public void uninhibit_autohide (uint cookie) throws DBus.Error
1061+ {
1062+ panel.uninhibit_autohide (cookie);
1063+ }
1064+
1065+ public void set_applet_flags (string uid, int flags) throws DBus.Error
1066+ {
1067+ panel.set_applet_flags (uid, flags);
1068+ }
1069+
1070+ public double offset_modifier
1071+ {
1072+ get
1073+ {
1074+ return panel.offset_modifier;
1075+ }
1076+ }
1077+
1078+ public int max_size
1079+ {
1080+ get
1081+ {
1082+ return panel.max_size;
1083+ }
1084+ }
1085+
1086+ public int offset
1087+ {
1088+ get
1089+ {
1090+ return panel.offset;
1091+ }
1092+ set
1093+ {
1094+ panel.offset = value;
1095+ }
1096+ }
1097+
1098+ public int path_type
1099+ {
1100+ get
1101+ {
1102+ return panel.path_type;
1103+ }
1104+ }
1105+
1106+ public int position
1107+ {
1108+ get
1109+ {
1110+ return panel.position;
1111+ }
1112+ set
1113+ {
1114+ panel.position = value;
1115+ }
1116+ }
1117+
1118+ public int size
1119+ {
1120+ get
1121+ {
1122+ return panel.size;
1123+ }
1124+ set
1125+ {
1126+ panel.size = value;
1127+ }
1128+ }
1129+
1130+ public int64 panel_xid
1131+ {
1132+ get
1133+ {
1134+ return panel.panel_xid;
1135+ }
1136+ }
1137+ }
1138+}
1139
1140=== modified file 'src/awn-panel.c'
1141--- src/awn-panel.c 2010-07-07 15:40:09 +0000
1142+++ src/awn-panel.c 2010-07-24 23:31:47 +0000
1143@@ -48,6 +48,7 @@
1144 #include "awn-defines.h"
1145 #include "awn-marshal.h"
1146 #include "awn-monitor.h"
1147+#include "awn-panel-dispatcher.h"
1148 #include "awn-throbber.h"
1149 #include "awn-x.h"
1150
1151@@ -68,6 +69,7 @@
1152 GHashTable *inhibits;
1153 guint startup_inhibit_cookie;
1154
1155+ AwnPanelDispatcher *dbus_proxy;
1156 AwnBackground *bg;
1157
1158 GtkWidget *alignment;
1159@@ -296,7 +298,9 @@
1160 GdkEventButton *event);
1161 static gboolean awn_panel_resize_timeout (gpointer data);
1162
1163-static void awn_panel_add (GtkContainer *window,
1164+static void awn_panel_add (GtkContainer *window,
1165+ GtkWidget *widget);
1166+static void awn_panel_remove (GtkContainer *window,
1167 GtkWidget *widget);
1168
1169 static void awn_panel_set_offset (AwnPanel *panel,
1170@@ -362,6 +366,11 @@
1171 static gboolean awn_panel_set_drag_proxy (AwnPanel *panel,
1172 gboolean check_mouse_pos);
1173
1174+static void dbus_inhibitor_lost (AwnDBusWatcher *watcher,
1175+ gchar *name,
1176+ AwnInhibitItem *item);
1177+
1178+
1179 /*
1180 * GOBJECT CODE
1181 */
1182@@ -494,6 +503,7 @@
1183 return priv->dnd_proxy_win != NULL;
1184 }
1185
1186+#if !GTK_CHECK_VERSION(2, 19, 5)
1187 static gboolean
1188 awn_panel_drag_motion (GtkWidget *widget, GdkDragContext *context,
1189 gint x, gint y, guint time_)
1190@@ -512,6 +522,7 @@
1191
1192 return TRUE;
1193 }
1194+#endif
1195
1196 static gboolean
1197 on_startup_complete (AwnPanel *panel)
1198@@ -606,6 +617,9 @@
1199 G_CALLBACK (on_window_state_event), NULL);
1200 g_signal_connect (panel, "delete-event",
1201 G_CALLBACK (gtk_true), NULL);
1202+
1203+ /* DBus interface */
1204+ priv->dbus_proxy = awn_panel_dispatcher_new (AWN_PANEL (object));
1205
1206 /* Contents */
1207 priv->manager = awn_applet_manager_new_from_config (priv->client);
1208@@ -1299,6 +1313,11 @@
1209 {
1210 AwnInhibitItem *item = data;
1211
1212+ // remove the dbus watcher
1213+ g_signal_handlers_disconnect_by_func (awn_dbus_watcher_get_default (),
1214+ G_CALLBACK (dbus_inhibitor_lost),
1215+ item);
1216+
1217 if (item->description) g_free (item->description);
1218
1219 g_free (item);
1220@@ -1352,7 +1371,7 @@
1221 static gboolean awn_panel_check_mouse_pos (AwnPanel *panel,
1222 MouseCheckType check_type)
1223 {
1224- g_return_val_if_fail(AWN_IS_PANEL(panel), FALSE);
1225+ g_return_val_if_fail (AWN_IS_PANEL (panel), FALSE);
1226
1227 GtkWidget *widget = GTK_WIDGET (panel);
1228 AwnPanelPrivate *priv = panel->priv;
1229@@ -1361,8 +1380,14 @@
1230
1231 gint x, y, window_x, window_y, width, height;
1232 /* FIXME: probably needs some love to work on multiple monitors */
1233+ panel_win = gtk_widget_get_window (widget);
1234+
1235+ if (!panel_win)
1236+ {
1237+ return FALSE;
1238+ }
1239+
1240 gdk_display_get_pointer (gdk_display_get_default (), NULL, &x, &y, NULL);
1241- panel_win = gtk_widget_get_window (widget);
1242 gdk_window_get_root_origin (panel_win, &window_x, &window_y);
1243
1244 switch (check_type)
1245@@ -1535,7 +1560,7 @@
1246 static gboolean
1247 autohide_start_timeout (gpointer data)
1248 {
1249- g_return_val_if_fail(AWN_IS_PANEL(data), FALSE);
1250+ g_return_val_if_fail (AWN_IS_PANEL (data), FALSE);
1251 gboolean signal_ret = FALSE;
1252
1253 AwnPanel *panel = AWN_PANEL (data);
1254@@ -1733,6 +1758,12 @@
1255 priv->resize_timer_id = 0;
1256 }
1257
1258+ if (priv->dbus_proxy)
1259+ {
1260+ g_object_unref (priv->dbus_proxy);
1261+ priv->dbus_proxy = NULL;
1262+ }
1263+
1264 desktop_agnostic_config_client_unbind_all_for_object (priv->client,
1265 object, NULL);
1266
1267@@ -1750,11 +1781,15 @@
1268 priv->inhibits = NULL;
1269 }
1270
1271+ if (priv->monitor)
1272+ {
1273+ g_object_unref (priv->monitor);
1274+ priv->monitor = NULL;
1275+ }
1276+
1277 G_OBJECT_CLASS (awn_panel_parent_class)->finalize (object);
1278 }
1279
1280-#include "awn-panel-glue.h"
1281-
1282 static void
1283 awn_panel_class_init (AwnPanelClass *klass)
1284 {
1285@@ -1769,6 +1804,7 @@
1286 obj_class->set_property = awn_panel_set_property;
1287
1288 cont_class->add = awn_panel_add;
1289+ cont_class->remove = awn_panel_remove;
1290
1291 wid_class->expose_event = awn_panel_expose;
1292 wid_class->show = awn_panel_show;
1293@@ -2024,9 +2060,6 @@
1294 0);
1295
1296 g_type_class_add_private (obj_class, sizeof (AwnPanelPrivate));
1297-
1298- dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
1299- &dbus_glib_awn_panel_object_info);
1300 }
1301
1302 static gboolean
1303@@ -2927,6 +2960,28 @@
1304 }
1305
1306 static void
1307+awn_panel_remove (GtkContainer *panel, GtkWidget *widget)
1308+{
1309+ AwnPanelPrivate *priv;
1310+
1311+ g_return_if_fail (AWN_IS_PANEL (panel));
1312+ g_return_if_fail (GTK_IS_WIDGET (widget));
1313+ priv = AWN_PANEL (panel)->priv;
1314+
1315+ if (widget == priv->eventbox)
1316+ {
1317+ /* the eventbox was added using the base method,
1318+ so it also has to be removed using that way */
1319+ GtkContainerClass *klass = GTK_CONTAINER_CLASS (awn_panel_parent_class);
1320+ klass->remove (GTK_CONTAINER (panel), widget);
1321+ }
1322+ else
1323+ {
1324+ gtk_container_remove (GTK_CONTAINER (priv->viewport), widget);
1325+ }
1326+}
1327+
1328+static void
1329 on_theme_changed (AwnBackground *bg, AwnPanel *panel)
1330 {
1331 g_return_if_fail (AWN_IS_BACKGROUND (bg));
1332@@ -3213,9 +3268,9 @@
1333 if (offset_mod != 1.0)
1334 {
1335 GValue mod_value = {0};
1336- g_value_init (&mod_value, G_TYPE_FLOAT);
1337+ g_value_init (&mod_value, G_TYPE_DOUBLE);
1338 /* FIXME: we also need to calculate our dimensions based on offset_mod */
1339- g_value_set_float (&mod_value, offset_mod);
1340+ g_value_set_double (&mod_value, offset_mod);
1341
1342 priv->offset_mod = offset_mod;
1343 g_object_notify (G_OBJECT (panel), "offset-modifier");
1344@@ -3674,11 +3729,11 @@
1345 awn_panel_uninhibit_autohide (item->panel, item->cookie);
1346 }
1347
1348-void
1349+guint
1350 awn_panel_inhibit_autohide (AwnPanel *panel,
1351+ const gchar *sender,
1352 const gchar *app_name,
1353- const gchar *reason,
1354- DBusGMethodInvocation *context)
1355+ const gchar *reason)
1356 {
1357 AwnPanelPrivate *priv = panel->priv;
1358
1359@@ -3686,7 +3741,6 @@
1360
1361 // watch the sender on dbus and remove all its inhibits when it
1362 // disappears (to be sure that we don't misbehave due to crashing app)
1363- gchar *sender = dbus_g_method_get_sender (context);
1364 gchar *detailed_signal = g_strdup_printf ("name-disappeared::%s", sender);
1365 g_signal_connect (awn_dbus_watcher_get_default (), detailed_signal,
1366 G_CALLBACK (dbus_inhibitor_lost),
1367@@ -3694,9 +3748,8 @@
1368 GINT_TO_POINTER (cookie)));
1369
1370 g_free (detailed_signal);
1371- g_free (sender);
1372
1373- dbus_g_method_return (context, cookie);
1374+ return cookie;
1375 }
1376
1377 gboolean
1378@@ -3709,11 +3762,6 @@
1379
1380 if (!item) return TRUE; // we could set an error
1381
1382- // remove the dbus watcher
1383- g_signal_handlers_disconnect_by_func (awn_dbus_watcher_get_default (),
1384- G_CALLBACK (dbus_inhibitor_lost),
1385- item);
1386-
1387 g_hash_table_remove (priv->inhibits, GINT_TO_POINTER (cookie));
1388
1389 if (g_hash_table_size (priv->inhibits) == 0)
1390@@ -3730,13 +3778,14 @@
1391 return TRUE;
1392 }
1393
1394-gboolean
1395-awn_panel_get_inhibitors (AwnPanel *panel, GStrv *reasons)
1396+GStrv
1397+awn_panel_get_inhibitors (AwnPanel *panel)
1398 {
1399 AwnPanelPrivate *priv = panel->priv;
1400 GList *list, *l;
1401+ GStrv reasons;
1402
1403- *reasons = g_new0 (char*, g_hash_table_size (priv->inhibits) + 1);
1404+ reasons = g_new0 (char*, g_hash_table_size (priv->inhibits) + 1);
1405
1406 list = l = g_hash_table_get_values (priv->inhibits); // list should be freed
1407 int i=0;
1408@@ -3744,14 +3793,14 @@
1409 while (list)
1410 {
1411 AwnInhibitItem *item = list->data;
1412- (*reasons)[i++] = g_strdup (item->description);
1413+ reasons[i++] = g_strdup (item->description);
1414
1415 list = list->next;
1416 }
1417
1418 g_list_free (l);
1419
1420- return TRUE;
1421+ return reasons;
1422 }
1423
1424 static void
1425@@ -3945,12 +3994,12 @@
1426 gtk_widget_hide (priv->docklet_closer);
1427 }
1428
1429-void
1430+gint64
1431 awn_panel_docklet_request (AwnPanel *panel,
1432 gint min_size,
1433 gboolean shrink,
1434 gboolean expand,
1435- DBusGMethodInvocation *context)
1436+ GError **error)
1437 {
1438 AwnPanelPrivate *priv = panel->priv;
1439 GtkAllocation alloc;
1440@@ -4035,50 +4084,23 @@
1441
1442 window_id = gtk_socket_get_id (GTK_SOCKET (priv->docklet));
1443
1444- dbus_g_method_return (context, window_id);
1445-}
1446-
1447-static void
1448-value_array_append_int (GValueArray *array, gint i)
1449-{
1450- GValue *value = g_new0 (GValue, 1);
1451-
1452- g_value_init (value, G_TYPE_INT);
1453- g_value_set_int (value, i);
1454-
1455- g_value_array_append (array, value);
1456-}
1457-
1458-static void
1459-value_array_append_bool (GValueArray *array, gboolean b)
1460-{
1461- GValue *value = g_new0 (GValue, 1);
1462-
1463- g_value_init (value, G_TYPE_BOOLEAN);
1464- g_value_set_boolean (value, b);
1465-
1466- g_value_array_append (array, value);
1467-}
1468-
1469-static void
1470-value_array_append_array (GValueArray *array, guchar *data, gsize data_len)
1471-{
1472- GArray *byte_array;
1473- GValue *value = g_new0 (GValue, 1);
1474-
1475- byte_array = g_array_sized_new (FALSE, FALSE, sizeof(guchar), data_len);
1476- g_array_append_vals (byte_array, data, data_len);
1477-
1478- g_value_init (value, dbus_g_type_get_collection ("GArray", G_TYPE_CHAR));
1479- g_value_take_boxed (value, byte_array);
1480-
1481- g_value_array_append (array, value);
1482+ return window_id;
1483 }
1484
1485 gboolean
1486-awn_panel_get_snapshot (AwnPanel *panel, GValue *value, GError **error)
1487+awn_panel_get_snapshot (AwnPanel *panel,
1488+ gint *width,
1489+ gint *height,
1490+ gint *rowstride,
1491+ gboolean *has_alpha,
1492+ gint *bits_per_sample,
1493+ gint *num_channels,
1494+ gchar **pixels,
1495+ gint *pixels_length,
1496+ GError **error)
1497 {
1498 GdkRectangle rect;
1499+ guint data_len;
1500 g_return_val_if_fail (AWN_IS_PANEL (panel), FALSE);
1501
1502 awn_panel_get_draw_rect (panel, &rect, 0, 0);
1503@@ -4102,28 +4124,20 @@
1504 cairo_surface_flush (surface);
1505
1506 // stuff the pixbuf to our out param
1507- gint width = rect.width;
1508- gint height = rect.height;
1509- gint rowstride = cairo_image_surface_get_stride (surface);
1510- gint n_channels = 4;
1511- gint bits_per_sample = 8;
1512+ *width = rect.width;
1513+ *height = rect.height;
1514+ *rowstride = cairo_image_surface_get_stride (surface);
1515+ *has_alpha = TRUE;
1516+ *bits_per_sample = 8;
1517+ *num_channels = 4;
1518+
1519+ data_len = rect.height * cairo_image_surface_get_stride (surface);
1520 //gint image_len = (height - 1) * rowstride + width *
1521 // ((n_channels * bits_per_sample + 7) / 8);
1522
1523 guchar *image = cairo_image_surface_get_data (surface);
1524-
1525- GValueArray *image_struct = g_value_array_new (1);
1526-
1527- value_array_append_int (image_struct, width);
1528- value_array_append_int (image_struct, height);
1529- value_array_append_int (image_struct, rowstride);
1530- value_array_append_bool (image_struct, TRUE);
1531- value_array_append_int (image_struct, bits_per_sample);
1532- value_array_append_int (image_struct, n_channels);
1533- value_array_append_array (image_struct, image, height * rowstride);
1534-
1535- g_value_init (value, G_TYPE_VALUE_ARRAY);
1536- g_value_take_boxed (value, image_struct);
1537+ *pixels = g_memdup (image, data_len);
1538+ *pixels_length = data_len;
1539
1540 cairo_surface_destroy (surface);
1541
1542
1543=== modified file 'src/awn-panel.h'
1544--- src/awn-panel.h 2010-07-07 15:34:01 +0000
1545+++ src/awn-panel.h 2010-07-24 23:31:47 +0000
1546@@ -94,27 +94,33 @@
1547 gint flags,
1548 GError **error);
1549
1550-void awn_panel_inhibit_autohide (AwnPanel *panel,
1551+guint awn_panel_inhibit_autohide (AwnPanel *panel,
1552+ const gchar *sender,
1553 const gchar *app_name,
1554- const gchar *reason,
1555- DBusGMethodInvocation *context);
1556+ const gchar *reason);
1557
1558 gboolean awn_panel_uninhibit_autohide (AwnPanel *panel,
1559 guint cookie);
1560
1561-gboolean awn_panel_get_inhibitors (AwnPanel *panel,
1562- GStrv *reasons);
1563+GStrv awn_panel_get_inhibitors (AwnPanel *panel);
1564
1565-void awn_panel_docklet_request (AwnPanel *panel,
1566+gint64 awn_panel_docklet_request (AwnPanel *panel,
1567 gint min_size,
1568 gboolean shrink,
1569 gboolean expand,
1570- DBusGMethodInvocation *context);
1571+ GError **error);
1572
1573 gboolean awn_panel_get_docklet_mode (AwnPanel *panel);
1574
1575 gboolean awn_panel_get_snapshot (AwnPanel *panel,
1576- GValue *value,
1577+ gint *width,
1578+ gint *height,
1579+ gint *rowstride,
1580+ gboolean *has_alpha,
1581+ gint *bits_per_sample,
1582+ gint *num_channels,
1583+ gchar **pixels,
1584+ gint *pixels_length,
1585 GError **error);
1586
1587 gboolean awn_panel_get_all_server_flags(AwnPanel *panel,
1588
1589=== added file 'src/awn-panel.vapi'
1590--- src/awn-panel.vapi 1970-01-01 00:00:00 +0000
1591+++ src/awn-panel.vapi 2010-07-24 23:31:47 +0000
1592@@ -0,0 +1,47 @@
1593+/* awn-panel.vapi stub (manually generated) */
1594+
1595+[CCode (cprefix = "Awn", lower_case_cprefix = "awn_")]
1596+namespace Awn {
1597+ [CCode (cheader_filename = "awn-panel.h")]
1598+ public class Panel : Gtk.Window, Atk.Implementor, Gtk.Buildable {
1599+ [CCode (type = "GtkWidget*", has_construct_function = false)]
1600+ public Panel.with_panel_id (int panel_id);
1601+ public bool add_applet (string desktop_file) throws GLib.Error;
1602+ public bool delete_applet (string uid) throws GLib.Error;
1603+ public bool set_applet_flags (string uid, int flags) throws GLib.Error;
1604+ public uint inhibit_autohide (string sender, string app_name, string reason);
1605+ public bool uninhibit_autohide (uint cookie);
1606+
1607+ [CCode (array_length = false, array_null_terminated = true)]
1608+ public string[] get_inhibitors ();
1609+
1610+ 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;
1611+
1612+ public int64 docklet_request (int min_size, bool shrink, bool expand) throws GLib.Error;
1613+
1614+ [NoAccessorMethod]
1615+ public int panel_id { get; construct; }
1616+ [NoAccessorMethod]
1617+ public int64 panel_xid { get; }
1618+ [NoAccessorMethod]
1619+ public int position { get; set construct; }
1620+ [NoAccessorMethod]
1621+ public int size { get; set construct; }
1622+ [NoAccessorMethod]
1623+ public int offset { get; set construct; }
1624+ [NoAccessorMethod]
1625+ public int max_size { get; }
1626+ [NoAccessorMethod]
1627+ public int path_type { get; set construct; }
1628+ [NoAccessorMethod]
1629+ public float offset_modifier { get; set construct; }
1630+
1631+ public virtual signal void size_changed (int size);
1632+ public virtual signal void position_changed (int position);
1633+ public virtual signal void offset_changed (int offset);
1634+ public virtual signal void property_changed (string prop_name, GLib.Value val);
1635+
1636+ public virtual signal void destroy_applet (string uid);
1637+ public virtual signal void destroy_notify ();
1638+ }
1639+}
1640
1641=== modified file 'tests/Makefile.am'
1642--- tests/Makefile.am 2010-01-11 21:30:13 +0000
1643+++ tests/Makefile.am 2010-07-24 23:31:47 +0000
1644@@ -41,7 +41,6 @@
1645 test-taskmanager-dnd.py \
1646 test-taskmanager-windows.py
1647
1648-if HAVE_VALA
1649 noinst_PROGRAMS += test-vala-awn-dialog
1650
1651 VALA_FILES = \
1652@@ -58,4 +57,3 @@
1653
1654 EXTRA_DIST += $(VALA_FILES)
1655 CLEANFILES = test-vala-awn-dialog.c
1656-endif

Subscribers

People subscribed via source and target branches