From cbf07a1b51b423cf125456622f7f48b9c81c89ff Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Mon, 14 Feb 2011 17:50:27 +1100 Subject: Add accessible description support --- src/indicator-messages.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 8a94a85..ebf670d 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -23,6 +23,7 @@ with this program. If not, see . #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ typedef struct _IndicatorMessagesClass IndicatorMessagesClass; struct _IndicatorMessagesClass { IndicatorObjectClass parent_class; + void (*update_a11y_desc) (IndicatorServiceManager * service, gpointer * user_data); }; struct _IndicatorMessages { @@ -71,6 +73,8 @@ static GDBusProxy * icon_proxy = NULL; 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_dispose (GObject *object); 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 @@ indicator_messages_class_init (IndicatorMessagesClass *klass) 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 @@ indicator_messages_init (IndicatorMessages *self) 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 @@ proxy_signal (GDBusProxy * proxy, const gchar * sender, const gchar * signal, GV 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 @@ proxy_signal (GDBusProxy * proxy, const gchar * sender, const gchar * signal, GV g_warning("Unknown signal %s", signal); } + update_a11y_desc(); + return; } @@ -205,10 +230,14 @@ attention_cb (GObject * object, GAsyncResult * ares, gpointer user_data) 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 @@ get_menu (IndicatorObject * io) return GTK_MENU(menu); } + +/* Returns the accessible description of the indicator */ +static const gchar * +get_accessible_desc (IndicatorObject * io) +{ + return accessible_desc; +} -- cgit v1.2.3 From a8a74beaa9b5b368a037c9b2fb592a89cb43ecc0 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Thu, 17 Feb 2011 09:56:38 +1100 Subject: No need to use g_strdup, the variable is a const --- src/indicator-messages.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index ebf670d..77a7b70 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -193,10 +193,10 @@ proxy_signal (GDBusProxy * proxy, const gchar * sender, const gchar * signal, GV 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")); + accessible_desc = _("New Messages"); } else { indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages"); - accessible_desc = g_strdup(_("Messages")); + accessible_desc = _("Messages"); } } else if (g_strcmp0("IconChanged", signal) == 0) { if (prop) { -- cgit v1.2.3 From 633b340034c355a8c2883894f5c61824184a59fa Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Thu, 17 Feb 2011 11:14:11 +1100 Subject: Store entry data in a variable so it can be freed after signaling an accessible description change, preventing a memory leak. --- src/indicator-messages.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 77a7b70..9c57856 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -94,12 +94,15 @@ static void update_a11y_desc (void) { g_return_if_fail(IS_INDICATOR_MESSAGES(indicator)); + GList *entry = indicator_object_get_entries(indicator); g_signal_emit(G_OBJECT(indicator), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, - 0, - (IndicatorObjectEntry *)indicator_object_get_entries(indicator)->data, + 0, + entry->data, TRUE); + g_list_free(entry); + return; } -- cgit v1.2.3 From e1c268aa248f8998497221a0245796a943980ef5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 11:59:42 -0600 Subject: Updating the description when we signal that it's changed --- src/indicator-messages.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 9c57856..aff4785 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -94,14 +94,19 @@ static void update_a11y_desc (void) { g_return_if_fail(IS_INDICATOR_MESSAGES(indicator)); - GList *entry = indicator_object_get_entries(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->data, - TRUE); - g_list_free(entry); + entry, + TRUE); + + g_list_free(entries); return; } -- cgit v1.2.3 From 699cb119b90390139f6136a325ed7f6e50684888 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 12:00:02 -0600 Subject: Updating libindicator required version --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 721805e..5f728f7 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ GTK_REQUIRED_VERSION=2.12 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 -- cgit v1.2.3 From 22fe0467f3be10a6f05c7d3e9f72cce94cf02d35 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 12:04:32 -0600 Subject: Removing an unneeded strdup --- src/indicator-messages.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index aff4785..ed6caa6 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -238,10 +238,10 @@ attention_cb (GObject * object, GAsyncResult * ares, gpointer user_data) if (prop) { indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages-new"); - accessible_desc = g_strdup(_("New Messages")); + accessible_desc = _("New Messages"); } else { indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages"); - accessible_desc = g_strdup(_("Messages")); + accessible_desc = _("Messages"); } update_a11y_desc(); -- cgit v1.2.3 From e2405bdf66f16449efda8001e4ed09915ac5cc59 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 12:09:26 -0600 Subject: 0.3.92 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5f728f7..962b6f0 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-messages.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-messages, 0.3.91) +AM_INIT_AUTOMAKE(indicator-messages, 0.3.92) AM_MAINTAINER_MODE -- cgit v1.2.3 From e49e67cc92c2e7a41e24c94afcf4fc763603b815 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 12:17:15 -0600 Subject: debian/control: libindicator version 0.3.19 --- debian/changelog | 3 ++- debian/control | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index d8b7f52..1f94b8b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ indicator-messages (0.3.92-0ubuntu1~ppa1) UNRELEASED; urgency=low * New upstream release. * Adding in accessible description support + * debian/control: libindicator version 0.3.19 - -- Ted Gould Thu, 17 Feb 2011 12:14:41 -0600 + -- Ted Gould Thu, 17 Feb 2011 12:17:02 -0600 indicator-messages (0.3.91-0ubuntu1) natty; urgency=low diff --git a/debian/control b/debian/control index 7029e65..dbebc17 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ Build-Depends: debhelper (>= 5.0), intltool, libindicate-dev (>= 0.4.91), libindicate-gtk-dev (>= 0.4.91), - libindicator-dev (>= 0.3.14), + libindicator-dev (>= 0.3.19), libdbusmenu-gtk-dev (>= 0.3.94), libdbusmenu-glib-dev (>= 0.3.94) Standards-Version: 3.8.4 -- cgit v1.2.3 From a5f40dd94444f5f5bdcb9e330adc9ab0c0a95cdd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 12:18:37 -0600 Subject: releasing version 0.3.92-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1f94b8b..bb54106 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-messages (0.3.92-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-messages (0.3.92-0ubuntu1~ppa1) natty; urgency=low * New upstream release. * Adding in accessible description support * debian/control: libindicator version 0.3.19 - -- Ted Gould Thu, 17 Feb 2011 12:17:02 -0600 + -- Ted Gould Thu, 17 Feb 2011 12:18:32 -0600 indicator-messages (0.3.91-0ubuntu1) natty; urgency=low -- cgit v1.2.3