Merge lp:~ted/indicator-applet/messages-dbusmenu into lp:indicator-applet/messages0.2

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~ted/indicator-applet/messages-dbusmenu
Merge into: lp:indicator-applet/messages0.2
Diff against target: None lines
To merge this branch: bzr merge lp:~ted/indicator-applet/messages-dbusmenu
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+9628@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-05-26 12:46:56 +0000
3+++ .bzrignore 2009-05-28 15:29:41 +0000
4@@ -18,3 +18,4 @@
5 src/libmessaging_la-app-menu-item.lo
6 data/indicator-messages.service
7 indicator-messages-service
8+indicator-messages-service-activate
9
10=== modified file 'data/Makefile.am'
11--- data/Makefile.am 2009-05-26 12:37:53 +0000
12+++ data/Makefile.am 2009-05-27 10:51:24 +0000
13@@ -1,4 +1,4 @@
14 SUBDIRS = icons
15
16-dbus_servicesdir = $(dbusservicedir)
17+dbus_servicesdir = $(DBUSSERVICEDIR)
18 dbus_services_DATA = indicator-messages.service
19
20=== modified file 'data/indicator-messages.service.in'
21--- data/indicator-messages.service.in 2009-05-26 12:24:24 +0000
22+++ data/indicator-messages.service.in 2009-05-28 15:33:26 +0000
23@@ -1,3 +1,3 @@
24-[Indicator Messages]
25+[D-BUS Service]
26 Name=com.ubuntu.indicator.messages
27 Exec=@prefix@/bin/indicator-messages-service
28
29=== modified file 'src/Makefile.am'
30--- src/Makefile.am 2009-05-26 12:46:56 +0000
31+++ src/Makefile.am 2009-05-28 15:19:48 +0000
32@@ -4,10 +4,10 @@
33 messaginglibdir = $(INDICATORDIR)
34 messaginglib_LTLIBRARIES = libmessaging.la
35 libmessaging_la_SOURCES = indicator-messages.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h
36-libmessaging_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed
37+libmessaging_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror
38 libmessaging_la_LIBADD = $(APPLET_LIBS)
39 libmessaging_la_LDFLAGS = -module -avoid-version
40
41 indicator_messages_service_SOURCES = indicator-service.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h
42-indicator_messages_service_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed
43+indicator_messages_service_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror
44 indicator_messages_service_LDADD = $(APPLET_LIBS)
45
46=== modified file 'src/indicator-messages.c'
47--- src/indicator-messages.c 2009-05-25 22:43:17 +0000
48+++ src/indicator-messages.c 2009-05-28 15:20:23 +0000
49@@ -23,6 +23,8 @@
50 #include <string.h>
51 #include <gtk/gtk.h>
52 #include <libdbusmenu-gtk/menu.h>
53+#include <dbus/dbus-glib.h>
54+#include <dbus/dbus-glib-bindings.h>
55
56 #include <libindicator/indicator.h>
57 INDICATOR_SET_VERSION
58@@ -57,6 +59,23 @@
59 GtkMenu *
60 get_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
82
83=== modified file 'src/indicator-service.c'
84--- src/indicator-service.c 2009-05-26 16:05:48 +0000
85+++ src/indicator-service.c 2009-05-27 08:44:37 +0000
86@@ -21,6 +21,7 @@
87 */
88
89 #include <string.h>
90+#include <dbus/dbus-glib-bindings.h>
91 #include <libindicate/listener.h>
92
93 #include <libdbusmenu-glib/server.h>
94@@ -292,14 +293,6 @@
95 }
96
97 static void
98-dbusmenu_menuitem_child_reorder(DbusmenuMenuitem * base, DbusmenuMenuitem * child, guint position)
99-{
100- dbusmenu_menuitem_child_delete(base, child);
101- dbusmenu_menuitem_child_add_position(base, child, position);
102- return;
103-}
104-
105-static void
106 reconsile_list_and_menu (GList * serverlist, DbusmenuMenuitem * menushell)
107 {
108 guint position = 0;
109@@ -477,6 +470,21 @@
110 {
111 g_type_init();
112
113+ DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
114+ DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
115+ GError * error = NULL;
116+ guint nameret = 0;
117+
118+ if (!org_freedesktop_DBus_request_name(bus_proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &nameret, &error)) {
119+ g_error("Unable to call to request name");
120+ return 1;
121+ }
122+
123+ if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
124+ g_error("Unable to get name");
125+ return 1;
126+ }
127+
128 listener = indicate_listener_ref_default();
129 serverList = NULL;
130
131
132=== added directory 'test'
133=== added file 'test/indicator-messages-service-activate.build.sh'
134--- test/indicator-messages-service-activate.build.sh 1970-01-01 00:00:00 +0000
135+++ test/indicator-messages-service-activate.build.sh 2009-05-28 15:29:41 +0000
136@@ -0,0 +1,3 @@
137+#!/bin/sh
138+
139+gcc -o indicator-messages-service-activate indicator-messages-service-activate.c `pkg-config --cflags --libs dbus-1 dbus-glib-1`
140
141=== added file 'test/indicator-messages-service-activate.c'
142--- test/indicator-messages-service-activate.c 1970-01-01 00:00:00 +0000
143+++ test/indicator-messages-service-activate.c 2009-05-28 15:29:41 +0000
144@@ -0,0 +1,53 @@
145+/*
146+An indicator to show information that is in messaging applications
147+that the user is using.
148+
149+Copyright 2009 Canonical Ltd.
150+
151+Authors:
152+ Ted Gould <ted@canonical.com>
153+
154+This program is free software: you can redistribute it and/or modify it
155+under the terms of the GNU General Public License version 3, as published
156+by the Free Software Foundation.
157+
158+This program is distributed in the hope that it will be useful, but
159+WITHOUT ANY WARRANTY; without even the implied warranties of
160+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
161+PURPOSE. See the GNU General Public License for more details.
162+
163+You should have received a copy of the GNU General Public License along
164+with this program. If not, see <http://www.gnu.org/licenses/>.
165+*/
166+
167+#include <string.h>
168+#include <dbus/dbus-glib.h>
169+#include <dbus/dbus-glib-bindings.h>
170+#include "../src/dbus-data.h"
171+
172+int
173+main (int argc, char ** argv)
174+{
175+ g_type_init();
176+
177+ guint returnval = 0;
178+ GError * error = NULL;
179+
180+ DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
181+ DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
182+
183+ g_debug("Activating service: %s", INDICATOR_MESSAGES_DBUS_NAME);
184+ if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &returnval, &error)) {
185+ g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" );
186+ g_error_free(error);
187+ return 1;
188+ }
189+
190+ if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) {
191+ g_error("Return value isn't indicative of success: %d", returnval);
192+ return 1;
193+ }
194+
195+ return 0;
196+}
197+

Subscribers

People subscribed via source and target branches