Mercurial > pidgin.yaz
changeset 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 | fab67640b59f |
children | 3e8592b95f68 |
files | ChangeLog src/buddy_chat.c src/dialogs.c src/gtkaccount.c src/gtkblist.c src/gtklog.c src/gtkpounce.c src/gtkprefs.c src/gtkprivacy.c src/gtkrequest.c src/gtkutils.c src/gtkutils.h src/server.c |
diffstat | 13 files changed, 99 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Jan 17 22:02:14 2004 +0000 +++ b/ChangeLog Sun Jan 18 03:51:40 2004 +0000 @@ -2,6 +2,7 @@ version 0.76cvs: * WYSIWYG text input (with scrollbars, too!) + * Improved accessibility support pretty much everywhere (Marc Mulcahy) * Improved accessibility in conversation windows (Nathan Fredrickson) * Chatroom List support (thanks, Tim Ringenbach) * TCL Plugin API changed
--- a/src/buddy_chat.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/buddy_chat.c Sun Jan 18 03:51:40 2004 +0000 @@ -123,6 +123,7 @@ gtk_widget_set_size_request(spin, 50, -1); gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(spin)); + gaim_set_accessible_label (spin, label); } else { GtkWidget *entry = gtk_entry_new(); @@ -143,6 +144,7 @@ gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(entry)); + gaim_set_accessible_label (entry, label); } g_free(pce); @@ -262,6 +264,7 @@ join_chat_check_account_func, data); gtk_box_pack_start(GTK_BOX(rowbox), data->account_menu, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(data->account_menu)); + gaim_set_accessible_label (data->account_menu, label); } data->entries_box = gtk_vbox_new(FALSE, 5);
--- a/src/dialogs.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/dialogs.c Sun Jan 18 03:51:40 2004 +0000 @@ -578,6 +578,7 @@ gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); + gaim_set_accessible_label (info->entry, label); g_signal_connect(G_OBJECT(info->entry), "changed", G_CALLBACK(gaim_gtk_set_sensitive_if_input), window); @@ -594,6 +595,7 @@ gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); + gaim_set_accessible_label (info->account, label); } g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_im), info); @@ -653,6 +655,7 @@ gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); gtk_entry_set_activates_default (GTK_ENTRY(info->entry), TRUE); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->entry)); + gaim_set_accessible_label (info->entry, label); g_signal_connect(G_OBJECT(info->entry), "changed", G_CALLBACK(gaim_gtk_set_sensitive_if_input), window); @@ -669,6 +672,7 @@ gtk_table_attach_defaults(GTK_TABLE(table), info->account, 1, 2, 1, 2); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(info->account)); + gaim_set_accessible_label (info->account, label); } g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_info), info); @@ -784,6 +788,7 @@ a->url = gtk_entry_new(); gtk_table_attach_defaults(GTK_TABLE(table), a->url, 1, 2, 0, 1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(a->url)); + gaim_set_accessible_label (a->url, label); gtk_widget_grab_focus(a->url); gtk_entry_set_activates_default (GTK_ENTRY(a->url), TRUE); @@ -797,6 +802,7 @@ a->text = gtk_entry_new(); gtk_table_attach_defaults(GTK_TABLE(table), a->text, 1, 2, 1, 2); gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(a->text)); + gaim_set_accessible_label (a->text, label); gtk_entry_set_activates_default (GTK_ENTRY(a->text), TRUE); gtkconv->dialogs.link = a->window; @@ -1257,6 +1263,7 @@ ca->entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox), ca->entry, TRUE, TRUE, 0); + gaim_set_accessible_label (ca->entry, label); gtk_widget_grab_focus(ca->entry); /* Away message text */
--- a/src/gtkaccount.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkaccount.c Sun Jan 18 03:51:40 2004 +0000 @@ -188,6 +188,7 @@ gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); gtk_widget_show(widget); + gaim_set_accessible_label (widget, label); return hbox; } @@ -554,6 +555,7 @@ gtk_editable_set_editable(GTK_EDITABLE(dialog->buddy_icon_entry), FALSE); gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_icon_entry, TRUE, TRUE, 0); gtk_widget_show(dialog->buddy_icon_entry); + gaim_set_accessible_label (dialog->buddy_icon_entry, label); button = gtk_button_new_with_mnemonic(_("_Browse")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
--- a/src/gtkblist.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkblist.c Sun Jan 18 03:51:40 2004 +0000 @@ -805,10 +805,10 @@ GtkWidget *menuitem; if (prpl_info && prpl_info->get_info) { - gaim_new_item_from_stock(menu, _("_Get Info"), GAIM_STOCK_INFO, + gaim_new_item_from_stock(menu, _("Get _Info"), GAIM_STOCK_INFO, G_CALLBACK(gtk_blist_menu_info_cb), b, 0, 0, NULL); } - gaim_new_item_from_stock(menu, _("_IM"), GAIM_STOCK_IM, + gaim_new_item_from_stock(menu, _("I_M"), GAIM_STOCK_IM, G_CALLBACK(gtk_blist_menu_im_cb), b, 0, 0, NULL); gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), NULL, G_CALLBACK(gtk_blist_menu_bp_cb), b, 0, 0, NULL); @@ -2699,7 +2699,7 @@ gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->bbox, FALSE, FALSE, 0); gtk_widget_show(gtkblist->bbox); - button = gaim_pixbuf_button_from_stock(_("IM"), GAIM_STOCK_IM, GAIM_BUTTON_VERTICAL); + button = gaim_pixbuf_button_from_stock(_("I_M"), GAIM_STOCK_IM, GAIM_BUTTON_VERTICAL); gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_size_group_add_widget(sg, button); @@ -2708,7 +2708,7 @@ gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Send a message to the selected buddy"), NULL); gtk_widget_show(button); - button = gaim_pixbuf_button_from_stock(_("Get Info"), GAIM_STOCK_INFO, GAIM_BUTTON_VERTICAL); + button = gaim_pixbuf_button_from_stock(_("Get _Info"), GAIM_STOCK_INFO, GAIM_BUTTON_VERTICAL); gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_size_group_add_widget(sg, button); @@ -2717,7 +2717,7 @@ gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Get information on the selected buddy"), NULL); gtk_widget_show(button); - button = gaim_pixbuf_button_from_stock(_("Chat"), GAIM_STOCK_CHAT, GAIM_BUTTON_VERTICAL); + button = gaim_pixbuf_button_from_stock(_("_Chat"), GAIM_STOCK_CHAT, GAIM_BUTTON_VERTICAL); gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_size_group_add_widget(sg, button); @@ -2725,7 +2725,7 @@ gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Join a chat room"), NULL); gtk_widget_show(button); - button = gaim_pixbuf_button_from_stock(_("Away"), GAIM_STOCK_ICON_AWAY, GAIM_BUTTON_VERTICAL); + button = gaim_pixbuf_button_from_stock(_("_Away"), GAIM_STOCK_ICON_AWAY, GAIM_BUTTON_VERTICAL); gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_size_group_add_widget(sg, button); @@ -3500,6 +3500,7 @@ gtk_entry_set_text(GTK_ENTRY(data->entry), username); gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE); + gaim_set_accessible_label (data->entry, label); label = gtk_label_new(_("Alias:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -3513,6 +3514,7 @@ gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias); gtk_entry_set_activates_default (GTK_ENTRY(data->entry_for_alias), TRUE); + gaim_set_accessible_label (data->entry_for_alias, label); label = gtk_label_new(_("Group:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -3521,6 +3523,7 @@ data->combo = gtk_combo_new(); gtk_combo_set_popdown_strings(GTK_COMBO(data->combo), groups_tree()); gtk_table_attach_defaults(GTK_TABLE(table), data->combo, 1, 2, 2, 3); + gaim_set_accessible_label (data->combo, label); /* Set up stuff for the account box */ label = gtk_label_new(_("Account:")); @@ -3531,6 +3534,7 @@ G_CALLBACK(add_buddy_select_account_cb), NULL, data); gtk_table_attach_defaults(GTK_TABLE(table), data->account_box, 1, 2, 3, 4); + gaim_set_accessible_label (data->account_box, label); /* End of account box */ @@ -3662,6 +3666,7 @@ gtk_widget_set_size_request(spin, 50, -1); gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0); gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin); + gaim_set_accessible_label (spin, label); } else { @@ -3687,6 +3692,7 @@ g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(add_chat_cb), data); gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gaim_set_accessible_label (entry, label); } g_free(pce); @@ -3813,6 +3819,7 @@ G_CALLBACK(add_chat_select_account_cb), add_chat_check_account_func, data); gtk_box_pack_start(GTK_BOX(rowbox), data->account_menu, TRUE, TRUE, 0); + gaim_set_accessible_label (data->account_menu, label); data->entries_box = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0); @@ -3832,6 +3839,7 @@ if (alias != NULL) gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias); gtk_box_pack_end(GTK_BOX(rowbox), data->alias_entry, TRUE, TRUE, 0); + gaim_set_accessible_label (data->alias_entry, label); rowbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); @@ -3850,6 +3858,7 @@ gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(data->group_combo)->entry), group->name); } + gaim_set_accessible_label (data->group_combo, label); g_signal_connect(G_OBJECT(data->window), "response", G_CALLBACK(add_chat_resp_cb), data);
--- a/src/gtklog.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtklog.c Sun Jan 18 03:51:40 2004 +0000 @@ -307,6 +307,7 @@ G_CALLBACK (search_cb), lv); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + gaim_set_accessible_label (lv->treeview, label); gtk_widget_show_all(lv->window); }
--- a/src/gtkpounce.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkpounce.c Sun Jan 18 03:51:40 2004 +0000 @@ -370,6 +370,7 @@ gtk_box_pack_start(GTK_BOX(hbox), dialog->account_menu, FALSE, FALSE, 0); gtk_widget_show(dialog->account_menu); + gaim_set_accessible_label (dialog->account_menu, label); /* Buddy: */ hbox = gtk_hbox_new(FALSE, 6); @@ -388,6 +389,7 @@ g_signal_connect(G_OBJECT(dialog->buddy_entry), "changed", G_CALLBACK(buddy_changed_cb), dialog); + gaim_set_accessible_label (dialog->buddy_entry, label); if (cur_pounce != NULL) { gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry),
--- a/src/gtkprefs.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkprefs.c Sun Jan 18 03:51:40 2004 +0000 @@ -139,6 +139,8 @@ gtk_misc_set_alignment(GTK_MISC(label), 0, 0); } + gaim_set_accessible_label (spin, label); + return label; } @@ -254,6 +256,7 @@ gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); gtk_widget_show(dropdown); + gaim_set_accessible_label (dropdown, label); return label; } @@ -605,6 +608,9 @@ g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(smiley_sel), NULL); gtk_widget_show_all(ret); + + gaim_set_accessible_label (view, label); + return ret; } @@ -1127,6 +1133,7 @@ hbox = gtk_hbox_new(TRUE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gaim_set_accessible_label (entry, label); label = gtk_label_new_with_mnemonic(_("_Port:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); @@ -1145,6 +1152,7 @@ gtk_entry_set_text(GTK_ENTRY(entry), buf); } + gaim_set_accessible_label (entry, label); label = gtk_label_new_with_mnemonic(_("_User:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); @@ -1162,6 +1170,7 @@ hbox = gtk_hbox_new(TRUE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gaim_set_accessible_label (entry, label); label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); @@ -1177,6 +1186,7 @@ if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL) gtk_entry_set_text(GTK_ENTRY(entry), gaim_proxy_info_get_password(proxy_info)); + gaim_set_accessible_label (entry, label); gtk_widget_show_all(ret); return ret; @@ -1294,6 +1304,7 @@ label = gaim_gtk_prefs_checkbox(_("Open new _window by default"), "/gaim/gtk/browsers/new_window", vbox); } + gaim_set_accessible_label (entry, label); gtk_widget_show_all(ret); return ret; @@ -1425,6 +1436,8 @@ #endif /* _WIN32 */ gtk_widget_show_all(ret); + gaim_set_accessible_label (entry, label); + return ret; } @@ -1525,6 +1538,8 @@ gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE); } + gaim_set_accessible_label (prefs_away_menu, label); + gtk_widget_show_all(ret); return ret;
--- a/src/gtkprivacy.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkprivacy.c Sun Jan 18 03:51:40 2004 +0000 @@ -404,6 +404,7 @@ check_account_func, dialog); gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); gtk_widget_show(dropdown); + gaim_set_accessible_label (dropdown, label); /* Add the drop-down list with the allow/block types. */ dialog->type_menu = gtk_option_menu_new();
--- a/src/gtkrequest.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkrequest.c Sun Jan 18 03:51:40 2004 +0000 @@ -324,6 +324,7 @@ gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); } + gaim_set_accessible_label (entry, label); data->u.input.entry = entry; /* Show everything. */
--- a/src/gtkutils.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkutils.c Sun Jan 18 03:51:40 2004 +0000 @@ -455,6 +455,7 @@ gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], GDK_MOD1_MASK, GTK_ACCEL_LOCKED); */ + gaim_set_accessible_label (menuitem, label); return menuitem; } @@ -531,6 +532,7 @@ gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); + gaim_set_accessible_label (button, label); } gtk_widget_show_all(bbox); @@ -600,6 +602,7 @@ gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); + gaim_set_accessible_label (vbox, label); hbox = gtk_hbox_new(FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); @@ -718,6 +721,7 @@ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); gtk_widget_show(item); + gaim_set_accessible_label (item, label); if (!strcmp(plugin->info->id, id)) selected_index = i; @@ -858,6 +862,7 @@ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); gtk_widget_show(item); + gaim_set_accessible_label (item, label); if (default_account != NULL && account == default_account) selected_index = i; @@ -1348,3 +1353,39 @@ return valid; } + +void +gaim_set_accessible_label (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); + + /* 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; + relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABELLED_BY); + atk_relation_set_add (set, relation); + g_object_unref (relation); + + /* Create the label-for relation */ + set = atk_object_ref_relation_set (label); + rel_obj[0] = acc; + relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABEL_FOR); + atk_relation_set_add (set, relation); + g_object_unref (relation); +}
--- a/src/gtkutils.h Sat Jan 17 22:02:14 2004 +0000 +++ b/src/gtkutils.h Sun Jan 18 03:51:40 2004 +0000 @@ -346,4 +346,13 @@ char **ret_protocol, char **ret_username, char **ret_alias); +/** + * Sets an ATK name for a given widget. Also sets the labelled-by + * and label-for ATK relationships. + * + * @w The widget that we want to name. + * @l A GtkLabel that we want to use as the ATK name for the widget. + */ +void gaim_set_accessible_label (GtkWidget *w, GtkWidget *l); + #endif /* _GAIM_GTK_UTILS_H_ */
--- a/src/server.c Sat Jan 17 22:02:14 2004 +0000 +++ b/src/server.c Sun Jan 18 03:51:40 2004 +0000 @@ -156,6 +156,7 @@ gc->idle_timer = g_timeout_add(20000, check_idle, gc); serv_touch_idle(gc); + /* Move this hack into toc.c */ if (prpl_info->options & OPT_PROTO_CORRECT_TIME) serv_add_buddy(gc, gaim_account_get_username(gaim_connection_get_account(gc)),