diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2015-05-07 15:26:57 +0000 |
---|---|---|
committer | CI Train Bot <ci-train-bot@canonical.com> | 2015-05-07 15:26:57 +0000 |
commit | 28f2e8012bfcf5307ac3a48b2f755fcae5006231 (patch) | |
tree | ac9cca4d482bcc06c6f3cccbb16b54eab6a05048 /src/service.vala | |
parent | c71c78e9e16e381b0104ed1e6934b80068e51ab1 (diff) | |
parent | 5edaee860df00ce8ef28dd244f196b4b3784a9b4 (diff) | |
download | ayatana-indicator-sound-28f2e8012bfcf5307ac3a48b2f755fcae5006231.tar.gz ayatana-indicator-sound-28f2e8012bfcf5307ac3a48b2f755fcae5006231.tar.bz2 ayatana-indicator-sound-28f2e8012bfcf5307ac3a48b2f755fcae5006231.zip |
Use the BusWatcher to look for org.freedesktop.Notifications ownership changes on the bus. Fixes: #1432446
Approved by: Rodney Dawes
Diffstat (limited to 'src/service.vala')
-rw-r--r-- | src/service.vala | 17 |
1 files 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"); |