# HG changeset patch # User Sadrul Habib Chowdhury # Date 1209554899 0 # Node ID 133798922e2d5301effac8da39d737b9c2e2c299 # Parent 591ef3693345fce12770c0b957d77ddd4028c7c6# Parent 1cd829a1d27e50e43b5d71e0edd65df97e830e6d merge of '6b848e03c7f6c7c392579517011deded648dedec' and 'cfe931b57f5bb36f22e6b5b6dee72e5ee4cf2258' diff -r 591ef3693345 -r 133798922e2d libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Wed Apr 30 06:29:16 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Wed Apr 30 11:28:19 2008 +0000 @@ -132,16 +132,8 @@ return list; } -static GHashTable * -msn_get_account_text_table() -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("E-mail Address...")); - - return table; +const char *msn_get_login_label() { + return _("E-mail Address..."); } static PurpleCmdRet @@ -2317,7 +2309,7 @@ NULL, /* unregister_user */ msn_send_attention, /* send_attention */ msn_attention_types, /* attention_types */ - msn_get_account_text_table /* get_account_text_table */ + msn_get_login_label /* account_login_label */ }; static PurplePluginInfo info = diff -r 591ef3693345 -r 133798922e2d libpurple/protocols/msnp9/msn.c --- a/libpurple/protocols/msnp9/msn.c Wed Apr 30 06:29:16 2008 +0000 +++ b/libpurple/protocols/msnp9/msn.c Wed Apr 30 11:28:19 2008 +0000 @@ -133,16 +133,9 @@ return list; } -static GHashTable * -msn_get_account_text_table() -{ - GHashTable *table; - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("E-mail Address...")); - - return table; +const char *msn_get_login_label() { + return _("E-mail Address..."); } static PurpleCmdRet @@ -2158,7 +2151,7 @@ NULL, /* unregister_user */ msn_send_attention, /* send_attention */ msn_attention_types, /* attention_types */ - msn_get_account_text_table /* get_account_text_table */ + msn_get_login_label /* account_login_label */ }; static PurplePluginInfo info = diff -r 591ef3693345 -r 133798922e2d libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Wed Apr 30 06:29:16 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.c Wed Apr 30 11:28:19 2008 +0000 @@ -2449,16 +2449,8 @@ return normalized; } -static GHashTable * -msim_get_account_text_table() -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("E-mail Address...")); - - return table; +const char *msim_get_login_label() { + return _("E-mail Address..."); } /** Return whether the buddy can be messaged while offline. @@ -3143,7 +3135,7 @@ NULL, /* unregister_user */ msim_send_attention, /* send_attention */ msim_attention_types, /* attention_types */ - msim_get_account_text_table /* get_account_text_table */ + msim_get_login_label /* get screen name field title */ }; diff -r 591ef3693345 -r 133798922e2d libpurple/prpl.h --- a/libpurple/prpl.h Wed Apr 30 06:29:16 2008 +0000 +++ b/libpurple/prpl.h Wed Apr 30 11:28:19 2008 +0000 @@ -398,15 +398,11 @@ gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type); GList *(*get_attention_types)(PurpleAccount *acct); - /** This allows protocols to specify additional strings to be used for - * various purposes. The idea is to stuff a bunch of strings in this hash - * table instead of expanding the struct for every addition. This hash - * table is allocated every call and MUST be unrefed by the caller. - * - * @param account The account to specify. This can be NULL. - * @return The protocol's string hash table. + /* This allows protocols to specify a more specific term for the "ScreenName" field + * in the add account window. This helps avoid confusion for users using protocols + * such as MySpace or MSN */ - GHashTable *(*get_account_text_table)(PurpleAccount *account); + const char *(*account_login_label)(void); }; #define PURPLE_IS_PROTOCOL_PLUGIN(plugin) \ diff -r 591ef3693345 -r 133798922e2d pidgin/gtkaccount.c --- a/pidgin/gtkaccount.c Wed Apr 30 06:29:16 2008 +0000 +++ b/pidgin/gtkaccount.c Wed Apr 30 11:28:19 2008 +0000 @@ -258,19 +258,10 @@ static gboolean screenname_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog) { - GHashTable *table; - const char *label; - - table = dialog->prpl_info->get_account_text_table(NULL); - label = g_hash_table_lookup(table, "login_label"); - - if(!strcmp(gtk_entry_get_text(GTK_ENTRY(widget)), label)) { - gtk_entry_set_text(GTK_ENTRY(widget), ""); - gtk_widget_modify_text(widget, GTK_STATE_NORMAL,NULL); + if (!strcmp(gtk_entry_get_text(GTK_ENTRY(widget)),dialog->prpl_info->account_login_label())) { + gtk_entry_set_text(GTK_ENTRY(widget),""); + gtk_widget_modify_text(widget,GTK_STATE_NORMAL,NULL); } - - g_hash_table_unref(table); - return FALSE; } @@ -293,25 +284,16 @@ screenname_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog) { GdkColor color = {0, 34952, 35466, 34181}; - GHashTable *table; - const char *label; - - table = dialog->prpl_info->get_account_text_table(NULL); - label = g_hash_table_lookup(table, "login_label"); - if (*gtk_entry_get_text(GTK_ENTRY(widget)) == '\0') { /* We have to avoid hitting the screenname_changed_cb function * because it enables buttons we don't want enabled yet ;) */ g_signal_handlers_block_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog); - gtk_entry_set_text(GTK_ENTRY(widget), label); + gtk_entry_set_text(GTK_ENTRY(widget),dialog->prpl_info->account_login_label()); /* Make sure we can hit it again */ g_signal_handlers_unblock_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog); - gtk_widget_modify_text(widget, GTK_STATE_NORMAL, &color); + gtk_widget_modify_text(widget,GTK_STATE_NORMAL,&color); } - - g_hash_table_unref(table); - return FALSE; } @@ -410,8 +392,6 @@ GList *l, *l2; char *username = NULL; GdkColor color = {0, 34952, 35466, 34181}; - GHashTable *table; - const char *label; if (dialog->protocol_menu != NULL) { @@ -458,18 +438,13 @@ add_pref_box(dialog, vbox, _("Screen _name:"), dialog->screenname_entry); - if (dialog->prpl_info->get_account_text_table) { - table = dialog->prpl_info->get_account_text_table(NULL); - label = g_hash_table_lookup(table, "login_label"); - - gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), label); + if (dialog->prpl_info->account_login_label) { + gtk_entry_set_text(dialog->screenname_entry,dialog->prpl_info->account_login_label()); g_signal_connect(G_OBJECT(dialog->screenname_entry), "focus-in-event", G_CALLBACK(screenname_focus_cb), dialog); g_signal_connect(G_OBJECT(dialog->screenname_entry), "focus-out-event", G_CALLBACK(screenname_nofocus_cb), dialog); - gtk_widget_modify_text(dialog->screenname_entry, GTK_STATE_NORMAL, &color); - - g_hash_table_unref(table); + gtk_widget_modify_text(dialog->screenname_entry,GTK_STATE_NORMAL,&color); } g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed",