diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-07-19 12:53:36 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-07-19 13:02:01 +0200 |
commit | 264b421f2e390a877eb175fa797e695e99c81bad (patch) | |
tree | c6f004bc89e547d10f5591847d62c221c583a10f /src/sound-menu.vala | |
parent | a7f70e851dcab16018a422be5c8b18adbd47585a (diff) | |
download | ayatana-indicator-sound-264b421f2e390a877eb175fa797e695e99c81bad.tar.gz ayatana-indicator-sound-264b421f2e390a877eb175fa797e695e99c81bad.tar.bz2 ayatana-indicator-sound-264b421f2e390a877eb175fa797e695e99c81bad.zip |
src/*.vala: make the 'silent mode' switch item & action QMenuModel compatible
QMenuModel, inheritting code from GTK, will consider the menu item not
"activatable" if the item's "target" [1] doesn't match the corresponding
action's parameter. Since we take a boolean as action's parameter (and
we can't change action's parameter easily since it's semi-public), we
instead have to pass "target".
Taking a page from the slider menu items, pass "true" as the target
will make QMenuModel considers the item activatable and reflect the
right state.
[1] i.e. the parameter to pass when activating the action. See
https://wiki.gnome.org/Projects/GLib/GApplication/DBusAPI#Attributes
Related: https://github.com/AyatanaIndicators/qmenumodel/issues/21
Diffstat (limited to 'src/sound-menu.vala')
-rw-r--r-- | src/sound-menu.vala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sound-menu.vala b/src/sound-menu.vala index fc68f91..fe2b7ff 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -51,7 +51,7 @@ public class SoundMenu: Object if ((flags & DisplayFlags.SHOW_MUTE) != 0) volume_section.append (_("Mute"), "indicator.mute"); if ((flags & DisplayFlags.SHOW_SILENT_MODE) != 0) { - var item = new MenuItem(_("Silent Mode"), "indicator.silent-mode"); + var item = new MenuItem(_("Silent Mode"), "indicator.silent-mode(true)"); item.set_attribute("x-ayatana-type", "s", "org.ayatana.indicator.switch"); volume_section.append_item(item); } |