Merge lp://qastaging/~indicator-applet-developers/indicator-me/lucid into lp://qastaging/~ubuntu-desktop/indicator-me/ubuntu
- lucid
- Merge into ubuntu
Proposed by
Ted Gould
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://qastaging/~indicator-applet-developers/indicator-me/lucid |
Merge into: | lp://qastaging/~ubuntu-desktop/indicator-me/ubuntu |
Diff against target: |
683 lines (+473/-18) 12 files modified
Makefile.am (+1/-0) configure.ac (+8/-6) debian/changelog (+22/-0) debian/control (+4/-3) src/Makefile.am (+4/-0) src/dbus-shared-names.h (+3/-0) src/entry-menu-item.c (+136/-0) src/entry-menu-item.h (+62/-0) src/indicator-me.c (+54/-3) src/me-service-gwibber.c (+85/-0) src/me-service-gwibber.h (+35/-0) src/me-service.c (+59/-6) |
To merge this branch: | bzr merge lp://qastaging/~indicator-applet-developers/indicator-me/lucid |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastien Bacher | Pending | ||
Review via email: mp+18661@code.qastaging.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 'Makefile.am' |
2 | --- Makefile.am 2010-01-21 17:12:02 +0000 |
3 | +++ Makefile.am 2010-02-05 01:56:12 +0000 |
4 | @@ -3,6 +3,7 @@ |
5 | src \ |
6 | data \ |
7 | po |
8 | +EXTRA_DIST = autogen.sh |
9 | |
10 | DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall |
11 | |
12 | |
13 | === modified file 'configure.ac' |
14 | --- configure.ac 2010-01-21 17:12:02 +0000 |
15 | +++ configure.ac 2010-02-05 01:56:12 +0000 |
16 | @@ -1,11 +1,11 @@ |
17 | |
18 | -AC_INIT(indicator-me, 0.2.1, ted@canonical.com) |
19 | -AC_COPYRIGHT([Copyright 2009,2010 Canonical]) |
20 | +AC_INIT(indicator-me, 0.2.3, ted@canonical.com) |
21 | +AC_COPYRIGHT([Copyright 2009, 2010 Canonical]) |
22 | |
23 | AC_PREREQ(2.53) |
24 | |
25 | AM_CONFIG_HEADER(config.h) |
26 | -AM_INIT_AUTOMAKE(indicator-me, 0.2.1) |
27 | +AM_INIT_AUTOMAKE(indicator-me, 0.2.3) |
28 | |
29 | AM_MAINTAINER_MODE |
30 | |
31 | @@ -28,13 +28,15 @@ |
32 | |
33 | GTK_REQUIRED_VERSION=2.12 |
34 | INDICATOR_REQUIRED_VERSION=0.3.0 |
35 | -DBUSMENUGTK_REQUIRED_VERSION=0.2.0 |
36 | -DBUSMENUGLIB_REQUIRED_VERSION=0.2.0 |
37 | +DBUSMENUGTK_REQUIRED_VERSION=0.2.2 |
38 | +DBUSMENUGLIB_REQUIRED_VERSION=0.2.2 |
39 | TELEPATHYGLIB_REQUIRED_VERSION=0.9.0 |
40 | +INDICATOR_DISPLAY_OBJECTS=0.1 |
41 | |
42 | PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION |
43 | indicator >= $INDICATOR_REQUIRED_VERSION |
44 | - dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION) |
45 | + libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS |
46 | + dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION) |
47 | PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION |
48 | indicator >= $INDICATOR_REQUIRED_VERSION |
49 | telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION) |
50 | |
51 | === modified file 'debian/changelog' |
52 | --- debian/changelog 2010-01-21 20:53:36 +0000 |
53 | +++ debian/changelog 2010-02-05 01:56:12 +0000 |
54 | @@ -1,3 +1,25 @@ |
55 | +indicator-me (0.2.3-0ubuntu1~ppa1) lucid; urgency=low |
56 | + |
57 | + * Upstream Release 0.2.3 |
58 | + * Fix for the signal prototype change in dbusmenu 0.2.2 |
59 | + |
60 | + -- Ted Gould <ted@ubuntu.com> Thu, 04 Feb 2010 17:54:53 -0800 |
61 | + |
62 | +indicator-me (0.2.2-0ubuntu1~ppa2) lucid; urgency=low |
63 | + |
64 | + * debian/control: Adding in ido |
65 | + |
66 | + -- Ted Gould <ted@ubuntu.com> Thu, 04 Feb 2010 17:24:43 -0800 |
67 | + |
68 | +indicator-me (0.2.2-0ubuntu1~ppa1) lucid; urgency=low |
69 | + |
70 | + * Upstream Release 0.2.2 |
71 | + * Basic Gwibber support |
72 | + * autogen.sh in tarball |
73 | + * debian/control: dbusmenu* to version 0.2.2 |
74 | + |
75 | + -- Ted Gould <ted@ubuntu.com> Thu, 04 Feb 2010 17:20:38 -0800 |
76 | + |
77 | indicator-me (0.2.1-0ubuntu1) lucid; urgency=low |
78 | |
79 | * Upstream Merge |
80 | |
81 | === modified file 'debian/control' |
82 | --- debian/control 2010-01-11 14:33:32 +0000 |
83 | +++ debian/control 2010-02-05 01:56:12 +0000 |
84 | @@ -9,10 +9,11 @@ |
85 | gnome-doc-utils, |
86 | scrollkeeper, |
87 | libindicator-dev (>= 0.3.0), |
88 | - libdbusmenu-glib-dev (>= 0.2.0), |
89 | - libdbusmenu-gtk-dev (>= 0.2.0), |
90 | + libdbusmenu-glib-dev (>= 0.2.2), |
91 | + libdbusmenu-gtk-dev (>= 0.2.2), |
92 | intltool, |
93 | - libtelepathy-glib-dev (>= 0.9.0) |
94 | + libtelepathy-glib-dev (>= 0.9.0), |
95 | + libido-0.1-dev |
96 | Standards-Version: 3.8.3 |
97 | Homepage: https://launchpad.net/indicator-me |
98 | Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-desktop/indicator-me/ubuntu |
99 | |
100 | === modified file 'src/Makefile.am' |
101 | --- src/Makefile.am 2010-01-21 17:12:02 +0000 |
102 | +++ src/Makefile.am 2010-02-05 01:56:12 +0000 |
103 | @@ -20,10 +20,14 @@ |
104 | ################ |
105 | |
106 | indicator_me_service_SOURCES = \ |
107 | + entry-menu-item.c \ |
108 | + entry-menu-item.h \ |
109 | me-service.c \ |
110 | me-service-dbus.h \ |
111 | me-service-dbus.c \ |
112 | me-service-server.h \ |
113 | + me-service-gwibber.c \ |
114 | + me-service-gwibber.h \ |
115 | status-provider.h \ |
116 | status-provider.c \ |
117 | status-provider-mc5.h \ |
118 | |
119 | === modified file 'src/dbus-shared-names.h' |
120 | --- src/dbus-shared-names.h 2010-01-03 05:41:48 +0000 |
121 | +++ src/dbus-shared-names.h 2010-02-05 01:56:12 +0000 |
122 | @@ -30,4 +30,7 @@ |
123 | #define INDICATOR_ME_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/me/service" |
124 | #define INDICATOR_ME_SERVICE_DBUS_INTERFACE "org.ayatana.indicator.me.service" |
125 | |
126 | +#define ENTRY_MENUITEM_TYPE "x-canonical-entry-item" |
127 | +#define ENTRY_MENUITEM_PROP_TEXT "text" |
128 | + |
129 | #endif /* __DBUS_SHARED_NAMES_H__ */ |
130 | |
131 | === added file 'src/entry-menu-item.c' |
132 | --- src/entry-menu-item.c 1970-01-01 00:00:00 +0000 |
133 | +++ src/entry-menu-item.c 2010-02-05 01:56:12 +0000 |
134 | @@ -0,0 +1,136 @@ |
135 | +/* |
136 | +An indicator to show information that is in messaging applications |
137 | +that the user is using. |
138 | + |
139 | +Copyright 2010 Canonical Ltd. |
140 | + |
141 | +Authors: |
142 | + David Barth <david.barth@canonical.com> |
143 | + Ted Gould <ted@canonical.com> |
144 | + |
145 | +This program is free software: you can redistribute it and/or modify it |
146 | +under the terms of the GNU General Public License version 3, as published |
147 | +by the Free Software Foundation. |
148 | + |
149 | +This program is distributed in the hope that it will be useful, but |
150 | +WITHOUT ANY WARRANTY; without even the implied warranties of |
151 | +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
152 | +PURPOSE. See the GNU General Public License for more details. |
153 | + |
154 | +You should have received a copy of the GNU General Public License along |
155 | +with this program. If not, see <http://www.gnu.org/licenses/>. |
156 | +*/ |
157 | + |
158 | +#ifdef HAVE_CONFIG_H |
159 | +#include "config.h" |
160 | +#endif |
161 | + |
162 | +#include <gdk/gdk.h> |
163 | +#include <glib/gi18n.h> |
164 | +#include "entry-menu-item.h" |
165 | +#include "dbus-shared-names.h" |
166 | + |
167 | +#include "me-service-gwibber.h" |
168 | + |
169 | +#include <libdbusmenu-glib/client.h> |
170 | +#include <libdbusmenu-glib/server.h> |
171 | +#include <libdbusmenu-glib/menuitem.h> |
172 | + |
173 | +enum { |
174 | + LAST_SIGNAL |
175 | +}; |
176 | + |
177 | +/* static guint signals[LAST_SIGNAL] = { }; */ |
178 | + |
179 | +typedef struct _EntryMenuItemPrivate EntryMenuItemPrivate; |
180 | +struct _EntryMenuItemPrivate |
181 | +{ |
182 | + void * placeholder; |
183 | +}; |
184 | + |
185 | +#define ENTRY_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ENTRY_MENU_ITEM_TYPE, EntryMenuItemPrivate)) |
186 | + |
187 | +/* Prototypes */ |
188 | +static void entry_menu_item_class_init (EntryMenuItemClass *klass); |
189 | +static void entry_menu_item_init (EntryMenuItem *self); |
190 | +static void entry_menu_item_dispose (GObject *object); |
191 | +static void entry_menu_item_finalize (GObject *object); |
192 | +static void handle_event (DbusmenuMenuitem *mi, const gchar *name, |
193 | + const GValue *value, guint timestamp); |
194 | + |
195 | +G_DEFINE_TYPE (EntryMenuItem, entry_menu_item, DBUSMENU_TYPE_MENUITEM); |
196 | + |
197 | +static void |
198 | +entry_menu_item_class_init (EntryMenuItemClass *klass) |
199 | +{ |
200 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); |
201 | + |
202 | + g_type_class_add_private (klass, sizeof (EntryMenuItemPrivate)); |
203 | + |
204 | + object_class->dispose = entry_menu_item_dispose; |
205 | + object_class->finalize = entry_menu_item_finalize; |
206 | + |
207 | + DbusmenuMenuitemClass *mclass = DBUSMENU_MENUITEM_CLASS(klass); |
208 | + mclass->handle_event = handle_event; |
209 | + |
210 | + return; |
211 | +} |
212 | + |
213 | +static void |
214 | +entry_menu_item_init (EntryMenuItem *self) |
215 | +{ |
216 | + g_debug("Building new Entry Menu Item"); |
217 | + /* EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); */ |
218 | + |
219 | + return; |
220 | +} |
221 | + |
222 | +static void |
223 | +entry_menu_item_dispose (GObject *object) |
224 | +{ |
225 | + /* EntryMenuItem * self = ENTRY_MENU_ITEM(object); |
226 | + EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); */ |
227 | + |
228 | + G_OBJECT_CLASS (entry_menu_item_parent_class)->dispose (object); |
229 | +} |
230 | + |
231 | +static void |
232 | +entry_menu_item_finalize (GObject *object) |
233 | +{ |
234 | + /* |
235 | + EntryMenuItem * self = ENTRY_MENU_ITEM(object); |
236 | + EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); |
237 | + */ |
238 | + |
239 | + G_OBJECT_CLASS (entry_menu_item_parent_class)->finalize (object); |
240 | + |
241 | + return; |
242 | +} |
243 | + |
244 | +EntryMenuItem * |
245 | +entry_menu_item_new () |
246 | +{ |
247 | + EntryMenuItem * self = g_object_new(ENTRY_MENU_ITEM_TYPE, NULL); |
248 | + /* EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); */ |
249 | + |
250 | + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, ENTRY_MENUITEM_TYPE); |
251 | + |
252 | + return self; |
253 | +} |
254 | + |
255 | +/* When the entry menu item is clicked on it emits a dbus signal |
256 | + for the corresponding bottom-half service to act upon */ |
257 | +static void |
258 | +handle_event (DbusmenuMenuitem *mi, const gchar *name, |
259 | + const GValue *value, guint timestamp) |
260 | +{ |
261 | + /* EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); */ |
262 | + |
263 | + g_debug ("handle_event"); |
264 | + if (g_strcmp0 (name, "send") == 0) { |
265 | + gwibber_send (g_value_get_string (value)); |
266 | + dbusmenu_menuitem_property_set (mi, ENTRY_MENUITEM_PROP_TEXT, ""); |
267 | + } |
268 | + |
269 | + return; |
270 | +} |
271 | |
272 | === added file 'src/entry-menu-item.h' |
273 | --- src/entry-menu-item.h 1970-01-01 00:00:00 +0000 |
274 | +++ src/entry-menu-item.h 2010-02-05 01:56:12 +0000 |
275 | @@ -0,0 +1,62 @@ |
276 | +/* |
277 | +An indicator to show information that is in messaging applications |
278 | +that the user is using. |
279 | + |
280 | +Copyright 2010 Canonical Ltd. |
281 | + |
282 | +Authors: |
283 | + David Barth <david.barth@canonical.com> |
284 | + Ted Gould <ted@canonical.com> |
285 | + |
286 | +This program is free software: you can redistribute it and/or modify it |
287 | +under the terms of the GNU General Public License version 3, as published |
288 | +by the Free Software Foundation. |
289 | + |
290 | +This program is distributed in the hope that it will be useful, but |
291 | +WITHOUT ANY WARRANTY; without even the implied warranties of |
292 | +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
293 | +PURPOSE. See the GNU General Public License for more details. |
294 | + |
295 | +You should have received a copy of the GNU General Public License along |
296 | +with this program. If not, see <http://www.gnu.org/licenses/>. |
297 | +*/ |
298 | + |
299 | +#ifndef __ENTRY_MENU_ITEM_H__ |
300 | +#define __ENTRY_MENU_ITEM_H__ |
301 | + |
302 | +#include <glib.h> |
303 | +#include <glib-object.h> |
304 | + |
305 | +#include <libdbusmenu-glib/menuitem.h> |
306 | + |
307 | +G_BEGIN_DECLS |
308 | + |
309 | +#define ENTRY_MENU_ITEM_TYPE (entry_menu_item_get_type ()) |
310 | +#define ENTRY_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENTRY_MENU_ITEM_TYPE, EntryMenuItem)) |
311 | +#define ENTRY_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENTRY_MENU_ITEM_TYPE, EntryMenuItemClass)) |
312 | +#define IS_ENTRY_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENTRY_MENU_ITEM_TYPE)) |
313 | +#define IS_ENTRY_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENTRY_MENU_ITEM_TYPE)) |
314 | +#define ENTRY_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENTRY_MENU_ITEM_TYPE, EntryMenuItemClass)) |
315 | + |
316 | +#define ENTRY_MENU_ITEM_SIGNAL_ACTIVATE "activate" |
317 | +#define ENTRY_MENUITEM_PROP_TEXT "text" |
318 | + |
319 | +typedef struct _EntryMenuItem EntryMenuItem; |
320 | +typedef struct _EntryMenuItemClass EntryMenuItemClass; |
321 | + |
322 | +struct _EntryMenuItemClass { |
323 | + DbusmenuMenuitemClass parent_class; |
324 | +}; |
325 | + |
326 | +struct _EntryMenuItem { |
327 | + DbusmenuMenuitem parent; |
328 | +}; |
329 | + |
330 | +GType entry_menu_item_get_type (void); |
331 | +EntryMenuItem * entry_menu_item_new (); |
332 | +const gchar * entry_menu_item_get_text (EntryMenuItem * appitem); |
333 | + |
334 | +G_END_DECLS |
335 | + |
336 | +#endif /* __ENTRY_MENU_ITEM_H__ */ |
337 | + |
338 | |
339 | === modified file 'src/indicator-me.c' |
340 | --- src/indicator-me.c 2010-01-03 05:42:47 +0000 |
341 | +++ src/indicator-me.c 2010-02-05 01:56:12 +0000 |
342 | @@ -23,6 +23,7 @@ |
343 | #include <glib.h> |
344 | #include <glib-object.h> |
345 | #include <gtk/gtk.h> |
346 | +#include <libdbusmenu-glib/menuitem.h> |
347 | #include <libdbusmenu-gtk/menu.h> |
348 | |
349 | #include <dbus/dbus-glib.h> |
350 | @@ -31,6 +32,7 @@ |
351 | #include <libindicator/indicator.h> |
352 | #include <libindicator/indicator-object.h> |
353 | #include <libindicator/indicator-service-manager.h> |
354 | +#include <libido/idoentrymenuitem.h> |
355 | |
356 | #include "dbus-shared-names.h" |
357 | #include "me-service-client.h" |
358 | @@ -201,11 +203,60 @@ |
359 | return; |
360 | } |
361 | |
362 | +static void |
363 | +entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GValue *value, GtkEntry *entry) |
364 | +{ |
365 | + if (g_strcmp0 (prop, ENTRY_MENUITEM_PROP_TEXT) == 0) { |
366 | + gtk_entry_set_text (entry, g_value_get_string (value)); |
367 | + } |
368 | +} |
369 | + |
370 | +static void |
371 | +activate_cb (GtkEntry *entry, DbusmenuMenuitem *gmi) |
372 | +{ |
373 | + GValue value = { 0 }; |
374 | + g_value_init (&value, G_TYPE_STRING); |
375 | + g_value_set_static_string (&value, gtk_entry_get_text (entry)); |
376 | + |
377 | + g_debug ("user typed: %s", g_value_get_string (&value)); |
378 | + |
379 | + dbusmenu_menuitem_handle_event (gmi, "send", &value, gtk_get_current_event_time()); |
380 | +} |
381 | + |
382 | +static gboolean |
383 | +new_entry_item (DbusmenuMenuitem * newitem, |
384 | + DbusmenuMenuitem * parent, |
385 | + DbusmenuClient * client) |
386 | +{ |
387 | + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); |
388 | + g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); |
389 | + /* Note: not checking parent, it's reasonable for it to be NULL */ |
390 | + |
391 | + IdoEntryMenuItem *ido = IDO_ENTRY_MENU_ITEM (ido_entry_menu_item_new ()); |
392 | + GtkEntry *entry = GTK_ENTRY(ido_entry_menu_item_get_entry (ido)); |
393 | + if (dbusmenu_menuitem_property_get (newitem, ENTRY_MENUITEM_PROP_TEXT) != NULL) |
394 | + gtk_entry_set_text(entry, dbusmenu_menuitem_property_get(newitem, ENTRY_MENUITEM_PROP_TEXT)); |
395 | + |
396 | + dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent); |
397 | + /* disconnect the activate signal that newitem_base connected with the wrong |
398 | + widget, ie menuitem, and re-connect it with the /entry/ instead */ |
399 | + gulong signal_id = g_signal_handler_find (GTK_MENU_ITEM (ido), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, parent); |
400 | + g_signal_handler_disconnect(GTK_MENU_ITEM (ido), signal_id); |
401 | + |
402 | + g_signal_connect (DBUSMENU_MENUITEM (newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK (entry_prop_change_cb), entry); |
403 | + g_signal_connect (GTK_ENTRY (entry), "activate", G_CALLBACK (activate_cb), newitem); |
404 | + |
405 | + return TRUE; |
406 | +} |
407 | + |
408 | /* Builds the dbusmenu for the service. */ |
409 | static GtkMenu * |
410 | get_menu (IndicatorObject * io) |
411 | { |
412 | - return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_ME_DBUS_NAME, INDICATOR_ME_DBUS_OBJECT)); |
413 | + DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_ME_DBUS_NAME, INDICATOR_ME_DBUS_OBJECT); |
414 | + DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu); |
415 | + |
416 | + dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), ENTRY_MENUITEM_TYPE, new_entry_item); |
417 | + |
418 | + return GTK_MENU (menu); |
419 | } |
420 | - |
421 | - |
422 | |
423 | === added file 'src/me-service-gwibber.c' |
424 | --- src/me-service-gwibber.c 1970-01-01 00:00:00 +0000 |
425 | +++ src/me-service-gwibber.c 2010-02-05 01:56:12 +0000 |
426 | @@ -0,0 +1,85 @@ |
427 | +/* |
428 | + |
429 | +Logic to send messages via gwibber |
430 | + |
431 | +Copyright 2010 Canonical Ltd. |
432 | + |
433 | +Authors: |
434 | + David Barth <david.barth@canonical.com> |
435 | + |
436 | +This program is free software: you can redistribute it and/or modify it |
437 | +under the terms of the GNU General Public License version 3, as published |
438 | +by the Free Software Foundation. |
439 | + |
440 | +This program is distributed in the hope that it will be useful, but |
441 | +WITHOUT ANY WARRANTY; without even the implied warranties of |
442 | +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
443 | +PURPOSE. See the GNU General Public License for more details. |
444 | + |
445 | +You should have received a copy of the GNU General Public License along |
446 | +with this program. If not, see <http://www.gnu.org/licenses/>. |
447 | +*/ |
448 | + |
449 | +#include <glib.h> |
450 | +#include <dbus/dbus-glib.h> |
451 | + |
452 | +#define GWIBBER_ADDRESS "com.Gwibber.Service" |
453 | +#define GWIBBER_OBJECT "/com/gwibber/Service" |
454 | +#define GWIBBER_INTERFACE "com.Gwibber.Service" |
455 | + |
456 | +static DBusGProxy * gwibber_proxy = NULL; |
457 | + |
458 | +/* |
459 | + static */ void |
460 | +gwibber_response (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) |
461 | +{ |
462 | + g_debug ("gwibber_send_response"); |
463 | + |
464 | + return; |
465 | +} |
466 | + |
467 | +static void |
468 | +setup_gwibber_proxy (void) { |
469 | + DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); |
470 | + g_return_if_fail(bus != NULL); |
471 | + |
472 | + if (gwibber_proxy == NULL) { |
473 | + gwibber_proxy = dbus_g_proxy_new_for_name(bus, |
474 | + GWIBBER_ADDRESS, |
475 | + GWIBBER_OBJECT, |
476 | + GWIBBER_INTERFACE); |
477 | + } |
478 | + g_return_if_fail (gwibber_proxy != NULL); |
479 | + |
480 | + return; |
481 | +} |
482 | + |
483 | +void |
484 | +gwibber_send (const gchar *msg) |
485 | +{ |
486 | + setup_gwibber_proxy (); |
487 | + |
488 | + if (gwibber_proxy == NULL) { |
489 | + g_warning ("Can not get a gwibber proxy object"); |
490 | + } |
491 | + |
492 | + GValue value = {0}; |
493 | + g_value_init(&value, G_TYPE_STRING); |
494 | + g_value_set_string(&value, msg); |
495 | + |
496 | + g_debug ("gwibber_send: %s\n", msg); |
497 | + |
498 | + dbus_g_proxy_begin_call(gwibber_proxy, |
499 | + "SendMessage", |
500 | + gwibber_response, |
501 | + NULL, |
502 | + NULL, |
503 | + G_TYPE_VALUE, |
504 | + &value, |
505 | + G_TYPE_INVALID); |
506 | + |
507 | + g_value_unset(&value); |
508 | + |
509 | + return; |
510 | +} |
511 | + |
512 | |
513 | === added file 'src/me-service-gwibber.h' |
514 | --- src/me-service-gwibber.h 1970-01-01 00:00:00 +0000 |
515 | +++ src/me-service-gwibber.h 2010-02-05 01:56:12 +0000 |
516 | @@ -0,0 +1,35 @@ |
517 | +/* |
518 | + |
519 | +Logic to send messages via gwibber |
520 | + |
521 | +Copyright 2010 Canonical Ltd. |
522 | + |
523 | +Authors: |
524 | + David Barth <david.barth@canonical.com> |
525 | + |
526 | +This program is free software: you can redistribute it and/or modify it |
527 | +under the terms of the GNU General Public License version 3, as published |
528 | +by the Free Software Foundation. |
529 | + |
530 | +This program is distributed in the hope that it will be useful, but |
531 | +WITHOUT ANY WARRANTY; without even the implied warranties of |
532 | +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
533 | +PURPOSE. See the GNU General Public License for more details. |
534 | + |
535 | +You should have received a copy of the GNU General Public License along |
536 | +with this program. If not, see <http://www.gnu.org/licenses/>. |
537 | +*/ |
538 | + |
539 | +#ifndef __ME_SERVICE_GWIBBER_H__ |
540 | +#define __ME_SERVICE_GWIBBER_H__ |
541 | + |
542 | +#include <glib.h> |
543 | + |
544 | +G_BEGIN_DECLS |
545 | + |
546 | +void gwibber_send (const gchar *msg); |
547 | + |
548 | +G_END_DECLS |
549 | + |
550 | +#endif /* __ME_SERVICE_GWIBBER_H__ */ |
551 | + |
552 | |
553 | === modified file 'src/me-service.c' |
554 | --- src/me-service.c 2010-01-21 17:12:02 +0000 |
555 | +++ src/me-service.c 2010-02-05 01:56:12 +0000 |
556 | @@ -46,6 +46,8 @@ |
557 | #include "status-provider-pidgin.h" |
558 | #include "status-provider-telepathy.h" |
559 | |
560 | +#include "entry-menu-item.h" |
561 | + |
562 | typedef StatusProvider * (*newfunc) (void); |
563 | #define STATUS_PROVIDER_CNT 3 |
564 | static newfunc status_provider_newfuncs[STATUS_PROVIDER_CNT] = { |
565 | @@ -108,7 +110,7 @@ |
566 | StatusProviderStatus i; |
567 | for (i = STATUS_PROVIDER_STATUS_ONLINE; i < STATUS_PROVIDER_STATUS_LAST; i++) { |
568 | if (status_menuitems[i] == NULL) continue; |
569 | - dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_SENSITIVE, FALSE); |
570 | + dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); |
571 | } |
572 | } |
573 | |
574 | @@ -118,7 +120,7 @@ |
575 | StatusProviderStatus i; |
576 | for (i = STATUS_PROVIDER_STATUS_ONLINE; i < STATUS_PROVIDER_STATUS_LAST; i++) { |
577 | if (status_menuitems[i] == NULL) continue; |
578 | - dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_SENSITIVE, TRUE); |
579 | + dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); |
580 | } |
581 | } |
582 | } |
583 | @@ -127,7 +129,7 @@ |
584 | } |
585 | |
586 | static void |
587 | -status_menu_click (DbusmenuMenuitem * mi, gpointer data) |
588 | +status_menu_click (DbusmenuMenuitem * mi, guint timestamp, gpointer data) |
589 | { |
590 | StatusProviderStatus status = (StatusProviderStatus)GPOINTER_TO_INT(data); |
591 | g_debug("Setting status: %d", status); |
592 | @@ -139,6 +141,47 @@ |
593 | return; |
594 | } |
595 | |
596 | +static void |
597 | +accounts_click (DbusmenuMenuitem *mi, gpointer user_data) |
598 | +{ |
599 | + GError * error = NULL; |
600 | + |
601 | + if (!g_spawn_command_line_async(user_data, &error)) { |
602 | + g_warning("Unable to start %s: %s", (char *)user_data, error->message); |
603 | + g_error_free(error); |
604 | + } |
605 | +} |
606 | + |
607 | +static void |
608 | +build_accounts_menuitems (gpointer data) |
609 | +{ |
610 | + DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data); |
611 | + g_return_if_fail(root != NULL); |
612 | + |
613 | + /* FIXME: find cmd line parameters with ken-vandine */ |
614 | + DbusmenuMenuitem *im_accounts_mi = dbusmenu_menuitem_new(); |
615 | + dbusmenu_menuitem_property_set(im_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, |
616 | + _("Chat Accounts...")); |
617 | + dbusmenu_menuitem_child_append(root, im_accounts_mi); |
618 | + g_signal_connect(G_OBJECT(im_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
619 | + G_CALLBACK(accounts_click), "empathy -a"); |
620 | + |
621 | + DbusmenuMenuitem *tw_accounts_mi = dbusmenu_menuitem_new(); |
622 | + dbusmenu_menuitem_property_set(tw_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, |
623 | + _("Broadcast Accounts...")); |
624 | + dbusmenu_menuitem_child_append(root, tw_accounts_mi); |
625 | + g_signal_connect(G_OBJECT(tw_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
626 | + G_CALLBACK(accounts_click), "gwibber-accounts"); |
627 | + |
628 | + DbusmenuMenuitem *u1_accounts_mi = dbusmenu_menuitem_new(); |
629 | + dbusmenu_menuitem_property_set(u1_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, |
630 | + _("Ubuntu One...")); |
631 | + dbusmenu_menuitem_child_append(root, u1_accounts_mi); |
632 | + g_signal_connect(G_OBJECT(u1_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
633 | + G_CALLBACK(accounts_click), "ubuntuone-client-preferences"); |
634 | + |
635 | +} |
636 | + |
637 | static gboolean |
638 | build_providers (gpointer data) |
639 | { |
640 | @@ -172,7 +215,7 @@ |
641 | if (name[0] != '\0') { |
642 | DbusmenuMenuitem * useritem = dbusmenu_menuitem_new(); |
643 | dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_LABEL, name); |
644 | - dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_SENSITIVE, FALSE); |
645 | + dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); |
646 | dbusmenu_menuitem_child_append(root, useritem); |
647 | } |
648 | |
649 | @@ -192,6 +235,9 @@ |
650 | |
651 | build_user_item(root); |
652 | |
653 | + DbusmenuMenuitem *entry = DBUSMENU_MENUITEM (entry_menu_item_new()); |
654 | + dbusmenu_menuitem_child_append(root, entry); |
655 | + |
656 | StatusProviderStatus i; |
657 | for (i = STATUS_PROVIDER_STATUS_ONLINE; i < STATUS_PROVIDER_STATUS_LAST; i++) { |
658 | if (i == STATUS_PROVIDER_STATUS_DISCONNECTED) { |
659 | @@ -203,9 +249,9 @@ |
660 | status_menuitems[i] = dbusmenu_menuitem_new(); |
661 | |
662 | dbusmenu_menuitem_property_set(status_menuitems[i], DBUSMENU_MENUITEM_PROP_LABEL, _(status_strings[i])); |
663 | - dbusmenu_menuitem_property_set(status_menuitems[i], DBUSMENU_MENUITEM_PROP_ICON, status_icons[i]); |
664 | + dbusmenu_menuitem_property_set(status_menuitems[i], DBUSMENU_MENUITEM_PROP_ICON_NAME, status_icons[i]); |
665 | if (global_status == STATUS_PROVIDER_STATUS_DISCONNECTED) { |
666 | - dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_SENSITIVE, FALSE); |
667 | + dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); |
668 | } |
669 | g_signal_connect(G_OBJECT(status_menuitems[i]), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(status_menu_click), GINT_TO_POINTER(i)); |
670 | |
671 | @@ -214,6 +260,13 @@ |
672 | g_debug("Built %s", status_strings[i]); |
673 | } |
674 | |
675 | + DbusmenuMenuitem *separator = dbusmenu_menuitem_new(); |
676 | + dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, |
677 | + DBUSMENU_CLIENT_TYPES_SEPARATOR); |
678 | + dbusmenu_menuitem_child_append(root, separator); |
679 | + |
680 | + build_accounts_menuitems(root); |
681 | + |
682 | return FALSE; |
683 | } |
684 |
0.2.2