[evolution/account-mgmt: 27/52] Adapt modules/startup-wizard to the new ESource API.



commit 19ffde0125e9bdef74285c825e99ea89ab553c4e
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Apr 25 15:18:41 2011 -0400

    Adapt modules/startup-wizard to the new ESource API.

 modules/startup-wizard/evolution-startup-wizard.c |   57 +++++++++++----------
 1 files changed, 29 insertions(+), 28 deletions(-)
---
diff --git a/modules/startup-wizard/evolution-startup-wizard.c b/modules/startup-wizard/evolution-startup-wizard.c
index 7dd1c67..5665757 100644
--- a/modules/startup-wizard/evolution-startup-wizard.c
+++ b/modules/startup-wizard/evolution-startup-wizard.c
@@ -22,16 +22,15 @@
 
 #include <glib/gi18n-lib.h>
 #include <libebackend/e-extension.h>
+#include <libedataserver/e-source-mail-account.h>
 
 #include <shell/e-shell.h>
 
 #include <libevolution-utils/e-alert-dialog.h>
 #include <e-util/e-import.h>
 
-#include <libemail-utils/e-account-utils.h>
-
 #include <mail/e-mail-backend.h>
-#include <mail/em-account-editor.h>
+#include <mail/e-mail-config-assistant.h>
 
 #include <capplet/settings/mail-capplet-shell.h>
 
@@ -50,8 +49,6 @@ typedef struct _EStartupWizardClass EStartupWizardClass;
 struct _EStartupWizard {
 	EExtension parent;
 
-	EConfig *config;
-
 	EImport *import;
 	EImportTarget *import_target;
 
@@ -101,6 +98,7 @@ startup_wizard_get_shell (EStartupWizard *extension)
 	return E_SHELL (extensible);
 }
 
+#if 0  /* ACCOUNT_MGMT */
 static void
 startup_wizard_import_status (EImport *import,
                               const gchar *what,
@@ -443,28 +441,21 @@ startup_wizard_progress_page (EConfig *config,
 
 	return page;
 }
+#endif /* ACCOUNT_MGMT */
 
 static GtkWidget *
 startup_wizard_new_assistant (EStartupWizard *extension)
 {
 	EShell *shell;
-	EShellBackend *shell_backend;
-	EMailBackend *backend;
-	EMAccountEditor *emae;
-	EConfig *config;
-	EConfigItem *config_item;
-	GtkWidget *widget;
-	GSList *items = NULL;
+	GtkWidget *assistant;
+	ESourceRegistry *registry;
 
 	shell = startup_wizard_get_shell (extension);
-	shell_backend = e_shell_get_backend_by_name (shell, "mail");
-
-	backend = E_MAIL_BACKEND (shell_backend);
+	registry = e_shell_get_registry (shell);
 
-	emae = em_account_editor_new (
-		NULL, EMAE_ASSISTANT, backend,
-		"org.gnome.evolution.mail.config.accountWizard");
+	assistant = e_mail_config_assistant_new (registry);
 
+#if 0  /* ACCOUNT_MGMT */
 	config = E_CONFIG (emae->config);
 	extension->config = g_object_ref (config);
 
@@ -525,6 +516,9 @@ startup_wizard_new_assistant (EStartupWizard *extension)
 		emae, (GDestroyNotify) g_object_unref);
 
 	return config->window;
+#endif /* ACCOUNT_MGMT */
+
+	return assistant;
 }
 
 static GtkWidget *
@@ -546,9 +540,12 @@ startup_wizard_run (EStartupWizard *extension)
 {
 	EShell *shell;
 	GtkWidget *window;
-	EAccountList *account_list;
+	ESourceRegistry *registry;
+	const gchar *extension_name;
 	const gchar *startup_view;
 	gboolean express_mode;
+	gboolean have_account;
+	GList *list;
 
 	/* Accounts should now be loaded if there were any to load.
 	 * Check, and proceed with the Evolution Setup Assistant. */
@@ -557,8 +554,13 @@ startup_wizard_run (EStartupWizard *extension)
 	express_mode = e_shell_get_express_mode (shell);
 	startup_view = e_shell_get_startup_view (shell);
 
-	account_list = e_get_account_list ();
-	if (e_list_length (E_LIST (account_list)) > 0)
+	registry = e_shell_get_registry (shell);
+	extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+	list = e_source_registry_list_sources (registry, extension_name);
+	have_account = (list != NULL);
+	g_list_free (list);
+
+	if (have_account)
 		return;
 
 	if (express_mode && g_strcmp0 (startup_view, "mail") != 0)
@@ -577,9 +579,13 @@ startup_wizard_run (EStartupWizard *extension)
 
 	gtk_main ();
 
-	if (e_list_length (E_LIST (account_list)) <= 0)
-		exit (0);
+	extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+	list = e_source_registry_list_sources (registry, extension_name);
+	have_account = (list != NULL);
+	g_list_free (list);
 
+	if (!have_account)
+		exit(0);
 }
 
 static void
@@ -678,11 +684,6 @@ startup_wizard_dispose (GObject *object)
 
 	extension = E_STARTUP_WIZARD (object);
 
-	if (extension->config != NULL) {
-		g_object_unref (extension->config);
-		extension->config = NULL;
-	}
-
 	if (extension->import != NULL) {
 		e_import_target_free (
 			extension->import,



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