aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-sound.c
diff options
context:
space:
mode:
authorLuke Yelavich <luke.yelavich@canonical.com>2011-02-14 17:39:57 +1100
committerLuke Yelavich <luke.yelavich@canonical.com>2011-02-14 17:39:57 +1100
commit60c1b7158a58e89c9a1a57eae17028fb4f9f4425 (patch)
tree73d73727c34fe0ca8d259994bbdeeae70a3d742b /src/indicator-sound.c
parentc963e37be35b53d6f9da68a92b2bb9f1d42a788d (diff)
downloadayatana-indicator-sound-60c1b7158a58e89c9a1a57eae17028fb4f9f4425.tar.gz
ayatana-indicator-sound-60c1b7158a58e89c9a1a57eae17028fb4f9f4425.tar.bz2
ayatana-indicator-sound-60c1b7158a58e89c9a1a57eae17028fb4f9f4425.zip
Add accessible_desc support
Diffstat (limited to 'src/indicator-sound.c')
-rw-r--r--src/indicator-sound.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 7e5ebc7..e390623 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -20,6 +20,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <glib.h>
#include <glib-object.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <libdbusmenu-gtk/menu.h>
@@ -66,6 +67,7 @@ G_DEFINE_TYPE (IndicatorSound, indicator_sound, INDICATOR_OBJECT_TYPE);
static GtkLabel * get_label (IndicatorObject * io);
static GtkImage * get_icon (IndicatorObject * io);
static GtkMenu * get_menu (IndicatorObject * io);
+static const gchar * get_accessible_desc (IndicatorObject * io);
static void indicator_sound_scroll (IndicatorObject* io,
gint delta,
IndicatorScrollDirection direction);
@@ -117,6 +119,7 @@ indicator_sound_class_init (IndicatorSoundClass *klass)
io_class->get_label = get_label;
io_class->get_image = get_icon;
io_class->get_menu = get_menu;
+ io_class->get_accessible_desc = get_accessible_desc;
io_class->scroll = indicator_sound_scroll;
}
@@ -207,6 +210,19 @@ get_menu (IndicatorObject * io)
return GTK_MENU(menu);
}
+static const gchar *
+get_accessible_desc (IndicatorObject * io)
+{
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
+
+ if (priv->volume_widget != NULL){
+ return g_strdup_printf(_("Volume (%'.0f%%)"), volume_widget_get_current_volume(priv->volume_widget));
+ }
+
+ return NULL;
+}
+
+
static void
connection_changed (IndicatorServiceManager * sm,
gboolean connected,
@@ -382,8 +398,8 @@ new_volume_slider_widget(DbusmenuMenuitem * newitem,
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
- volume_widget = volume_widget_new (newitem);
io = g_object_get_data (G_OBJECT (client), "indicator");
+ volume_widget = volume_widget_new (newitem, io);
IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
priv->volume_widget = volume_widget;