comparison src/gtkblist.c @ 13315:d65250edebe0

[gaim-migrate @ 15681] SF Patch #1435616 from Sadrul "If an account is disconnected/disabled, then the connection-error dialog that pops up when you click on the error-notifier button in the buddy-list will have the options to `Modify Account' and `Enable Account' (if the account is disabled) or `Connect' (if just disconnected)." I like this, as I can do something from that dialog now. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 22 Feb 2006 02:24:23 +0000
parents 44a8d46ee3c1
children 999571d910ed
comparison
equal deleted inserted replaced
13314:b12427d2994e 13315:d65250edebe0
3469 /***********************************/ 3469 /***********************************/
3470 /* Connection error handling stuff */ 3470 /* Connection error handling stuff */
3471 /***********************************/ 3471 /***********************************/
3472 3472
3473 static void 3473 static void
3474 ce_modify_account_cb(GaimAccount *account)
3475 {
3476 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account);
3477 }
3478
3479 static void
3480 ce_enable_account_cb(GaimAccount *account)
3481 {
3482 gaim_account_set_enabled(account, gaim_core_get_ui(), TRUE);
3483 }
3484
3485 static void
3474 connection_error_button_clicked_cb(GtkButton *widget, gpointer user_data) 3486 connection_error_button_clicked_cb(GtkButton *widget, gpointer user_data)
3475 { 3487 {
3476 GaimAccount *account; 3488 GaimAccount *account;
3477 char *primary; 3489 char *primary;
3478 const char *text; 3490 const char *text;
3479 3491
3480 account = user_data; 3492 account = user_data;
3481 primary = g_strdup_printf(_("%s disconnected"), 3493 primary = g_strdup_printf(_("%s disconnected"),
3482 gaim_account_get_username(account)); 3494 gaim_account_get_username(account));
3483 text = g_hash_table_lookup(gtkblist->connection_errors, account); 3495 text = g_hash_table_lookup(gtkblist->connection_errors, account);
3484 gaim_notify_formatted(NULL, _("Connection Error"), 3496
3485 primary, NULL, text, NULL, NULL); 3497 if (gaim_account_is_connected(account))
3498 {
3499 gaim_notify_formatted(NULL, _("Connection Error"),
3500 primary, NULL, text, NULL, NULL);
3501 }
3502 else
3503 {
3504 gboolean enabled = gaim_account_get_enabled(account, gaim_core_get_ui());
3505 gaim_request_action(NULL, _("Connection Error"), primary, text, 2,
3506 account, 3,
3507 _("OK"), NULL,
3508 _("Modify Account"), GAIM_CALLBACK(ce_modify_account_cb),
3509 enabled ? _("Connect") : _("Enable Account"),
3510 enabled ? GAIM_CALLBACK(gaim_account_connect) :
3511 GAIM_CALLBACK(ce_enable_account_cb));
3512 }
3486 gtk_widget_destroy(GTK_WIDGET(widget)); 3513 gtk_widget_destroy(GTK_WIDGET(widget));
3487 g_hash_table_remove(gtkblist->connection_errors, account); 3514 g_hash_table_remove(gtkblist->connection_errors, account);
3488 } 3515 }
3489 3516
3490 /* Add some buttons that show connection errors */ 3517 /* Add some buttons that show connection errors */