# HG changeset patch # User Casey Harkins # Date 1187838412 0 # Node ID bf918749b375d64655f73cfb05871c67feec91ac # Parent bd18c02bba9f9e8d38d2a3145ec7850a00d9ffc2 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). diff -r bd18c02bba9f -r bf918749b375 pidgin/gtkprefs.c --- 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) diff -r bd18c02bba9f -r bf918749b375 pidgin/gtkutils.c --- 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; diff -r bd18c02bba9f -r bf918749b375 pidgin/gtkutils.h --- 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. *