← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/indicator-applet/applet] Rev 381: Adding support for accessible descriptions

 

Merge authors:
  Luke Yelavich (themuso)
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~themuso/indicator-applet/accessible-desc/+merge/49586
  proposed by: Luke Yelavich (themuso)
  review: Needs Information - Ted Gould (ted)
------------------------------------------------------------
revno: 381 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-02-17 14:52:24 -0600
message:
  Adding support for accessible descriptions
modified:
  configure.ac
  src/applet-main.c


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

Your team ayatana-commits is subscribed to branch lp:indicator-applet.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-applet/applet/+edit-subscription
=== modified file 'configure.ac'
--- configure.ac	2011-02-03 20:28:06 +0000
+++ configure.ac	2011-02-17 20:51:44 +0000
@@ -26,7 +26,7 @@
 ###########################
 
 GTK_REQUIRED_VERSION=2.12
-INDICATOR_REQUIRED_VERSION=0.3.18
+INDICATOR_REQUIRED_VERSION=0.3.19
 
 PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
                           x11

=== modified file 'src/applet-main.c'
--- src/applet-main.c	2011-01-31 20:27:31 +0000
+++ src/applet-main.c	2011-02-17 20:51:09 +0000
@@ -55,6 +55,7 @@
                         				         GdkColor                  *colour,
                         				         GdkPixmap                 *pixmap,
                                          GtkWidget                 *menubar);
+static void update_accessible_desc (IndicatorObjectEntry * entry, GtkWidget * menuitem);
 
 /*************
  * main
@@ -243,6 +244,14 @@
 }
 
 static void
+accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menuitem)
+{
+	g_return_if_fail(GTK_IS_WIDGET(menuitem));
+	update_accessible_desc(entry, menuitem);
+	return;
+}
+
+static void
 entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
 {
 	g_debug("Signal: Entry Added");
@@ -319,7 +328,12 @@
 
 	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
 
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menuitem);
+
 	if (something_visible) {
+		if (entry->accessible_desc != NULL) {
+			update_accessible_desc(entry, menuitem);
+		}
 		gtk_widget_show(menuitem);
 	}
 	gtk_widget_set_sensitive(menuitem, something_sensitive);
@@ -443,6 +457,28 @@
 	// TODO: do something sensible here
 }
 
+static void
+update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem)
+{
+	/* FIXME: We need to deal with the use case where the contents of the
+	   label overrides what is found in the atk object's name, or at least
+	   orca speaks the label instead of the atk object name.
+	 */
+	AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem);
+	if (menuitem_obj == NULL) {
+		/* Should there be an error printed here? */
+		return;
+	}
+
+	if (entry->accessible_desc != NULL) {
+		atk_object_set_name(menuitem_obj, entry->accessible_desc);
+	} else {
+		atk_object_set_name(menuitem_obj, "");
+	}
+	return;
+}
+
+
 static gboolean
 load_module (const gchar * name, GtkWidget * menubar)
 {