Awn

Merge lp:~awn-testing/awn/awn-rewrite-ua-support into lp:~awn-core/awn/trunk-rewrite

Proposed by moonbeam
Status: Superseded
Proposed branch: lp:~awn-testing/awn/awn-rewrite-ua-support
Merge into: lp:~awn-core/awn/trunk-rewrite
Diff against target: None lines
To merge this branch: bzr merge lp:~awn-testing/awn/awn-rewrite-ua-support

This proposal supersedes a proposal from 2009-07-15.

This proposal has been superseded by a proposal from 2009-07-15.

To post a comment you must log in.
Revision history for this message
moonbeam (rcryderman) wrote : Posted in a previous version of this proposal

It may not perfect, but I think it's good enough for a merge at this point. There's some design ugliness due to the alignment being outside of the socket. But most of the ua specific code is in its own object. And if UA/screenlets are not being used then there is close to zero impact on the code paths used by awn.

839. By moonbeam

* src/awn-ua-alignment.c:
 Destroy the socket when ua/screenlet removed from the ua_acitive_list.

840. By Julien Lavergne

Fix tabs in awnClass.py (require by PEP8)

841. By Julien Lavergne

Fix also tabs in AwnDefs.py.in

842. By moonbeam

* applets/uawrapper/awn-ua-wrapper.h:
       Removed leftover file

843. By moonbeam

* libawn/awn-alignment.c:
       Sync file with rewrite.

844. By moonbeam

* src/awn-applet-manager.c:
* src/awn-applet-manager.h:
* src/awn-ua-alignment.c:
       Various whitespace fixes.
       Modified awn_ua_get_all_server_flags().
       Removed touch_quark set on UaAlignment() for UAAlignment.

845. By moonbeam

Merge rewrite.

846. By moonbeam

* applets/uawrapper/:
 Removed empty dir.

847. By moonbeam

Merged rewrite

848. By Michal Hruby

Changes to the DBus interface

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'applets/uawrapper'
2=== added file 'applets/uawrapper/awn-ua-wrapper.h'
3--- applets/uawrapper/awn-ua-wrapper.h 1970-01-01 00:00:00 +0000
4+++ applets/uawrapper/awn-ua-wrapper.h 2009-06-25 04:55:53 +0000
5@@ -0,0 +1,42 @@
6+/* awn-ua-wrapper.h */
7+
8+#ifndef _AWN_UA_WRAPPER
9+#define _AWN_UA_WRAPPER
10+
11+#include <glib-object.h>
12+#include <libawn/libawn.h>
13+
14+G_BEGIN_DECLS
15+
16+#define AWN_TYPE_UA_WRAPPER awn_ua_wrapper_get_type()
17+
18+#define AWN_UA_WRAPPER(obj) \
19+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), AWN_TYPE_UA_WRAPPER, AwnUAWrapper))
20+
21+#define AWN_UA_WRAPPER_CLASS(klass) \
22+ (G_TYPE_CHECK_CLASS_CAST ((klass), AWN_TYPE_UA_WRAPPER, AwnUAWrapperClass))
23+
24+#define AWN_IS_UA_WRAPPER(obj) \
25+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AWN_TYPE_UA_WRAPPER))
26+
27+#define AWN_IS_UA_WRAPPER_CLASS(klass) \
28+ (G_TYPE_CHECK_CLASS_TYPE ((klass), AWN_TYPE_UA_WRAPPER))
29+
30+#define AWN_UA_WRAPPER_GET_CLASS(obj) \
31+ (G_TYPE_INSTANCE_GET_CLASS ((obj), AWN_TYPE_UA_WRAPPER, AwnUAWrapperClass))
32+
33+typedef struct {
34+ AwnApplet parent;
35+} AwnUAWrapper;
36+
37+typedef struct {
38+ AwnAppletClass parent_class;
39+} AwnUAWrapperClass;
40+
41+GType awn_ua_wrapper_get_type (void);
42+
43+AwnUAWrapper* awn_ua_wrapper_new (gchar* uid, gint panel_id);
44+
45+G_END_DECLS
46+
47+#endif /* _AWN_UA_WRAPPER */
48
49=== modified file 'awn-settings/awnClass.py'
50--- awn-settings/awnClass.py 2009-07-10 00:56:51 +0000
51+++ awn-settings/awnClass.py 2009-07-14 17:57:18 +0000
52@@ -1537,16 +1537,22 @@
53 os.unlink(filename)
54
55 def _apply (self):
56- l = []
57+ applets_list = []
58+ ua_list = []
59+
60 it = self.active_model.get_iter_first ()
61 while (it):
62 path = self.active_model.get_value (it, 1)
63 uid = self.active_model.get_value (it, 2)
64 s = "%s::%s" % (path, uid)
65- l.append (s)
66+ if path.endswith(".desktop"):
67+ applets_list.append(s)
68+ else:
69+ ua_list.append(s)
70+
71 it= self.active_model.iter_next (it)
72
73- self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, l)
74+ self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, applets_list)
75
76 def up_clicked (self, button):
77 select = self.treeview.get_selection()
78@@ -1592,18 +1598,32 @@
79
80 applets = self.client.get_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING)
81
82+ ua_applets = self.client.get_list(defs.PANEL, defs.UA_LIST, awn.CONFIG_LIST_STRING)
83+
84+ for ua in ua_applets:
85+ tokens = ua.split("::")
86+ applets.insert(int(tokens[1]), ua)
87+
88 self.refresh_icon_list (applets, self.active_model)
89
90 def refresh_icon_list (self, applets, model):
91- for a in applets:
92- tokens = a.split("::")
93- path = tokens[0]
94- uid = tokens[1]
95- icon, text, name = self.make_row(path)
96- if len (text) < 2:
97- continue;
98+ for a in applets:
99+ tokens = a.split("::")
100+ if tokens[0].endswith(".desktop"):
101+ path = tokens[0]
102+ uid = tokens[1]
103+ icon, text, name = self.make_row(path)
104+ if len (text) < 2:
105+ continue;
106
107- model.append([icon, path, uid, text])
108+ model.append([icon, path, uid, text])
109+ else:
110+ path = tokens[0]
111+ uid = tokens[1]
112+ theme = gtk.icon_theme_get_default ()
113+ icon = theme.load_icon ("screenlets", 32, 0)
114+ text = tokens[0]
115+ model.append([icon, path, uid, text])
116
117 def load_applets (self):
118 applets = self.applets_by_categories()
119@@ -1645,7 +1665,21 @@
120 applets = l.values()
121
122 if not None in applets and self.load_finished:
123- self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, applets)
124+ applets_list = []
125+ ua_list = []
126+ for a in applets:
127+ tokens = a.split("::")
128+ path = tokens[0]
129+ if path.endswith(".desktop"):
130+ applets_list.append(a)
131+ else:
132+ position = applets.index(a)
133+ ua = tokens[0] + "::" + str(position)
134+ ua_list.append(ua)
135+
136+ self.client.set_list(defs.PANEL, defs.APPLET_LIST, awn.CONFIG_LIST_STRING, applets_list)
137+ self.client.set_list(defs.PANEL, defs.UA_LIST, awn.CONFIG_LIST_STRING, ua_list)
138+
139
140 def callback_widget_filter_applets(self, data=None):
141 model = self.choose_categorie.get_model()
142
143=== modified file 'awn-settings/awnDefs.py.in'
144--- awn-settings/awnDefs.py.in 2009-07-10 00:56:51 +0000
145+++ awn-settings/awnDefs.py.in 2009-07-14 19:09:25 +0000
146@@ -59,6 +59,7 @@
147 EXPAND = "expand" #bool
148 CLICKTHROUGH = "clickthrough" #int
149 BEHAVIOR = "behavior" #int
150+UA_LIST = "ua_active_list" #list-string
151
152 PANELS = "panels" #group
153 PANEL_LIST = "panel_list" #int
154
155=== modified file 'data/awn.schema-ini.in'
156--- data/awn.schema-ini.in 2009-07-06 22:12:25 +0000
157+++ data/awn.schema-ini.in 2009-07-14 18:01:40 +0000
158@@ -28,6 +28,16 @@
159 default = @APPLETDATADIR@/taskmanager.desktop::1
160 description = The list of applets for this panel ordered from ltr or ttb.
161
162+[panel/ua_list]
163+type = list-string
164+default =
165+description = The list of UA Screenlets that have been previous added in the form ScreeneletInstance::Position.
166+
167+[panel/ua_active_list]
168+type = list-string
169+default =
170+description = The active list UA Screenlets for this panel.
171+
172 [panel/monitor_force]
173 type = bool
174 default = False
175
176=== modified file 'libawn/awn-alignment.c'
177--- libawn/awn-alignment.c 2009-03-26 23:47:26 +0000
178+++ libawn/awn-alignment.c 2009-06-25 18:26:59 +0000
179@@ -192,6 +192,18 @@
180 return alignment;
181 }
182
183+GtkWidget*
184+awn_alignment_new (void)
185+{
186+ GtkWidget *alignment;
187+
188+ alignment = g_object_new(AWN_TYPE_ALIGNMENT,
189+ NULL);
190+
191+ return alignment;
192+}
193+
194+
195 static void
196 on_orient_changed (AwnAlignment *alignment, AwnOrientation orient)
197 {
198
199=== modified file 'libawn/awn-alignment.h'
200--- libawn/awn-alignment.h 2009-03-22 23:12:16 +0000
201+++ libawn/awn-alignment.h 2009-06-25 18:26:59 +0000
202@@ -80,6 +80,8 @@
203 void awn_alignment_set_offset_modifier (AwnAlignment *alignment,
204 gint modifier);
205
206+GtkWidget* awn_alignment_new (void);
207+
208 G_END_DECLS
209
210 #endif
211
212=== modified file 'src/Makefile.am'
213--- src/Makefile.am 2009-06-21 13:23:05 +0000
214+++ src/Makefile.am 2009-07-13 18:20:16 +0000
215@@ -27,6 +27,7 @@
216 awn-app-glue.h \
217 awn-applet-manager.c \
218 awn-applet-manager.h \
219+ awn-applet-manager-glue.h \
220 awn-applet-proxy.c \
221 awn-applet-proxy.h \
222 awn-background.c \
223@@ -51,6 +52,8 @@
224 awn-panel-glue.h \
225 awn-throbber.c \
226 awn-throbber.h \
227+ awn-ua-alignment.c \
228+ awn-ua-alignment.h \
229 awn-x.h \
230 awn-x.c \
231 inlinepixbufs.h \
232@@ -65,9 +68,13 @@
233 awn-panel-glue.h: awn-panel-dbus.xml Makefile
234 $(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_panel --mode=glib-server --output=$@ $<
235
236+awn-applet-manager-glue.h: awn-applet-manager-dbus.xml Makefile
237+ $(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_ua --mode=glib-server --output=$@ $<
238+
239 BUILT_SOURCES = \
240 awn-app-glue.h \
241 awn-panel-glue.h \
242+ awn-applet-manager-glue.h \
243 $(MARSHALFILES) \
244 $(NULL)
245
246@@ -76,6 +83,7 @@
247 EXTRA_DIST = \
248 awn-app-dbus.xml \
249 awn-panel-dbus.xml \
250+ awn-applet-manager-dbus.xml \
251 $(NULL)
252
253 # vim: set ts=8 sts=8 sw=8 :
254
255=== added file 'src/awn-applet-manager-dbus.xml'
256--- src/awn-applet-manager-dbus.xml 1970-01-01 00:00:00 +0000
257+++ src/awn-applet-manager-dbus.xml 2009-06-02 22:11:19 +0000
258@@ -0,0 +1,21 @@
259+<?xml version="1.0"?>
260+<node name="/org/awnproject/Awn/UA">
261+ <interface name="org.awnproject.Awn.UA">
262+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="awn_ua"/>
263+
264+ <!-- Methods -->
265+ <method name="add_applet">
266+ <arg name="name" type="s" direction="in" />
267+ <arg name="uid" type="x" direction="in" />
268+ <arg name="width" type="i" direction="in" />
269+ <arg name="height" type="i" direction="in" />
270+ <arg name="size_type" type="s" direction="in" />
271+ </method>
272+
273+ <method name="get_all_server_flags">
274+ <arg name="name" type="s" direction="in" />
275+ <arg name="hash" type="a{ss}" direction="out" />
276+ </method>
277+
278+ </interface>
279+</node>
280
281=== modified file 'src/awn-applet-manager.c'
282--- src/awn-applet-manager.c 2009-07-09 07:12:27 +0000
283+++ src/awn-applet-manager.c 2009-07-15 17:12:11 +0000
284@@ -21,17 +21,21 @@
285
286 #include "config.h"
287
288-#include <libawn/awn-config-bridge.h>
289+#include <libawn/libawn.h>
290+#include <dbus/dbus-glib.h>
291+#include <dbus/dbus-glib-bindings.h>
292 #include <libawn/awn-utils.h>
293 #include <math.h>
294
295 #include "awn-defines.h"
296 #include "awn-applet-manager.h"
297-
298+#include "awn-ua-alignment.h"
299 #include "awn-applet-proxy.h"
300 #include "awn-throbber.h"
301 #include "xutils.h"
302
303+#define MAX_UA_LIST_ENTRIES 50
304+
305 G_DEFINE_TYPE (AwnAppletManager, awn_applet_manager, GTK_TYPE_BOX)
306
307 #define AWN_APPLET_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj, \
308@@ -44,8 +48,15 @@
309 AwnOrientation orient;
310 gint offset;
311 gint size;
312+
313 GSList *applet_list;
314
315+ /*ua_list does not serve the same purpose as the applet_list
316+ It's a list of unique UA names plus their position in the panel
317+ */
318+ GSList *ua_list;
319+ GSList *ua_active_list;
320+
321 gboolean docklet_mode;
322 GtkWidget *docklet_widget;
323
324@@ -60,6 +71,7 @@
325
326 /* Current box class */
327 GtkWidgetClass *klass;
328+
329 };
330
331 enum
332@@ -71,6 +83,8 @@
333 PROP_OFFSET,
334 PROP_SIZE,
335 PROP_APPLET_LIST,
336+ PROP_UA_LIST,
337+ PROP_UA_ACTIVE_LIST,
338 PROP_EXPANDS
339 };
340
341@@ -123,6 +137,20 @@
342 AWN_GROUP_PANEL, AWN_PANEL_APPLET_LIST,
343 AWN_CONFIG_CLIENT_LIST_TYPE_STRING,
344 object, "applet_list");
345+ awn_config_bridge_bind_list (bridge, priv->client,
346+ AWN_GROUP_PANEL, AWN_PANEL_UA_LIST,
347+ AWN_CONFIG_CLIENT_LIST_TYPE_STRING,
348+ object, "ua_list");
349+ awn_config_bridge_bind_list (bridge, priv->client,
350+ AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST,
351+ AWN_CONFIG_CLIENT_LIST_TYPE_STRING,
352+ object, "ua_active_list");
353+ /*
354+ ua_active_list should be empty when awn starts...
355+ */
356+ awn_config_client_set_list (priv->client,AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST,
357+ AWN_CONFIG_CLIENT_LIST_TYPE_STRING,
358+ NULL, NULL);
359 }
360
361 static void
362@@ -165,10 +193,15 @@
363 case PROP_SIZE:
364 g_value_set_int (value, priv->size);
365 break;
366-
367 case PROP_APPLET_LIST:
368 g_value_set_pointer (value, priv->applet_list);
369 break;
370+ case PROP_UA_LIST:
371+ g_value_set_pointer (value, priv->ua_list);
372+ break;
373+ case PROP_UA_ACTIVE_LIST:
374+ g_value_set_pointer (value, priv->ua_active_list);
375+ break;
376 case PROP_EXPANDS:
377 g_value_set_boolean (value, priv->expands);
378 break;
379@@ -208,6 +241,16 @@
380 priv->applet_list = g_value_get_pointer (value);
381 awn_applet_manager_refresh_applets (manager);
382 break;
383+ case PROP_UA_LIST:
384+ free_list (priv->ua_list);
385+ priv->ua_list = g_value_get_pointer (value);
386+ awn_applet_manager_refresh_applets (manager);
387+ break;
388+ case PROP_UA_ACTIVE_LIST:
389+ free_list (priv->ua_active_list);
390+ priv->ua_active_list = g_value_get_pointer (value);
391+ awn_applet_manager_refresh_applets (manager);
392+ break;
393 default:
394 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
395 }
396@@ -240,6 +283,8 @@
397 G_OBJECT_CLASS (awn_applet_manager_parent_class)->dispose (object);
398 }
399
400+#include "awn-applet-manager-glue.h"
401+
402 static void
403 awn_applet_manager_class_init (AwnAppletManagerClass *klass)
404 {
405@@ -294,6 +339,20 @@
406 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
407
408 g_object_class_install_property (obj_class,
409+ PROP_UA_LIST,
410+ g_param_spec_pointer ("ua_list",
411+ "UA List",
412+ "The rememebered screenlet positions for this panel",
413+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
414+
415+ g_object_class_install_property (obj_class,
416+ PROP_UA_ACTIVE_LIST,
417+ g_param_spec_pointer ("ua-active-list",
418+ "UA Active List",
419+ "The list of acitve screenlets for this panel",
420+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
421+
422+ g_object_class_install_property (obj_class,
423 PROP_EXPANDS,
424 g_param_spec_boolean ("expands",
425 "Expands",
426@@ -321,12 +380,18 @@
427 G_TYPE_NONE, 0);
428
429 g_type_class_add_private (obj_class, sizeof (AwnAppletManagerPrivate));
430+
431+ dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
432+ &dbus_glib_awn_ua_object_info);
433+
434 }
435
436 static void
437 awn_applet_manager_init (AwnAppletManager *manager)
438 {
439 AwnAppletManagerPrivate *priv;
440+ DBusGConnection *connection;
441+ GError *error = NULL;
442
443 priv = manager->priv = AWN_APPLET_MANAGER_GET_PRIVATE (manager);
444
445@@ -338,6 +403,21 @@
446 priv->extra_widgets = g_hash_table_new (g_direct_hash, g_direct_equal);
447
448 gtk_widget_show_all (GTK_WIDGET (manager));
449+
450+ /* Grab a connection to the bus */
451+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
452+ if (connection == NULL)
453+ {
454+ g_warning ("Unable to make connection to the D-Bus session bus: %s",
455+ error->message);
456+ g_error_free (error);
457+ gtk_main_quit ();
458+ }
459+
460+ dbus_g_connection_register_g_object (connection,
461+ AWN_DBUS_MANAGER_PATH,
462+ G_OBJECT (GTK_WIDGET (manager)));
463+
464 }
465
466 GtkWidget *
467@@ -505,7 +585,6 @@
468 g_type_class_unref (priv->klass);
469 priv->klass = NULL;
470 }
471-
472 switch (priv->orient)
473 {
474 case AWN_ORIENTATION_TOP:
475@@ -547,7 +626,10 @@
476 {
477 g_free (l->data);
478 }
479- g_slist_free (list);
480+ if (list)
481+ {
482+ g_slist_free (list);
483+ }
484 }
485
486 /*
487@@ -752,6 +834,7 @@
488 gtk_box_pack_start (GTK_BOX (manager), widget, FALSE, FALSE, 0);
489 /* caller is supposed to call gtk_widget_show! */
490 }
491+ g_print ("Gint : %i : ", pos);
492 g_hash_table_replace (priv->extra_widgets, widget, GINT_TO_POINTER (pos));
493
494 awn_applet_manager_refresh_applets (manager);
495@@ -769,6 +852,159 @@
496 }
497 }
498
499+/*DBUS*/
500+/*
501+ Description of this dbus interface.
502+
503+ @action(IFACE)
504+ def add_applet (self, id, plug_id, width, height, size_type):
505+ """
506+ Add an applet.
507+
508+ id: A unique string used to identify the applet.
509+ plug_id: The applet's gtk.Plug's xid.
510+ width: A recommended width. This will be interpreted according to size_type.
511+ height A recommended height. This will be interpreted according to size_type.
512+ size_type: Determines the meaning of width and height.
513+ May be one of the following values:
514+ "scalable"- The applet may be resized as long as the width/height ratio is kept.
515+ "static"- The applet should be displayed at exactly the size requested.
516+ "static-width"- The applet's width should remain static, and the server may change the height.
517+ "static-height"- The applet's height should remain static, and the server may change the width.
518+ "dynamic"- The applet may be resized to any size.
519+ desktop_path: Path to the desktop file.
520+ """
521+ # NOTE: Melange currently ignores the size_type parameter.
522+ container = ToplevelContainer(plug_id, id, self, width, height,
523+ size_type, backend=self.backend)
524+ self.containers.append(container)
525+*/
526+gboolean
527+awn_ua_add_applet ( AwnAppletManager *manager,
528+ gchar *name,
529+ glong xid,
530+ gint width,
531+ gint height,
532+ gchar *size_type,
533+ GError **error)
534+{
535+ g_return_val_if_fail (AWN_IS_APPLET_MANAGER (manager),FALSE);
536+ g_return_val_if_fail ( (g_strcmp0(size_type,"scalable")==0 ) ||
537+ (g_strcmp0(size_type,"dynamic")==0 ), FALSE );
538+
539+ GdkWindow* plugwin;
540+ AwnAppletManagerPrivate *priv = manager->priv;
541+ gint pos = g_slist_length (priv->applet_list);
542+ GdkNativeWindow native_window = (GdkNativeWindow) xid;
543+ gchar * tmp = g_strdup_printf ("%s::%d",name,pos);
544+ gchar * ua_list_entry = NULL;
545+ GtkWidget *ua_alignment;
546+ double ua_ratio;
547+
548+ /*
549+ Is there an entry in ua_list for this particular screenlet instance(name).
550+ The comparision function used ignores the position.
551+ */
552+ GSList * search = g_slist_find_custom (priv->ua_list,tmp,awn_ua_alignment_list_cmp);
553+ if (search)
554+ {
555+ /* There's already an entry in ua_list so use that. */
556+ GStrv tokens;
557+ ua_list_entry = g_strdup (search->data) ;
558+ g_free (tmp);
559+ /* Get the position where the screenlet should be placed*/
560+ tokens = g_strsplit (search->data,"::",2);
561+ if (tokens && tokens[1])
562+ {
563+ pos = atoi (tokens[1]);
564+ }
565+ g_strfreev (tokens);
566+ /* remove the link... that data will be appended at to the list*/
567+ g_free (search->data);
568+ priv->ua_list = g_slist_delete_link (priv->ua_list,search);
569+ search = NULL;
570+ }
571+ else
572+ {
573+ /*
574+ This screenlet instance is not recorded in ua_list. It will end up being
575+ placed at the end of the bar
576+ */
577+ ua_list_entry = tmp;
578+ }
579+
580+ /*
581+ Calculated here and passed to the awn_ua_alignment_new(). AwnUAAlignment
582+ could recalculate the ratio on bar resizes based on the, then current,
583+ dimensions of the widget but over time the amount of error in the the
584+ calcs would increase
585+ */
586+ ua_ratio = width / (double) height;
587+ ua_alignment = awn_ua_alignment_new(manager,ua_list_entry,ua_ratio);
588+
589+ g_signal_connect_swapped (awn_ua_alignment_get_socket(AWN_UA_ALIGNMENT(ua_alignment)),
590+ "plug-added",
591+ G_CALLBACK (_applet_plug_added),
592+ manager);
593+
594+ awn_applet_manager_add_widget(manager, GTK_WIDGET (ua_alignment), pos);
595+ gtk_widget_show_all (ua_alignment);
596+
597+ plugwin = awn_ua_alignment_add_id (AWN_UA_ALIGNMENT(ua_alignment),native_window);
598+
599+ g_object_set_qdata (G_OBJECT (ua_alignment),
600+ priv->touch_quark, GINT_TO_POINTER (0));
601+
602+ if (!plugwin)
603+ {
604+ g_warning ("UA Plug was not created within socket.");
605+ gtk_widget_destroy (ua_alignment);
606+ return FALSE;
607+ }
608+
609+ /*
610+ Either add the new entry into ua_list or move an existing entry to the
611+ end of ua_list_entry
612+ */
613+ priv->ua_list = g_slist_append (priv->ua_list,g_strdup(ua_list_entry));
614+
615+ /* Keep the length of ua_list reasonable */
616+ if (g_slist_length (priv->ua_list) > MAX_UA_LIST_ENTRIES)
617+ {
618+ GSList * iter;
619+ int i = g_slist_length (priv->ua_list) - MAX_UA_LIST_ENTRIES;
620+ for(iter = priv->ua_list; i && iter ; iter = priv->ua_list )
621+ {
622+ g_free (iter->data);
623+ priv->ua_list = g_slist_delete_link (priv->ua_list,iter);
624+ i--;
625+ }
626+ }
627+ awn_config_client_set_list (priv->client,AWN_GROUP_PANEL, AWN_PANEL_UA_LIST,
628+ AWN_CONFIG_CLIENT_LIST_TYPE_STRING,
629+ priv->ua_list, NULL);
630+ /*Add our newly active screenlet to thend of the active list */
631+ priv->ua_active_list = g_slist_append (priv->ua_active_list,g_strdup(ua_list_entry));
632+ awn_config_client_set_list (priv->client,AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST,
633+ AWN_CONFIG_CLIENT_LIST_TYPE_STRING,
634+ priv->ua_active_list, NULL);
635+
636+ return TRUE;
637+}
638+
639+gboolean
640+awn_ua_get_all_server_flags ( AwnAppletManager *manager,
641+ GHashTable *hash,
642+ gchar *name,
643+ GError **error)
644+{
645+/* Future function to return capability of the server
646+For now, it return nothing*/
647+return TRUE;
648+}
649+
650+
651+/*End DBUS*/
652 void
653 awn_applet_manager_show_applets (AwnAppletManager *manager)
654 {
655
656=== modified file 'src/awn-applet-manager.h'
657--- src/awn-applet-manager.h 2009-07-08 20:38:35 +0000
658+++ src/awn-applet-manager.h 2009-07-13 18:05:02 +0000
659@@ -25,6 +25,7 @@
660 #include <gtk/gtk.h>
661
662 #include <libawn/awn-config-client.h>
663+#include <libawn/awn-defines.h>
664
665 #include "awn-panel.h"
666
667@@ -82,9 +83,25 @@
668
669 gboolean awn_applet_manager_get_expands (AwnAppletManager *manager);
670
671-void awn_applet_manager_set_applet_flags (AwnAppletManager *manager,
672- const gchar *uid,
673- AwnAppletFlags flags);
674+
675+
676+gboolean awn_ua_get_all_server_flags (AwnAppletManager *manager,
677+ GHashTable *hash,
678+ gchar *name,
679+ GError **error);
680+
681+gboolean awn_ua_add_applet ( AwnAppletManager *manager,
682+ gchar *name,
683+ glong xid,
684+ gint width,
685+ gint height,
686+ gchar *size_type,
687+ GError **error);
688+
689+
690+void awn_applet_manager_set_applet_flags (AwnAppletManager *manager,
691+ const gchar *uid,
692+ AwnAppletFlags flags);
693
694 void awn_applet_manager_show_applets (AwnAppletManager *manager);
695 void awn_applet_manager_hide_applets (AwnAppletManager *manager);
696
697=== modified file 'src/awn-applet-proxy.c'
698--- src/awn-applet-proxy.c 2009-07-08 21:17:59 +0000
699+++ src/awn-applet-proxy.c 2009-07-13 18:05:02 +0000
700@@ -276,6 +276,7 @@
701 1, G_TYPE_INT);
702
703 g_type_class_add_private (obj_class, sizeof (AwnAppletProxyPrivate));
704+
705 }
706
707 static gboolean
708@@ -349,6 +350,8 @@
709 return proxy;
710 }
711
712+
713+
714 /*
715 * GtkSocket callbacks
716 */
717@@ -552,4 +555,3 @@
718 priv->idle_id = g_idle_add (awn_applet_proxy_idle_cb, proxy);
719 }
720 }
721-
722
723=== modified file 'src/awn-defines.h'
724--- src/awn-defines.h 2009-04-18 00:36:20 +0000
725+++ src/awn-defines.h 2009-07-14 18:01:40 +0000
726@@ -28,6 +28,7 @@
727
728 #define AWN_DBUS_APP_PATH AWN_DBUS_PATH
729 #define AWN_DBUS_PANEL_PATH AWN_DBUS_PATH"/Panel"
730+#define AWN_DBUS_MANAGER_PATH AWN_DBUS_PATH"/UA"
731
732 /* FIXME: Move some of these out into libawn when we can */
733 #define AWN_GROUP_PANEL "panel"
734@@ -38,6 +39,8 @@
735 #define AWN_PANEL_SIZE "size"
736 #define AWN_PANEL_AUTOHIDE "autohide"
737 #define AWN_PANEL_APPLET_LIST "applet_list"
738+#define AWN_PANEL_UA_LIST "ua_list"
739+#define AWN_PANEL_UA_ACTIVE_LIST "ua_active_list"
740 #define AWN_PANEL_MONITOR_HEIGHT "monitor_height"
741 #define AWN_PANEL_MONITOR_WIDTH "monitor_width"
742 #define AWN_PANEL_MONITOR_FORCE "monitor_force"
743
744=== added file 'src/awn-ua-alignment.c'
745--- src/awn-ua-alignment.c 1970-01-01 00:00:00 +0000
746+++ src/awn-ua-alignment.c 2009-07-14 19:09:25 +0000
747@@ -0,0 +1,469 @@
748+/*
749+ * Copyright (C) 2009 Rodney Cryderman <rcryderman@gmail.com>
750+ *
751+ * This program is free software; you can redistribute it and/or modify
752+ * it under the terms of the GNU General Public License as published by
753+ * the Free Software Foundation; either version 2 of the License, or
754+ * (at your option) any later version.
755+ *
756+ * This program is distributed in the hope that it will be useful,
757+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
758+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
759+ * GNU General Public License for more details.
760+ *
761+ * You should have received a copy of the GNU General Public License
762+ * along with this program; if not, write to the Free Software
763+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
764+ *
765+ *
766+ */
767+
768+/* awn-ua-alignment.c */
769+#include <stdlib.h>
770+#include "awn-ua-alignment.h"
771+#include "awn-defines.h"
772+
773+G_DEFINE_TYPE (AwnUAAlignment, awn_ua_alignment, GTK_TYPE_ALIGNMENT)
774+
775+#define AWN_UA_ALIGNMENT_GET_PRIVATE(o) \
776+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignmentPrivate))
777+
778+typedef struct _AwnUAAlignmentPrivate AwnUAAlignmentPrivate;
779+
780+struct _AwnUAAlignmentPrivate
781+{
782+ GtkWidget * socket;
783+ GtkWidget * applet_manager;
784+
785+ gchar *ua_list_entry;
786+ double ua_ratio;
787+
788+ guint notify_size_id;
789+ guint notify_orient_id;
790+ guint notify_offset_id;
791+ guint notify_ua_list_id;
792+};
793+
794+enum
795+{
796+ PROP_0,
797+ PROP_APPLET_MANAGER,
798+ PROP_UA_LIST_ENTRY,
799+ PROP_UA_RATIO
800+};
801+
802+
803+static gboolean awn_ua_alignment_plug_removed (GtkWidget * socket,
804+ AwnUAAlignment * self);
805+static void awn_ua_alignment_list_change(GObject *object,
806+ GParamSpec *param_spec,
807+ gpointer user_data);
808+static void awn_ua_alignment_orient_change(GObject *object,
809+ GParamSpec *param_spec,
810+ gpointer user_data);
811+static void awn_ua_alignment_size_change(GObject *object,
812+ GParamSpec *param_spec,
813+ gpointer user_data);
814+static void awn_ua_alignment_offset_change(GObject *object,
815+ GParamSpec *param_spec,
816+ gpointer user_data);
817+
818+
819+static void
820+awn_ua_alignment_get_property (GObject *object, guint property_id,
821+ GValue *value, GParamSpec *pspec)
822+{
823+ AwnUAAlignmentPrivate * priv;
824+
825+ priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object);
826+
827+ switch (property_id)
828+ {
829+ case PROP_APPLET_MANAGER:
830+ g_value_set_object (value,priv->applet_manager);
831+ break;
832+ case PROP_UA_LIST_ENTRY:
833+ g_value_set_string (value,priv->ua_list_entry);
834+ break;
835+ case PROP_UA_RATIO:
836+ g_value_set_double (value,priv->ua_ratio);
837+ break;
838+ default:
839+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
840+ }
841+}
842+
843+static void
844+awn_ua_alignment_set_property (GObject *object, guint property_id,
845+ const GValue *value, GParamSpec *pspec)
846+{
847+ AwnUAAlignmentPrivate * priv;
848+
849+ priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object);
850+ switch (property_id)
851+ {
852+ case PROP_APPLET_MANAGER:
853+ priv->applet_manager = g_value_get_object (value);
854+ break;
855+ case PROP_UA_LIST_ENTRY:
856+ g_free (priv->ua_list_entry);
857+ priv->ua_list_entry = g_value_dup_string (value);
858+ break;
859+ case PROP_UA_RATIO:
860+ priv->ua_ratio = g_value_get_double (value);
861+ break;
862+ default:
863+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
864+ }
865+}
866+
867+static void
868+awn_ua_alignment_dispose (GObject *object)
869+{
870+ G_OBJECT_CLASS (awn_ua_alignment_parent_class)->dispose (object);
871+}
872+
873+static void
874+awn_ua_alignment_finalize (GObject *object)
875+{
876+ AwnUAAlignmentPrivate * priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object);
877+ g_debug ("%s",__func__);
878+ if (priv->ua_list_entry)
879+ {
880+ g_free (priv->ua_list_entry);
881+ }
882+ G_OBJECT_CLASS (awn_ua_alignment_parent_class)->finalize (object);
883+}
884+
885+static void
886+awn_ua_alignment_constructed (GObject *object)
887+{
888+ AwnUAAlignmentPrivate * priv = AWN_UA_ALIGNMENT_GET_PRIVATE (object);
889+
890+ if (G_OBJECT_CLASS (awn_ua_alignment_parent_class)->constructed)
891+ {
892+ G_OBJECT_CLASS (awn_ua_alignment_parent_class)->constructed (object);
893+ }
894+
895+ gtk_container_add (GTK_CONTAINER(object),priv->socket);
896+ awn_ua_alignment_orient_change (NULL,NULL,object);
897+ priv->notify_offset_id = g_signal_connect (priv->applet_manager,
898+ "notify::offset",
899+ G_CALLBACK(awn_ua_alignment_offset_change),
900+ object);
901+ priv->notify_orient_id = g_signal_connect_after (priv->applet_manager,
902+ "notify::orient",
903+ G_CALLBACK(awn_ua_alignment_orient_change),
904+ object);
905+ priv->notify_size_id = g_signal_connect_after (priv->applet_manager,
906+ "notify::size",
907+ G_CALLBACK(awn_ua_alignment_size_change),
908+ object);
909+ priv->notify_ua_list_id = g_signal_connect_after (priv->applet_manager,
910+ "notify::ua-active-list",
911+ G_CALLBACK(awn_ua_alignment_list_change),
912+ object);
913+}
914+
915+static void
916+awn_ua_alignment_class_init (AwnUAAlignmentClass *klass)
917+{
918+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
919+ GParamSpec *pspec;
920+
921+ object_class->get_property = awn_ua_alignment_get_property;
922+ object_class->set_property = awn_ua_alignment_set_property;
923+ object_class->dispose = awn_ua_alignment_dispose;
924+ object_class->finalize = awn_ua_alignment_finalize;
925+ object_class->constructed = awn_ua_alignment_constructed;
926+
927+ pspec = g_param_spec_object ("applet-manager",
928+ "Awn Applet Manager",
929+ "Awn Applet Manager",
930+ AWN_TYPE_APPLET_MANAGER,
931+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
932+ g_object_class_install_property (object_class, PROP_APPLET_MANAGER, pspec);
933+
934+ pspec = g_param_spec_string ("ua-list-entry",
935+ "UA List entry",
936+ "UA List entry",
937+ NULL,
938+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
939+ g_object_class_install_property (object_class, PROP_UA_LIST_ENTRY, pspec);
940+
941+ pspec = g_param_spec_double ("ua-ratio",
942+ "UA Ratio",
943+ "UA Ratio",
944+ 0.0,
945+ 100.0,
946+ 1.0,
947+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
948+ g_object_class_install_property (object_class, PROP_UA_RATIO, pspec);
949+
950+ g_type_class_add_private (klass, sizeof (AwnUAAlignmentPrivate));
951+}
952+
953+static void
954+awn_ua_alignment_init (AwnUAAlignment *self)
955+{
956+ AwnUAAlignmentPrivate *priv;
957+
958+ priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
959+ priv->socket = gtk_socket_new ();
960+}
961+
962+GtkWidget*
963+awn_ua_alignment_new (AwnAppletManager *manager,gchar * ua_list_entry,double ua_ratio)
964+{
965+ return g_object_new (AWN_TYPE_UA_ALIGNMENT,
966+ "applet-manager",manager,
967+ "ua-list-entry",ua_list_entry,
968+ "ua-ratio",ua_ratio,
969+ NULL);
970+}
971+
972+GtkWidget*
973+awn_ua_alignment_get_socket (AwnUAAlignment *self)
974+{
975+ AwnUAAlignmentPrivate *priv;
976+
977+ priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
978+ return priv->socket;
979+}
980+
981+
982+GdkWindow *
983+awn_ua_alignment_add_id (AwnUAAlignment *self,GdkNativeWindow native_window)
984+{
985+ GdkWindow * plugwin;
986+ AwnUAAlignmentPrivate *priv;
987+
988+ priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
989+ gtk_socket_add_id (GTK_SOCKET(priv->socket), native_window);
990+ plugwin = gtk_socket_get_plug_window (GTK_SOCKET(priv->socket));
991+ g_signal_connect (priv->socket,"plug-removed",
992+ G_CALLBACK(awn_ua_alignment_plug_removed),self);
993+ gtk_widget_realize (priv->socket);
994+ gtk_widget_show_all (priv->socket);
995+ return plugwin;
996+}
997+
998+
999+static gboolean
1000+awn_ua_alignment_plug_removed (GtkWidget * socket,AwnUAAlignment * self)
1001+{
1002+
1003+ GSList * search;
1004+ GSList * ua_active_list;
1005+ GSList * orig_active_list;
1006+ GSList * iter;
1007+ AwnConfigClient *client;
1008+
1009+ AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
1010+
1011+ g_signal_handler_disconnect (priv->applet_manager,priv->notify_size_id);
1012+ g_signal_handler_disconnect (priv->applet_manager,priv->notify_orient_id);
1013+ g_signal_handler_disconnect (priv->applet_manager,priv->notify_offset_id);
1014+ g_signal_handler_disconnect (priv->applet_manager,priv->notify_ua_list_id);
1015+
1016+ g_object_get ( priv->applet_manager,
1017+ "ua_active_list",&orig_active_list,
1018+ "client",&client,
1019+ NULL);
1020+ ua_active_list = g_slist_copy (orig_active_list);
1021+ for (iter = ua_active_list;iter;iter = iter->next)
1022+ {
1023+ iter->data = g_strdup(iter->data);
1024+ }
1025+ search = g_slist_find_custom (ua_active_list,priv->ua_list_entry,
1026+ (GCompareFunc)g_strcmp0);
1027+ if (search)
1028+ {
1029+ ua_active_list = g_slist_delete_link (ua_active_list,search);
1030+ }
1031+ awn_config_client_set_list (client,AWN_GROUP_PANEL, AWN_PANEL_UA_ACTIVE_LIST,
1032+ AWN_CONFIG_CLIENT_LIST_TYPE_STRING,
1033+ ua_active_list, NULL);
1034+ g_object_set (priv->applet_manager,
1035+ "ua-active-list",ua_active_list,
1036+ NULL);
1037+ awn_applet_manager_remove_widget(AWN_APPLET_MANAGER(priv->applet_manager),
1038+ GTK_WIDGET (self));
1039+ return FALSE;
1040+}
1041+
1042+/*UA*/
1043+gint
1044+awn_ua_alignment_list_cmp (gconstpointer a, gconstpointer b)
1045+{
1046+ const gchar * str1 = a;
1047+ const gchar * str2 = b;
1048+ gchar * search = NULL;
1049+ GStrv tokens = g_strsplit (str1,"::",2);
1050+ g_return_val_if_fail (tokens,-1);
1051+
1052+ search = g_strstr_len (str2,-1,tokens[0]);
1053+ g_strfreev (tokens);
1054+
1055+ if (!search)
1056+ {
1057+ return -1;
1058+ };
1059+ return 0;
1060+}
1061+
1062+static void
1063+awn_ua_alignment_offset_change(GObject *object,GParamSpec *param_spec,gpointer user_data)
1064+{
1065+ AwnUAAlignment * self = user_data;
1066+ gint offset;
1067+ gint orient;
1068+ AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
1069+
1070+ g_object_get ( priv->applet_manager,
1071+ "offset",&offset,
1072+ "orient",&orient,
1073+ NULL);
1074+
1075+ switch (orient)
1076+ {
1077+ case AWN_ORIENTATION_TOP:
1078+ gtk_alignment_set_padding (GTK_ALIGNMENT(self), offset, 0, 0, 0);
1079+ break;
1080+ case AWN_ORIENTATION_BOTTOM:
1081+ gtk_alignment_set_padding (GTK_ALIGNMENT(self), 0, offset, 0, 0);
1082+ break;
1083+ case AWN_ORIENTATION_LEFT:
1084+ gtk_alignment_set_padding (GTK_ALIGNMENT(self), 0, 0, offset, 0);
1085+ break;
1086+ case AWN_ORIENTATION_RIGHT:
1087+ gtk_alignment_set_padding (GTK_ALIGNMENT(self), 0, 0, 0, offset);
1088+ break;
1089+ default:
1090+ g_warning ("%s: recieved invalid orient %d",__func__,orient);
1091+ }
1092+}
1093+
1094+static void
1095+awn_ua_alignment_size_change(GObject *object,GParamSpec *param_spec,gpointer user_data)
1096+{
1097+ AwnUAAlignment * self = user_data;
1098+ gint offset;
1099+ gint orient;
1100+ gint size;
1101+ AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
1102+
1103+ g_object_get ( priv->applet_manager,
1104+ "offset",&offset,
1105+ "orient",&orient,
1106+ "size",&size,
1107+ NULL);
1108+ GtkRequisition req;
1109+
1110+ req.width = req.height = size;
1111+ switch (orient)
1112+ {
1113+ case AWN_ORIENTATION_TOP:
1114+ case AWN_ORIENTATION_BOTTOM:
1115+ req.width = size * priv->ua_ratio;
1116+ req.height = size;
1117+ break;
1118+ case AWN_ORIENTATION_LEFT:
1119+ case AWN_ORIENTATION_RIGHT:
1120+ req.width = size;
1121+ req.height = size * 1.0 / priv->ua_ratio;
1122+ break;
1123+ default:
1124+ g_warning ("%s: recieved invalid orient %d",__func__,orient);
1125+ }
1126+ gtk_widget_set_size_request (GTK_WIDGET(self),req.width,req.height);
1127+}
1128+
1129+static void
1130+awn_ua_alignment_orient_change(GObject *object,GParamSpec *param_spec,gpointer user_data)
1131+{
1132+
1133+ AwnUAAlignment * self = user_data;
1134+ gint orient;
1135+ AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
1136+
1137+ g_object_get ( priv->applet_manager,
1138+ "orient",&orient,
1139+ NULL);
1140+ switch (orient)
1141+ {
1142+ case AWN_ORIENTATION_TOP:
1143+ gtk_alignment_set (GTK_ALIGNMENT(self), 0.0, 0.0, 1.0, 0.5);
1144+ break;
1145+ case AWN_ORIENTATION_BOTTOM:
1146+ gtk_alignment_set (GTK_ALIGNMENT(self), 0.0, 1.0, 1.0, 0.5);
1147+ break;
1148+ case AWN_ORIENTATION_LEFT:
1149+ gtk_alignment_set (GTK_ALIGNMENT(self), 0.0, 0.0, 0.5, 1.0);
1150+ break;
1151+ case AWN_ORIENTATION_RIGHT:
1152+ gtk_alignment_set (GTK_ALIGNMENT(self), 1.0, 0.0, 0.5, 1.0);
1153+ break;
1154+ default:
1155+ g_warning ("%s: recieved invalid orient %d",__func__,orient);
1156+ }
1157+ awn_ua_alignment_offset_change (object,param_spec,self);
1158+ awn_ua_alignment_size_change (object,param_spec,self);
1159+}
1160+
1161+static void
1162+awn_ua_alignment_list_change(GObject *object,GParamSpec *param_spec,gpointer user_data)
1163+{
1164+ AwnUAAlignment * self = user_data;
1165+ gint orient;
1166+ AwnUAAlignmentPrivate *priv = AWN_UA_ALIGNMENT_GET_PRIVATE (self);
1167+ GSList * ua_active_list;
1168+
1169+ g_object_get ( priv->applet_manager,
1170+ "orient",&orient,
1171+ "ua_active_list",&ua_active_list,
1172+ NULL);
1173+
1174+ GSList * search = g_slist_find_custom (ua_active_list,
1175+ priv->ua_list_entry,
1176+ (GCompareFunc)g_strcmp0);
1177+ if (search)
1178+ {
1179+ g_debug ("Found... do not need to update %s",priv->ua_list_entry);
1180+ }
1181+ else
1182+ {
1183+ search = g_slist_find_custom (ua_active_list,priv->ua_list_entry,awn_ua_alignment_list_cmp);
1184+ if (search)
1185+ {
1186+ g_debug ("Moving %s to %s",priv->ua_list_entry,(gchar*)search->data);
1187+ GStrv tokens;
1188+ gint pos = -1;
1189+ g_free (priv->ua_list_entry);
1190+ priv->ua_list_entry = g_strdup(search->data);
1191+ tokens = g_strsplit (search->data,"::",2);
1192+ if (tokens && tokens[1])
1193+ {
1194+ pos = atoi (tokens[1]);
1195+ }
1196+ g_strfreev (tokens);
1197+ if (pos != -1)
1198+ {
1199+ awn_applet_manager_add_widget(AWN_APPLET_MANAGER(priv->applet_manager),
1200+ GTK_WIDGET (self),
1201+ pos);
1202+ }
1203+ }
1204+ else
1205+ {
1206+ g_debug ("looks like %s was removed from panel/ua_list",priv->ua_list_entry);
1207+ /*
1208+ aantn as expected this does not kill the screenlet. What is the best way to
1209+ tell it that we want it to go away?
1210+ */
1211+ awn_applet_manager_remove_widget(AWN_APPLET_MANAGER(priv->applet_manager),
1212+ GTK_WIDGET (self));
1213+ gtk_widget_destroy (GTK_WIDGET(self));
1214+ }
1215+ }
1216+}
1217
1218=== added file 'src/awn-ua-alignment.h'
1219--- src/awn-ua-alignment.h 1970-01-01 00:00:00 +0000
1220+++ src/awn-ua-alignment.h 2009-07-14 02:56:28 +0000
1221@@ -0,0 +1,68 @@
1222+/*
1223+ * Copyright (C) 2009 Rodney Cryderman <rcryderman@gmail.com>
1224+ *
1225+ * This program is free software; you can redistribute it and/or modify
1226+ * it under the terms of the GNU General Public License as published by
1227+ * the Free Software Foundation; either version 2 of the License, or
1228+ * (at your option) any later version.
1229+ *
1230+ * This program is distributed in the hope that it will be useful,
1231+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1232+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1233+ * GNU General Public License for more details.
1234+ *
1235+ * You should have received a copy of the GNU General Public License
1236+ * along with this program; if not, write to the Free Software
1237+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1238+ *
1239+ *
1240+ */
1241+
1242+/* awn-ua-alignment.h */
1243+
1244+#ifndef _AWN_UA_ALIGNMENT
1245+#define _AWN_UA_ALIGNMENT
1246+
1247+#include <gtk/gtk.h>
1248+#include "awn-applet-manager.h"
1249+
1250+G_BEGIN_DECLS
1251+
1252+#define AWN_TYPE_UA_ALIGNMENT awn_ua_alignment_get_type()
1253+
1254+#define AWN_UA_ALIGNMENT(obj) \
1255+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignment))
1256+
1257+#define AWN_UA_ALIGNMENT_CLASS(klass) \
1258+ (G_TYPE_CHECK_CLASS_CAST ((klass), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignmentClass))
1259+
1260+#define AWN_IS_UA_ALIGNMENT(obj) \
1261+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AWN_TYPE_UA_ALIGNMENT))
1262+
1263+#define AWN_IS_UA_ALIGNMENT_CLASS(klass) \
1264+ (G_TYPE_CHECK_CLASS_TYPE ((klass), AWN_TYPE_UA_ALIGNMENT))
1265+
1266+#define AWN_UA_ALIGNMENT_GET_CLASS(obj) \
1267+ (G_TYPE_INSTANCE_GET_CLASS ((obj), AWN_TYPE_UA_ALIGNMENT, AwnUAAlignmentClass))
1268+
1269+typedef struct {
1270+ GtkAlignment parent;
1271+} AwnUAAlignment;
1272+
1273+typedef struct {
1274+ GtkAlignmentClass parent_class;
1275+} AwnUAAlignmentClass;
1276+
1277+GType awn_ua_alignment_get_type (void);
1278+
1279+GtkWidget* awn_ua_alignment_new (AwnAppletManager *manager,gchar * ua_list_entry,double ua_ratio);
1280+
1281+GtkWidget* awn_ua_alignment_get_socket (AwnUAAlignment *self);
1282+
1283+GdkWindow * awn_ua_alignment_add_id (AwnUAAlignment *self, GdkNativeWindow native_window);
1284+
1285+gint awn_ua_alignment_list_cmp (gconstpointer a, gconstpointer b);
1286+
1287+G_END_DECLS
1288+
1289+#endif /* _AWN_UA_ALIGNMENT */

Subscribers

People subscribed via source and target branches

to status/vote changes: