Awn

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

Proposed by Michal Hruby
Status: Merged
Approved by: moonbeam
Approved revision: 848
Merged at revision: not available
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
Reviewer Review Type Date Requested Status
Mark Lee superreview Approve
Michal Hruby (community) Approve
Review via email: mp+8972@code.launchpad.net

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

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.

Revision history for this message
Mark Lee (malept) : Posted in a previous version of this proposal
review: Approve (superreview)
Revision history for this message
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal

Here are my comments (all line numbers are from merge diff at LP):

1) Please remove applets/uawrapper/*
2) Do we really need both ua_list and ua_active_list to be saved in config client? There's for example a comment that ua_active_list must be empty when AWN starts, so does it really have to be saved to permanent config?
3) Please remove the g_debugs (for example 876), don't just comment them out (if not necessary for future development) - ok, most seem to be gone now.
4) Why is touch_quark set on UaAlignment (line 599)?
5) The UA has its special DBus object AND interface, I think it should be part of the instanced Panel object (though a separate interface). Currently it is multipanel-unfriendly. This would also remove the need to add dbus-specifics to AppletManager (*-glue.h and changes to Makefile.am)
6) get_all_server_flags method looks suspicious - hash table is not allocated, but TRUE is returned. (line 639)
7) There are mixed tabs/spaces in awn-applet-manager.h
8) Please revert the whitespace changes to awn-applet-proxy.c
9) Wouldn't it be better if instead of each UaAlignment watching the ua-active-list, the AppletManager would do it? The logic behind is very similar to applet watching, so it does make sense to put it into AppletManager. (moreover it'd be a little faster)
10) Why are the x/y-scale in gtk_alignment_set sometimes set to 0.5 (line 1142)?

review: Needs Fixing (detailed)
Revision history for this message
moonbeam (rcryderman) wrote : Posted in a previous version of this proposal

> Here are my comments (all line numbers are from merge diff at LP):
>
> 1) Please remove applets/uawrapper/*
Done

> 2) Do we really need both ua_list and ua_active_list to be saved in config
> client? There's for example a comment that ua_active_list must be empty
> AWN starts, so does it really have to be saved to permanent config?
Yes, unfortunately we do. At least for the moment. Admittedly ua_active_list is ephemeral in nature. It exists so awn-settings can be used to manipulate the active screenlets.

> 3) Please remove the g_debugs (for example 876), don't just comment them out
> (if not necessary for future development) - ok, most seem to be gone now.'s
There are still a few kicking around at the moment. I'd like to keep those specific ones in a bit longer.

> 4) Why is touch_quark set on UaAlignment (line 599)?
Leftover from duplication of code in create_applet(). I'll remove it.

> 5) The UA has its special DBus object AND interface, I think it should be part
> of the instanced Panel object (though a separate interface). Currently it is
> multipanel-unfriendly. This would also remove the need to add dbus-specifics
> to AppletManager (*-glue.h and changes to Makefile.am)
Beyond my time and abilities to do. Though I know we would like to keep the 0.4 mult-panel friendly I feel this can be dealt with in the 0.6 cycle.

> 6) get_all_server_flags method looks suspicious - hash table is not allocated,
> but TRUE is returned. (line 639)
Changed to return FALSE.

> 7) There are mixed tabs/spaces in awn-applet-manager.h

> 8) Please revert the whitespace changes to awn-applet-proxy.c
Missed those.

> 9) Wouldn't it be better if instead of each UaAlignment watching the ua-
> active-list, the AppletManager would do it? The logic behind is very similar
> to applet watching, so it does make sense to put it into AppletManager.
> (moreover it'd be a little faster)
Maybe. I gave consideration to leaving it ther, it could have went either way. I chose to move as much into UAAlignment as possible for the moment. My inclination is to leave it as it is for now but possibly move it back into AppletManager at a later date.

> 10) Why are the x/y-scale in gtk_alignment_set sometimes set to 0.5 (line
> 1142)?
Probably because they worked fine that way:-) I'l fix that before I push the changes.

Revision history for this message
moonbeam (rcryderman) wrote : Posted in a previous version of this proposal

Turns out they are necessary for proper placement of the UA/screenlet.

> > 10) Why are the x/y-scale in gtk_alignment_set sometimes set to 0.5 (line
> > 1142)?
> Probably because they worked fine that way:-) I'l fix that before I push the
> changes.

Revision history for this message
Julien Lavergne (gilir) wrote : Posted in a previous version of this proposal

About the dbus stuff, changing the interface sound possible, the
necessary stuff to do on screenlets's side shoudl not be too hard.

I need to take another look for the AppletManager code.

Julien Lavergne

Le 16 juil. 2009 à 16:27, moonbeam <email address hidden> a écrit :

>> Here are my comments (all line numbers are from merge diff at LP):
>>
>> 1) Please remove applets/uawrapper/*
> Done
>
>> 2) Do we really need both ua_list and ua_active_list to be saved in
>> config
>> client? There's for example a comment that ua_active_list must be
>> empty
>> AWN starts, so does it really have to be saved to permanent config?
> Yes, unfortunately we do. At least for the moment. Admittedly
> ua_active_list is ephemeral in nature. It exists so awn-settings
> can be used to manipulate the active screenlets.
>
>> 3) Please remove the g_debugs (for example 876), don't just comment
>> them out
>> (if not necessary for future development) - ok, most seem to be
>> gone now.'s
> There are still a few kicking around at the moment. I'd like to
> keep those specific ones in a bit longer.
>
>> 4) Why is touch_quark set on UaAlignment (line 599)?
> Leftover from duplication of code in create_applet(). I'll remove it.
>
>> 5) The UA has its special DBus object AND interface, I think it
>> should be part
>> of the instanced Panel object (though a separate interface).
>> Currently it is
>> multipanel-unfriendly. This would also remove the need to add dbus-
>> specifics
>> to AppletManager (*-glue.h and changes to Makefile.am)
> Beyond my time and abilities to do. Though I know we would like to
> keep the 0.4 mult-panel friendly I feel this can be dealt with in
> the 0.6 cycle.
>
>> 6) get_all_server_flags method looks suspicious - hash table is not
>> allocated,
>> but TRUE is returned. (line 639)
> Changed to return FALSE.
>
>> 7) There are mixed tabs/spaces in awn-applet-manager.h
>
>> 8) Please revert the whitespace changes to awn-applet-proxy.c
> Missed those.
>
>> 9) Wouldn't it be better if instead of each UaAlignment watching
>> the ua-
>> active-list, the AppletManager would do it? The logic behind is
>> very similar
>> to applet watching, so it does make sense to put it into
>> AppletManager.
>> (moreover it'd be a little faster)
> Maybe. I gave consideration to leaving it ther, it could have went
> either way. I chose to move as much into UAAlignment as possible
> for the moment. My inclination is to leave it as it is for now but
> possibly move it back into AppletManager at a later date.
>
>> 10) Why are the x/y-scale in gtk_alignment_set sometimes set to 0.5
>> (line
>> 1142)?
> Probably because they worked fine that way:-) I'l fix that before I
> push the changes.
>
> --
> https://code.launchpad.net/~awn-testing/awn/awn-rewrite-ua-support/+merge/8851
> You proposed lp:~awn-testing/awn/awn-rewrite-ua-support for merging.

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

From my point of view it's good to go, but someone please test with the actual UA before merging, since there were changes to the DBus interface (btw shouldn't there be a standardized name for the UA interface?).

review: Approve
Revision history for this message
Mark Lee (malept) :
review: Approve (superreview)

Preview Diff

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

Subscribers

People subscribed via source and target branches

to status/vote changes: