aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-05-08 12:20:03 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-05-08 12:20:03 +0000
commit4426cc225d2421b34b026451a561bb0b4b62144b (patch)
treeac9cca4d482bcc06c6f3cccbb16b54eab6a05048
parentc71c78e9e16e381b0104ed1e6934b80068e51ab1 (diff)
parent5edaee860df00ce8ef28dd244f196b4b3784a9b4 (diff)
downloadayatana-indicator-sound-4426cc225d2421b34b026451a561bb0b4b62144b.tar.gz
ayatana-indicator-sound-4426cc225d2421b34b026451a561bb0b4b62144b.tar.bz2
ayatana-indicator-sound-4426cc225d2421b34b026451a561bb0b4b62144b.zip
Use the BusWatcher to look for org.freedesktop.Notifications ownership changes on the bus. Fixes: #1432446
Approved by: PS Jenkins bot, Rodney Dawes
-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");