Merge lp:~indicator-applet-developers/indicator-applet/messages-packaging into lp:~ubuntu-core-dev/indicator-applet/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
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+9670@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Update to use libindicator, libindicate-gtk and libdbusmenu.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2009-02-06 15:26:20 +0000
+++ .bzrignore 2009-05-28 15:29:41 +0000
@@ -16,3 +16,6 @@
16debian/stamp-makefile-build16debian/stamp-makefile-build
17libmessaging_la-im-menu-item.lo17libmessaging_la-im-menu-item.lo
18src/libmessaging_la-app-menu-item.lo18src/libmessaging_la-app-menu-item.lo
19data/indicator-messages.service
20indicator-messages-service
21indicator-messages-service-activate
1922
=== modified file 'autogen.sh'
--- autogen.sh 2008-12-05 00:34:45 +0000
+++ autogen.sh 2009-04-05 11:03:12 +0000
@@ -1,6 +1,6 @@
1#!/bin/sh1#!/bin/sh
22
3PKG_NAME="indicator-applet"3PKG_NAME="indicator-messages"
44
5which gnome-autogen.sh || {5which gnome-autogen.sh || {
6 echo "You need gnome-common from GNOME SVN"6 echo "You need gnome-common from GNOME SVN"
77
=== modified file 'configure.ac'
--- configure.ac 2009-04-13 15:57:24 +0000
+++ configure.ac 2009-08-04 16:44:11 +0000
@@ -4,7 +4,7 @@
4AC_PREREQ(2.53)4AC_PREREQ(2.53)
55
6AM_CONFIG_HEADER(config.h)6AM_CONFIG_HEADER(config.h)
7AM_INIT_AUTOMAKE(indicator-messages, 0.1.6)7AM_INIT_AUTOMAKE(indicator-messages, 0.2.0dev)
88
9AM_MAINTAINER_MODE9AM_MAINTAINER_MODE
1010
@@ -24,15 +24,34 @@
24GTK_REQUIRED_VERSION=2.1224GTK_REQUIRED_VERSION=2.12
25GIO_UNIX_REQUIRED_VERSION=2.1825GIO_UNIX_REQUIRED_VERSION=2.18
26PANEL_REQUIRED_VERSION=2.0.026PANEL_REQUIRED_VERSION=2.0.0
27INDICATE_REQUIRED_VERSION=0.1.527INDICATE_REQUIRED_VERSION=0.2.0
28INDICATOR_REQUIRED_VERSION=0.2.0
29DBUSMENUGTK_REQUIRED_VERSION=0.0.0
2830
29PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION31PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
30 gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION32 gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
31 indicate >= $INDICATE_REQUIRED_VERSION)33 indicator >= $INDICATOR_REQUIRED_VERSION
34 indicate >= $INDICATE_REQUIRED_VERSION
35 indicate-gtk >= $INDICATE_REQUIRED_VERSION
36 dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION)
32AC_SUBST(APPLET_CFLAGS)37AC_SUBST(APPLET_CFLAGS)
33AC_SUBST(APPLET_LIBS)38AC_SUBST(APPLET_LIBS)
3439
35###########################40###########################
41# Indicator Info
42###########################
43
44INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator`
45AC_SUBST(INDICATORDIR)
46
47###########################
48# DBus Service Info
49###########################
50
51DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`
52AC_SUBST(DBUSSERVICEDIR)
53
54###########################
36# Files55# Files
37###########################56###########################
3857
@@ -40,6 +59,7 @@
40Makefile59Makefile
41src/Makefile60src/Makefile
42data/Makefile61data/Makefile
62data/indicator-messages.service
43data/icons/Makefile63data/icons/Makefile
44data/icons/16x16/Makefile64data/icons/16x16/Makefile
45data/icons/16x16/status/Makefile65data/icons/16x16/status/Makefile
@@ -64,4 +84,5 @@
64Messaging Indicator Configuration:84Messaging Indicator Configuration:
6585
66 Prefix: $prefix86 Prefix: $prefix
87 Indicator Dir: $INDICATORDIR
67])88])
6889
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2009-02-04 16:01:51 +0000
+++ data/Makefile.am 2009-05-27 10:51:24 +0000
@@ -1,1 +1,4 @@
1SUBDIRS = icons1SUBDIRS = icons
2
3dbus_servicesdir = $(DBUSSERVICEDIR)
4dbus_services_DATA = indicator-messages.service
25
=== added file 'data/indicator-messages.service.in'
--- data/indicator-messages.service.in 1970-01-01 00:00:00 +0000
+++ data/indicator-messages.service.in 2009-05-28 15:33:26 +0000
@@ -0,0 +1,3 @@
1[D-BUS Service]
2Name=com.ubuntu.indicator.messages
3Exec=@prefix@/bin/indicator-messages-service
04
=== modified file 'debian/changelog'
--- debian/changelog 2009-04-14 09:32:06 +0000
+++ debian/changelog 2009-08-04 16:54:53 +0000
@@ -1,3 +1,62 @@
1indicator-messages (0.2.0~bzr121-0ubuntu1~ppa4) karmic; urgency=low
2
3 * debian/control: Adding in a build dep on libindicate-gtk-dev
4
5 -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 17:54:44 +0100
6
7indicator-messages (0.2.0~bzr121-0ubuntu1~ppa3) karmic; urgency=low
8
9 * Changes for the changing libindicate stuff.
10
11 -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 17:46:17 +0100
12
13indicator-messages (0.2.0~bzr121-0ubuntu1~ppa2) karmic; urgency=low
14
15 * Forgot to run ./autogen.sh
16
17 -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 17:38:41 +0100
18
19indicator-messages (0.2.0~bzr121-0ubuntu1~ppa1) karmic; urgency=low
20
21 * Merge in the dbusmenu changes from the dbusmenu branch
22 * debian/control: Adding in a build dependency on libdbusmenu-glib and
23 libdbusmenu-gtk to catch up with the merge.
24
25 -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 12:50:10 +0100
26
27indicator-messages (0.2.0~bzr120-0ubuntu1) jaunty; urgency=low
28
29 * Fix to track the timer. (LP: #365187)
30
31 -- Ted Gould <ted@ubuntu.com> Wed, 13 May 2009 09:56:20 -0500
32
33indicator-messages (0.2.0~bzr119-0ubuntu1) jaunty; urgency=low
34
35 * Upstream update
36
37 -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 23:34:21 -0500
38
39indicator-messages (0.2.0~bzr116-0ubuntu3) jaunty; urgency=low
40
41 * debian/rules: Adding a rule to remove the .la/.a clutter
42
43 -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 16:46:59 -0500
44
45indicator-messages (0.2.0~bzr116-0ubuntu2) jaunty; urgency=low
46
47 * debian/control: libindicator-dev to ~bzr301
48
49 -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 15:58:45 -0500
50
51indicator-messages (0.2.0~bzr116-0ubuntu1) jaunty; urgency=low
52
53 * Upstream release
54 * Bug fixes
55 * Update API to new libindicator
56 * debian/control: Adding new dependency on libindicator-dev
57
58 -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 15:45:21 -0500
59
1indicator-messages (0.1.6-0ubuntu1) jaunty; urgency=low60indicator-messages (0.1.6-0ubuntu1) jaunty; urgency=low
261
3 * New upstream version62 * New upstream version
463
=== modified file 'debian/control'
--- debian/control 2009-04-08 03:00:24 +0000
+++ debian/control 2009-08-04 16:54:42 +0000
@@ -9,7 +9,11 @@
9 gnome-doc-utils,9 gnome-doc-utils,
10 scrollkeeper,10 scrollkeeper,
11 intltool,11 intltool,
12 libindicate-dev (>= 0.1.5)12 libindicate-dev (>= 0.2.0~bzr298),
13 libindicate-gtk-dev (>= 0.2.0~bzr298),
14 libindicator-dev (>= 0.2.0~bzr301),
15 libdbusmenu-gtk-dev,
16 libdbusmenu-glib-dev
13Standards-Version: 3.8.017Standards-Version: 3.8.0
14Homepage: https://launchpad.net/indicator-applet18Homepage: https://launchpad.net/indicator-applet
15Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/indicator-applet/messages-ubuntu19Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/indicator-applet/messages-ubuntu
1620
=== modified file 'debian/rules'
--- debian/rules 2008-12-05 04:36:11 +0000
+++ debian/rules 2009-04-22 21:46:57 +0000
@@ -6,3 +6,7 @@
6DEB_CONFIGURE_EXTRA_FLAGS += --disable-scrollkeeper6DEB_CONFIGURE_EXTRA_FLAGS += --disable-scrollkeeper
7LDFLAGS += -Wl,-z,defs -Wl,--as-needed7LDFLAGS += -Wl,-z,defs -Wl,--as-needed
88
9binary-install/indicator-messages::
10 # remove .a/.la clutter
11 rm -f debian/$(cdbs_curpkg)/usr/lib/indicators/*/*.a
12 rm -f debian/$(cdbs_curpkg)/usr/lib/indicators/*/*.la
913
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2009-03-15 15:32:27 +0000
+++ src/Makefile.am 2009-05-28 15:19:48 +0000
@@ -1,7 +1,13 @@
11
2messaginglibdir = $(libdir)/indicators/12bin_PROGRAMS = indicator-messages-service
3
4messaginglibdir = $(INDICATORDIR)
3messaginglib_LTLIBRARIES = libmessaging.la5messaginglib_LTLIBRARIES = libmessaging.la
4libmessaging_la_SOURCES = indicator-messages.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h6libmessaging_la_SOURCES = indicator-messages.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h
5libmessaging_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed7libmessaging_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror
6libmessaging_la_LIBADD = $(APPLET_LIBS)8libmessaging_la_LIBADD = $(APPLET_LIBS)
7libmessaging_la_LDFLAGS = -module -avoid-version9libmessaging_la_LDFLAGS = -module -avoid-version
10
11indicator_messages_service_SOURCES = indicator-service.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h
12indicator_messages_service_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror
13indicator_messages_service_LDADD = $(APPLET_LIBS)
814
=== modified file 'src/app-menu-item.c'
--- src/app-menu-item.c 2009-04-13 15:02:06 +0000
+++ src/app-menu-item.c 2009-05-26 14:30:31 +0000
@@ -25,7 +25,6 @@
25#endif25#endif
2626
27#include <glib/gi18n.h>27#include <glib/gi18n.h>
28#include <gtk/gtk.h>
29#include <gio/gdesktopappinfo.h>28#include <gio/gdesktopappinfo.h>
30#include "app-menu-item.h"29#include "app-menu-item.h"
3130
@@ -48,8 +47,6 @@
48 GAppInfo * appinfo;47 GAppInfo * appinfo;
49 guint unreadcount;48 guint unreadcount;
50 gboolean count_on_label;49 gboolean count_on_label;
51
52 GtkWidget * name;
53};50};
5451
55#define APP_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_MENU_ITEM_TYPE, AppMenuItemPrivate))52#define APP_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_MENU_ITEM_TYPE, AppMenuItemPrivate))
@@ -68,7 +65,7 @@
6865
6966
7067
71G_DEFINE_TYPE (AppMenuItem, app_menu_item, GTK_TYPE_MENU_ITEM);68G_DEFINE_TYPE (AppMenuItem, app_menu_item, DBUSMENU_TYPE_MENUITEM);
7269
73static void70static void
74app_menu_item_class_init (AppMenuItemClass *klass)71app_menu_item_class_init (AppMenuItemClass *klass)
@@ -106,7 +103,6 @@
106103
107 priv->listener = NULL;104 priv->listener = NULL;
108 priv->server = NULL;105 priv->server = NULL;
109 priv->name = NULL;
110 priv->type = NULL;106 priv->type = NULL;
111 priv->appinfo = NULL;107 priv->appinfo = NULL;
112 priv->unreadcount = 0;108 priv->unreadcount = 0;
@@ -119,6 +115,14 @@
119static void115static void
120app_menu_item_dispose (GObject *object)116app_menu_item_dispose (GObject *object)
121{117{
118 AppMenuItem * self = APP_MENU_ITEM(object);
119 AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self);
120
121 g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_added_cb), self);
122 g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_removed_cb), self);
123
124 g_object_unref(priv->listener);
125
122 G_OBJECT_CLASS (app_menu_item_parent_class)->dispose (object);126 G_OBJECT_CLASS (app_menu_item_parent_class)->dispose (object);
123}127}
124128
@@ -128,8 +132,13 @@
128 AppMenuItem * self = APP_MENU_ITEM(object);132 AppMenuItem * self = APP_MENU_ITEM(object);
129 AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self);133 AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self);
130134
131 g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_added_cb), self);135 if (priv->type != NULL) {
132 g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener), G_CALLBACK(indicator_removed_cb), self);136 g_free(priv->type);
137 }
138
139 if (priv->appinfo != NULL) {
140 g_object_unref(priv->appinfo);
141 }
133142
134 G_OBJECT_CLASS (app_menu_item_parent_class)->finalize (object);143 G_OBJECT_CLASS (app_menu_item_parent_class)->finalize (object);
135144
@@ -144,21 +153,17 @@
144 AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self);153 AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self);
145154
146 priv->listener = listener;155 priv->listener = listener;
156 g_object_ref(G_OBJECT(listener));
147 priv->server = server;157 priv->server = server;
158 /* Can not ref as not real GObject */
148159
149 g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added_cb), self);160 g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added_cb), self);
150 g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, G_CALLBACK(indicator_removed_cb), self);161 g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, G_CALLBACK(indicator_removed_cb), self);
151162
152 priv->name = gtk_label_new(INDICATE_LISTENER_SERVER_DBUS_NAME(server));
153 gtk_misc_set_alignment(GTK_MISC(priv->name), 0.0, 0.5);
154 gtk_widget_show(GTK_WIDGET(priv->name));
155
156 gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(priv->name));
157
158 indicate_listener_server_get_type(listener, server, type_cb, self);163 indicate_listener_server_get_type(listener, server, type_cb, self);
159 indicate_listener_server_get_desktop(listener, server, desktop_cb, self);164 indicate_listener_server_get_desktop(listener, server, desktop_cb, self);
160165
161 g_signal_connect(G_OBJECT(self), "activate", G_CALLBACK(activate_cb), NULL);166 g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL);
162167
163 indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_SERVER_DISPLAY);168 indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_SERVER_DISPLAY);
164 indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_SERVER_SIGNAL);169 indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_SERVER_SIGNAL);
@@ -174,8 +179,14 @@
174179
175 if (priv->type != NULL) {180 if (priv->type != NULL) {
176 g_free(priv->type);181 g_free(priv->type);
182 priv->type = NULL;
177 }183 }
178 184
185 if (value == NULL) {
186 g_warning("Type value is NULL, that shouldn't really happen");
187 return;
188 }
189
179 priv->type = g_strdup(value);190 priv->type = g_strdup(value);
180191
181 if (!(!g_strcmp0(priv->type, "message.instant") || !g_strcmp0(priv->type, "message.micro") || !g_strcmp0(priv->type, "message.im"))) {192 if (!(!g_strcmp0(priv->type, "message.instant") || !g_strcmp0(priv->type, "message.micro") || !g_strcmp0(priv->type, "message.im"))) {
@@ -200,11 +211,11 @@
200 if (priv->count_on_label && !priv->unreadcount < 1) {211 if (priv->count_on_label && !priv->unreadcount < 1) {
201 /* TRANSLATORS: This is the name of the program and the number of indicators. So it212 /* TRANSLATORS: This is the name of the program and the number of indicators. So it
202 would read something like "Mail Client (5)" */213 would read something like "Mail Client (5)" */
203 gchar * label = g_strdup_printf(_("%s (%d)"), g_app_info_get_name(priv->appinfo), priv->unreadcount);214 gchar * label = g_strdup_printf(_("%s (%d)"), app_menu_item_get_name(self), priv->unreadcount);
204 gtk_label_set_text(GTK_LABEL(priv->name), label);215 dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", label);
205 g_free(label);216 g_free(label);
206 } else {217 } else {
207 gtk_label_set_text(GTK_LABEL(priv->name), g_app_info_get_name(priv->appinfo));218 dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", app_menu_item_get_name(self));
208 }219 }
209220
210 return;221 return;
@@ -228,7 +239,7 @@
228 g_return_if_fail(priv->appinfo != NULL);239 g_return_if_fail(priv->appinfo != NULL);
229240
230 update_label(self);241 update_label(self);
231 g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, g_app_info_get_name(priv->appinfo), TRUE);242 g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, app_menu_item_get_name(self), TRUE);
232243
233 return;244 return;
234}245}
235246
=== modified file 'src/app-menu-item.h'
--- src/app-menu-item.h 2009-03-15 17:19:02 +0000
+++ src/app-menu-item.h 2009-05-26 14:30:31 +0000
@@ -25,6 +25,7 @@
25#include <glib.h>25#include <glib.h>
26#include <glib-object.h>26#include <glib-object.h>
2727
28#include <libdbusmenu-glib/menuitem.h>
28#include <libindicate/listener.h>29#include <libindicate/listener.h>
2930
30G_BEGIN_DECLS31G_BEGIN_DECLS
@@ -43,14 +44,14 @@
43typedef struct _AppMenuItemClass AppMenuItemClass;44typedef struct _AppMenuItemClass AppMenuItemClass;
4445
45struct _AppMenuItemClass {46struct _AppMenuItemClass {
46 GtkMenuItemClass parent_class;47 DbusmenuMenuitemClass parent_class;
4748
48 void (* count_changed) (guint count);49 void (* count_changed) (guint count);
49 void (* name_changed) (gchar * name);50 void (* name_changed) (gchar * name);
50};51};
5152
52struct _AppMenuItem {53struct _AppMenuItem {
53 GtkMenuItem parent;54 DbusmenuMenuitem parent;
54};55};
5556
56GType app_menu_item_get_type (void);57GType app_menu_item_get_type (void);
5758
=== added file 'src/dbus-data.h'
--- src/dbus-data.h 1970-01-01 00:00:00 +0000
+++ src/dbus-data.h 2009-05-25 22:28:08 +0000
@@ -0,0 +1,8 @@
1
2#ifndef __DBUS_DATA_H__
3#define __DBUS_DATA_H__ 1
4
5#define INDICATOR_MESSAGES_DBUS_NAME "com.ubuntu.indicator.messages"
6#define INDICATOR_MESSAGES_DBUS_OBJECT "/com/ubuntu/indicator/messages"
7
8#endif /* __DBUS_DATA_H__ */
09
=== modified file 'src/im-menu-item.c'
--- src/im-menu-item.c 2009-04-07 22:00:29 +0000
+++ src/im-menu-item.c 2009-08-04 16:44:11 +0000
@@ -24,7 +24,8 @@
24#endif24#endif
2525
26#include <glib/gi18n.h>26#include <glib/gi18n.h>
27#include <gtk/gtk.h>27#include <libindicate-gtk/indicator.h>
28#include <libindicate-gtk/listener.h>
28#include "im-menu-item.h"29#include "im-menu-item.h"
2930
30enum {31enum {
@@ -47,11 +48,6 @@
47 gulong indicator_changed;48 gulong indicator_changed;
4849
49 guint time_update_min;50 guint time_update_min;
50
51 GtkHBox * hbox;
52 GtkLabel * user;
53 GtkLabel * time;
54 GtkImage * icon;
55};51};
5652
57#define IM_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IM_MENU_ITEM_TYPE, ImMenuItemPrivate))53#define IM_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IM_MENU_ITEM_TYPE, ImMenuItemPrivate))
@@ -88,13 +84,7 @@
88 gchar * property,84 gchar * property,
89 ImMenuItem * self);85 ImMenuItem * self);
9086
9187G_DEFINE_TYPE (ImMenuItem, im_menu_item, DBUSMENU_TYPE_MENUITEM);
92static GtkSizeGroup * icon_group = NULL;
93static GtkSizeGroup * user_group = NULL;
94static GtkSizeGroup * time_group = NULL;
95
96
97G_DEFINE_TYPE (ImMenuItem, im_menu_item, GTK_TYPE_MENU_ITEM);
9888
99static void89static void
100im_menu_item_class_init (ImMenuItemClass *klass)90im_menu_item_class_init (ImMenuItemClass *klass)
@@ -129,35 +119,6 @@
129119
130 priv->seconds = 0;120 priv->seconds = 0;
131121
132 /* build widgets first */
133 priv->icon = GTK_IMAGE(gtk_image_new());
134 priv->user = GTK_LABEL(gtk_label_new(""));
135 priv->time = GTK_LABEL(gtk_label_new(""));
136
137 gtk_misc_set_alignment(GTK_MISC(priv->user), 0.0, 0.5);
138 gtk_misc_set_alignment(GTK_MISC(priv->time), 0.0, 0.5);
139
140 if (icon_group == NULL) {
141 icon_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
142 }
143 if (user_group == NULL) {
144 user_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
145 }
146 if (time_group == NULL) {
147 time_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
148 }
149 gtk_size_group_add_widget(icon_group, GTK_WIDGET(priv->icon));
150 gtk_size_group_add_widget(user_group, GTK_WIDGET(priv->user));
151 gtk_size_group_add_widget(time_group, GTK_WIDGET(priv->time));
152
153 priv->hbox = GTK_HBOX(gtk_hbox_new(FALSE, 3));
154 gtk_box_pack_start(GTK_BOX(priv->hbox), GTK_WIDGET(priv->icon), FALSE, TRUE, 3);
155 gtk_box_pack_start(GTK_BOX(priv->hbox), GTK_WIDGET(priv->user), TRUE, TRUE, 3);
156 gtk_box_pack_start(GTK_BOX(priv->hbox), GTK_WIDGET(priv->time), FALSE, TRUE, 3);
157 gtk_widget_show(GTK_WIDGET(priv->hbox));
158
159 gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(priv->hbox));
160
161 return;122 return;
162}123}
163124
@@ -188,19 +149,7 @@
188static void149static void
189icon_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GdkPixbuf * propertydata, gpointer data)150icon_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GdkPixbuf * propertydata, gpointer data)
190{151{
191 ImMenuItem * self = IM_MENU_ITEM(data);152 /* dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "icon", propertydata); */
192 ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);
193
194 gint height, width;
195 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
196
197 GdkPixbuf * scaled = gdk_pixbuf_scale_simple(propertydata, width, height, GDK_INTERP_BILINEAR);
198 g_object_unref(propertydata);
199
200 gtk_image_set_from_pixbuf(priv->icon, scaled);
201 g_object_unref(scaled);
202
203 gtk_widget_show(GTK_WIDGET(priv->icon));
204153
205 return;154 return;
206}155}
@@ -211,7 +160,7 @@
211 ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);160 ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);
212161
213 if (!priv->show_time) {162 if (!priv->show_time) {
214 gtk_label_set_label(priv->time, "");163 dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "right-column", "");
215 return;164 return;
216 }165 }
217 166
@@ -242,9 +191,7 @@
242 }191 }
243192
244 if (timestring != NULL) {193 if (timestring != NULL) {
245 gtk_label_set_label(priv->time, timestring);194 dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "right-column", "");
246 gtk_widget_show(GTK_WIDGET(priv->time));
247
248 g_free(timestring);195 g_free(timestring);
249 }196 }
250197
@@ -283,7 +230,7 @@
283 update_time(self);230 update_time(self);
284231
285 if (priv->time_update_min == 0) {232 if (priv->time_update_min == 0) {
286 g_timeout_add_seconds(60, time_update_cb, self);233 priv->time_update_min = g_timeout_add_seconds(60, time_update_cb, self);
287 }234 }
288235
289 g_signal_emit(G_OBJECT(self), signals[TIME_CHANGED], 0, priv->seconds, TRUE);236 g_signal_emit(G_OBJECT(self), signals[TIME_CHANGED], 0, priv->seconds, TRUE);
@@ -306,13 +253,7 @@
306 return;253 return;
307 }254 }
308255
309 ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);256 dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", propertydata);
310
311 gtk_label_set_label(priv->user, propertydata);
312 gtk_widget_show(GTK_WIDGET(priv->user));
313
314 /* Once we have the user we'll show the menu item */
315 gtk_widget_show(GTK_WIDGET(self));
316257
317 return;258 return;
318}259}
@@ -348,7 +289,6 @@
348ImMenuItem *289ImMenuItem *
349im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gboolean show_time)290im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gboolean show_time)
350{291{
351 g_debug("Building a new IM Menu Item");
352 ImMenuItem * self = g_object_new(IM_MENU_ITEM_TYPE, NULL);292 ImMenuItem * self = g_object_new(IM_MENU_ITEM_TYPE, NULL);
353293
354 ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);294 ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);
@@ -363,7 +303,7 @@
363 indicate_listener_get_property_time(listener, server, indicator, "time", time_cb, self); 303 indicate_listener_get_property_time(listener, server, indicator, "time", time_cb, self);
364 indicate_listener_get_property_icon(listener, server, indicator, "icon", icon_cb, self); 304 indicate_listener_get_property_icon(listener, server, indicator, "icon", icon_cb, self);
365305
366 g_signal_connect(G_OBJECT(self), "activate", G_CALLBACK(activate_cb), NULL);306 g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL);
367 priv->indicator_changed = g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED, G_CALLBACK(indicator_modified_cb), self);307 priv->indicator_changed = g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED, G_CALLBACK(indicator_modified_cb), self);
368308
369 return self;309 return self;
370310
=== modified file 'src/im-menu-item.h'
--- src/im-menu-item.h 2009-03-24 21:57:06 +0000
+++ src/im-menu-item.h 2009-05-26 14:30:37 +0000
@@ -25,6 +25,7 @@
25#include <glib.h>25#include <glib.h>
26#include <glib-object.h>26#include <glib-object.h>
2727
28#include <libdbusmenu-glib/menuitem.h>
28#include <libindicate/listener.h>29#include <libindicate/listener.h>
2930
30G_BEGIN_DECLS31G_BEGIN_DECLS
@@ -42,13 +43,13 @@
42typedef struct _ImMenuItemClass ImMenuItemClass;43typedef struct _ImMenuItemClass ImMenuItemClass;
4344
44struct _ImMenuItemClass {45struct _ImMenuItemClass {
45 GtkMenuItemClass parent_class;46 DbusmenuMenuitemClass parent_class;
4647
47 void (*time_changed) (glong seconds);48 void (*time_changed) (glong seconds);
48};49};
4950
50struct _ImMenuItem {51struct _ImMenuItem {
51 GtkMenuItem parent;52 DbusmenuMenuitem parent;
52};53};
5354
54GType im_menu_item_get_type (void);55GType im_menu_item_get_type (void);
5556
=== added file 'src/indicator-messages.c'
--- src/indicator-messages.c 1970-01-01 00:00:00 +0000
+++ src/indicator-messages.c 2009-05-28 15:20:23 +0000
@@ -0,0 +1,81 @@
1/*
2An indicator to show information that is in messaging applications
3that the user is using.
4
5Copyright 2009 Canonical Ltd.
6
7Authors:
8 Ted Gould <ted@canonical.com>
9
10This program is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License version 3, as published
12by the Free Software Foundation.
13
14This program is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranties of
16MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17PURPOSE. See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License along
20with this program. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include <string.h>
24#include <gtk/gtk.h>
25#include <libdbusmenu-gtk/menu.h>
26#include <dbus/dbus-glib.h>
27#include <dbus/dbus-glib-bindings.h>
28
29#include <libindicator/indicator.h>
30INDICATOR_SET_VERSION
31INDICATOR_SET_NAME("messages")
32
33#include "dbus-data.h"
34
35static GtkWidget * main_image;
36
37#define DESIGN_TEAM_SIZE design_team_size
38static GtkIconSize design_team_size;
39
40GtkLabel *
41get_label (void)
42{
43 return NULL;
44}
45
46GtkImage *
47get_icon (void)
48{
49 design_team_size = gtk_icon_size_register("design-team-size", 22, 22);
50
51 main_image = gtk_image_new_from_icon_name("indicator-messages", DESIGN_TEAM_SIZE);
52 gtk_widget_show(main_image);
53
54 /* Need a proxy here to figure out when the icon changes */
55
56 return GTK_IMAGE(main_image);
57}
58
59GtkMenu *
60get_menu (void)
61{
62 guint returnval = 0;
63 GError * error = NULL;
64
65 DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
66 DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
67
68 if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &returnval, &error)) {
69 g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" );
70 g_error_free(error);
71 return NULL;
72 }
73
74 if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) {
75 g_error("Return value isn't indicative of success: %d", returnval);
76 return NULL;
77 }
78
79 return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT));
80}
81
082
=== renamed file 'src/indicator-messages.c' => 'src/indicator-service.c'
--- src/indicator-messages.c 2009-04-08 02:50:41 +0000
+++ src/indicator-service.c 2009-05-27 08:44:37 +0000
@@ -21,26 +21,28 @@
21*/21*/
2222
23#include <string.h>23#include <string.h>
24#include <gtk/gtk.h>24#include <dbus/dbus-glib-bindings.h>
25#include <libindicate/listener.h>25#include <libindicate/listener.h>
2626
27#include <libdbusmenu-glib/server.h>
28
27#include "im-menu-item.h"29#include "im-menu-item.h"
28#include "app-menu-item.h"30#include "app-menu-item.h"
31#include "dbus-data.h"
2932
30static IndicateListener * listener;33static IndicateListener * listener;
31static GList * serverList;34static GList * serverList;
32static GtkWidget * main_image;35
33static GtkWidget * main_menu;36static DbusmenuMenuitem * root_menuitem = NULL;
37static GMainLoop * mainloop = NULL;
38
3439
35static void server_count_changed (AppMenuItem * appitem, guint count, gpointer data);40static void server_count_changed (AppMenuItem * appitem, guint count, gpointer data);
36static void server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data);41static void server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data);
37static void im_time_changed (ImMenuItem * imitem, glong seconds, gpointer data);42static void im_time_changed (ImMenuItem * imitem, glong seconds, gpointer data);
38static void reconsile_list_and_menu (GList * serverlist, GtkMenuShell * menushell);43static void reconsile_list_and_menu (GList * serverlist, DbusmenuMenuitem * menushell);
39static void indicator_removed (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data);44static void indicator_removed (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data);
4045
41#define DESIGN_TEAM_SIZE design_team_size
42static GtkIconSize design_team_size;
43
44typedef struct _serverList_t serverList_t;46typedef struct _serverList_t serverList_t;
45struct _serverList_t {47struct _serverList_t {
46 IndicateListenerServer * server;48 IndicateListenerServer * server;
@@ -80,7 +82,7 @@
80struct _imList_t {82struct _imList_t {
81 IndicateListenerServer * server;83 IndicateListenerServer * server;
82 IndicateListenerIndicator * indicator;84 IndicateListenerIndicator * indicator;
83 GtkWidget * menuitem;85 DbusmenuMenuitem * menuitem;
84 gulong timechange_cb;86 gulong timechange_cb;
85};87};
8688
@@ -131,7 +133,7 @@
131 return;133 return;
132 }134 }
133135
134 GtkMenuShell * menushell = GTK_MENU_SHELL(data);136 DbusmenuMenuitem * menushell = DBUSMENU_MENUITEM(data);
135 if (menushell == NULL) {137 if (menushell == NULL) {
136 g_error("\tData in callback is not a menushell");138 g_error("\tData in callback is not a menushell");
137 return;139 return;
@@ -157,9 +159,8 @@
157 serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort);159 serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort);
158 }160 }
159161
160 gtk_menu_shell_prepend(menushell, GTK_WIDGET(menuitem));162 dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(menuitem));
161 gtk_widget_show(GTK_WIDGET(menuitem));163 /* Should be prepend ^ */
162 gtk_widget_show(GTK_WIDGET(main_menu));
163164
164 reconsile_list_and_menu(serverList, menushell);165 reconsile_list_and_menu(serverList, menushell);
165166
@@ -170,7 +171,7 @@
170server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data)171server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data)
171{172{
172 serverList = g_list_sort(serverList, serverList_sort);173 serverList = g_list_sort(serverList, serverList_sort);
173 reconsile_list_and_menu(serverList, GTK_MENU_SHELL(data));174 reconsile_list_and_menu(serverList, DBUSMENU_MENUITEM(data));
174 return;175 return;
175}176}
176177
@@ -193,7 +194,7 @@
193 if (count != 0) {194 if (count != 0) {
194 g_debug("Setting image to 'new'");195 g_debug("Setting image to 'new'");
195 showing_new_icon = TRUE;196 showing_new_icon = TRUE;
196 gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages-new", DESIGN_TEAM_SIZE);197 /* gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages-new", DESIGN_TEAM_SIZE); */
197 return;198 return;
198 }199 }
199200
@@ -214,7 +215,7 @@
214 if (!we_have_indicators) {215 if (!we_have_indicators) {
215 g_debug("Setting image to boring");216 g_debug("Setting image to boring");
216 showing_new_icon = FALSE;217 showing_new_icon = FALSE;
217 gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages", DESIGN_TEAM_SIZE);218 /* gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages", DESIGN_TEAM_SIZE); */
218 }219 }
219220
220 return;221 return;
@@ -225,7 +226,7 @@
225{226{
226 serverList_t * sl = (serverList_t *)data;227 serverList_t * sl = (serverList_t *)data;
227 sl->imList = g_list_sort(sl->imList, imList_sort);228 sl->imList = g_list_sort(sl->imList, imList_sort);
228 reconsile_list_and_menu(serverList, GTK_MENU_SHELL(gtk_widget_get_parent(GTK_WIDGET(imitem))));229 reconsile_list_and_menu(serverList, root_menuitem);
229 return;230 return;
230}231}
231232
@@ -252,18 +253,14 @@
252 serverList = g_list_remove(serverList, sltp);253 serverList = g_list_remove(serverList, sltp);
253254
254 if (sltp->menuitem != NULL) {255 if (sltp->menuitem != NULL) {
255 gtk_widget_hide(GTK_WIDGET(sltp->menuitem));256 dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(sltp->menuitem), "visibile", "false");
256 gtk_container_remove(GTK_CONTAINER(data), GTK_WIDGET(sltp->menuitem));257 dbusmenu_menuitem_child_delete(DBUSMENU_MENUITEM(data), DBUSMENU_MENUITEM(sltp->menuitem));
257 }258 }
258259
259 g_free(sltp);260 g_free(sltp);
260261
261 if (g_list_length(serverList) == 0) {262 /* Simulate a server saying zero to recalculate icon */
262 gtk_widget_hide(main_menu);263 server_count_changed(NULL, 0, NULL);
263 } else {
264 /* Simulate a server saying zero to recalculate icon */
265 server_count_changed(NULL, 0, NULL);
266 }
267264
268 return;265 return;
269}266}
@@ -276,7 +273,7 @@
276};273};
277274
278static void275static void
279menushell_foreach_cb (GtkWidget * data_mi, gpointer data_ms) {276menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) {
280 menushell_location_t * msl = (menushell_location_t *)data_ms;277 menushell_location_t * msl = (menushell_location_t *)data_ms;
281278
282 if (msl->found) return;279 if (msl->found) return;
@@ -296,7 +293,7 @@
296}293}
297294
298static void295static void
299reconsile_list_and_menu (GList * serverlist, GtkMenuShell * menushell)296reconsile_list_and_menu (GList * serverlist, DbusmenuMenuitem * menushell)
300{297{
301 guint position = 0;298 guint position = 0;
302 GList * serverentry;299 GList * serverentry;
@@ -307,7 +304,7 @@
307 serverList_t * si = (serverList_t *)serverentry->data;304 serverList_t * si = (serverList_t *)serverentry->data;
308 if (si->menuitem != NULL) {305 if (si->menuitem != NULL) {
309 g_debug("\tMoving app %s to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position);306 g_debug("\tMoving app %s to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position);
310 gtk_menu_reorder_child(GTK_MENU(menushell), GTK_WIDGET(si->menuitem), position);307 dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->menuitem), position);
311 position++;308 position++;
312 }309 }
313310
@@ -317,7 +314,7 @@
317314
318 if (imi->menuitem != NULL) {315 if (imi->menuitem != NULL) {
319 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);316 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);
320 gtk_menu_reorder_child(GTK_MENU(menushell), imi->menuitem, position);317 dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(imi->menuitem), position);
321 position++;318 position++;
322 }319 }
323 }320 }
@@ -329,7 +326,7 @@
329static void326static void
330subtype_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data)327subtype_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data)
331{328{
332 GtkMenuShell * menushell = GTK_MENU_SHELL(data);329 DbusmenuMenuitem * menushell = DBUSMENU_MENUITEM(data);
333 if (menushell == NULL) {330 if (menushell == NULL) {
334 g_error("Data in callback is not a menushell");331 g_error("Data in callback is not a menushell");
335 return;332 return;
@@ -358,7 +355,7 @@
358 g_debug("Building IM Item");355 g_debug("Building IM Item");
359 ImMenuItem * menuitem = im_menu_item_new(listener, server, indicator, !g_strcmp0(propertydata, "im"));356 ImMenuItem * menuitem = im_menu_item_new(listener, server, indicator, !g_strcmp0(propertydata, "im"));
360 g_object_ref(G_OBJECT(menuitem));357 g_object_ref(G_OBJECT(menuitem));
361 listItem->menuitem = GTK_WIDGET(menuitem);358 listItem->menuitem = DBUSMENU_MENUITEM(menuitem);
362359
363 g_debug("Finding the server entry");360 g_debug("Finding the server entry");
364 serverList_t sl_item_local;361 serverList_t sl_item_local;
@@ -389,12 +386,12 @@
389 msl.position = 0;386 msl.position = 0;
390 msl.server = server;387 msl.server = server;
391388
392 gtk_container_foreach(GTK_CONTAINER(menushell), menushell_foreach_cb, &msl);389 dbusmenu_menuitem_foreach(DBUSMENU_MENUITEM(menushell), menushell_foreach_cb, &msl);
393 if (msl.found) {390 if (msl.found) {
394 gtk_menu_shell_insert(menushell, GTK_WIDGET(menuitem), msl.position);391 dbusmenu_menuitem_child_add_position(menushell, DBUSMENU_MENUITEM(menuitem), msl.position);
395 } else {392 } else {
396 g_warning("Unable to find server menu item");393 g_warning("Unable to find server menu item");
397 gtk_menu_shell_append(menushell, GTK_WIDGET(menuitem));394 dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(menuitem));
398 }395 }
399 }396 }
400397
@@ -444,7 +441,7 @@
444 listData.indicator = indicator;441 listData.indicator = indicator;
445442
446 GList * listItem = g_list_find_custom(sl_item->imList, &listData, imList_equal);443 GList * listItem = g_list_find_custom(sl_item->imList, &listData, imList_equal);
447 GtkWidget * menuitem = NULL;444 DbusmenuMenuitem * menuitem = NULL;
448 imList_t * ilt = NULL;445 imList_t * ilt = NULL;
449 if (listItem != NULL) {446 if (listItem != NULL) {
450 ilt = (imList_t *)listItem->data;447 ilt = (imList_t *)listItem->data;
@@ -456,8 +453,8 @@
456 g_signal_handler_disconnect(menuitem, ilt->timechange_cb);453 g_signal_handler_disconnect(menuitem, ilt->timechange_cb);
457 g_free(ilt);454 g_free(ilt);
458455
459 gtk_widget_hide(menuitem);456 dbusmenu_menuitem_property_set(menuitem, "visibile", "false");
460 gtk_container_remove(GTK_CONTAINER(data), menuitem);457 dbusmenu_menuitem_child_delete(DBUSMENU_MENUITEM(data), menuitem);
461 removed = TRUE;458 removed = TRUE;
462 }459 }
463460
@@ -468,30 +465,40 @@
468 return;465 return;
469}466}
470467
471GtkWidget *468int
472get_menu_item (void)469main (int argc, char ** argv)
473{470{
474 design_team_size = gtk_icon_size_register("design-team-size", 22, 22);471 g_type_init();
475472
476 listener = indicate_listener_new();473 DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
474 DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
475 GError * error = NULL;
476 guint nameret = 0;
477
478 if (!org_freedesktop_DBus_request_name(bus_proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &nameret, &error)) {
479 g_error("Unable to call to request name");
480 return 1;
481 }
482
483 if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
484 g_error("Unable to get name");
485 return 1;
486 }
487
488 listener = indicate_listener_ref_default();
477 serverList = NULL;489 serverList = NULL;
478490
479 main_menu = gtk_menu_item_new();491 root_menuitem = dbusmenu_menuitem_new();
480 gtk_widget_set_name(main_menu, "fast-user-switch-menuitem");492 DbusmenuServer * server = dbusmenu_server_new(INDICATOR_MESSAGES_DBUS_OBJECT);
481493 dbusmenu_server_set_root(server, root_menuitem);
482 main_image = gtk_image_new_from_icon_name("indicator-messages", DESIGN_TEAM_SIZE);494
483 gtk_widget_show(main_image);495 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), root_menuitem);
484 gtk_container_add(GTK_CONTAINER(main_menu), main_image);496 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, G_CALLBACK(indicator_removed), root_menuitem);
485497 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), root_menuitem);
486 GtkWidget * submenu = gtk_menu_new();498 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), root_menuitem);
487 gtk_menu_item_set_submenu(GTK_MENU_ITEM(main_menu), submenu);499
488 gtk_widget_show(submenu);500 mainloop = g_main_loop_new(NULL, FALSE);
489501 g_main_loop_run(mainloop);
490 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), submenu);502
491 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, G_CALLBACK(indicator_removed), submenu);503 return 0;
492 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), submenu);
493 g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), submenu);
494
495 return main_menu;
496}504}
497
498505
=== added directory 'test'
=== added file 'test/indicator-messages-service-activate.build.sh'
--- test/indicator-messages-service-activate.build.sh 1970-01-01 00:00:00 +0000
+++ test/indicator-messages-service-activate.build.sh 2009-05-28 15:29:41 +0000
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3gcc -o indicator-messages-service-activate indicator-messages-service-activate.c `pkg-config --cflags --libs dbus-1 dbus-glib-1`
04
=== added file 'test/indicator-messages-service-activate.c'
--- test/indicator-messages-service-activate.c 1970-01-01 00:00:00 +0000
+++ test/indicator-messages-service-activate.c 2009-05-28 15:29:41 +0000
@@ -0,0 +1,53 @@
1/*
2An indicator to show information that is in messaging applications
3that the user is using.
4
5Copyright 2009 Canonical Ltd.
6
7Authors:
8 Ted Gould <ted@canonical.com>
9
10This program is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License version 3, as published
12by the Free Software Foundation.
13
14This program is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranties of
16MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17PURPOSE. See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License along
20with this program. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include <string.h>
24#include <dbus/dbus-glib.h>
25#include <dbus/dbus-glib-bindings.h>
26#include "../src/dbus-data.h"
27
28int
29main (int argc, char ** argv)
30{
31 g_type_init();
32
33 guint returnval = 0;
34 GError * error = NULL;
35
36 DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
37 DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
38
39 g_debug("Activating service: %s", INDICATOR_MESSAGES_DBUS_NAME);
40 if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &returnval, &error)) {
41 g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" );
42 g_error_free(error);
43 return 1;
44 }
45
46 if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) {
47 g_error("Return value isn't indicative of success: %d", returnval);
48 return 1;
49 }
50
51 return 0;
52}
53

Subscribers

People subscribed via source and target branches