Merge lp:~macslow/notify-osd/exit-if-being-replaced into lp:notify-osd

Proposed by Mirco Müller
Status: Merged
Approved by: Michał Sawicz
Approved revision: 473
Merged at revision: 473
Proposed branch: lp:~macslow/notify-osd/exit-if-being-replaced
Merge into: lp:notify-osd
Prerequisite: lp:~larsu/notify-osd/allow-being-replaced
Diff against target: 56 lines (+17/-1)
2 files modified
src/dbus.c (+4/-1)
src/main.c (+13/-0)
To merge this branch: bzr merge lp:~macslow/notify-osd/exit-if-being-replaced
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+193121@code.launchpad.net

Commit message

Watch "NameLost" signal on DBus and exit if received.

Description of the change

* fix crucial typo
* fix a small mem-leak
* make notify-osd watch "NameLost" DBus-signal and quit, if other process takes ownership of notification-service

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Yup, this is working!

review: Approve
Revision history for this message
Lars Karlitski (larsu) wrote :

Connecting gtk_main_quit() directly to the NameLost signal is a bit ugly but will definitely work.

Thanks for fixing this Mirco!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dbus.c'
2--- src/dbus.c 2013-10-29 18:32:15 +0000
3+++ src/dbus.c 2013-10-29 18:32:15 +0000
4@@ -67,7 +67,7 @@
5
6 proxy = dbus_g_proxy_new_for_name (connection,
7 "org.freedesktop.DBus",
8- "/org/freedesktop/Dbus",
9+ "/org/freedesktop/DBus",
10 "org.freedesktop.DBus");
11 error = NULL;
12 if (!dbus_g_proxy_call (proxy,
13@@ -83,9 +83,12 @@
14 "Got error \"%s\"\n",
15 error->message);
16 g_error_free (error);
17+ g_object_unref (proxy);
18 return NULL;
19 }
20
21+ g_object_unref (proxy);
22+
23 if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
24 {
25 g_warning ("Another instance has already registered %s", service_name);
26
27=== modified file 'src/main.c'
28--- src/main.c 2009-03-19 09:30:11 +0000
29+++ src/main.c 2013-10-29 18:32:15 +0000
30@@ -70,6 +70,18 @@
31 return 0;
32 }
33
34+ DBusGProxy* proxy = dbus_g_proxy_new_for_name (connection,
35+ "org.freedesktop.DBus",
36+ "/org/freedesktop/DBus",
37+ "org.freedesktop.DBus");
38+
39+ dbus_g_proxy_add_signal (proxy, "NameLost", G_TYPE_STRING, G_TYPE_INVALID);
40+ dbus_g_proxy_connect_signal (proxy,
41+ "NameLost",
42+ gtk_main_quit,
43+ NULL,
44+ NULL);
45+
46 dbus_g_connection_register_g_object (connection,
47 DBUS_PATH,
48 G_OBJECT (stack));
49@@ -77,6 +89,7 @@
50 gtk_main ();
51
52 stack_del (stack);
53+ g_object_unref (proxy);
54
55 return 0;
56 }

Subscribers

People subscribed via source and target branches