Mercurial > pidgin
changeset 7889:7e1bb4deca24
[gaim-migrate @ 8547]
if we're gonna have mnemonics, let's use 'em!
(there was going to be a clever play on words there, but it's 4:30,
so it's not gonna happen)
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 17 Dec 2003 09:33:05 +0000 |
parents | d12b234959d5 |
children | 438b4667db0d |
files | src/gtkblist.c src/util.c src/util.h |
diffstat | 3 files changed, 46 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkblist.c Tue Dec 16 05:41:30 2003 +0000 +++ b/src/gtkblist.c Wed Dec 17 09:33:05 2003 +0000 @@ -1758,13 +1758,15 @@ g_free(account); } for(tmp = parts; tmp; tmp = tmp->next) { - char *label, *value; + char *label, *tmp2, *value; pce = tmp->data; if(pce->secret) continue; - label = g_markup_escape_text(pce->label, -1); + tmp2 = g_markup_escape_text(pce->label, -1); + label = gaim_text_strip_mnemonic(tmp2); + g_free(tmp2); value = g_markup_escape_text(g_hash_table_lookup(chat->components, pce->identifier), -1); @@ -3446,7 +3448,7 @@ rowbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(data->entries_box), rowbox, FALSE, FALSE, 0); - label = gtk_label_new(pce->label); + label = gtk_label_new_with_mnemonic(pce->label); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(data->sg, label); gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); @@ -3463,6 +3465,7 @@ data->entries = g_list_append(data->entries, spin); gtk_widget_set_size_request(spin, 50, -1); gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0); + gtk_label_set_mnemonic_widget(label, spin); } else { @@ -3487,6 +3490,7 @@ g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(add_chat_cb), data); + gtk_label_set_mnemonic_widget(label, entry); } g_free(pce);
--- a/src/util.c Tue Dec 16 05:41:30 2003 +0000 +++ b/src/util.c Wed Dec 17 09:33:05 2003 +0000 @@ -2434,3 +2434,32 @@ return FALSE; } +char *gaim_text_strip_mnemonic(const char *in) +{ + char *out; + char *a; + const char *b; + + g_return_val_if_fail(in != NULL, NULL); + + out = g_malloc(strlen(in)+1); + a = out; + b = in; + + while(*b) { + if(*b == '_') { + if(*(b+1) == '_') { + *(a++) = '_'; + b += 2; + } else { + b++; + } + } else { + *(a++) = *(b++); + } + } + *a = '\0'; + + return out; +} +
--- a/src/util.h Tue Dec 16 05:41:30 2003 +0000 +++ b/src/util.h Wed Dec 17 09:33:05 2003 +0000 @@ -590,6 +590,16 @@ */ gboolean gaim_message_meify(char *message, size_t len); +/** + * Removes the underscore characters from a string used identify the mnemonic + * character. + * + * @param in The string to strip + * + * @return The stripped string + */ +char * gaim_text_strip_mnemonic(const char *in); + /*@}*/ #ifdef __cplusplus