diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-08-08 16:43:39 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-08-08 16:43:39 -0500 |
commit | a67fff57b9a0c12ca90fc37905893891c99234b4 (patch) | |
tree | 022ed3145d33d0c96dc4259793252a8fa1cba6b6 /src | |
parent | ab72c8871394f1b197e606c2d5b20f149c27138a (diff) | |
download | ayatana-indicator-sound-a67fff57b9a0c12ca90fc37905893891c99234b4.tar.gz ayatana-indicator-sound-a67fff57b9a0c12ca90fc37905893891c99234b4.tar.bz2 ayatana-indicator-sound-a67fff57b9a0c12ca90fc37905893891c99234b4.zip |
add accessible-name property to the ng sound indicator
Diffstat (limited to 'src')
-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 () { |