aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-04-20 16:02:32 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-04-20 16:02:32 -0500
commit5edaee860df00ce8ef28dd244f196b4b3784a9b4 (patch)
tree078c12ec58fc1681f0033fd30b3b11b31b744a38
parent549069be2aaee5f13a4fa56539ef4a8ece972e8b (diff)
downloadayatana-indicator-sound-5edaee860df00ce8ef28dd244f196b4b3784a9b4.tar.gz
ayatana-indicator-sound-5edaee860df00ce8ef28dd244f196b4b3784a9b4.tar.bz2
ayatana-indicator-sound-5edaee860df00ce8ef28dd244f196b4b3784a9b4.zip
in SoundService, use BusWatcher to look for Notifications name owner changes
-rw-r--r--src/service.vala17
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");