aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-12-01 12:22:00 +0100
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-12-01 12:22:00 +0100
commit7c69f81a079a08d58241cc50365dde7d37ad3345 (patch)
tree3fcc2d43b3660ee53da481760545764acf9ebf99
parent9da17031233db5f7961f3dd7be69c8a3bc13bb27 (diff)
downloadayatana-indicator-sound-7c69f81a079a08d58241cc50365dde7d37ad3345.tar.gz
ayatana-indicator-sound-7c69f81a079a08d58241cc50365dde7d37ad3345.tar.bz2
ayatana-indicator-sound-7c69f81a079a08d58241cc50365dde7d37ad3345.zip
Added action to sync volume with UI
-rw-r--r--src/service.vala16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/service.vala b/src/service.vala
index 985d434..8f90547 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -40,7 +40,11 @@ public class IndicatorSound.Service: Object {
warn_notification.set_hint ("x-canonical-non-shaped-icon", "true");
warn_notification.set_hint ("x-canonical-snap-decisions", "true");
warn_notification.set_hint ("x-canonical-private-affirmative-tint", "true");
- warn_notification.closed.connect((n) => { n.clear_actions(); waiting_user_approve_warn=false; });
+ warn_notification.closed.connect((n) => {
+ n.clear_actions();
+ waiting_user_approve_warn=false;
+ volume_sync_action.set_state(volume_sync_number_++);
+ });
BusWatcher.watch_namespace (GLib.BusType.SESSION,
"org.freedesktop.Notifications",
() => { debug("Notifications name appeared"); },
@@ -77,6 +81,7 @@ public class IndicatorSound.Service: Object {
this.actions.add_action (this.create_volume_action ());
this.actions.add_action (this.create_mic_volume_action ());
this.actions.add_action (this.create_high_volume_action ());
+ this.actions.add_action (this.create_volume_sync_action ());
this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal);
this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS));
@@ -634,6 +639,7 @@ public class IndicatorSound.Service: Object {
warn_notification.add_action ("cancel", _("Cancel"), (n, a) => {
_pre_warn_volume = null;
waiting_user_approve_warn = false;
+ volume_sync_action.set_state(volume_sync_number_++);
});
waiting_user_approve_warn = true;
show_notification(warn_notification);
@@ -818,6 +824,14 @@ public class IndicatorSound.Service: Object {
return high_volume_action;
}
+ SimpleAction volume_sync_action;
+ uint64 volume_sync_number_ = 0;
+ Action create_volume_sync_action () {
+ volume_sync_action = new SimpleAction.stateful("volume-sync", null, new Variant.uint64 (volume_sync_number_));
+
+ return volume_sync_action;
+ }
+
uint export_actions = 0;
Variant action_state_for_player (MediaPlayer player, bool show_track = true) {