Merge lp:~indicator-applet-developers/indicator-application/lucid into lp:~ubuntu-desktop/indicator-application/ubuntu

Proposed by Ted Gould
Status: Merged
Approved by: Ken VanDine
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~indicator-applet-developers/indicator-application/lucid
Merge into: lp:~ubuntu-desktop/indicator-application/ubuntu
Diff against target: 325 lines (+90/-40)
8 files modified
configure.ac (+2/-2)
debian/changelog (+8/-0)
src/application-service-appstore.c (+10/-1)
src/libappindicator/app-indicator.c (+48/-29)
tests/Makefile.am (+4/-2)
tests/test-libappindicator-dbus-client.c (+1/-1)
tests/test-libappindicator-dbus-server.c (+10/-4)
tests/test-libappindicator-status-server.c (+7/-1)
To merge this branch: bzr merge lp:~indicator-applet-developers/indicator-application/lucid
Reviewer Review Type Date Requested Status
Ken VanDine Pending
Review via email: mp+19113@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

0.0.13

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2010-02-08 15:51:25 +0000
3+++ configure.ac 2010-02-11 16:44:12 +0000
4@@ -1,11 +1,11 @@
5
6-AC_INIT(indicator-application, 0.0.12, ted@canonical.com)
7+AC_INIT(indicator-application, 0.0.13, ted@canonical.com)
8 AC_COPYRIGHT([Copyright 2009, 2010 Canonical])
9
10 AC_PREREQ(2.53)
11
12 AM_CONFIG_HEADER(config.h)
13-AM_INIT_AUTOMAKE(indicator-application, 0.0.12)
14+AM_INIT_AUTOMAKE(indicator-application, 0.0.13)
15
16 AM_MAINTAINER_MODE
17
18
19=== modified file 'debian/changelog'
20--- debian/changelog 2010-02-09 00:25:26 +0000
21+++ debian/changelog 2010-02-11 16:44:12 +0000
22@@ -1,3 +1,11 @@
23+indicator-application (0.0.13-0ubuntu1) lucid; urgency=low
24+
25+ * Upstream release 0.0.13
26+ * Changing the menu property to be a proper DBus object path
27+ * Make object paths unique by including application IDs in them
28+
29+ -- Ted Gould <ted@ubuntu.com> Thu, 11 Feb 2010 10:41:53 -0600
30+
31 indicator-application (0.0.12-0ubuntu1) lucid; urgency=low
32
33 * Upstream release 0.0.12
34
35=== modified file 'src/application-service-appstore.c'
36--- src/application-service-appstore.c 2010-02-06 18:06:53 +0000
37+++ src/application-service-appstore.c 2010-02-11 16:44:12 +0000
38@@ -222,7 +222,16 @@
39 app_lru_file_touch(priv->lrufile, app->id, app->category);
40
41 app->icon = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_NAME));
42- app->menu = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_MENU));
43+
44+ GValue * menuval = (GValue *)g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_MENU);
45+ if (G_VALUE_TYPE(menuval) == G_TYPE_STRING) {
46+ /* This is here to support an older version where we
47+ were using strings instea of object paths. */
48+ app->menu = g_value_dup_string(menuval);
49+ } else {
50+ app->menu = g_strdup((gchar *)g_value_get_boxed(menuval));
51+ }
52+
53 if (g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_AICON_NAME) != NULL) {
54 app->aicon = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_AICON_NAME));
55 }
56
57=== modified file 'src/libappindicator/app-indicator.c'
58--- src/libappindicator/app-indicator.c 2010-02-08 15:33:13 +0000
59+++ src/libappindicator/app-indicator.c 2010-02-11 16:44:12 +0000
60@@ -59,6 +59,7 @@
61 struct _AppIndicatorPrivate {
62 /* Properties */
63 gchar *id;
64+ gchar *clean_id;
65 AppIndicatorCategory category;
66 AppIndicatorStatus status;
67 gchar *icon_name;
68@@ -115,9 +116,8 @@
69 #define APP_INDICATOR_GET_PRIVATE(o) \
70 (G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_INDICATOR_TYPE, AppIndicatorPrivate))
71
72-/* Default Paths */
73+/* Default Path */
74 #define DEFAULT_ITEM_PATH "/org/ayatana/NotificationItem"
75-#define DEFAULT_MENU_PATH "/org/ayatana/NotificationItem/Menu"
76
77 /* More constants */
78 #define DEFAULT_FALLBACK_TIMER 100 /* in milliseconds */
79@@ -215,10 +215,10 @@
80
81 g_object_class_install_property(object_class,
82 PROP_MENU,
83- g_param_spec_string (PROP_MENU_S,
84+ g_param_spec_boxed (PROP_MENU_S,
85 "The object path of the menu on DBus.",
86 "A method for getting the menu path as a string for DBus.",
87- NULL,
88+ DBUS_TYPE_G_OBJECT_PATH,
89 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
90
91 g_object_class_install_property (object_class,
92@@ -307,6 +307,7 @@
93 AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(self);
94
95 priv->id = NULL;
96+ priv->clean_id = NULL;
97 priv->category = APP_INDICATOR_CATEGORY_OTHER;
98 priv->status = APP_INDICATOR_STATUS_PASSIVE;
99 priv->icon_name = NULL;
100@@ -332,11 +333,7 @@
101 }
102 dbus_g_connection_ref(priv->connection);
103
104- dbus_g_connection_register_g_object(priv->connection,
105- DEFAULT_ITEM_PATH,
106- G_OBJECT(self));
107-
108- self->priv = priv;
109+ self->priv = priv;
110
111 return;
112 }
113@@ -413,6 +410,11 @@
114 priv->id = NULL;
115 }
116
117+ if (priv->clean_id != NULL) {
118+ g_free(priv->clean_id);
119+ priv->clean_id = NULL;
120+ }
121+
122 if (priv->icon_name != NULL) {
123 g_free(priv->icon_name);
124 priv->icon_name = NULL;
125@@ -445,16 +447,23 @@
126
127 switch (prop_id) {
128 case PROP_ID:
129- if (priv->id != NULL) {
130- g_warning ("Resetting ID value when I already had a value of: %s", priv->id);
131- g_free (priv->id);
132- priv->id = NULL;
133- }
134-
135- priv->id = g_strdup (g_value_get_string (value));
136-
137- check_connect (self);
138- break;
139+ if (priv->id != NULL) {
140+ g_warning ("Resetting ID value when I already had a value of: %s", priv->id);
141+ break;
142+ }
143+
144+ priv->id = g_strdup (g_value_get_string (value));
145+
146+ priv->clean_id = g_strdup(priv->id);
147+ gchar * cleaner;
148+ for (cleaner = priv->clean_id; *cleaner != '\0'; cleaner++) {
149+ if (!g_ascii_isalnum(*cleaner)) {
150+ *cleaner = '_';
151+ }
152+ }
153+
154+ check_connect (self);
155+ break;
156
157 case PROP_CATEGORY:
158 enum_val = g_enum_get_value_by_nick ((GEnumClass *) g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_CATEGORY),
159@@ -547,14 +556,14 @@
160 break;
161
162 case PROP_MENU:
163- if (G_VALUE_HOLDS_STRING(value)) {
164- if (priv->menuservice != NULL) {
165- g_object_get_property (G_OBJECT (priv->menuservice), DBUSMENU_SERVER_PROP_DBUS_OBJECT, value);
166- }
167- } else {
168- WARN_BAD_TYPE(PROP_MENU_S, value);
169- }
170- break;
171+ if (priv->menuservice != NULL) {
172+ GValue strval = {0};
173+ g_value_init(&strval, G_TYPE_STRING);
174+ g_object_get_property (G_OBJECT (priv->menuservice), DBUSMENU_SERVER_PROP_DBUS_OBJECT, &strval);
175+ g_value_set_boxed(value, g_value_get_string(&strval));
176+ g_value_unset(&strval);
177+ }
178+ break;
179
180 case PROP_CONNECTED:
181 g_value_set_boolean (value, priv->watcher_proxy != NULL ? TRUE : FALSE);
182@@ -584,6 +593,11 @@
183 if (priv->icon_name == NULL) return;
184 if (priv->id == NULL) return;
185
186+ gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s", priv->clean_id);
187+ dbus_g_connection_register_g_object(priv->connection,
188+ path,
189+ G_OBJECT(self));
190+
191 GError * error = NULL;
192 priv->watcher_proxy = dbus_g_proxy_new_for_name_owner(priv->connection,
193 NOTIFICATION_WATCHER_DBUS_ADDR,
194@@ -595,11 +609,13 @@
195 it's not a warning anymore. */
196 g_error_free(error);
197 start_fallback_timer(self, FALSE);
198+ g_free(path);
199 return;
200 }
201
202 g_signal_connect(G_OBJECT(priv->watcher_proxy), "destroy", G_CALLBACK(watcher_proxy_destroyed), self);
203- org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, DEFAULT_ITEM_PATH, register_service_cb, self);
204+ org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, path, register_service_cb, self);
205+ g_free(path);
206
207 return;
208 }
209@@ -1220,7 +1236,9 @@
210 root);
211
212 if (priv->menuservice == NULL) {
213- priv->menuservice = dbusmenu_server_new (DEFAULT_MENU_PATH);
214+ gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id);
215+ priv->menuservice = dbusmenu_server_new (path);
216+ g_free(path);
217 }
218
219 dbusmenu_server_set_root (priv->menuservice, root);
220@@ -1244,6 +1262,7 @@
221
222 g_return_if_fail (IS_APP_INDICATOR (self));
223 g_return_if_fail (GTK_IS_MENU (menu));
224+ g_return_if_fail (self->priv->clean_id != NULL);
225
226 priv = self->priv;
227
228
229=== modified file 'tests/Makefile.am'
230--- tests/Makefile.am 2010-02-06 01:30:41 +0000
231+++ tests/Makefile.am 2010-02-11 16:44:12 +0000
232@@ -158,14 +158,16 @@
233 DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf
234
235 test-libappindicator-dbus: test-libappindicator-dbus-client test-libappindicator-dbus-server Makefile.am
236- @echo "#!/bin/sh" > test-libappindicator-dbus
237+ @echo "#!/bin/bash" > test-libappindicator-dbus
238+ @echo . $(srcdir)/run-xvfb.sh >> $@
239 @echo $(DBUS_RUNNER) --task ./test-libappindicator-dbus-client --task-name Client --task ./test-libappindicator-dbus-server --task-name Server --ignore-return >> test-libappindicator-dbus
240 @chmod +x test-libappindicator-dbus
241
242 TESTS += test-libappindicator-dbus
243
244 test-libappindicator-status: test-libappindicator-status-client test-libappindicator-status-server Makefile.am
245- @echo "#!/bin/sh" > test-libappindicator-status
246+ @echo "#!/bin/bash" > test-libappindicator-status
247+ @echo . $(srcdir)/run-xvfb.sh >> $@
248 @echo $(DBUS_RUNNER) --task ./test-libappindicator-status-client --task-name Client --task ./test-libappindicator-status-server --task-name Server --ignore-return >> test-libappindicator-status
249 @chmod +x test-libappindicator-status
250
251
252=== modified file 'tests/test-libappindicator-dbus-client.c'
253--- tests/test-libappindicator-dbus-client.c 2010-01-12 06:06:47 +0000
254+++ tests/test-libappindicator-dbus-client.c 2010-02-11 16:44:12 +0000
255@@ -200,7 +200,7 @@
256
257 DBusGProxy * props = dbus_g_proxy_new_for_name_owner(session_bus,
258 ":1.0",
259- "/org/ayatana/NotificationItem",
260+ "/org/ayatana/NotificationItem/my_id",
261 DBUS_INTERFACE_PROPERTIES,
262 &error);
263 if (error != NULL) {
264
265=== modified file 'tests/test-libappindicator-dbus-server.c'
266--- tests/test-libappindicator-dbus-server.c 2009-12-04 17:02:30 +0000
267+++ tests/test-libappindicator-dbus-server.c 2010-02-11 16:44:12 +0000
268@@ -23,7 +23,7 @@
269
270 #include <dbus/dbus-glib.h>
271 #include <dbus/dbus-glib-lowlevel.h>
272-#include <glib.h>
273+#include <gtk/gtk.h>
274 #include <libappindicator/app-indicator.h>
275 #include "test-defines.h"
276
277@@ -39,13 +39,19 @@
278 gint
279 main (gint argc, gchar * argv[])
280 {
281- g_type_init();
282+ gtk_init(&argc, &argv);
283
284 g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL))));
285
286 AppIndicator * ci = app_indicator_new (TEST_ID, TEST_ICON_NAME, TEST_CATEGORY);
287- app_indicator_set_status (ci, TEST_STATE);
288- app_indicator_set_attention_icon (ci, TEST_ATTENTION_ICON_NAME);
289+ app_indicator_set_status (ci, TEST_STATE);
290+ app_indicator_set_attention_icon (ci, TEST_ATTENTION_ICON_NAME);
291+
292+ GtkMenu * menu = GTK_MENU(gtk_menu_new());
293+ GtkMenuItem * item = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Label"));
294+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(item));
295+
296+ app_indicator_set_menu(ci, menu);
297
298 g_timeout_add_seconds(2, kill_func, NULL);
299
300
301=== modified file 'tests/test-libappindicator-status-server.c'
302--- tests/test-libappindicator-status-server.c 2010-02-06 17:44:32 +0000
303+++ tests/test-libappindicator-status-server.c 2010-02-11 16:44:12 +0000
304@@ -55,7 +55,7 @@
305 gint
306 main (gint argc, gchar * argv[])
307 {
308- g_type_init();
309+ gtk_init(&argc, &argv);
310
311 g_usleep(100000);
312
313@@ -64,6 +64,12 @@
314 AppIndicator * ci = app_indicator_new ("my-id", "my-icon-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
315 app_indicator_set_attention_icon (ci, "my-attention-icon");
316
317+ GtkMenu * menu = GTK_MENU(gtk_menu_new());
318+ GtkMenuItem * item = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Label"));
319+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(item));
320+
321+ app_indicator_set_menu(ci, menu);
322+
323 g_timeout_add(50, toggle, ci);
324
325 mainloop = g_main_loop_new(NULL, FALSE);

Subscribers

People subscribed via source and target branches

to all changes: