Merge lp:~indicator-applet-developers/indicator-applet/messages-packaging into lp:~ubuntu-core-dev/indicator-applet/messages-ubuntu
- messages-packaging
- Merge into messages-ubuntu
Proposed by
Ted Gould
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||||||||||
Proposed branch: | lp:~indicator-applet-developers/indicator-applet/messages-packaging | ||||||||||||||||
Merge into: | lp:~ubuntu-core-dev/indicator-applet/messages-ubuntu | ||||||||||||||||
Diff against target: | None lines | ||||||||||||||||
To merge this branch: | bzr merge lp:~indicator-applet-developers/indicator-applet/messages-packaging | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Indicator Applet Developers | Pending | ||
Review via email: mp+9670@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2009-02-06 15:26:20 +0000 |
3 | +++ .bzrignore 2009-05-28 15:29:41 +0000 |
4 | @@ -16,3 +16,6 @@ |
5 | debian/stamp-makefile-build |
6 | libmessaging_la-im-menu-item.lo |
7 | src/libmessaging_la-app-menu-item.lo |
8 | +data/indicator-messages.service |
9 | +indicator-messages-service |
10 | +indicator-messages-service-activate |
11 | |
12 | === modified file 'autogen.sh' |
13 | --- autogen.sh 2008-12-05 00:34:45 +0000 |
14 | +++ autogen.sh 2009-04-05 11:03:12 +0000 |
15 | @@ -1,6 +1,6 @@ |
16 | #!/bin/sh |
17 | |
18 | -PKG_NAME="indicator-applet" |
19 | +PKG_NAME="indicator-messages" |
20 | |
21 | which gnome-autogen.sh || { |
22 | echo "You need gnome-common from GNOME SVN" |
23 | |
24 | === modified file 'configure.ac' |
25 | --- configure.ac 2009-04-13 15:57:24 +0000 |
26 | +++ configure.ac 2009-08-04 16:44:11 +0000 |
27 | @@ -4,7 +4,7 @@ |
28 | AC_PREREQ(2.53) |
29 | |
30 | AM_CONFIG_HEADER(config.h) |
31 | -AM_INIT_AUTOMAKE(indicator-messages, 0.1.6) |
32 | +AM_INIT_AUTOMAKE(indicator-messages, 0.2.0dev) |
33 | |
34 | AM_MAINTAINER_MODE |
35 | |
36 | @@ -24,15 +24,34 @@ |
37 | GTK_REQUIRED_VERSION=2.12 |
38 | GIO_UNIX_REQUIRED_VERSION=2.18 |
39 | PANEL_REQUIRED_VERSION=2.0.0 |
40 | -INDICATE_REQUIRED_VERSION=0.1.5 |
41 | +INDICATE_REQUIRED_VERSION=0.2.0 |
42 | +INDICATOR_REQUIRED_VERSION=0.2.0 |
43 | +DBUSMENUGTK_REQUIRED_VERSION=0.0.0 |
44 | |
45 | PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION |
46 | gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION |
47 | - indicate >= $INDICATE_REQUIRED_VERSION) |
48 | + indicator >= $INDICATOR_REQUIRED_VERSION |
49 | + indicate >= $INDICATE_REQUIRED_VERSION |
50 | + indicate-gtk >= $INDICATE_REQUIRED_VERSION |
51 | + dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION) |
52 | AC_SUBST(APPLET_CFLAGS) |
53 | AC_SUBST(APPLET_LIBS) |
54 | |
55 | ########################### |
56 | +# Indicator Info |
57 | +########################### |
58 | + |
59 | +INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator` |
60 | +AC_SUBST(INDICATORDIR) |
61 | + |
62 | +########################### |
63 | +# DBus Service Info |
64 | +########################### |
65 | + |
66 | +DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1` |
67 | +AC_SUBST(DBUSSERVICEDIR) |
68 | + |
69 | +########################### |
70 | # Files |
71 | ########################### |
72 | |
73 | @@ -40,6 +59,7 @@ |
74 | Makefile |
75 | src/Makefile |
76 | data/Makefile |
77 | +data/indicator-messages.service |
78 | data/icons/Makefile |
79 | data/icons/16x16/Makefile |
80 | data/icons/16x16/status/Makefile |
81 | @@ -64,4 +84,5 @@ |
82 | Messaging Indicator Configuration: |
83 | |
84 | Prefix: $prefix |
85 | + Indicator Dir: $INDICATORDIR |
86 | ]) |
87 | |
88 | === modified file 'data/Makefile.am' |
89 | --- data/Makefile.am 2009-02-04 16:01:51 +0000 |
90 | +++ data/Makefile.am 2009-05-27 10:51:24 +0000 |
91 | @@ -1,1 +1,4 @@ |
92 | SUBDIRS = icons |
93 | + |
94 | +dbus_servicesdir = $(DBUSSERVICEDIR) |
95 | +dbus_services_DATA = indicator-messages.service |
96 | |
97 | === added file 'data/indicator-messages.service.in' |
98 | --- data/indicator-messages.service.in 1970-01-01 00:00:00 +0000 |
99 | +++ data/indicator-messages.service.in 2009-05-28 15:33:26 +0000 |
100 | @@ -0,0 +1,3 @@ |
101 | +[D-BUS Service] |
102 | +Name=com.ubuntu.indicator.messages |
103 | +Exec=@prefix@/bin/indicator-messages-service |
104 | |
105 | === modified file 'debian/changelog' |
106 | --- debian/changelog 2009-04-14 09:32:06 +0000 |
107 | +++ debian/changelog 2009-08-04 16:54:53 +0000 |
108 | @@ -1,3 +1,62 @@ |
109 | +indicator-messages (0.2.0~bzr121-0ubuntu1~ppa4) karmic; urgency=low |
110 | + |
111 | + * debian/control: Adding in a build dep on libindicate-gtk-dev |
112 | + |
113 | + -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 17:54:44 +0100 |
114 | + |
115 | +indicator-messages (0.2.0~bzr121-0ubuntu1~ppa3) karmic; urgency=low |
116 | + |
117 | + * Changes for the changing libindicate stuff. |
118 | + |
119 | + -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 17:46:17 +0100 |
120 | + |
121 | +indicator-messages (0.2.0~bzr121-0ubuntu1~ppa2) karmic; urgency=low |
122 | + |
123 | + * Forgot to run ./autogen.sh |
124 | + |
125 | + -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 17:38:41 +0100 |
126 | + |
127 | +indicator-messages (0.2.0~bzr121-0ubuntu1~ppa1) karmic; urgency=low |
128 | + |
129 | + * Merge in the dbusmenu changes from the dbusmenu branch |
130 | + * debian/control: Adding in a build dependency on libdbusmenu-glib and |
131 | + libdbusmenu-gtk to catch up with the merge. |
132 | + |
133 | + -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 12:50:10 +0100 |
134 | + |
135 | +indicator-messages (0.2.0~bzr120-0ubuntu1) jaunty; urgency=low |
136 | + |
137 | + * Fix to track the timer. (LP: #365187) |
138 | + |
139 | + -- Ted Gould <ted@ubuntu.com> Wed, 13 May 2009 09:56:20 -0500 |
140 | + |
141 | +indicator-messages (0.2.0~bzr119-0ubuntu1) jaunty; urgency=low |
142 | + |
143 | + * Upstream update |
144 | + |
145 | + -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 23:34:21 -0500 |
146 | + |
147 | +indicator-messages (0.2.0~bzr116-0ubuntu3) jaunty; urgency=low |
148 | + |
149 | + * debian/rules: Adding a rule to remove the .la/.a clutter |
150 | + |
151 | + -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 16:46:59 -0500 |
152 | + |
153 | +indicator-messages (0.2.0~bzr116-0ubuntu2) jaunty; urgency=low |
154 | + |
155 | + * debian/control: libindicator-dev to ~bzr301 |
156 | + |
157 | + -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 15:58:45 -0500 |
158 | + |
159 | +indicator-messages (0.2.0~bzr116-0ubuntu1) jaunty; urgency=low |
160 | + |
161 | + * Upstream release |
162 | + * Bug fixes |
163 | + * Update API to new libindicator |
164 | + * debian/control: Adding new dependency on libindicator-dev |
165 | + |
166 | + -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 15:45:21 -0500 |
167 | + |
168 | indicator-messages (0.1.6-0ubuntu1) jaunty; urgency=low |
169 | |
170 | * New upstream version |
171 | |
172 | === modified file 'debian/control' |
173 | --- debian/control 2009-04-08 03:00:24 +0000 |
174 | +++ debian/control 2009-08-04 16:54:42 +0000 |
175 | @@ -9,7 +9,11 @@ |
176 | gnome-doc-utils, |
177 | scrollkeeper, |
178 | intltool, |
179 | - libindicate-dev (>= 0.1.5) |
180 | + libindicate-dev (>= 0.2.0~bzr298), |
181 | + libindicate-gtk-dev (>= 0.2.0~bzr298), |
182 | + libindicator-dev (>= 0.2.0~bzr301), |
183 | + libdbusmenu-gtk-dev, |
184 | + libdbusmenu-glib-dev |
185 | Standards-Version: 3.8.0 |
186 | Homepage: https://launchpad.net/indicator-applet |
187 | Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/indicator-applet/messages-ubuntu |
188 | |
189 | === modified file 'debian/rules' |
190 | --- debian/rules 2008-12-05 04:36:11 +0000 |
191 | +++ debian/rules 2009-04-22 21:46:57 +0000 |
192 | @@ -6,3 +6,7 @@ |
193 | DEB_CONFIGURE_EXTRA_FLAGS += --disable-scrollkeeper |
194 | LDFLAGS += -Wl,-z,defs -Wl,--as-needed |
195 | |
196 | +binary-install/indicator-messages:: |
197 | + # remove .a/.la clutter |
198 | + rm -f debian/$(cdbs_curpkg)/usr/lib/indicators/*/*.a |
199 | + rm -f debian/$(cdbs_curpkg)/usr/lib/indicators/*/*.la |
200 | |
201 | === modified file 'src/Makefile.am' |
202 | --- src/Makefile.am 2009-03-15 15:32:27 +0000 |
203 | +++ src/Makefile.am 2009-05-28 15:19:48 +0000 |
204 | @@ -1,7 +1,13 @@ |
205 | |
206 | -messaginglibdir = $(libdir)/indicators/1 |
207 | +bin_PROGRAMS = indicator-messages-service |
208 | + |
209 | +messaginglibdir = $(INDICATORDIR) |
210 | messaginglib_LTLIBRARIES = libmessaging.la |
211 | libmessaging_la_SOURCES = indicator-messages.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h |
212 | -libmessaging_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed |
213 | +libmessaging_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror |
214 | libmessaging_la_LIBADD = $(APPLET_LIBS) |
215 | libmessaging_la_LDFLAGS = -module -avoid-version |
216 | + |
217 | +indicator_messages_service_SOURCES = indicator-service.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h |
218 | +indicator_messages_service_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror |
219 | +indicator_messages_service_LDADD = $(APPLET_LIBS) |
220 | |
221 | === modified file 'src/app-menu-item.c' |
222 | --- src/app-menu-item.c 2009-04-13 15:02:06 +0000 |
223 | +++ src/app-menu-item.c 2009-05-26 14:30:31 +0000 |
224 | @@ -25,7 +25,6 @@ |
225 | #endif |
226 | |
227 | #include <glib/gi18n.h> |
228 | -#include <gtk/gtk.h> |
229 | #include <gio/gdesktopappinfo.h> |
230 | #include "app-menu-item.h" |
231 | |
232 | @@ -48,8 +47,6 @@ |
233 | GAppInfo * appinfo; |
234 | guint unreadcount; |
235 | gboolean count_on_label; |
236 | - |
237 | - GtkWidget * name; |
238 | }; |
239 | |
240 | #define APP_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_MENU_ITEM_TYPE, AppMenuItemPrivate)) |
241 | @@ -68,7 +65,7 @@ |
242 | |
243 | |
244 | |
245 | -G_DEFINE_TYPE (AppMenuItem, app_menu_item, GTK_TYPE_MENU_ITEM); |
246 | +G_DEFINE_TYPE (AppMenuItem, app_menu_item, DBUSMENU_TYPE_MENUITEM); |
247 | |
248 | static void |
249 | app_menu_item_class_init (AppMenuItemClass *klass) |
250 | @@ -106,7 +103,6 @@ |
251 | |
252 | priv->listener = NULL; |
253 | priv->server = NULL; |
254 | - priv->name = NULL; |
255 | priv->type = NULL; |
256 | priv->appinfo = NULL; |
257 | priv->unreadcount = 0; |
258 | @@ -119,6 +115,14 @@ |
259 | static void |
260 | app_menu_item_dispose (GObject *object) |
261 | { |
262 | + AppMenuItem * self = APP_MENU_ITEM(object); |
263 | + AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self); |
264 | + |
265 | + g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_added_cb), self); |
266 | + g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_removed_cb), self); |
267 | + |
268 | + g_object_unref(priv->listener); |
269 | + |
270 | G_OBJECT_CLASS (app_menu_item_parent_class)->dispose (object); |
271 | } |
272 | |
273 | @@ -128,8 +132,13 @@ |
274 | AppMenuItem * self = APP_MENU_ITEM(object); |
275 | AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self); |
276 | |
277 | - g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_added_cb), self); |
278 | - g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_removed_cb), self); |
279 | + if (priv->type != NULL) { |
280 | + g_free(priv->type); |
281 | + } |
282 | + |
283 | + if (priv->appinfo != NULL) { |
284 | + g_object_unref(priv->appinfo); |
285 | + } |
286 | |
287 | G_OBJECT_CLASS (app_menu_item_parent_class)->finalize (object); |
288 | |
289 | @@ -144,21 +153,17 @@ |
290 | AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self); |
291 | |
292 | priv->listener = listener; |
293 | + g_object_ref(G_OBJECT(listener)); |
294 | priv->server = server; |
295 | + /* Can not ref as not real GObject */ |
296 | |
297 | g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added_cb), self); |
298 | g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, G_CALLBACK(indicator_removed_cb), self); |
299 | |
300 | - priv->name = gtk_label_new(INDICATE_LISTENER_SERVER_DBUS_NAME(server)); |
301 | - gtk_misc_set_alignment(GTK_MISC(priv->name), 0.0, 0.5); |
302 | - gtk_widget_show(GTK_WIDGET(priv->name)); |
303 | - |
304 | - gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(priv->name)); |
305 | - |
306 | indicate_listener_server_get_type(listener, server, type_cb, self); |
307 | indicate_listener_server_get_desktop(listener, server, desktop_cb, self); |
308 | |
309 | - g_signal_connect(G_OBJECT(self), "activate", G_CALLBACK(activate_cb), NULL); |
310 | + g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); |
311 | |
312 | indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_SERVER_DISPLAY); |
313 | indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_SERVER_SIGNAL); |
314 | @@ -174,8 +179,14 @@ |
315 | |
316 | if (priv->type != NULL) { |
317 | g_free(priv->type); |
318 | + priv->type = NULL; |
319 | } |
320 | |
321 | + if (value == NULL) { |
322 | + g_warning("Type value is NULL, that shouldn't really happen"); |
323 | + return; |
324 | + } |
325 | + |
326 | priv->type = g_strdup(value); |
327 | |
328 | if (!(!g_strcmp0(priv->type, "message.instant") || !g_strcmp0(priv->type, "message.micro") || !g_strcmp0(priv->type, "message.im"))) { |
329 | @@ -200,11 +211,11 @@ |
330 | if (priv->count_on_label && !priv->unreadcount < 1) { |
331 | /* TRANSLATORS: This is the name of the program and the number of indicators. So it |
332 | would read something like "Mail Client (5)" */ |
333 | - gchar * label = g_strdup_printf(_("%s (%d)"), g_app_info_get_name(priv->appinfo), priv->unreadcount); |
334 | - gtk_label_set_text(GTK_LABEL(priv->name), label); |
335 | + gchar * label = g_strdup_printf(_("%s (%d)"), app_menu_item_get_name(self), priv->unreadcount); |
336 | + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", label); |
337 | g_free(label); |
338 | } else { |
339 | - gtk_label_set_text(GTK_LABEL(priv->name), g_app_info_get_name(priv->appinfo)); |
340 | + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", app_menu_item_get_name(self)); |
341 | } |
342 | |
343 | return; |
344 | @@ -228,7 +239,7 @@ |
345 | g_return_if_fail(priv->appinfo != NULL); |
346 | |
347 | update_label(self); |
348 | - g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, g_app_info_get_name(priv->appinfo), TRUE); |
349 | + g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, app_menu_item_get_name(self), TRUE); |
350 | |
351 | return; |
352 | } |
353 | |
354 | === modified file 'src/app-menu-item.h' |
355 | --- src/app-menu-item.h 2009-03-15 17:19:02 +0000 |
356 | +++ src/app-menu-item.h 2009-05-26 14:30:31 +0000 |
357 | @@ -25,6 +25,7 @@ |
358 | #include <glib.h> |
359 | #include <glib-object.h> |
360 | |
361 | +#include <libdbusmenu-glib/menuitem.h> |
362 | #include <libindicate/listener.h> |
363 | |
364 | G_BEGIN_DECLS |
365 | @@ -43,14 +44,14 @@ |
366 | typedef struct _AppMenuItemClass AppMenuItemClass; |
367 | |
368 | struct _AppMenuItemClass { |
369 | - GtkMenuItemClass parent_class; |
370 | + DbusmenuMenuitemClass parent_class; |
371 | |
372 | void (* count_changed) (guint count); |
373 | void (* name_changed) (gchar * name); |
374 | }; |
375 | |
376 | struct _AppMenuItem { |
377 | - GtkMenuItem parent; |
378 | + DbusmenuMenuitem parent; |
379 | }; |
380 | |
381 | GType app_menu_item_get_type (void); |
382 | |
383 | === added file 'src/dbus-data.h' |
384 | --- src/dbus-data.h 1970-01-01 00:00:00 +0000 |
385 | +++ src/dbus-data.h 2009-05-25 22:28:08 +0000 |
386 | @@ -0,0 +1,8 @@ |
387 | + |
388 | +#ifndef __DBUS_DATA_H__ |
389 | +#define __DBUS_DATA_H__ 1 |
390 | + |
391 | +#define INDICATOR_MESSAGES_DBUS_NAME "com.ubuntu.indicator.messages" |
392 | +#define INDICATOR_MESSAGES_DBUS_OBJECT "/com/ubuntu/indicator/messages" |
393 | + |
394 | +#endif /* __DBUS_DATA_H__ */ |
395 | |
396 | === modified file 'src/im-menu-item.c' |
397 | --- src/im-menu-item.c 2009-04-07 22:00:29 +0000 |
398 | +++ src/im-menu-item.c 2009-08-04 16:44:11 +0000 |
399 | @@ -24,7 +24,8 @@ |
400 | #endif |
401 | |
402 | #include <glib/gi18n.h> |
403 | -#include <gtk/gtk.h> |
404 | +#include <libindicate-gtk/indicator.h> |
405 | +#include <libindicate-gtk/listener.h> |
406 | #include "im-menu-item.h" |
407 | |
408 | enum { |
409 | @@ -47,11 +48,6 @@ |
410 | gulong indicator_changed; |
411 | |
412 | guint time_update_min; |
413 | - |
414 | - GtkHBox * hbox; |
415 | - GtkLabel * user; |
416 | - GtkLabel * time; |
417 | - GtkImage * icon; |
418 | }; |
419 | |
420 | #define IM_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IM_MENU_ITEM_TYPE, ImMenuItemPrivate)) |
421 | @@ -88,13 +84,7 @@ |
422 | gchar * property, |
423 | ImMenuItem * self); |
424 | |
425 | - |
426 | -static GtkSizeGroup * icon_group = NULL; |
427 | -static GtkSizeGroup * user_group = NULL; |
428 | -static GtkSizeGroup * time_group = NULL; |
429 | - |
430 | - |
431 | -G_DEFINE_TYPE (ImMenuItem, im_menu_item, GTK_TYPE_MENU_ITEM); |
432 | +G_DEFINE_TYPE (ImMenuItem, im_menu_item, DBUSMENU_TYPE_MENUITEM); |
433 | |
434 | static void |
435 | im_menu_item_class_init (ImMenuItemClass *klass) |
436 | @@ -129,35 +119,6 @@ |
437 | |
438 | priv->seconds = 0; |
439 | |
440 | - /* build widgets first */ |
441 | - priv->icon = GTK_IMAGE(gtk_image_new()); |
442 | - priv->user = GTK_LABEL(gtk_label_new("")); |
443 | - priv->time = GTK_LABEL(gtk_label_new("")); |
444 | - |
445 | - gtk_misc_set_alignment(GTK_MISC(priv->user), 0.0, 0.5); |
446 | - gtk_misc_set_alignment(GTK_MISC(priv->time), 0.0, 0.5); |
447 | - |
448 | - if (icon_group == NULL) { |
449 | - icon_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
450 | - } |
451 | - if (user_group == NULL) { |
452 | - user_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
453 | - } |
454 | - if (time_group == NULL) { |
455 | - time_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
456 | - } |
457 | - gtk_size_group_add_widget(icon_group, GTK_WIDGET(priv->icon)); |
458 | - gtk_size_group_add_widget(user_group, GTK_WIDGET(priv->user)); |
459 | - gtk_size_group_add_widget(time_group, GTK_WIDGET(priv->time)); |
460 | - |
461 | - priv->hbox = GTK_HBOX(gtk_hbox_new(FALSE, 3)); |
462 | - gtk_box_pack_start(GTK_BOX(priv->hbox), GTK_WIDGET(priv->icon), FALSE, TRUE, 3); |
463 | - gtk_box_pack_start(GTK_BOX(priv->hbox), GTK_WIDGET(priv->user), TRUE, TRUE, 3); |
464 | - gtk_box_pack_start(GTK_BOX(priv->hbox), GTK_WIDGET(priv->time), FALSE, TRUE, 3); |
465 | - gtk_widget_show(GTK_WIDGET(priv->hbox)); |
466 | - |
467 | - gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(priv->hbox)); |
468 | - |
469 | return; |
470 | } |
471 | |
472 | @@ -188,19 +149,7 @@ |
473 | static void |
474 | icon_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GdkPixbuf * propertydata, gpointer data) |
475 | { |
476 | - ImMenuItem * self = IM_MENU_ITEM(data); |
477 | - ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self); |
478 | - |
479 | - gint height, width; |
480 | - gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); |
481 | - |
482 | - GdkPixbuf * scaled = gdk_pixbuf_scale_simple(propertydata, width, height, GDK_INTERP_BILINEAR); |
483 | - g_object_unref(propertydata); |
484 | - |
485 | - gtk_image_set_from_pixbuf(priv->icon, scaled); |
486 | - g_object_unref(scaled); |
487 | - |
488 | - gtk_widget_show(GTK_WIDGET(priv->icon)); |
489 | + /* dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "icon", propertydata); */ |
490 | |
491 | return; |
492 | } |
493 | @@ -211,7 +160,7 @@ |
494 | ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self); |
495 | |
496 | if (!priv->show_time) { |
497 | - gtk_label_set_label(priv->time, ""); |
498 | + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "right-column", ""); |
499 | return; |
500 | } |
501 | |
502 | @@ -242,9 +191,7 @@ |
503 | } |
504 | |
505 | if (timestring != NULL) { |
506 | - gtk_label_set_label(priv->time, timestring); |
507 | - gtk_widget_show(GTK_WIDGET(priv->time)); |
508 | - |
509 | + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "right-column", ""); |
510 | g_free(timestring); |
511 | } |
512 | |
513 | @@ -283,7 +230,7 @@ |
514 | update_time(self); |
515 | |
516 | if (priv->time_update_min == 0) { |
517 | - g_timeout_add_seconds(60, time_update_cb, self); |
518 | + priv->time_update_min = g_timeout_add_seconds(60, time_update_cb, self); |
519 | } |
520 | |
521 | g_signal_emit(G_OBJECT(self), signals[TIME_CHANGED], 0, priv->seconds, TRUE); |
522 | @@ -306,13 +253,7 @@ |
523 | return; |
524 | } |
525 | |
526 | - ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self); |
527 | - |
528 | - gtk_label_set_label(priv->user, propertydata); |
529 | - gtk_widget_show(GTK_WIDGET(priv->user)); |
530 | - |
531 | - /* Once we have the user we'll show the menu item */ |
532 | - gtk_widget_show(GTK_WIDGET(self)); |
533 | + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", propertydata); |
534 | |
535 | return; |
536 | } |
537 | @@ -348,7 +289,6 @@ |
538 | ImMenuItem * |
539 | im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gboolean show_time) |
540 | { |
541 | - g_debug("Building a new IM Menu Item"); |
542 | ImMenuItem * self = g_object_new(IM_MENU_ITEM_TYPE, NULL); |
543 | |
544 | ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self); |
545 | @@ -363,7 +303,7 @@ |
546 | indicate_listener_get_property_time(listener, server, indicator, "time", time_cb, self); |
547 | indicate_listener_get_property_icon(listener, server, indicator, "icon", icon_cb, self); |
548 | |
549 | - g_signal_connect(G_OBJECT(self), "activate", G_CALLBACK(activate_cb), NULL); |
550 | + g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); |
551 | priv->indicator_changed = g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED, G_CALLBACK(indicator_modified_cb), self); |
552 | |
553 | return self; |
554 | |
555 | === modified file 'src/im-menu-item.h' |
556 | --- src/im-menu-item.h 2009-03-24 21:57:06 +0000 |
557 | +++ src/im-menu-item.h 2009-05-26 14:30:37 +0000 |
558 | @@ -25,6 +25,7 @@ |
559 | #include <glib.h> |
560 | #include <glib-object.h> |
561 | |
562 | +#include <libdbusmenu-glib/menuitem.h> |
563 | #include <libindicate/listener.h> |
564 | |
565 | G_BEGIN_DECLS |
566 | @@ -42,13 +43,13 @@ |
567 | typedef struct _ImMenuItemClass ImMenuItemClass; |
568 | |
569 | struct _ImMenuItemClass { |
570 | - GtkMenuItemClass parent_class; |
571 | + DbusmenuMenuitemClass parent_class; |
572 | |
573 | void (*time_changed) (glong seconds); |
574 | }; |
575 | |
576 | struct _ImMenuItem { |
577 | - GtkMenuItem parent; |
578 | + DbusmenuMenuitem parent; |
579 | }; |
580 | |
581 | GType im_menu_item_get_type (void); |
582 | |
583 | === added file 'src/indicator-messages.c' |
584 | --- src/indicator-messages.c 1970-01-01 00:00:00 +0000 |
585 | +++ src/indicator-messages.c 2009-05-28 15:20:23 +0000 |
586 | @@ -0,0 +1,81 @@ |
587 | +/* |
588 | +An indicator to show information that is in messaging applications |
589 | +that the user is using. |
590 | + |
591 | +Copyright 2009 Canonical Ltd. |
592 | + |
593 | +Authors: |
594 | + Ted Gould <ted@canonical.com> |
595 | + |
596 | +This program is free software: you can redistribute it and/or modify it |
597 | +under the terms of the GNU General Public License version 3, as published |
598 | +by the Free Software Foundation. |
599 | + |
600 | +This program is distributed in the hope that it will be useful, but |
601 | +WITHOUT ANY WARRANTY; without even the implied warranties of |
602 | +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
603 | +PURPOSE. See the GNU General Public License for more details. |
604 | + |
605 | +You should have received a copy of the GNU General Public License along |
606 | +with this program. If not, see <http://www.gnu.org/licenses/>. |
607 | +*/ |
608 | + |
609 | +#include <string.h> |
610 | +#include <gtk/gtk.h> |
611 | +#include <libdbusmenu-gtk/menu.h> |
612 | +#include <dbus/dbus-glib.h> |
613 | +#include <dbus/dbus-glib-bindings.h> |
614 | + |
615 | +#include <libindicator/indicator.h> |
616 | +INDICATOR_SET_VERSION |
617 | +INDICATOR_SET_NAME("messages") |
618 | + |
619 | +#include "dbus-data.h" |
620 | + |
621 | +static GtkWidget * main_image; |
622 | + |
623 | +#define DESIGN_TEAM_SIZE design_team_size |
624 | +static GtkIconSize design_team_size; |
625 | + |
626 | +GtkLabel * |
627 | +get_label (void) |
628 | +{ |
629 | + return NULL; |
630 | +} |
631 | + |
632 | +GtkImage * |
633 | +get_icon (void) |
634 | +{ |
635 | + design_team_size = gtk_icon_size_register("design-team-size", 22, 22); |
636 | + |
637 | + main_image = gtk_image_new_from_icon_name("indicator-messages", DESIGN_TEAM_SIZE); |
638 | + gtk_widget_show(main_image); |
639 | + |
640 | + /* Need a proxy here to figure out when the icon changes */ |
641 | + |
642 | + return GTK_IMAGE(main_image); |
643 | +} |
644 | + |
645 | +GtkMenu * |
646 | +get_menu (void) |
647 | +{ |
648 | + guint returnval = 0; |
649 | + GError * error = NULL; |
650 | + |
651 | + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); |
652 | + DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); |
653 | + |
654 | + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &returnval, &error)) { |
655 | + g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); |
656 | + g_error_free(error); |
657 | + return NULL; |
658 | + } |
659 | + |
660 | + if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { |
661 | + g_error("Return value isn't indicative of success: %d", returnval); |
662 | + return NULL; |
663 | + } |
664 | + |
665 | + return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT)); |
666 | +} |
667 | + |
668 | |
669 | === renamed file 'src/indicator-messages.c' => 'src/indicator-service.c' |
670 | --- src/indicator-messages.c 2009-04-08 02:50:41 +0000 |
671 | +++ src/indicator-service.c 2009-05-27 08:44:37 +0000 |
672 | @@ -21,26 +21,28 @@ |
673 | */ |
674 | |
675 | #include <string.h> |
676 | -#include <gtk/gtk.h> |
677 | +#include <dbus/dbus-glib-bindings.h> |
678 | #include <libindicate/listener.h> |
679 | |
680 | +#include <libdbusmenu-glib/server.h> |
681 | + |
682 | #include "im-menu-item.h" |
683 | #include "app-menu-item.h" |
684 | +#include "dbus-data.h" |
685 | |
686 | static IndicateListener * listener; |
687 | static GList * serverList; |
688 | -static GtkWidget * main_image; |
689 | -static GtkWidget * main_menu; |
690 | + |
691 | +static DbusmenuMenuitem * root_menuitem = NULL; |
692 | +static GMainLoop * mainloop = NULL; |
693 | + |
694 | |
695 | static void server_count_changed (AppMenuItem * appitem, guint count, gpointer data); |
696 | static void server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data); |
697 | static void im_time_changed (ImMenuItem * imitem, glong seconds, gpointer data); |
698 | -static void reconsile_list_and_menu (GList * serverlist, GtkMenuShell * menushell); |
699 | +static void reconsile_list_and_menu (GList * serverlist, DbusmenuMenuitem * menushell); |
700 | static void indicator_removed (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data); |
701 | |
702 | -#define DESIGN_TEAM_SIZE design_team_size |
703 | -static GtkIconSize design_team_size; |
704 | - |
705 | typedef struct _serverList_t serverList_t; |
706 | struct _serverList_t { |
707 | IndicateListenerServer * server; |
708 | @@ -80,7 +82,7 @@ |
709 | struct _imList_t { |
710 | IndicateListenerServer * server; |
711 | IndicateListenerIndicator * indicator; |
712 | - GtkWidget * menuitem; |
713 | + DbusmenuMenuitem * menuitem; |
714 | gulong timechange_cb; |
715 | }; |
716 | |
717 | @@ -131,7 +133,7 @@ |
718 | return; |
719 | } |
720 | |
721 | - GtkMenuShell * menushell = GTK_MENU_SHELL(data); |
722 | + DbusmenuMenuitem * menushell = DBUSMENU_MENUITEM(data); |
723 | if (menushell == NULL) { |
724 | g_error("\tData in callback is not a menushell"); |
725 | return; |
726 | @@ -157,9 +159,8 @@ |
727 | serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort); |
728 | } |
729 | |
730 | - gtk_menu_shell_prepend(menushell, GTK_WIDGET(menuitem)); |
731 | - gtk_widget_show(GTK_WIDGET(menuitem)); |
732 | - gtk_widget_show(GTK_WIDGET(main_menu)); |
733 | + dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(menuitem)); |
734 | + /* Should be prepend ^ */ |
735 | |
736 | reconsile_list_and_menu(serverList, menushell); |
737 | |
738 | @@ -170,7 +171,7 @@ |
739 | server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data) |
740 | { |
741 | serverList = g_list_sort(serverList, serverList_sort); |
742 | - reconsile_list_and_menu(serverList, GTK_MENU_SHELL(data)); |
743 | + reconsile_list_and_menu(serverList, DBUSMENU_MENUITEM(data)); |
744 | return; |
745 | } |
746 | |
747 | @@ -193,7 +194,7 @@ |
748 | if (count != 0) { |
749 | g_debug("Setting image to 'new'"); |
750 | showing_new_icon = TRUE; |
751 | - gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages-new", DESIGN_TEAM_SIZE); |
752 | + /* gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages-new", DESIGN_TEAM_SIZE); */ |
753 | return; |
754 | } |
755 | |
756 | @@ -214,7 +215,7 @@ |
757 | if (!we_have_indicators) { |
758 | g_debug("Setting image to boring"); |
759 | showing_new_icon = FALSE; |
760 | - gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages", DESIGN_TEAM_SIZE); |
761 | + /* gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages", DESIGN_TEAM_SIZE); */ |
762 | } |
763 | |
764 | return; |
765 | @@ -225,7 +226,7 @@ |
766 | { |
767 | serverList_t * sl = (serverList_t *)data; |
768 | sl->imList = g_list_sort(sl->imList, imList_sort); |
769 | - reconsile_list_and_menu(serverList, GTK_MENU_SHELL(gtk_widget_get_parent(GTK_WIDGET(imitem)))); |
770 | + reconsile_list_and_menu(serverList, root_menuitem); |
771 | return; |
772 | } |
773 | |
774 | @@ -252,18 +253,14 @@ |
775 | serverList = g_list_remove(serverList, sltp); |
776 | |
777 | if (sltp->menuitem != NULL) { |
778 | - gtk_widget_hide(GTK_WIDGET(sltp->menuitem)); |
779 | - gtk_container_remove(GTK_CONTAINER(data), GTK_WIDGET(sltp->menuitem)); |
780 | + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(sltp->menuitem), "visibile", "false"); |
781 | + dbusmenu_menuitem_child_delete(DBUSMENU_MENUITEM(data), DBUSMENU_MENUITEM(sltp->menuitem)); |
782 | } |
783 | |
784 | g_free(sltp); |
785 | |
786 | - if (g_list_length(serverList) == 0) { |
787 | - gtk_widget_hide(main_menu); |
788 | - } else { |
789 | - /* Simulate a server saying zero to recalculate icon */ |
790 | - server_count_changed(NULL, 0, NULL); |
791 | - } |
792 | + /* Simulate a server saying zero to recalculate icon */ |
793 | + server_count_changed(NULL, 0, NULL); |
794 | |
795 | return; |
796 | } |
797 | @@ -276,7 +273,7 @@ |
798 | }; |
799 | |
800 | static void |
801 | -menushell_foreach_cb (GtkWidget * data_mi, gpointer data_ms) { |
802 | +menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) { |
803 | menushell_location_t * msl = (menushell_location_t *)data_ms; |
804 | |
805 | if (msl->found) return; |
806 | @@ -296,7 +293,7 @@ |
807 | } |
808 | |
809 | static void |
810 | -reconsile_list_and_menu (GList * serverlist, GtkMenuShell * menushell) |
811 | +reconsile_list_and_menu (GList * serverlist, DbusmenuMenuitem * menushell) |
812 | { |
813 | guint position = 0; |
814 | GList * serverentry; |
815 | @@ -307,7 +304,7 @@ |
816 | serverList_t * si = (serverList_t *)serverentry->data; |
817 | if (si->menuitem != NULL) { |
818 | g_debug("\tMoving app %s to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position); |
819 | - gtk_menu_reorder_child(GTK_MENU(menushell), GTK_WIDGET(si->menuitem), position); |
820 | + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->menuitem), position); |
821 | position++; |
822 | } |
823 | |
824 | @@ -317,7 +314,7 @@ |
825 | |
826 | if (imi->menuitem != NULL) { |
827 | g_debug("\tMoving indicator on %s id %d to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(imi->server), INDICATE_LISTENER_INDICATOR_ID(imi->indicator), position); |
828 | - gtk_menu_reorder_child(GTK_MENU(menushell), imi->menuitem, position); |
829 | + dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(imi->menuitem), position); |
830 | position++; |
831 | } |
832 | } |
833 | @@ -329,7 +326,7 @@ |
834 | static void |
835 | subtype_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data) |
836 | { |
837 | - GtkMenuShell * menushell = GTK_MENU_SHELL(data); |
838 | + DbusmenuMenuitem * menushell = DBUSMENU_MENUITEM(data); |
839 | if (menushell == NULL) { |
840 | g_error("Data in callback is not a menushell"); |
841 | return; |
842 | @@ -358,7 +355,7 @@ |
843 | g_debug("Building IM Item"); |
844 | ImMenuItem * menuitem = im_menu_item_new(listener, server, indicator, !g_strcmp0(propertydata, "im")); |
845 | g_object_ref(G_OBJECT(menuitem)); |
846 | - listItem->menuitem = GTK_WIDGET(menuitem); |
847 | + listItem->menuitem = DBUSMENU_MENUITEM(menuitem); |
848 | |
849 | g_debug("Finding the server entry"); |
850 | serverList_t sl_item_local; |
851 | @@ -389,12 +386,12 @@ |
852 | msl.position = 0; |
853 | msl.server = server; |
854 | |
855 | - gtk_container_foreach(GTK_CONTAINER(menushell), menushell_foreach_cb, &msl); |
856 | + dbusmenu_menuitem_foreach(DBUSMENU_MENUITEM(menushell), menushell_foreach_cb, &msl); |
857 | if (msl.found) { |
858 | - gtk_menu_shell_insert(menushell, GTK_WIDGET(menuitem), msl.position); |
859 | + dbusmenu_menuitem_child_add_position(menushell, DBUSMENU_MENUITEM(menuitem), msl.position); |
860 | } else { |
861 | g_warning("Unable to find server menu item"); |
862 | - gtk_menu_shell_append(menushell, GTK_WIDGET(menuitem)); |
863 | + dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(menuitem)); |
864 | } |
865 | } |
866 | |
867 | @@ -444,7 +441,7 @@ |
868 | listData.indicator = indicator; |
869 | |
870 | GList * listItem = g_list_find_custom(sl_item->imList, &listData, imList_equal); |
871 | - GtkWidget * menuitem = NULL; |
872 | + DbusmenuMenuitem * menuitem = NULL; |
873 | imList_t * ilt = NULL; |
874 | if (listItem != NULL) { |
875 | ilt = (imList_t *)listItem->data; |
876 | @@ -456,8 +453,8 @@ |
877 | g_signal_handler_disconnect(menuitem, ilt->timechange_cb); |
878 | g_free(ilt); |
879 | |
880 | - gtk_widget_hide(menuitem); |
881 | - gtk_container_remove(GTK_CONTAINER(data), menuitem); |
882 | + dbusmenu_menuitem_property_set(menuitem, "visibile", "false"); |
883 | + dbusmenu_menuitem_child_delete(DBUSMENU_MENUITEM(data), menuitem); |
884 | removed = TRUE; |
885 | } |
886 | |
887 | @@ -468,30 +465,40 @@ |
888 | return; |
889 | } |
890 | |
891 | -GtkWidget * |
892 | -get_menu_item (void) |
893 | +int |
894 | +main (int argc, char ** argv) |
895 | { |
896 | - design_team_size = gtk_icon_size_register("design-team-size", 22, 22); |
897 | - |
898 | - listener = indicate_listener_new(); |
899 | + g_type_init(); |
900 | + |
901 | + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); |
902 | + DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); |
903 | + GError * error = NULL; |
904 | + guint nameret = 0; |
905 | + |
906 | + if (!org_freedesktop_DBus_request_name(bus_proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &nameret, &error)) { |
907 | + g_error("Unable to call to request name"); |
908 | + return 1; |
909 | + } |
910 | + |
911 | + if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { |
912 | + g_error("Unable to get name"); |
913 | + return 1; |
914 | + } |
915 | + |
916 | + listener = indicate_listener_ref_default(); |
917 | serverList = NULL; |
918 | |
919 | - main_menu = gtk_menu_item_new(); |
920 | - gtk_widget_set_name(main_menu, "fast-user-switch-menuitem"); |
921 | - |
922 | - main_image = gtk_image_new_from_icon_name("indicator-messages", DESIGN_TEAM_SIZE); |
923 | - gtk_widget_show(main_image); |
924 | - gtk_container_add(GTK_CONTAINER(main_menu), main_image); |
925 | - |
926 | - GtkWidget * submenu = gtk_menu_new(); |
927 | - gtk_menu_item_set_submenu(GTK_MENU_ITEM(main_menu), submenu); |
928 | - gtk_widget_show(submenu); |
929 | - |
930 | - g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), submenu); |
931 | - g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, G_CALLBACK(indicator_removed), submenu); |
932 | - g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), submenu); |
933 | - g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), submenu); |
934 | - |
935 | - return main_menu; |
936 | + root_menuitem = dbusmenu_menuitem_new(); |
937 | + DbusmenuServer * server = dbusmenu_server_new(INDICATOR_MESSAGES_DBUS_OBJECT); |
938 | + dbusmenu_server_set_root(server, root_menuitem); |
939 | + |
940 | + g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), root_menuitem); |
941 | + g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, G_CALLBACK(indicator_removed), root_menuitem); |
942 | + g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), root_menuitem); |
943 | + g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), root_menuitem); |
944 | + |
945 | + mainloop = g_main_loop_new(NULL, FALSE); |
946 | + g_main_loop_run(mainloop); |
947 | + |
948 | + return 0; |
949 | } |
950 | - |
951 | |
952 | === added directory 'test' |
953 | === added file 'test/indicator-messages-service-activate.build.sh' |
954 | --- test/indicator-messages-service-activate.build.sh 1970-01-01 00:00:00 +0000 |
955 | +++ test/indicator-messages-service-activate.build.sh 2009-05-28 15:29:41 +0000 |
956 | @@ -0,0 +1,3 @@ |
957 | +#!/bin/sh |
958 | + |
959 | +gcc -o indicator-messages-service-activate indicator-messages-service-activate.c `pkg-config --cflags --libs dbus-1 dbus-glib-1` |
960 | |
961 | === added file 'test/indicator-messages-service-activate.c' |
962 | --- test/indicator-messages-service-activate.c 1970-01-01 00:00:00 +0000 |
963 | +++ test/indicator-messages-service-activate.c 2009-05-28 15:29:41 +0000 |
964 | @@ -0,0 +1,53 @@ |
965 | +/* |
966 | +An indicator to show information that is in messaging applications |
967 | +that the user is using. |
968 | + |
969 | +Copyright 2009 Canonical Ltd. |
970 | + |
971 | +Authors: |
972 | + Ted Gould <ted@canonical.com> |
973 | + |
974 | +This program is free software: you can redistribute it and/or modify it |
975 | +under the terms of the GNU General Public License version 3, as published |
976 | +by the Free Software Foundation. |
977 | + |
978 | +This program is distributed in the hope that it will be useful, but |
979 | +WITHOUT ANY WARRANTY; without even the implied warranties of |
980 | +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
981 | +PURPOSE. See the GNU General Public License for more details. |
982 | + |
983 | +You should have received a copy of the GNU General Public License along |
984 | +with this program. If not, see <http://www.gnu.org/licenses/>. |
985 | +*/ |
986 | + |
987 | +#include <string.h> |
988 | +#include <dbus/dbus-glib.h> |
989 | +#include <dbus/dbus-glib-bindings.h> |
990 | +#include "../src/dbus-data.h" |
991 | + |
992 | +int |
993 | +main (int argc, char ** argv) |
994 | +{ |
995 | + g_type_init(); |
996 | + |
997 | + guint returnval = 0; |
998 | + GError * error = NULL; |
999 | + |
1000 | + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); |
1001 | + DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); |
1002 | + |
1003 | + g_debug("Activating service: %s", INDICATOR_MESSAGES_DBUS_NAME); |
1004 | + if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &returnval, &error)) { |
1005 | + g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); |
1006 | + g_error_free(error); |
1007 | + return 1; |
1008 | + } |
1009 | + |
1010 | + if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { |
1011 | + g_error("Return value isn't indicative of success: %d", returnval); |
1012 | + return 1; |
1013 | + } |
1014 | + |
1015 | + return 0; |
1016 | +} |
1017 | + |
Update to use libindicator, libindicate-gtk and libdbusmenu.