changeset 19367:bf918749b375

Separate out setting up the labelled-by and label-for ATK relationships from pidgin_set_accessible_label(). This allows us to set up the label relationships for combo boxes in gtkprefs without setting an ATK name on the combo box (which breaks screen reading of the combo box). Fixes ticket #2687 (Gnome bug #468762).
author Casey Harkins <charkins@pidgin.im>
date Thu, 23 Aug 2007 03:06:52 +0000
parents bd18c02bba9f
children ec0ef7f0a12d
files pidgin/gtkprefs.c pidgin/gtkutils.c pidgin/gtkutils.h
diffstat 3 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkprefs.c	Wed Aug 22 23:27:38 2007 +0000
+++ b/pidgin/gtkprefs.c	Thu Aug 23 03:06:52 2007 +0000
@@ -240,7 +240,7 @@
 
 	if (label != NULL) {
 		gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown);
-		pidgin_set_accessible_label (dropdown, label);
+		pidgin_set_accessible_relations (dropdown, label);
 	}
 
 	if (type == PURPLE_PREF_INT)
--- a/pidgin/gtkutils.c	Wed Aug 22 23:27:38 2007 +0000
+++ b/pidgin/gtkutils.c	Thu Aug 23 03:06:52 2007 +0000
@@ -1147,12 +1147,30 @@
 void
 pidgin_set_accessible_label (GtkWidget *w, GtkWidget *l)
 {
+	AtkObject *acc;
+	const gchar *label_text;
+	const gchar *existing_name;
+
+	acc = gtk_widget_get_accessible (w);
+
+	/* If this object has no name, set it's name with the label text */
+	existing_name = atk_object_get_name (acc);
+	if (!existing_name) {
+		label_text = gtk_label_get_text (GTK_LABEL(l));
+		if (label_text)
+			atk_object_set_name (acc, label_text);
+	}
+
+	pidgin_set_accessible_relations(w, l);
+}
+
+void
+pidgin_set_accessible_relations (GtkWidget *w, GtkWidget *l)
+{
 	AtkObject *acc, *label;
 	AtkObject *rel_obj[1];
 	AtkRelationSet *set;
 	AtkRelation *relation;
-	const gchar *label_text;
-	const gchar *existing_name;
 
 	acc = gtk_widget_get_accessible (w);
 	label = gtk_widget_get_accessible (l);
@@ -1160,14 +1178,6 @@
 	/* Make sure mnemonics work */
         gtk_label_set_mnemonic_widget(GTK_LABEL(l), w);
 	
-	/* If this object has no name, set it's name with the label text */
-	existing_name = atk_object_get_name (acc);
-	if (!existing_name) {
-		label_text = gtk_label_get_text (GTK_LABEL(l));
-		if (label_text)
-			atk_object_set_name (acc, label_text);
-	}
-
 	/* Create the labeled-by relation */
 	set = atk_object_ref_relation_set (acc);
 	rel_obj[0] = label;
--- a/pidgin/gtkutils.h	Wed Aug 22 23:27:38 2007 +0000
+++ b/pidgin/gtkutils.h	Thu Aug 23 03:06:52 2007 +0000
@@ -418,6 +418,14 @@
 void pidgin_set_accessible_label(GtkWidget *w, GtkWidget *l);
 
 /**
+ * Sets the labelled-by and label-for ATK relationships.
+ *
+ * @param w The widget that we want to label.
+ * @param l A GtkLabel that we want to use as the label for the widget.
+ */
+void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l);
+
+/**
  * A helper function for GtkMenuPositionFuncs. This ensures the menu will
  * be kept on screen if possible.
  *