aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-04-04 17:09:51 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-04-04 17:09:51 +0200
commite0e9e9bc1e6a0bf393134c9fa6927f2fccc525f2 (patch)
tree014550c281a947e75f0c2b78bc4b87163a62e47c
parent4138cbeb33798018034dff8c0a83ea70850d912f (diff)
downloadayatana-indicator-sound-e0e9e9bc1e6a0bf393134c9fa6927f2fccc525f2.tar.gz
ayatana-indicator-sound-e0e9e9bc1e6a0bf393134c9fa6927f2fccc525f2.tar.bz2
ayatana-indicator-sound-e0e9e9bc1e6a0bf393134c9fa6927f2fccc525f2.zip
Don't add players to the root menu
-rw-r--r--src/service.vala30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/service.vala b/src/service.vala
index cf0f1c2..9b9900c 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -32,7 +32,8 @@ public class IndicatorSound.Service {
this.actions.add_action (this.create_mute_action ());
this.actions.add_action (this.create_volume_action ());
- this.menu = create_base_menu ();
+ this.menu = create_menu ();
+ this.root_menu = create_root_menu (this.menu);
this.players.sync (settings.get_strv ("preferred-media-players"));
this.settings.changed["preferred-media-players"].connect ( () => {
@@ -62,6 +63,7 @@ public class IndicatorSound.Service {
MainLoop loop;
SimpleActionGroup actions;
+ Menu root_menu;
Menu menu;
Settings settings;
VolumeControl volume_control;
@@ -76,16 +78,7 @@ public class IndicatorSound.Service {
}
}
- static Menu create_base_menu () {
- var submenu = new Menu ();
- submenu.append ("Mute", "indicator.mute");
-
- var slider = new MenuItem (null, "indicator.volume");
- slider.set_attribute ("x-canonical-type", "s", "com.canonical.unity.slider");
- submenu.append_item (slider);
-
- submenu.append ("Sound Settingsā€¦", "indicator.settings");
-
+ static Menu create_root_menu (Menu submenu) {
var root = new MenuItem (null, "indicator.root");
root.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");
root.set_submenu (submenu);
@@ -96,6 +89,19 @@ public class IndicatorSound.Service {
return menu;
}
+ static Menu create_menu () {
+ var menu = new Menu ();
+ menu.append ("Mute", "indicator.mute");
+
+ var slider = new MenuItem (null, "indicator.volume");
+ slider.set_attribute ("x-canonical-type", "s", "com.canonical.unity.slider");
+ menu.append_item (slider);
+
+ menu.append ("Sound Settingsā€¦", "indicator.settings");
+
+ return menu;
+ }
+
Action create_mute_action () {
var mute_action = new SimpleAction.stateful ("mute", null, this.volume_control.mute);
@@ -133,7 +139,7 @@ public class IndicatorSound.Service {
void bus_acquired (DBusConnection connection, string name) {
try {
connection.export_action_group ("/com/canonical/indicator/sound", this.actions);
- connection.export_menu_model ("/com/canonical/indicator/sound/desktop", this.menu);
+ connection.export_menu_model ("/com/canonical/indicator/sound/desktop", this.root_menu);
} catch (Error e) {
critical ("%s", e.message);
}