From 5edaee860df00ce8ef28dd244f196b4b3784a9b4 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 20 Apr 2015 16:02:32 -0500 Subject: in SoundService, use BusWatcher to look for Notifications name owner changes --- src/service.vala | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/service.vala b/src/service.vala index 488b993..22be11d 100644 --- a/src/service.vala +++ b/src/service.vala @@ -19,7 +19,6 @@ public class IndicatorSound.Service: Object { DBusConnection bus; - DBusProxy notification_proxy; public Service (MediaPlayerList playerlist, VolumeControl volume, AccountsServiceUser? accounts) { try { @@ -29,18 +28,10 @@ public class IndicatorSound.Service: Object { } sync_notification = new Notify.Notification(_("Volume"), "", "audio-volume-muted"); - try { - this.notification_proxy = new DBusProxy.for_bus_sync(GLib.BusType.SESSION, - DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS | DBusProxyFlags.DO_NOT_AUTO_START, - null, /* interface info */ - "org.freedesktop.Notifications", - "/org/freedesktop/Notifications", - "org.freedesktop.Notifications", - null); - this.notification_proxy.notify["g-name-owner"].connect ( () => { debug("Notifications name owner changed"); check_sync_notification = false; } ); - } catch (GLib.Error e) { - error("Unable to build notification proxy: %s", e.message); - } + BusWatcher.watch_namespace (GLib.BusType.SESSION, + "org.freedesktop.Notifications", + () => { debug("Notifications name appeared"); check_sync_notification = false; }, + () => { debug("Notifications name vanshed"); check_sync_notification = false; }); this.settings = new Settings ("com.canonical.indicator.sound"); this.sharedsettings = new Settings ("com.ubuntu.sound"); -- cgit v1.2.3