diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-07-19 10:39:34 +0200 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-07-19 10:39:34 +0200 |
commit | 812adbd27ed4f5af7a0a78c9ad62e4b9337d8c0a (patch) | |
tree | 8363f1c95541a2556838fa74b8fe82e4aee90101 | |
parent | 5b88f582d23fb2b4af0335b99f315a5803ccdca0 (diff) | |
download | ayatana-indicator-sound-812adbd27ed4f5af7a0a78c9ad62e4b9337d8c0a.tar.gz ayatana-indicator-sound-812adbd27ed4f5af7a0a78c9ad62e4b9337d8c0a.tar.bz2 ayatana-indicator-sound-812adbd27ed4f5af7a0a78c9ad62e4b9337d8c0a.zip |
Specify fallback icons
The *-panel suffix is only used by the ubuntu-mono icon themes.
-rw-r--r-- | src/service.vala | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/service.vala b/src/service.vala index 3d14d5e..e13c02e 100644 --- a/src/service.vala +++ b/src/service.vala @@ -62,7 +62,7 @@ public class IndicatorSound.Service { } const ActionEntry[] action_entries = { - { "root", null, null, "{ 'icon': <'audio-volume-high-panel'> }", null }, + { "root", null, null, "@a{sv} {}", null }, { "settings", activate_settings, null, null, null }, }; @@ -92,6 +92,13 @@ public class IndicatorSound.Service { } } + /* Returns a serialized version of @icon_name suited for the panel */ + static Variant serialize_themed_icon (string icon_name) + { + var icon = new ThemedIcon.with_default_fallbacks (icon_name); + return g_icon_serialize (icon); + } + 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"); @@ -109,8 +116,8 @@ public class IndicatorSound.Service { var slider = new MenuItem (null, "indicator.volume"); slider.set_attribute ("x-canonical-type", "s", "com.canonical.unity.slider"); - slider.set_attribute_value ("min-icon", g_icon_serialize (new ThemedIcon ("audio-volume-low-zero-panel"))); - slider.set_attribute_value ("max-icon", g_icon_serialize (new ThemedIcon ("audio-volume-high-panel"))); + slider.set_attribute_value ("min-icon", serialize_themed_icon ("audio-volume-low-zero-panel")); + slider.set_attribute_value ("max-icon", serialize_themed_icon ("audio-volume-high-panel")); slider.set_attribute ("min-value", "d", 0.0); slider.set_attribute ("max-value", "d", 1.0); slider.set_attribute ("step", "d", 0.01); @@ -129,8 +136,8 @@ public class IndicatorSound.Service { if (volume_section.get_n_items () < 3) { var slider = new MenuItem (null, "indicator.mic-volume"); slider.set_attribute ("x-canonical-type", "s", "com.canonical.unity.slider"); - slider.set_attribute_value ("min-icon", g_icon_serialize (new ThemedIcon ("audio-input-microphone-low-zero-panel"))); - slider.set_attribute_value ("max-icon", g_icon_serialize (new ThemedIcon ("audio-input-microphone-high-panel"))); + slider.set_attribute_value ("min-icon", serialize_themed_icon ("audio-input-microphone-low-zero-panel")); + slider.set_attribute_value ("max-icon", serialize_themed_icon ("audio-input-microphone-high-panel")); slider.set_attribute ("min-value", "d", 0.0); slider.set_attribute ("max-value", "d", 1.0); slider.set_attribute ("step", "d", 0.01); @@ -158,7 +165,7 @@ public class IndicatorSound.Service { icon = "audio-volume-high-panel"; var root_action = this.actions.lookup ("root") as SimpleAction; - root_action.set_state (new Variant.parsed ("{ 'icon': <%s> }", icon)); + root_action.set_state (new Variant.parsed ("{ 'icon': %v }", serialize_themed_icon (icon))); } Action create_mute_action () { |