Merge lp:~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications into lp:indicator-sound/15.10

Proposed by Charles Kerr
Status: Merged
Approved by: dobey
Approved revision: 493
Merged at revision: 495
Proposed branch: lp:~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications
Merge into: lp:indicator-sound/15.10
Diff against target: 34 lines (+4/-13)
1 file modified
src/service.vala (+4/-13)
To merge this branch: bzr merge lp:~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications
Reviewer Review Type Date Requested Status
dobey (community) Approve
Review via email: mp+258300@code.launchpad.net

Commit message

Use the BusWatcher to look for org.freedesktop.Notifications ownership changes on the bus.

Description of the change

Use BusWatcher, rather than a GDBusProxy, to watch for org.freedesktop.Notifications' owner to change. BusWatcher already handles bus errors gracefully, and as a bonus the resulting service code is slightly simpler.

This crash is happening when there are bigger problems on the system, evidenced by the ticket's description of a blank white screen before this crash shows up. i-sound isn't much use without a working session bus, but at least we can stop it from generating redundant bug reports.

Sibling 15.04 MP: https://code.launchpad.net/~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications/+merge/256861

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/service.vala'
--- src/service.vala 2015-02-27 22:36:17 +0000
+++ src/service.vala 2015-05-05 19:09:37 +0000
@@ -19,7 +19,6 @@
1919
20public class IndicatorSound.Service: Object {20public class IndicatorSound.Service: Object {
21 DBusConnection bus;21 DBusConnection bus;
22 DBusProxy notification_proxy;
2322
24 public Service (MediaPlayerList playerlist, VolumeControl volume, AccountsServiceUser? accounts) {23 public Service (MediaPlayerList playerlist, VolumeControl volume, AccountsServiceUser? accounts) {
25 try {24 try {
@@ -29,18 +28,10 @@
29 }28 }
3029
31 sync_notification = new Notify.Notification(_("Volume"), "", "audio-volume-muted");30 sync_notification = new Notify.Notification(_("Volume"), "", "audio-volume-muted");
32 try {31 BusWatcher.watch_namespace (GLib.BusType.SESSION,
33 this.notification_proxy = new DBusProxy.for_bus_sync(GLib.BusType.SESSION,32 "org.freedesktop.Notifications",
34 DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS | DBusProxyFlags.DO_NOT_AUTO_START,33 () => { debug("Notifications name appeared"); check_sync_notification = false; },
35 null, /* interface info */34 () => { debug("Notifications name vanshed"); check_sync_notification = false; });
36 "org.freedesktop.Notifications",
37 "/org/freedesktop/Notifications",
38 "org.freedesktop.Notifications",
39 null);
40 this.notification_proxy.notify["g-name-owner"].connect ( () => { debug("Notifications name owner changed"); check_sync_notification = false; } );
41 } catch (GLib.Error e) {
42 error("Unable to build notification proxy: %s", e.message);
43 }
4435
45 this.settings = new Settings ("com.canonical.indicator.sound");36 this.settings = new Settings ("com.canonical.indicator.sound");
46 this.sharedsettings = new Settings ("com.ubuntu.sound");37 this.sharedsettings = new Settings ("com.ubuntu.sound");

Subscribers

People subscribed via source and target branches