From a67fff57b9a0c12ca90fc37905893891c99234b4 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 8 Aug 2013 16:43:39 -0500 Subject: add accessible-name property to the ng sound indicator --- src/service.vala | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/service.vala') 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 () { -- cgit v1.2.3