src/gtkaccount.c

changeset 12172
717fa0ec02c4
parent 12152
e663abedf464
child 12185
e693dd57141c
equal deleted inserted replaced
12171:a7c0ec510cfc 12172:717fa0ec02c4
1113 1113
1114 break; 1114 break;
1115 1115
1116 case GAIM_PREF_STRING_LIST: 1116 case GAIM_PREF_STRING_LIST:
1117 i = 0; 1117 i = 0;
1118 idx = -1; 1118 idx = 0;
1119 1119
1120 if (account == NULL || 1120 if (account == NULL ||
1121 strcmp(gaim_account_get_protocol_id(account), 1121 strcmp(gaim_account_get_protocol_id(account),
1122 dialog->protocol_id)) 1122 dialog->protocol_id))
1123 { 1123 {
1124 str_value = gaim_account_option_get_default_string(option); 1124 str_value = gaim_account_option_get_default_list_value(option);
1125 } 1125 }
1126 else 1126 else
1127 { 1127 {
1128 str_value = gaim_account_get_string(account, 1128 str_value = gaim_account_get_string(account,
1129 gaim_account_option_get_setting(option), 1129 gaim_account_option_get_setting(option),
1130 gaim_account_option_get_default_string(option)); 1130 gaim_account_option_get_default_list_value(option));
1131 } 1131 }
1132
1133 1132
1134 list = gaim_account_option_get_list(option); 1133 list = gaim_account_option_get_list(option);
1135 model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); 1134 model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
1136 combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); 1135 combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
1137
1138 //if (gaim_account_option_get_masked(option))
1139 //gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
1140 1136
1141 /* Loop through list of GaimKeyValuePair items */ 1137 /* Loop through list of GaimKeyValuePair items */
1142 for (node = list; node != NULL; node = node->next) { 1138 for (node = list; node != NULL; node = node->next) {
1143 if (node->data != NULL) { 1139 if (node->data != NULL) {
1144 kvp = (GaimKeyValuePair *) node->data; 1140 kvp = (GaimKeyValuePair *) node->data;
1145 if ((idx < 0) && (kvp->value != NULL) && (str_value != NULL)) 1141 if ((kvp->value != NULL) && (str_value != NULL) &&
1146 if (!g_utf8_collate(kvp->value, str_value)) 1142 !g_utf8_collate(kvp->value, str_value))
1147 idx = i; 1143 idx = i;
1148 1144
1149 gtk_list_store_append(model, &iter); 1145 gtk_list_store_append(model, &iter);
1150 gtk_list_store_set(model, &iter, 1146 gtk_list_store_set(model, &iter,
1151 0, kvp->key, 1147 0, kvp->key,
1152 1, kvp->value, 1148 1, kvp->value,
1155 1151
1156 i++; 1152 i++;
1157 } 1153 }
1158 1154
1159 /* Set default */ 1155 /* Set default */
1160 if (idx >= 0) 1156 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), idx);
1161 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), idx);
1162 1157
1163 /* Define renderer */ 1158 /* Define renderer */
1164 renderer = gtk_cell_renderer_text_new(); 1159 renderer = gtk_cell_renderer_text_new();
1165 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, 1160 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer,
1166 TRUE); 1161 TRUE);

mercurial