aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-01-29 11:28:58 -0600
committerTed Gould <ted@gould.cx>2015-01-29 11:28:58 -0600
commit30e9118a70ef2ed337ae613b6af55245da5df4f5 (patch)
treedf4cc8d1fcf54489625eed4c08e287a18533d313
parent91b54a8a59cd51813d750efbe01203b7fe1d0e3c (diff)
downloadayatana-indicator-sound-30e9118a70ef2ed337ae613b6af55245da5df4f5.tar.gz
ayatana-indicator-sound-30e9118a70ef2ed337ae613b6af55245da5df4f5.tar.bz2
ayatana-indicator-sound-30e9118a70ef2ed337ae613b6af55245da5df4f5.zip
Add a watcher for the notification server going up and down. Redetect sync notifications depending on it.
-rw-r--r--src/service.vala12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/service.vala b/src/service.vala
index c7e29e7..f4f13ab 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -20,6 +20,11 @@
public class IndicatorSound.Service: Object {
public Service (MediaPlayerList playerlist) {
sync_notification = new Notify.Notification(_("Volume"), "", "audio-volume-muted");
+ this.notification_server_watch = GLib.Bus.watch_name(GLib.BusType.SESSION,
+ "org.freedesktop.Notifications",
+ GLib.BusNameWatcherFlags.NONE,
+ () => { check_sync_notification = false; },
+ () => { check_sync_notification = false; });
this.settings = new Settings ("com.canonical.indicator.sound");
this.sharedsettings = new Settings ("com.ubuntu.sound");
@@ -92,6 +97,11 @@ public class IndicatorSound.Service: Object {
Source.remove (this.sound_was_blocked_timeout_id);
this.sound_was_blocked_timeout_id = 0;
}
+
+ if (this.notification_server_watch != 0) {
+ GLib.Bus.unwatch_name(this.notification_server_watch);
+ this.notification_server_watch = 0;
+ }
}
bool greeter_show_track () {
@@ -175,6 +185,7 @@ public class IndicatorSound.Service: Object {
AccountsServiceUser? accounts_service = null;
bool export_to_accounts_service = false;
private Notify.Notification sync_notification;
+ private uint notification_server_watch;
/* Maximum volume as a scaling factor between the volume action's state and the value in
* this.volume_control. See create_volume_action().
@@ -252,7 +263,6 @@ public class IndicatorSound.Service: Object {
root_action.set_state (builder.end());
}
- /* TODO: Update these if the notification server leaves the bus and restarts */
private bool check_sync_notification = false;
private bool support_sync_notification = false;