aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-07-25 16:38:15 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-07-25 16:38:15 +0200
commitce5583c3d5c8f4cf390936ef567c7088062675df (patch)
tree7fc36fabcf623a4a4c7946558dcb512790479f31 /src/service.vala
parent997864b9fc62596e8cc238f4c4b77d780651ffb4 (diff)
downloadayatana-indicator-sound-ce5583c3d5c8f4cf390936ef567c7088062675df.tar.gz
ayatana-indicator-sound-ce5583c3d5c8f4cf390936ef567c7088062675df.tar.bz2
ayatana-indicator-sound-ce5583c3d5c8f4cf390936ef567c7088062675df.zip
Export phone menu
For now, this does the same as the one on the desktop, except for starting the the phone's settings ui.
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala21
1 files changed, 17 insertions, 4 deletions
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)
{