Mercurial > pidgin.yaz
diff src/gtkaccount.c @ 7956:1b8261f374ea
[gaim-migrate @ 8631]
This is the death of protocol numbers. There are probably now a few
functions that should now go away, but i'll let our crack team of crazy
patch writers figure out which ones they are.
out-of-tree and unofficial prpl-writers, rejoice!
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 29 Dec 2003 09:03:47 +0000 |
parents | e873d0bd0e6c |
children | fa6395637e2c |
line wrap: on
line diff
--- a/src/gtkaccount.c Mon Dec 29 08:59:22 2003 +0000 +++ b/src/gtkaccount.c Mon Dec 29 09:03:47 2003 +0000 @@ -81,7 +81,6 @@ GaimGtkAccountDialogType type; GaimAccount *account; - GaimProtocol protocol; char *protocol_id; GaimPlugin *plugin; GaimPluginProtocolInfo *prpl_info; @@ -152,9 +151,9 @@ GaimAccount *account); static char * -proto_name(int proto) +proto_name(const char *id) { - GaimPlugin *p = gaim_find_prpl(proto); + GaimPlugin *p = gaim_find_prpl(id); return ((p && p->info->name) ? _(p->info->name) : _("Unknown")); } @@ -192,12 +191,11 @@ } static void -set_account_protocol_cb(GtkWidget *item, GaimProtocol protocol, +set_account_protocol_cb(GtkWidget *item, const char *id, AccountPrefsDialog *dialog) { - if ((dialog->plugin = gaim_find_prpl(protocol)) != NULL) { + if ((dialog->plugin = gaim_find_prpl(id)) != NULL) { dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); - dialog->protocol = dialog->prpl_info->protocol; if (dialog->protocol_id != NULL) g_free(dialog->protocol_id); @@ -381,7 +379,7 @@ /* Protocol */ dialog->protocol_menu = gaim_gtk_protocol_option_menu_new( - dialog->protocol, G_CALLBACK(set_account_protocol_cb), dialog); + dialog->protocol_id, G_CALLBACK(set_account_protocol_cb), dialog); add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); @@ -647,15 +645,13 @@ switch (gaim_account_option_get_type(option)) { case GAIM_PREF_BOOLEAN: - if (account == NULL || - gaim_account_get_protocol(account) != dialog->protocol) { - + if (account == NULL || !strcmp(gaim_account_get_protocol_id(account), dialog->protocol_id)) { bool_value = gaim_account_option_get_default_bool(option); - } - else + } else { bool_value = gaim_account_get_bool(account, gaim_account_option_get_setting(option), gaim_account_option_get_default_bool(option)); + } check = gtk_check_button_new_with_label( gaim_account_option_get_text(option)); @@ -672,15 +668,13 @@ break; case GAIM_PREF_INT: - if (account == NULL || - gaim_account_get_protocol(account) != dialog->protocol) { - + if (account == NULL || !strcmp(gaim_account_get_protocol_id(account), dialog->protocol_id)) { int_value = gaim_account_option_get_default_int(option); - } - else + } else { int_value = gaim_account_get_int(account, gaim_account_option_get_setting(option), gaim_account_option_get_default_int(option)); + } g_snprintf(buf, sizeof(buf), "%d", int_value); @@ -700,15 +694,13 @@ break; case GAIM_PREF_STRING: - if (account == NULL || - gaim_account_get_protocol(account) != dialog->protocol) { - + if (account == NULL || !strcmp(gaim_account_get_protocol_id(account), dialog->protocol_id)) { str_value = gaim_account_option_get_default_string(option); - } - else + } else { str_value = gaim_account_get_string(account, gaim_account_option_get_setting(option), gaim_account_option_get_default_string(option)); + } entry = gtk_entry_new(); @@ -1198,16 +1190,14 @@ dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); if (dialog->account == NULL) { - dialog->protocol_id = g_strdup("prpl-oscar"); - dialog->protocol = GAIM_PROTO_OSCAR; + dialog->protocol_id = g_strdup(GAIM_PROTO_DEFAULT); } else { dialog->protocol_id = g_strdup(gaim_account_get_protocol_id(dialog->account)); - dialog->protocol = gaim_account_get_protocol(dialog->account); } - if ((dialog->plugin = gaim_find_prpl(dialog->protocol)) != NULL) + if ((dialog->plugin = gaim_find_prpl(dialog->protocol_id)) != NULL) dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); @@ -1805,7 +1795,7 @@ COLUMN_SCREENNAME, gaim_account_get_username(account), COLUMN_ONLINE, gaim_account_is_connected(account), COLUMN_AUTOLOGIN, gaim_account_get_auto_login(account, GAIM_GTK_UI), - COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol(account)), + COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol_id(account)), COLUMN_DATA, account, -1);