From 57982f343b03175c20a4b51ccb5c853588613935 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 3 Dec 2014 09:52:32 -0600 Subject: Add an action to track whether the indicator is shown so that we can not show notifications if it is open --- src/service.vala | 5 +++++ src/sound-menu.vala | 1 + 2 files changed, 6 insertions(+) diff --git a/src/service.vala b/src/service.vala index c74b2eb..48b0cbe 100644 --- a/src/service.vala +++ b/src/service.vala @@ -146,6 +146,7 @@ public class IndicatorSound.Service: Object { { "scroll", activate_scroll_action, "i", null, null }, { "desktop-settings", activate_desktop_settings, null, null, null }, { "phone-settings", activate_phone_settings, null, null, null }, + { "indicator-shown", null, null, "@b false", null }, }; MainLoop loop; @@ -255,6 +256,10 @@ public class IndicatorSound.Service: Object { if (!support_sync_notification) return; + var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction; + if (shown_action != null && shown_action.get_state().get_boolean()) + return; + /* Determine Label */ string volume_label = ""; if (volume_control.high_volume) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 3881faf..96dd143 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -60,6 +60,7 @@ public class SoundMenu: Object root_item.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root"); root_item.set_attribute ("x-canonical-scroll-action", "s", "indicator.scroll"); root_item.set_attribute ("x-canonical-secondary-action", "s", "indicator.mute"); + root_item.set_attribute ("submenu-action", "s", "indicator.indicator-shown"); root_item.set_submenu (this.menu); this.root = new Menu (); -- cgit v1.2.3