aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-02-24 12:59:40 -0600
committerTed Gould <ted@gould.cx>2015-02-24 12:59:40 -0600
commitd41efaf10217625c18ce64c257a104301fe03082 (patch)
tree96b6d169eaf369c6e76447dd6f347f36615a9c77 /src
parentdc2a1411a7989c54f71698605c3405a0de84a263 (diff)
downloadayatana-indicator-sound-d41efaf10217625c18ce64c257a104301fe03082.tar.gz
ayatana-indicator-sound-d41efaf10217625c18ce64c257a104301fe03082.tar.bz2
ayatana-indicator-sound-d41efaf10217625c18ce64c257a104301fe03082.zip
Switch to using a state variable based on the change
Diffstat (limited to 'src')
-rw-r--r--src/service.vala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/service.vala b/src/service.vala
index 0c82538..926decf 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -97,12 +97,16 @@ public class IndicatorSound.Service: Object {
/* Hide the notification when the menu is shown */
var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction;
shown_action.change_state.connect ((state) => {
- if (state.get_boolean()) {
+ block_notifications = state.get_boolean();
+ if (block_notifications) {
+ debug("Indicator is shown");
try {
sync_notification.close();
} catch (Error e) {
warning("Unable to close synchronous volume notification: %s", e.message);
}
+ } else {
+ debug("Indicator is hidden");
}
});
@@ -280,6 +284,7 @@ public class IndicatorSound.Service: Object {
private bool check_sync_notification = false;
private bool support_sync_notification = false;
+ private bool block_notifications = false;
void update_sync_notification () {
if (!check_sync_notification) {
@@ -294,8 +299,7 @@ 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())
+ if (block_notifications)
return;
/* Determine Label */