ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03054
[Merge] lp:~themuso/indicator-messages/accessible-desc into lp:indicator-messages
Luke Yelavich has proposed merging lp:~themuso/indicator-messages/accessible-desc into lp:indicator-messages.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
For more details, see:
https://code.launchpad.net/~themuso/indicator-messages/accessible-desc/+merge/49745
--
https://code.launchpad.net/~themuso/indicator-messages/accessible-desc/+merge/49745
Your team ayatana-commits is subscribed to branch lp:indicator-messages.
=== modified file 'src/indicator-messages.c'
--- src/indicator-messages.c 2011-01-27 22:57:04 +0000
+++ src/indicator-messages.c 2011-02-15 00:58:52 +0000
@@ -23,6 +23,7 @@
#include <string.h>
#include <glib.h>
#include <glib-object.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libdbusmenu-gtk/menu.h>
#include <libdbusmenu-gtk/menuitem.h>
@@ -52,6 +53,7 @@
struct _IndicatorMessagesClass {
IndicatorObjectClass parent_class;
+ void (*update_a11y_desc) (IndicatorServiceManager * service, gpointer * user_data);
};
struct _IndicatorMessages {
@@ -71,6 +73,8 @@
static GtkSizeGroup * indicator_right_group = NULL;
static GDBusNodeInfo * bus_node_info = NULL;
static GDBusInterfaceInfo * bus_interface_info = NULL;
+static const gchar * accessible_desc = NULL;
+static IndicatorObject * indicator = NULL;
/* Prototypes */
static void indicator_messages_class_init (IndicatorMessagesClass *klass);
@@ -79,12 +83,26 @@
static void indicator_messages_finalize (GObject *object);
static GtkImage * get_icon (IndicatorObject * io);
static GtkMenu * get_menu (IndicatorObject * io);
+static const gchar * get_accessible_desc (IndicatorObject * io);
static void connection_change (IndicatorServiceManager * sm,
gboolean connected,
gpointer user_data);
G_DEFINE_TYPE (IndicatorMessages, indicator_messages, INDICATOR_OBJECT_TYPE);
+static void
+update_a11y_desc (void)
+{
+ g_return_if_fail(IS_INDICATOR_MESSAGES(indicator));
+
+ g_signal_emit(G_OBJECT(indicator),
+ INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
+ 0,
+ (IndicatorObjectEntry *)indicator_object_get_entries(indicator)->data,
+ TRUE);
+ return;
+}
+
/* Initialize the one-timers */
static void
indicator_messages_class_init (IndicatorMessagesClass *klass)
@@ -98,6 +116,7 @@
io_class->get_image = get_icon;
io_class->get_menu = get_menu;
+ io_class->get_accessible_desc = get_accessible_desc;
if (bus_node_info == NULL) {
GError * error = NULL;
@@ -131,6 +150,8 @@
self->service = indicator_service_manager_new_version(INDICATOR_MESSAGES_DBUS_NAME, 1);
g_signal_connect(self->service, INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_change), self);
+ indicator = INDICATOR_OBJECT(self);
+
return;
}
@@ -172,8 +193,10 @@
if (g_strcmp0("AttentionChanged", signal) == 0) {
if (prop) {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages-new");
+ accessible_desc = g_strdup(_("New Messages"));
} else {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages");
+ accessible_desc = g_strdup(_("Messages"));
}
} else if (g_strcmp0("IconChanged", signal) == 0) {
if (prop) {
@@ -185,6 +208,8 @@
g_warning("Unknown signal %s", signal);
}
+ update_a11y_desc();
+
return;
}
@@ -205,10 +230,14 @@
if (prop) {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages-new");
+ accessible_desc = g_strdup(_("New Messages"));
} else {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages");
+ accessible_desc = g_strdup(_("Messages"));
}
+ update_a11y_desc();
+
return;
}
@@ -705,3 +734,10 @@
return GTK_MENU(menu);
}
+
+/* Returns the accessible description of the indicator */
+static const gchar *
+get_accessible_desc (IndicatorObject * io)
+{
+ return accessible_desc;
+}
Follow ups