Mercurial > pidgin.yaz
comparison src/gtkutils.c @ 8137:4971193f761d
[gaim-migrate @ 8842]
The easy parts of Marc Mulcahy accessibility patch. Basically
set a label for a lot of widgets so screen readers and stuff
have something useful to read.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 18 Jan 2004 03:51:40 +0000 |
parents | ea3eb461efc0 |
children | 8633dc570442 |
comparison
equal
deleted
inserted
replaced
8136:fab67640b59f | 8137:4971193f761d |
---|---|
453 gtk_widget_show(label); | 453 gtk_widget_show(label); |
454 /* FIXME: Go back and fix this | 454 /* FIXME: Go back and fix this |
455 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], | 455 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], |
456 GDK_MOD1_MASK, GTK_ACCEL_LOCKED); | 456 GDK_MOD1_MASK, GTK_ACCEL_LOCKED); |
457 */ | 457 */ |
458 gaim_set_accessible_label (menuitem, label); | |
458 return menuitem; | 459 return menuitem; |
459 } | 460 } |
460 | 461 |
461 GtkWidget *gaim_new_check_item(GtkWidget *menu, const char *str, | 462 GtkWidget *gaim_new_check_item(GtkWidget *menu, const char *str, |
462 GtkSignalFunc sf, gpointer data, gboolean checked) | 463 GtkSignalFunc sf, gpointer data, gboolean checked) |
529 if (text) { | 530 if (text) { |
530 label = gtk_label_new(NULL); | 531 label = gtk_label_new(NULL); |
531 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); | 532 gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); |
532 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); | 533 gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); |
533 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); | 534 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); |
535 gaim_set_accessible_label (button, label); | |
534 } | 536 } |
535 | 537 |
536 gtk_widget_show_all(bbox); | 538 gtk_widget_show_all(bbox); |
537 | 539 |
538 return button; | 540 return button; |
598 | 600 |
599 gtk_label_set_markup(GTK_LABEL(label), labeltitle); | 601 gtk_label_set_markup(GTK_LABEL(label), labeltitle); |
600 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | 602 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
601 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | 603 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
602 gtk_widget_show(label); | 604 gtk_widget_show(label); |
605 gaim_set_accessible_label (vbox, label); | |
603 | 606 |
604 hbox = gtk_hbox_new(FALSE, 6); | 607 hbox = gtk_hbox_new(FALSE, 6); |
605 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); | 608 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); |
606 gtk_widget_show(hbox); | 609 gtk_widget_show(hbox); |
607 | 610 |
716 | 719 |
717 g_object_set_data(G_OBJECT(item), "protocol", plugin->info->id); | 720 g_object_set_data(G_OBJECT(item), "protocol", plugin->info->id); |
718 | 721 |
719 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | 722 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
720 gtk_widget_show(item); | 723 gtk_widget_show(item); |
724 gaim_set_accessible_label (item, label); | |
721 | 725 |
722 if (!strcmp(plugin->info->id, id)) | 726 if (!strcmp(plugin->info->id, id)) |
723 selected_index = i; | 727 selected_index = i; |
724 } | 728 } |
725 | 729 |
856 | 860 |
857 g_object_set_data(G_OBJECT(item), "account", account); | 861 g_object_set_data(G_OBJECT(item), "account", account); |
858 | 862 |
859 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | 863 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
860 gtk_widget_show(item); | 864 gtk_widget_show(item); |
865 gaim_set_accessible_label (item, label); | |
861 | 866 |
862 if (default_account != NULL && account == default_account) | 867 if (default_account != NULL && account == default_account) |
863 selected_index = i; | 868 selected_index = i; |
864 } | 869 } |
865 | 870 |
1346 | 1351 |
1347 g_free(str); | 1352 g_free(str); |
1348 | 1353 |
1349 return valid; | 1354 return valid; |
1350 } | 1355 } |
1356 | |
1357 void | |
1358 gaim_set_accessible_label (GtkWidget *w, GtkWidget *l) | |
1359 { | |
1360 AtkObject *acc, *label; | |
1361 AtkObject *rel_obj[1]; | |
1362 AtkRelationSet *set; | |
1363 AtkRelation *relation; | |
1364 const gchar *label_text; | |
1365 const gchar *existing_name; | |
1366 | |
1367 acc = gtk_widget_get_accessible (w); | |
1368 label = gtk_widget_get_accessible (l); | |
1369 | |
1370 /* If this object has no name, set it's name with the label text */ | |
1371 existing_name = atk_object_get_name (acc); | |
1372 if (!existing_name) { | |
1373 label_text = gtk_label_get_text (GTK_LABEL(l)); | |
1374 if (label_text) | |
1375 atk_object_set_name (acc, label_text); | |
1376 } | |
1377 | |
1378 /* Create the labeled-by relation */ | |
1379 set = atk_object_ref_relation_set (acc); | |
1380 rel_obj[0] = label; | |
1381 relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABELLED_BY); | |
1382 atk_relation_set_add (set, relation); | |
1383 g_object_unref (relation); | |
1384 | |
1385 /* Create the label-for relation */ | |
1386 set = atk_object_ref_relation_set (label); | |
1387 rel_obj[0] = acc; | |
1388 relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABEL_FOR); | |
1389 atk_relation_set_add (set, relation); | |
1390 g_object_unref (relation); | |
1391 } |