← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/indicator-me/trunk] Rev 130: Add accessible description support

 

Merge authors:
  Luke Yelavich (themuso)
Related merge proposals:
  https://code.launchpad.net/~themuso/indicator-me/accessible-desc/+merge/49752
  proposed by: Luke Yelavich (themuso)
------------------------------------------------------------
revno: 130 [merge]
committer: Ken VanDine <ken.vandine@xxxxxxxxxxxxx>
branch nick: indicator-me
timestamp: Wed 2011-03-02 14:06:50 -0500
message:
  Add accessible description support
modified:
  src/indicator-me.c


--
lp:indicator-me
https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk

Your team ayatana-commits is subscribed to branch lp:indicator-me.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk/+edit-subscription
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c	2011-02-01 14:05:45 +0000
+++ src/indicator-me.c	2011-02-17 00:25:04 +0000
@@ -24,6 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 #include <libdbusmenu-glib/menuitem.h>
@@ -76,10 +77,13 @@
 
 static IdoEntryMenuItem *ido_entry = NULL;
 
+static const gchar *status_desc = NULL;
+
 /* Prototypes */
 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_me_class_init (IndicatorMeClass *klass);
 static void indicator_me_init       (IndicatorMe *self);
@@ -119,6 +123,7 @@
 	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;
 
 	return;
 }
@@ -235,6 +240,16 @@
 	return status_image;
 }
 
+static const gchar *
+get_accessible_desc (IndicatorObject * io)
+{
+	if (label == NULL) {
+		/* Create the label if it doesn't exist already */
+		username_changed (NULL, NULL);
+	}
+	return g_strdup_printf("%s (%s)", gtk_label_get_text(label), status_desc);
+}
+
 static void
 status_icon_cb (GObject * object, GAsyncResult * res, gpointer user_data)
 {
@@ -273,6 +288,20 @@
 		gtk_widget_show(GTK_WIDGET(status_image));
 	}
 
+	if (g_strcmp0(icon, "user-away") == 0) {
+		status_desc = _("Away"));
+	} else if (g_strcmp0(icon, "user-invisible") == 0) {
+		status_desc = _("Invisible"));
+	} else if (g_strcmp0(icon, "user-busy") == 0) {
+		status_desc = _("Busy"));
+	} else if (g_strcmp0(icon, "user-available") == 0) {
+		status_desc = _("Available"));
+	} else if (g_strcmp0(icon, "user-indeterminate") == 0) {
+		status_desc = _("Unknown"));
+	} else if (g_strcmp0(icon, "user-offline") == 0) {
+		status_desc = _("Offline"));
+	}
+
 	gchar *panel_icon = g_strconcat (icon, "-panel", NULL);
 	indicator_image_helper_update (status_image, panel_icon);
 	g_free (panel_icon);