Mercurial > pidgin.yaz
comparison src/gtkaccount.c @ 7208:e5a03ffc6c26
[gaim-migrate @ 7777]
more assuming that dialog->prpl_info != NULL
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Thu, 09 Oct 2003 17:28:38 +0000 |
parents | 439b83f4a833 |
children | 4fc46299e5fb |
comparison
equal
deleted
inserted
replaced
7207:439b83f4a833 | 7208:e5a03ffc6c26 |
---|---|
207 | 207 |
208 add_login_options(dialog, dialog->top_vbox); | 208 add_login_options(dialog, dialog->top_vbox); |
209 add_user_options(dialog, dialog->top_vbox); | 209 add_user_options(dialog, dialog->top_vbox); |
210 add_protocol_options(dialog, dialog->bottom_vbox); | 210 add_protocol_options(dialog, dialog->bottom_vbox); |
211 | 211 |
212 if (dialog->prpl_info->register_user == NULL) | 212 if (!dialog->prpl_info || !dialog->prpl_info->register_user) |
213 gtk_widget_hide(dialog->register_button); | 213 gtk_widget_hide(dialog->register_button); |
214 else | 214 else |
215 gtk_widget_show(dialog->register_button); | 215 gtk_widget_show(dialog->register_button); |
216 } | 216 } |
217 | 217 |
987 gaim_account_set_alias(dialog->account, NULL); | 987 gaim_account_set_alias(dialog->account, NULL); |
988 | 988 |
989 /* Buddy Icon */ | 989 /* Buddy Icon */ |
990 value = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_icon_entry)); | 990 value = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_icon_entry)); |
991 | 991 |
992 if ((dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON) && *value != '\0') | 992 if (dialog->prpl_info && |
993 (dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON) && | |
994 *value != '\0') | |
993 gaim_account_set_buddy_icon(dialog->account, value); | 995 gaim_account_set_buddy_icon(dialog->account, value); |
994 else | 996 else |
995 gaim_account_set_buddy_icon(dialog->account, NULL); | 997 gaim_account_set_buddy_icon(dialog->account, NULL); |
996 | 998 |
997 /* Remember Password */ | 999 /* Remember Password */ |
998 gaim_account_set_remember_password(dialog->account, | 1000 gaim_account_set_remember_password(dialog->account, |
999 gtk_toggle_button_get_active( | 1001 gtk_toggle_button_get_active( |
1000 GTK_TOGGLE_BUTTON(dialog->remember_pass_check))); | 1002 GTK_TOGGLE_BUTTON(dialog->remember_pass_check))); |
1001 | 1003 |
1002 /* Check Mail */ | 1004 /* Check Mail */ |
1003 if (dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) | 1005 if (dialog->prpl_info && dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) |
1004 gaim_account_set_check_mail(dialog->account, | 1006 gaim_account_set_check_mail(dialog->account, |
1005 gtk_toggle_button_get_active( | 1007 gtk_toggle_button_get_active( |
1006 GTK_TOGGLE_BUTTON(dialog->new_mail_check))); | 1008 GTK_TOGGLE_BUTTON(dialog->new_mail_check))); |
1007 | 1009 |
1008 /* Auto Login */ | 1010 /* Auto Login */ |
1020 | 1022 |
1021 /* Build the username string. */ | 1023 /* Build the username string. */ |
1022 username = | 1024 username = |
1023 g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry))); | 1025 g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry))); |
1024 | 1026 |
1025 for (l = dialog->prpl_info->user_splits, l2 = dialog->user_split_entries; | 1027 if(dialog->prpl_info) { |
1026 l != NULL && l2 != NULL; | 1028 for (l = dialog->prpl_info->user_splits, l2 = dialog->user_split_entries; |
1027 l = l->next, l2 = l2->next) { | 1029 l != NULL && l2 != NULL; |
1028 | 1030 l = l->next, l2 = l2->next) { |
1029 GaimAccountUserSplit *split = l->data; | 1031 |
1030 GtkEntry *entry = l2->data; | 1032 GaimAccountUserSplit *split = l->data; |
1031 char sep[2] = " "; | 1033 GtkEntry *entry = l2->data; |
1032 | 1034 char sep[2] = " "; |
1033 value = gtk_entry_get_text(entry); | 1035 |
1034 | 1036 value = gtk_entry_get_text(entry); |
1035 *sep = gaim_account_user_split_get_separator(split); | 1037 |
1036 | 1038 *sep = gaim_account_user_split_get_separator(split); |
1037 tmp = g_strconcat(username, sep, | 1039 |
1038 (*value ? value : | 1040 tmp = g_strconcat(username, sep, |
1039 gaim_account_user_split_get_default_value(split)), | 1041 (*value ? value : |
1040 NULL); | 1042 gaim_account_user_split_get_default_value(split)), |
1041 | 1043 NULL); |
1042 g_free(username); | 1044 |
1043 username = tmp; | 1045 g_free(username); |
1046 username = tmp; | |
1047 } | |
1044 } | 1048 } |
1045 | 1049 |
1046 gaim_account_set_username(dialog->account, username); | 1050 gaim_account_set_username(dialog->account, username); |
1047 g_free(username); | 1051 g_free(username); |
1048 | 1052 |
1049 /* Add the protocol settings */ | 1053 /* Add the protocol settings */ |
1050 | 1054 |
1051 for (l = dialog->prpl_info->protocol_options, | 1055 if(dialog->prpl_info) { |
1052 l2 = dialog->protocol_opt_entries; | 1056 for (l = dialog->prpl_info->protocol_options, |
1053 l != NULL && l2 != NULL; | 1057 l2 = dialog->protocol_opt_entries; |
1054 l = l->next, l2 = l2->next) { | 1058 l != NULL && l2 != NULL; |
1055 | 1059 l = l->next, l2 = l2->next) { |
1056 GaimPrefType type; | 1060 |
1057 GaimAccountOption *option = l->data; | 1061 GaimPrefType type; |
1058 GtkWidget *widget = l2->data; | 1062 GaimAccountOption *option = l->data; |
1059 const char *setting; | 1063 GtkWidget *widget = l2->data; |
1060 int int_value; | 1064 const char *setting; |
1061 gboolean bool_value; | 1065 int int_value; |
1062 | 1066 gboolean bool_value; |
1063 type = gaim_account_option_get_type(option); | 1067 |
1064 | 1068 type = gaim_account_option_get_type(option); |
1065 setting = gaim_account_option_get_setting(option); | 1069 |
1066 | 1070 setting = gaim_account_option_get_setting(option); |
1067 switch (type) { | 1071 |
1068 case GAIM_PREF_STRING: | 1072 switch (type) { |
1069 value = gtk_entry_get_text(GTK_ENTRY(widget)); | 1073 case GAIM_PREF_STRING: |
1070 gaim_account_set_string(dialog->account, setting, value); | 1074 value = gtk_entry_get_text(GTK_ENTRY(widget)); |
1071 break; | 1075 gaim_account_set_string(dialog->account, setting, value); |
1072 | 1076 break; |
1073 case GAIM_PREF_INT: | 1077 |
1074 int_value = atoi(gtk_entry_get_text(GTK_ENTRY(widget))); | 1078 case GAIM_PREF_INT: |
1075 gaim_account_set_int(dialog->account, setting, int_value); | 1079 int_value = atoi(gtk_entry_get_text(GTK_ENTRY(widget))); |
1076 break; | 1080 gaim_account_set_int(dialog->account, setting, int_value); |
1077 | 1081 break; |
1078 case GAIM_PREF_BOOLEAN: | 1082 |
1079 bool_value = | 1083 case GAIM_PREF_BOOLEAN: |
1080 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | 1084 bool_value = |
1081 gaim_account_set_bool(dialog->account, setting, bool_value); | 1085 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); |
1082 break; | 1086 gaim_account_set_bool(dialog->account, setting, bool_value); |
1083 | 1087 break; |
1084 default: | 1088 |
1085 break; | 1089 default: |
1090 break; | |
1091 } | |
1086 } | 1092 } |
1087 } | 1093 } |
1088 | 1094 |
1089 /* Set the proxy stuff. */ | 1095 /* Set the proxy stuff. */ |
1090 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL) { | 1096 if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL) { |
1270 dialog->register_button = button; | 1276 dialog->register_button = button; |
1271 | 1277 |
1272 if (dialog->account == NULL) | 1278 if (dialog->account == NULL) |
1273 gtk_widget_set_sensitive(button, FALSE); | 1279 gtk_widget_set_sensitive(button, FALSE); |
1274 | 1280 |
1275 if (dialog->prpl_info->register_user == NULL) | 1281 if (!dialog->prpl_info || !dialog->prpl_info->register_user) |
1276 gtk_widget_hide(button); | 1282 gtk_widget_hide(button); |
1277 | 1283 |
1278 /* Cancel button */ | 1284 /* Cancel button */ |
1279 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | 1285 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); |
1280 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | 1286 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |