diff options
-rw-r--r-- | data/com.canonical.indicator.sound | 2 | ||||
-rw-r--r-- | src/service.vala | 21 | ||||
-rw-r--r-- | src/sound-menu.vala | 4 |
3 files changed, 20 insertions, 7 deletions
diff --git a/data/com.canonical.indicator.sound b/data/com.canonical.indicator.sound index ccea589..adefae9 100644 --- a/data/com.canonical.indicator.sound +++ b/data/com.canonical.indicator.sound @@ -7,7 +7,7 @@ Position=30 ObjectPath=/com/canonical/indicator/sound/desktop [phone] -ObjectPath=/com/canonical/indicator/sound/desktop +ObjectPath=/com/canonical/indicator/sound/phone [desktop_greeter] ObjectPath=/com/canonical/indicator/sound/desktop diff --git a/src/service.vala b/src/service.vala index c1c6306..8fbd871 100644 --- a/src/service.vala +++ b/src/service.vala @@ -37,8 +37,12 @@ public class IndicatorSound.Service { this.actions.add_action (this.create_mic_volume_action ()); this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal); - this.menus.insert ("desktop", new SoundMenu ()); - this.volume_control.bind_property ("active-mic", this.menus.get("desktop"), "show-mic-volume", BindingFlags.SYNC_CREATE); + this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings")); + this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings")); + + this.menus.@foreach ( (profile, menu) => { + this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE); + }); this.players.sync (settings.get_strv ("interested-media-players")); this.settings.changed["interested-media-players"].connect ( () => { @@ -63,7 +67,8 @@ public class IndicatorSound.Service { const ActionEntry[] action_entries = { { "root", null, null, "@a{sv} {}", null }, - { "settings", activate_settings, null, null, null }, + { "desktop-settings", activate_desktop_settings, null, null, null }, + { "phone-settings", activate_phone_settings, null, null, null }, }; MainLoop loop; @@ -74,7 +79,7 @@ public class IndicatorSound.Service { MediaPlayerList players; uint player_action_update_id; - void activate_settings (SimpleAction action, Variant? param) { + void activate_desktop_settings (SimpleAction action, Variant? param) { var env = Environment.get_variable ("DESKTOP_SESSION"); string cmd; if (env == "unity") @@ -91,6 +96,14 @@ public class IndicatorSound.Service { } } + void activate_phone_settings (SimpleAction action, Variant? param) { + try { + Process.spawn_command_line_async ("system-settings sound"); + } catch (Error e) { + warning ("unable to launch sound settings: %s", e.message); + } + } + /* Returns a serialized version of @icon_name suited for the panel */ static Variant serialize_themed_icon (string icon_name) { diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 376ef15..dd50f12 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -19,7 +19,7 @@ class SoundMenu: Object { - public SoundMenu () { + public SoundMenu (string settings_action) { /* 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. @@ -33,7 +33,7 @@ class SoundMenu: Object this.menu = new Menu (); this.menu.append_section (null, volume_section); - this.menu.append (_("Sound Settingsā¦"), "indicator.settings"); + this.menu.append (_("Sound Settingsā¦"), settings_action); var root_item = new MenuItem (null, "indicator.root"); root_item.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root"); |