changeset 19768:41cad24fd6df

Instead of just notifying the user about a connection error, give him options to re-enable the account, or change account settings. (This does not introduce any new strings)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 12 Sep 2007 13:24:12 +0000
parents 6060bc0a8cca
children 6f4facc932b6
files ChangeLog.API finch/gntaccount.c finch/gntaccount.h finch/gntconn.c
diffstat 4 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Wed Sep 12 12:20:49 2007 +0000
+++ b/ChangeLog.API	Wed Sep 12 13:24:12 2007 +0000
@@ -43,6 +43,7 @@
 		* finch_sound_is_enabled
 		* The reserved field in the FinchConv is now used to store information
 		  about the conversation (using FinchConversationFlag)
+		* finch_account_dialog_show
 
 		libgnt:
 		* gnt_slider_set_small_step, gnt_slider_set_large_step to allow more
--- a/finch/gntaccount.c	Wed Sep 12 12:20:49 2007 +0000
+++ b/finch/gntaccount.c	Wed Sep 12 13:24:12 2007 +0000
@@ -715,6 +715,11 @@
 	gnt_widget_show(accounts.window);
 }
 
+void finch_account_dialog_show(PurpleAccount *account)
+{
+	edit_account(account);
+}
+
 static gpointer
 finch_accounts_get_handle()
 {
--- a/finch/gntaccount.h	Wed Sep 12 12:20:49 2007 +0000
+++ b/finch/gntaccount.h	Wed Sep 12 13:24:12 2007 +0000
@@ -54,6 +54,13 @@
  */
 void finch_accounts_show_all(void);
 
+/**
+ * Show the edit dialog for an account.
+ *
+ * @param account  The account to edit, or @c NULL to create a new account.
+ */
+void finch_account_dialog_show(PurpleAccount *account);
+
 /*@}*/
 
 #endif
--- a/finch/gntconn.c	Wed Sep 12 12:20:49 2007 +0000
+++ b/finch/gntconn.c	Wed Sep 12 13:24:12 2007 +0000
@@ -30,6 +30,7 @@
 #include "debug.h"
 #include "request.h"
 
+#include "gntaccount.h"
 #include "gntconn.h"
 
 #define INITIAL_RECON_DELAY_MIN  8000
@@ -87,6 +88,18 @@
 }
 
 static void
+ce_modify_account_cb(PurpleAccount *account)
+{
+	finch_account_dialog_show(account);
+}
+
+static void
+ce_enable_account_cb(PurpleAccount *account)
+{
+	purple_account_set_enabled(account, FINCH_UI, TRUE);
+}
+
+static void
 finch_connection_report_disconnect(PurpleConnection *gc, const char *text)
 {
 	FinchAutoRecon *info;
@@ -114,7 +127,13 @@
 		secondary = g_strdup_printf(_("%s\n\n"
 				"Finch will not attempt to reconnect the account until you "
 				"correct the error and re-enable the account."), text);
-		purple_notify_error(NULL, NULL, primary, secondary);
+
+		purple_request_action(account, NULL, primary, secondary, 2,
+							account, NULL, NULL,
+							account, 3,
+							_("OK"), NULL,
+							_("Modify Account"), PURPLE_CALLBACK(ce_modify_account_cb),
+							_("Re-enable Account"), PURPLE_CALLBACK(ce_enable_account_cb));
 
 		g_free(act);
 		g_free(primary);