diff options
author | Robert Tari <robert@tari.in> | 2022-09-03 01:51:11 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-09-08 20:41:13 +0200 |
commit | 6d68d25b821cc7e717c9fa134f5b1204e13ecf65 (patch) | |
tree | c8483aa056cad3cd328903d719f7fe4e87b0bfce /src/service.vala | |
parent | 23d48f5a9baddfa248ace0675e67a03ae584a128 (diff) | |
download | ayatana-indicator-sound-6d68d25b821cc7e717c9fa134f5b1204e13ecf65.tar.gz ayatana-indicator-sound-6d68d25b821cc7e717c9fa134f5b1204e13ecf65.tar.bz2 ayatana-indicator-sound-6d68d25b821cc7e717c9fa134f5b1204e13ecf65.zip |
Convert Mute menuitem to switch
fixes https://github.com/AyatanaIndicators/ayatana-indicator-sound/issues/83
Diffstat (limited to 'src/service.vala')
-rw-r--r-- | src/service.vala | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/service.vala b/src/service.vala index c2c425c..c437475 100644 --- a/src/service.vala +++ b/src/service.vala @@ -1,6 +1,6 @@ /* * Copyright 2013 Canonical Ltd. - * Copyright 2021 Robert Tari + * Copyright 2021-2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -362,11 +362,23 @@ public class IndicatorSound.Service: Object { SimpleAction mute_action; Action create_mute_action () { - mute_action = new SimpleAction.stateful ("mute", null, new Variant.boolean (this.volume_control.mute)); - mute_action.activate.connect ( (action, param) => { - action.change_state (new Variant.boolean (!action.get_state ().get_boolean ())); - }); + if (AyatanaCommon.utils_is_lomiri()) + { + mute_action = new SimpleAction.stateful ("mute", null, new Variant.boolean (this.volume_control.mute)); + + mute_action.activate.connect ( (action, param) => { + action.change_state (new Variant.boolean (!action.get_state ().get_boolean ())); + }); + } + else + { + mute_action = new SimpleAction.stateful ("mute", VariantType.BOOLEAN, new Variant.boolean (this.volume_control.mute)); + + mute_action.activate.connect ((action, param) => { + action.change_state (param); + }); + } mute_action.change_state.connect ( (action, val) => { volume_control.set_mute (val.get_boolean ()); |