| 78 GtkWidget *register_button; |
78 GtkWidget *register_button; |
| 79 |
79 |
| 80 /* Login Options */ |
80 /* Login Options */ |
| 81 GtkWidget *login_frame; |
81 GtkWidget *login_frame; |
| 82 GtkWidget *protocol_menu; |
82 GtkWidget *protocol_menu; |
| 83 gchar *password; |
|
| 84 GtkWidget *username_entry; |
83 GtkWidget *username_entry; |
| 85 GdkRGBA username_entry_hint_color; |
84 GdkRGBA username_entry_hint_color; |
| 86 GtkWidget *alias_entry; |
85 GtkWidget *alias_entry; |
| 87 |
86 |
| 88 /* User Options */ |
87 /* User Options */ |
| 1190 if(PURPLE_IS_ACCOUNT(account)) { |
1186 if(PURPLE_IS_ACCOUNT(account)) { |
| 1191 dialog->protocol_id = g_strdup(purple_account_get_protocol_id(account)); |
1187 dialog->protocol_id = g_strdup(purple_account_get_protocol_id(account)); |
| 1192 } |
1188 } |
| 1193 |
1189 |
| 1194 dialog->account = account; |
1190 dialog->account = account; |
| 1195 dialog->password = g_strdup(password); |
|
| 1196 dialog->type = type; |
1191 dialog->type = type; |
| 1197 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1192 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 1198 |
1193 |
| 1199 if(dialog->protocol_id != NULL) { |
1194 if(dialog->protocol_id != NULL) { |
| 1200 PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
1195 PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
| 1269 |
1264 |
| 1270 /* Show the window. */ |
1265 /* Show the window. */ |
| 1271 gtk_widget_show(win); |
1266 gtk_widget_show(win); |
| 1272 if (!account) |
1267 if (!account) |
| 1273 gtk_widget_grab_focus(dialog->protocol_menu); |
1268 gtk_widget_grab_focus(dialog->protocol_menu); |
| 1274 } |
|
| 1275 |
|
| 1276 static void |
|
| 1277 pidgin_account_dialog_read_password_cb(GObject *obj, GAsyncResult *res, |
|
| 1278 gpointer data) |
|
| 1279 { |
|
| 1280 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj); |
|
| 1281 PidginAccountDialogShowData *d = (PidginAccountDialogShowData *)data; |
|
| 1282 GError *error = NULL; |
|
| 1283 gchar *password; |
|
| 1284 |
|
| 1285 password = purple_credential_manager_read_password_finish(manager, res, |
|
| 1286 &error); |
|
| 1287 |
|
| 1288 if(error != NULL) { |
|
| 1289 purple_debug_warning("gtkaccount", "failed to read password: %s", |
|
| 1290 error->message); |
|
| 1291 |
|
| 1292 g_error_free(error); |
|
| 1293 } |
|
| 1294 |
|
| 1295 pidgin_account_dialog_show_continue(d->type, d->account, password); |
|
| 1296 |
|
| 1297 g_free(password); |
|
| 1298 g_free(d); |
|
| 1299 } |
|
| 1300 |
|
| 1301 void |
|
| 1302 pidgin_account_dialog_show(PidginAccountDialogType type, PurpleAccount *account) |
|
| 1303 { |
|
| 1304 PurpleCredentialManager *manager = NULL; |
|
| 1305 |
|
| 1306 manager = purple_credential_manager_get_default(); |
|
| 1307 |
|
| 1308 if(PURPLE_IS_ACCOUNT(account)) { |
|
| 1309 /* this is kind of dangerous, but it's no worse than the old version. |
|
| 1310 * Regardless this dialog needs a lot of TLC. |
|
| 1311 */ |
|
| 1312 PidginAccountDialogShowData *data = NULL; |
|
| 1313 data = g_new0(PidginAccountDialogShowData, 1); |
|
| 1314 data->account = account; |
|
| 1315 data->type = type; |
|
| 1316 |
|
| 1317 purple_credential_manager_read_password_async(manager, account, NULL, |
|
| 1318 pidgin_account_dialog_read_password_cb, |
|
| 1319 data); |
|
| 1320 } else { |
|
| 1321 pidgin_account_dialog_show_continue(type, account, NULL); |
|
| 1322 } |
|
| 1323 } |
1269 } |
| 1324 |
1270 |
| 1325 /************************************************************************** |
1271 /************************************************************************** |
| 1326 * Accounts Dialog |
1272 * Accounts Dialog |
| 1327 **************************************************************************/ |
1273 **************************************************************************/ |