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
=== modified file '.bzrignore'
--- .bzrignore 2009-05-26 12:46:56 +0000
+++ .bzrignore 2009-05-28 15:29:41 +0000
@@ -18,3 +18,4 @@
18src/libmessaging_la-app-menu-item.lo18src/libmessaging_la-app-menu-item.lo
19data/indicator-messages.service19data/indicator-messages.service
20indicator-messages-service20indicator-messages-service
21indicator-messages-service-activate
2122
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2009-05-26 12:37:53 +0000
+++ data/Makefile.am 2009-05-27 10:51:24 +0000
@@ -1,4 +1,4 @@
1SUBDIRS = icons1SUBDIRS = icons
22
3dbus_servicesdir = $(dbusservicedir)3dbus_servicesdir = $(DBUSSERVICEDIR)
4dbus_services_DATA = indicator-messages.service4dbus_services_DATA = indicator-messages.service
55
=== modified file 'data/indicator-messages.service.in'
--- data/indicator-messages.service.in 2009-05-26 12:24:24 +0000
+++ data/indicator-messages.service.in 2009-05-28 15:33:26 +0000
@@ -1,3 +1,3 @@
1[Indicator Messages]1[D-BUS Service]
2Name=com.ubuntu.indicator.messages2Name=com.ubuntu.indicator.messages
3Exec=@prefix@/bin/indicator-messages-service3Exec=@prefix@/bin/indicator-messages-service
44
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2009-05-26 12:46:56 +0000
+++ src/Makefile.am 2009-05-28 15:19:48 +0000
@@ -4,10 +4,10 @@
4messaginglibdir = $(INDICATORDIR)4messaginglibdir = $(INDICATORDIR)
5messaginglib_LTLIBRARIES = libmessaging.la5messaginglib_LTLIBRARIES = libmessaging.la
6libmessaging_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
7libmessaging_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
8libmessaging_la_LIBADD = $(APPLET_LIBS)8libmessaging_la_LIBADD = $(APPLET_LIBS)
9libmessaging_la_LDFLAGS = -module -avoid-version9libmessaging_la_LDFLAGS = -module -avoid-version
1010
11indicator_messages_service_SOURCES = indicator-service.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h11indicator_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-needed12indicator_messages_service_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror
13indicator_messages_service_LDADD = $(APPLET_LIBS)13indicator_messages_service_LDADD = $(APPLET_LIBS)
1414
=== modified file 'src/indicator-messages.c'
--- src/indicator-messages.c 2009-05-25 22:43:17 +0000
+++ src/indicator-messages.c 2009-05-28 15:20:23 +0000
@@ -23,6 +23,8 @@
23#include <string.h>23#include <string.h>
24#include <gtk/gtk.h>24#include <gtk/gtk.h>
25#include <libdbusmenu-gtk/menu.h>25#include <libdbusmenu-gtk/menu.h>
26#include <dbus/dbus-glib.h>
27#include <dbus/dbus-glib-bindings.h>
2628
27#include <libindicator/indicator.h>29#include <libindicator/indicator.h>
28INDICATOR_SET_VERSION30INDICATOR_SET_VERSION
@@ -57,6 +59,23 @@
57GtkMenu *59GtkMenu *
58get_menu (void)60get_menu (void)
59{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
60 return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT));79 return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT));
61}80}
6281
6382
=== modified file 'src/indicator-service.c'
--- src/indicator-service.c 2009-05-26 16:05:48 +0000
+++ src/indicator-service.c 2009-05-27 08:44:37 +0000
@@ -21,6 +21,7 @@
21*/21*/
2222
23#include <string.h>23#include <string.h>
24#include <dbus/dbus-glib-bindings.h>
24#include <libindicate/listener.h>25#include <libindicate/listener.h>
2526
26#include <libdbusmenu-glib/server.h>27#include <libdbusmenu-glib/server.h>
@@ -292,14 +293,6 @@
292}293}
293294
294static void295static void
295dbusmenu_menuitem_child_reorder(DbusmenuMenuitem * base, DbusmenuMenuitem * child, guint position)
296{
297 dbusmenu_menuitem_child_delete(base, child);
298 dbusmenu_menuitem_child_add_position(base, child, position);
299 return;
300}
301
302static void
303reconsile_list_and_menu (GList * serverlist, DbusmenuMenuitem * menushell)296reconsile_list_and_menu (GList * serverlist, DbusmenuMenuitem * menushell)
304{297{
305 guint position = 0;298 guint position = 0;
@@ -477,6 +470,21 @@
477{470{
478 g_type_init();471 g_type_init();
479472
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
480 listener = indicate_listener_ref_default();488 listener = indicate_listener_ref_default();
481 serverList = NULL;489 serverList = NULL;
482490
483491
=== 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