ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03104
[Branch ~indicator-applet-developers/indicator-messages/trunk] Rev 208: Support for accessiable descriptions of the indicator
Merge authors:
Luke Yelavich (themuso)
Ted Gould (ted)
Related merge proposals:
https://code.launchpad.net/~themuso/indicator-messages/accessible-desc/+merge/49745
proposed by: Luke Yelavich (themuso)
review: Resubmit - Luke Yelavich (themuso)
review: Needs Fixing - Ted Gould (ted)
------------------------------------------------------------
revno: 208 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-02-17 12:05:34 -0600
message:
Support for accessiable descriptions of the indicator
modified:
configure.ac
src/indicator-messages.c
--
lp:indicator-messages
https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk
Your team ayatana-commits is subscribed to branch lp:indicator-messages.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk/+edit-subscription
=== modified file 'configure.ac'
--- configure.ac 2011-01-27 22:57:19 +0000
+++ configure.ac 2011-02-17 18:00:02 +0000
@@ -39,7 +39,7 @@
GIO_UNIX_REQUIRED_VERSION=2.18
PANEL_REQUIRED_VERSION=2.0.0
INDICATE_REQUIRED_VERSION=0.4.90
-INDICATOR_REQUIRED_VERSION=0.3.5
+INDICATOR_REQUIRED_VERSION=0.3.19
DBUSMENUGTK_REQUIRED_VERSION=0.3.94
PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
=== modified file 'src/indicator-messages.c'
--- src/indicator-messages.c 2011-01-27 22:57:04 +0000
+++ src/indicator-messages.c 2011-02-17 18:04:32 +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,34 @@
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));
+
+ GList *entries = indicator_object_get_entries(indicator);
+ IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;
+
+ entry->accessible_desc = get_accessible_desc(indicator);
+
+ g_signal_emit(G_OBJECT(indicator),
+ INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
+ 0,
+ entry,
+ TRUE);
+
+ g_list_free(entries);
+
+ return;
+}
+
/* Initialize the one-timers */
static void
indicator_messages_class_init (IndicatorMessagesClass *klass)
@@ -98,6 +124,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 +158,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 +201,10 @@
if (g_strcmp0("AttentionChanged", signal) == 0) {
if (prop) {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages-new");
+ accessible_desc = _("New Messages");
} else {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages");
+ accessible_desc = _("Messages");
}
} else if (g_strcmp0("IconChanged", signal) == 0) {
if (prop) {
@@ -185,6 +216,8 @@
g_warning("Unknown signal %s", signal);
}
+ update_a11y_desc();
+
return;
}
@@ -205,10 +238,14 @@
if (prop) {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages-new");
+ accessible_desc = _("New Messages");
} else {
indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages");
+ accessible_desc = _("Messages");
}
+ update_a11y_desc();
+
return;
}
@@ -705,3 +742,10 @@
return GTK_MENU(menu);
}
+
+/* Returns the accessible description of the indicator */
+static const gchar *
+get_accessible_desc (IndicatorObject * io)
+{
+ return accessible_desc;
+}