diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-08-09 22:07:02 +0000 |
---|---|---|
committer | Tarmac <Unknown> | 2013-08-09 22:07:02 +0000 |
commit | d9c75a4725e974945fce3925392ae2a5acd547da (patch) | |
tree | 022ed3145d33d0c96dc4259793252a8fa1cba6b6 /src/service.vala | |
parent | ab72c8871394f1b197e606c2d5b20f149c27138a (diff) | |
parent | a67fff57b9a0c12ca90fc37905893891c99234b4 (diff) | |
download | ayatana-indicator-sound-d9c75a4725e974945fce3925392ae2a5acd547da.tar.gz ayatana-indicator-sound-d9c75a4725e974945fce3925392ae2a5acd547da.tar.bz2 ayatana-indicator-sound-d9c75a4725e974945fce3925392ae2a5acd547da.zip |
Add back an accessible_desc property to the sound indicator.
Approved by Mathieu Trudel-Lapierre, PS Jenkins bot.
Diffstat (limited to 'src/service.vala')
-rw-r--r-- | src/service.vala | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/service.vala b/src/service.vala index 8fbd871..690fdce 100644 --- a/src/service.vala +++ b/src/service.vala @@ -125,8 +125,20 @@ public class IndicatorSound.Service { else icon = "audio-volume-high-panel"; - var root_action = this.actions.lookup ("root") as SimpleAction; - root_action.set_state (new Variant.parsed ("{ 'icon': %v }", serialize_themed_icon (icon))); + string accessible_name; + if (this.volume_control.mute) { + accessible_name = "Volume (muted)"; + } else { + int volume_int = (int)(volume * 100); + accessible_name = @"Volume ($volume_int%)"; + } + + var root_action = actions.lookup ("root") as SimpleAction; + var builder = new VariantBuilder (new VariantType ("a{sv}")); + builder.add ("{sv}", "accessible-desc", new Variant.string (accessible_name)); + builder.add ("{sv}", "icon", serialize_themed_icon (icon)); + builder.add ("{sv}", "visible", new Variant.boolean (true)); + root_action.set_state (builder.end()); } Action create_mute_action () { |