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
=== modified file 'src/dbus.c'
--- src/dbus.c 2013-10-29 18:32:15 +0000
+++ src/dbus.c 2013-10-29 18:32:15 +0000
@@ -67,7 +67,7 @@
6767
68 proxy = dbus_g_proxy_new_for_name (connection,68 proxy = dbus_g_proxy_new_for_name (connection,
69 "org.freedesktop.DBus",69 "org.freedesktop.DBus",
70 "/org/freedesktop/Dbus",70 "/org/freedesktop/DBus",
71 "org.freedesktop.DBus");71 "org.freedesktop.DBus");
72 error = NULL;72 error = NULL;
73 if (!dbus_g_proxy_call (proxy,73 if (!dbus_g_proxy_call (proxy,
@@ -83,9 +83,12 @@
83 "Got error \"%s\"\n",83 "Got error \"%s\"\n",
84 error->message);84 error->message);
85 g_error_free (error);85 g_error_free (error);
86 g_object_unref (proxy);
86 return NULL;87 return NULL;
87 }88 }
8889
90 g_object_unref (proxy);
91
89 if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)92 if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
90 {93 {
91 g_warning ("Another instance has already registered %s", service_name);94 g_warning ("Another instance has already registered %s", service_name);
9295
=== modified file 'src/main.c'
--- src/main.c 2009-03-19 09:30:11 +0000
+++ src/main.c 2013-10-29 18:32:15 +0000
@@ -70,6 +70,18 @@
70 return 0;70 return 0;
71 }71 }
7272
73 DBusGProxy* proxy = dbus_g_proxy_new_for_name (connection,
74 "org.freedesktop.DBus",
75 "/org/freedesktop/DBus",
76 "org.freedesktop.DBus");
77
78 dbus_g_proxy_add_signal (proxy, "NameLost", G_TYPE_STRING, G_TYPE_INVALID);
79 dbus_g_proxy_connect_signal (proxy,
80 "NameLost",
81 gtk_main_quit,
82 NULL,
83 NULL);
84
73 dbus_g_connection_register_g_object (connection,85 dbus_g_connection_register_g_object (connection,
74 DBUS_PATH,86 DBUS_PATH,
75 G_OBJECT (stack));87 G_OBJECT (stack));
@@ -77,6 +89,7 @@
77 gtk_main ();89 gtk_main ();
7890
79 stack_del (stack);91 stack_del (stack);
92 g_object_unref (proxy);
8093
81 return 0;94 return 0;
82}95}

Subscribers

People subscribed via source and target branches