empathy r1630 - trunk/src



Author: xclaesse
Date: Fri Oct 17 12:47:48 2008
New Revision: 1630
URL: http://svn.gnome.org/viewvc/empathy?rev=1630&view=rev

Log:
Removed empathy_import_dialog_accounts_to_import to stop the accounts being parsed twice. (Jonny Lamb)

Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>

Modified:
   trunk/src/empathy-accounts-dialog.c
   trunk/src/empathy-import-dialog.c
   trunk/src/empathy-import-dialog.h

Modified: trunk/src/empathy-accounts-dialog.c
==============================================================================
--- trunk/src/empathy-accounts-dialog.c	(original)
+++ trunk/src/empathy-accounts-dialog.c	Fri Oct 17 12:47:48 2008
@@ -1007,7 +1007,7 @@
 accounts_dialog_button_import_clicked_cb (GtkWidget             *button,
 					  EmpathyAccountsDialog *dialog)
 {
-	empathy_import_dialog_show (GTK_WINDOW (dialog->window));
+	empathy_import_dialog_show (GTK_WINDOW (dialog->window), TRUE);
 }
 
 static void
@@ -1021,36 +1021,6 @@
 }
 
 static void
-accounts_dialog_accounts_to_import (EmpathyAccountsDialog *dialog)
-{
-	GtkWidget *message;
-	gint response;
-	gboolean ask;
-
-	empathy_conf_get_bool (empathy_conf_get (),
-				 EMPATHY_PREFS_IMPORT_ASKED, &ask);
-
-	if (ask)
-		return;
-
-	empathy_conf_set_bool (empathy_conf_get (),
-				 EMPATHY_PREFS_IMPORT_ASKED, TRUE);
-
-	message = gtk_message_dialog_new (GTK_WINDOW (dialog->window),
-					  GTK_DIALOG_MODAL,
-					  GTK_MESSAGE_QUESTION,
-					  GTK_BUTTONS_YES_NO,
-					  _("Do you want to import accounts"
-					    " from Pidgin?"));
-
-	response = gtk_dialog_run (GTK_DIALOG (message));
-	gtk_widget_destroy (message);
-
-	if (response == GTK_RESPONSE_YES)
-		empathy_import_dialog_show (GTK_WINDOW (dialog->window));
-}
-
-static void
 accounts_dialog_destroy_cb (GtkWidget            *widget,
 			    EmpathyAccountsDialog *dialog)
 {
@@ -1105,6 +1075,8 @@
 	GladeXML                     *glade;
 	gchar                        *filename;
 	GList                        *accounts, *l;
+	gboolean                      import;
+
 
 	if (dialog) {
 		gtk_window_present (GTK_WINDOW (dialog->window));
@@ -1208,8 +1180,15 @@
 
 	gtk_widget_show (dialog->window);
 
-	if (empathy_import_dialog_accounts_to_import ())
-		accounts_dialog_accounts_to_import (dialog);
+	empathy_conf_get_bool (empathy_conf_get (),
+			       EMPATHY_PREFS_IMPORT_ASKED, &import);
+
+	if (!import) {
+		empathy_conf_set_bool (empathy_conf_get (),
+				       EMPATHY_PREFS_IMPORT_ASKED, TRUE);
+		empathy_import_dialog_show (GTK_WINDOW (dialog->window),
+					    FALSE);
+	}
 
 	return dialog->window;
 }

Modified: trunk/src/empathy-import-dialog.c
==============================================================================
--- trunk/src/empathy-import-dialog.c	(original)
+++ trunk/src/empathy-import-dialog.c	Fri Oct 17 12:47:48 2008
@@ -416,21 +416,6 @@
   return accounts;
 }
 
-gboolean
-empathy_import_dialog_accounts_to_import (void)
-{
-  GList *list;
-  gboolean out;
-
-  list = import_dialog_pidgin_load ();
-
-  out = (g_list_length (list) > 0);
-
-  g_list_free (list);
-
-  return out;
-}
-
 static gboolean
 import_dialog_tree_model_foreach (GtkTreeModel *model,
                                   GtkTreePath *path,
@@ -669,7 +654,8 @@
 }
 
 void
-empathy_import_dialog_show (GtkWindow *parent)
+empathy_import_dialog_show (GtkWindow *parent,
+                            gboolean warning)
 {
   static EmpathyImportDialog *dialog = NULL;
   GladeXML *glade;
@@ -689,13 +675,19 @@
     {
       GtkWidget *message;
 
-      message = gtk_message_dialog_new (parent,
-          GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
-          _("No accounts to import could be found. Empathy currently only "
-            "supports importing accounts from Pidgin."));
+      if (warning)
+        {
+          message = gtk_message_dialog_new (parent,
+              GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
+              _("No accounts to import could be found. Empathy currently only "
+                "supports importing accounts from Pidgin."));
+
+          gtk_dialog_run (GTK_DIALOG (message));
+          gtk_widget_destroy (message);
+        }
+      else
+        DEBUG ("No accounts to import; closing dialog silently.");
 
-      gtk_dialog_run (GTK_DIALOG (message));
-      gtk_widget_destroy (message);
       import_dialog_free (dialog);
       dialog = NULL;
       return;

Modified: trunk/src/empathy-import-dialog.h
==============================================================================
--- trunk/src/empathy-import-dialog.h	(original)
+++ trunk/src/empathy-import-dialog.h	Fri Oct 17 12:47:48 2008
@@ -26,8 +26,7 @@
 
 G_BEGIN_DECLS
 
-gboolean empathy_import_dialog_accounts_to_import (void);
-void empathy_import_dialog_show (GtkWindow *parent);
+void empathy_import_dialog_show (GtkWindow *parent, gboolean warning);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]