aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2022-09-03 01:51:11 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-09-08 20:41:13 +0200
commit6d68d25b821cc7e717c9fa134f5b1204e13ecf65 (patch)
treec8483aa056cad3cd328903d719f7fe4e87b0bfce /src
parent23d48f5a9baddfa248ace0675e67a03ae584a128 (diff)
downloadayatana-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')
-rw-r--r--src/service.vala22
-rw-r--r--src/sound-menu.vala15
2 files changed, 30 insertions, 7 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 ());
diff --git a/src/sound-menu.vala b/src/sound-menu.vala
index fe2b7ff..338f7c1 100644
--- a/src/sound-menu.vala
+++ b/src/sound-menu.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
@@ -49,7 +49,18 @@ public class SoundMenu: Object
this.volume_section = new Menu ();
if ((flags & DisplayFlags.SHOW_MUTE) != 0)
- volume_section.append (_("Mute"), "indicator.mute");
+ {
+ if (AyatanaCommon.utils_is_lomiri())
+ {
+ volume_section.append (_("Mute"), "indicator.mute");
+ }
+ else
+ {
+ var item = new MenuItem (_("Mute"), "indicator.mute(true)");
+ item.set_attribute ("x-ayatana-type", "s", "org.ayatana.indicator.switch");
+ volume_section.append_item (item);
+ }
+ }
if ((flags & DisplayFlags.SHOW_SILENT_MODE) != 0) {
var item = new MenuItem(_("Silent Mode"), "indicator.silent-mode(true)");
item.set_attribute("x-ayatana-type", "s", "org.ayatana.indicator.switch");