← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~themuso/indicator-me/accessible-desc into lp:indicator-me

 

Luke Yelavich has proposed merging lp:~themuso/indicator-me/accessible-desc into lp:indicator-me.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)

For more details, see:
https://code.launchpad.net/~themuso/indicator-me/accessible-desc/+merge/49752
-- 
https://code.launchpad.net/~themuso/indicator-me/accessible-desc/+merge/49752
Your team ayatana-commits is subscribed to branch lp:indicator-me.
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c	2011-02-01 14:05:45 +0000
+++ src/indicator-me.c	2011-02-15 01:16:17 +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 = g_strdup(_("Away"));
+	} else if (g_strcmp0(icon, "user-invisible") == 0) {
+		status_desc = g_strdup(_("Invisible"));
+	} else if (g_strcmp0(icon, "user-busy") == 0) {
+		status_desc = g_strdup(_("Busy"));
+	} else if (g_strcmp0(icon, "user-available") == 0) {
+		status_desc = g_strdup(_("Available"));
+	} else if (g_strcmp0(icon, "user-indeterminate") == 0) {
+		status_desc = g_strdup(_("Unknown"));
+	} else if (g_strcmp0(icon, "user-offline") == 0) {
+		status_desc = g_strdup(_("Offline"));
+	}
+
 	gchar *panel_icon = g_strconcat (icon, "-panel", NULL);
 	indicator_image_helper_update (status_image, panel_icon);
 	g_free (panel_icon);


Follow ups