From 071576b6e7b3d979c1fcefd611b67bac171f2877 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 10 Oct 2013 15:46:54 +0200 Subject: Replace 'mute' boolean by a flag in the SoundMenu constructor This makes the code calling the constructor more readable and allows for extensibility. --- src/sound-menu.vala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/sound-menu.vala') diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 9d0c521..25234d9 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -22,14 +22,19 @@ extern Variant? g_icon_serialize (Icon icon); class SoundMenu: Object { - public SoundMenu (bool show_mute, string? settings_action) { + public enum DisplayFlags { + NONE = 0, + SHOW_MUTE = 1 + } + + public SoundMenu (string? settings_action, DisplayFlags flags) { /* A sound menu always has at least two sections: the volume section (this.volume_section) * at the start of the menu, and the settings section at the end. Between those two, * it has a dynamic amount of player sections, one for each registered player. */ this.volume_section = new Menu (); - if (show_mute) + if ((flags & DisplayFlags.SHOW_MUTE) != 0) volume_section.append (_("Mute"), "indicator.mute"); volume_section.append_item (this.create_slider_menu_item ("indicator.volume", 0.0, 1.0, 0.01, "audio-volume-low-zero-panel", -- cgit v1.2.3