| 1145 } |
1145 } |
| 1146 |
1146 |
| 1147 void |
1147 void |
| 1148 pidgin_set_accessible_label (GtkWidget *w, GtkWidget *l) |
1148 pidgin_set_accessible_label (GtkWidget *w, GtkWidget *l) |
| 1149 { |
1149 { |
| 1150 AtkObject *acc, *label; |
1150 AtkObject *acc; |
| 1151 AtkObject *rel_obj[1]; |
|
| 1152 AtkRelationSet *set; |
|
| 1153 AtkRelation *relation; |
|
| 1154 const gchar *label_text; |
1151 const gchar *label_text; |
| 1155 const gchar *existing_name; |
1152 const gchar *existing_name; |
| 1156 |
1153 |
| 1157 acc = gtk_widget_get_accessible (w); |
1154 acc = gtk_widget_get_accessible (w); |
| 1158 label = gtk_widget_get_accessible (l); |
1155 |
| 1159 |
|
| 1160 /* Make sure mnemonics work */ |
|
| 1161 gtk_label_set_mnemonic_widget(GTK_LABEL(l), w); |
|
| 1162 |
|
| 1163 /* If this object has no name, set it's name with the label text */ |
1156 /* If this object has no name, set it's name with the label text */ |
| 1164 existing_name = atk_object_get_name (acc); |
1157 existing_name = atk_object_get_name (acc); |
| 1165 if (!existing_name) { |
1158 if (!existing_name) { |
| 1166 label_text = gtk_label_get_text (GTK_LABEL(l)); |
1159 label_text = gtk_label_get_text (GTK_LABEL(l)); |
| 1167 if (label_text) |
1160 if (label_text) |
| 1168 atk_object_set_name (acc, label_text); |
1161 atk_object_set_name (acc, label_text); |
| 1169 } |
1162 } |
| 1170 |
1163 |
| |
1164 pidgin_set_accessible_relations(w, l); |
| |
1165 } |
| |
1166 |
| |
1167 void |
| |
1168 pidgin_set_accessible_relations (GtkWidget *w, GtkWidget *l) |
| |
1169 { |
| |
1170 AtkObject *acc, *label; |
| |
1171 AtkObject *rel_obj[1]; |
| |
1172 AtkRelationSet *set; |
| |
1173 AtkRelation *relation; |
| |
1174 |
| |
1175 acc = gtk_widget_get_accessible (w); |
| |
1176 label = gtk_widget_get_accessible (l); |
| |
1177 |
| |
1178 /* Make sure mnemonics work */ |
| |
1179 gtk_label_set_mnemonic_widget(GTK_LABEL(l), w); |
| |
1180 |
| 1171 /* Create the labeled-by relation */ |
1181 /* Create the labeled-by relation */ |
| 1172 set = atk_object_ref_relation_set (acc); |
1182 set = atk_object_ref_relation_set (acc); |
| 1173 rel_obj[0] = label; |
1183 rel_obj[0] = label; |
| 1174 relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABELLED_BY); |
1184 relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABELLED_BY); |
| 1175 atk_relation_set_add (set, relation); |
1185 atk_relation_set_add (set, relation); |