diff pidgin/gtkutils.c @ 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 d520087c3462
children 44b4e8bd759b
line wrap: on
line diff
--- 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;