changeset 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 b12427d2994e
children 41c4b4aa523a
files src/gtkblist.c
diffstat 1 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Wed Feb 22 02:11:02 2006 +0000
+++ b/src/gtkblist.c	Wed Feb 22 02:24:23 2006 +0000
@@ -3471,6 +3471,18 @@
 /***********************************/
 
 static void
+ce_modify_account_cb(GaimAccount *account)
+{
+	gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account);
+}
+
+static void
+ce_enable_account_cb(GaimAccount *account)
+{
+	gaim_account_set_enabled(account, gaim_core_get_ui(), TRUE);
+}
+
+static void
 connection_error_button_clicked_cb(GtkButton *widget, gpointer user_data)
 {
 	GaimAccount *account;
@@ -3481,8 +3493,23 @@
 	primary = g_strdup_printf(_("%s disconnected"),
 							  gaim_account_get_username(account));
 	text = g_hash_table_lookup(gtkblist->connection_errors, account);
-	gaim_notify_formatted(NULL, _("Connection Error"),
-						  primary, NULL, text, NULL, NULL);
+	
+	if (gaim_account_is_connected(account))
+	{
+		gaim_notify_formatted(NULL, _("Connection Error"),
+							  primary, NULL, text, NULL, NULL);
+	}
+	else
+	{
+		gboolean enabled = gaim_account_get_enabled(account, gaim_core_get_ui());
+		gaim_request_action(NULL, _("Connection Error"), primary, text, 2,
+							account, 3,
+							_("OK"), NULL,
+							_("Modify Account"), GAIM_CALLBACK(ce_modify_account_cb),
+							enabled ? _("Connect") : _("Enable Account"),
+							enabled ? GAIM_CALLBACK(gaim_account_connect) : 
+										GAIM_CALLBACK(ce_enable_account_cb));
+	}
 	gtk_widget_destroy(GTK_WIDGET(widget));
 	g_hash_table_remove(gtkblist->connection_errors, account);
 }