Re: [evolution-patches] 71373 Re-enabling first run wizard



On Tue, 2005-02-22 at 10:50 +0800, Not Zed wrote:
> 
> i'd much rather you just added a 'const char *id' to
> em_account_editor_new(), without this abdomination of a function name.
>
> and made the em_account_editor_construct code static.

Done and done.  Also made sure the strings used are exact so as not to
break the string freeze and that the groupwise/exchange plugin
definitions were updated.

-JP      
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1439
diff -u -r1.1439 ChangeLog
--- ChangeLog	3 Feb 2005 17:58:52 -0000	1.1439
+++ ChangeLog	21 Feb 2005 21:55:31 -0000
@@ -1,3 +1,7 @@
+2005-02-21  JP Rosevear  <jpr novell com>
+
+	* configure.in: add startup wizard plugin
+
 2005-02-01  Priit Laes <amd store20 com>
 
 	* configure.in : Remove duplicate entries for addressbook-groupwise,
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.784
diff -u -r1.784 configure.in
--- configure.in	9 Feb 2005 00:24:57 -0000	1.784
+++ configure.in	21 Feb 2005 21:55:32 -0000
@@ -1333,7 +1333,7 @@
 AC_ARG_ENABLE(plugins, [  --enable-plugins=[no/all/list]      Enable plugins.],enable_plugins="$enableval",enable_plugins=base)
 
 dnl Add any new plugins here
-plugins_base="calendar-file calendar-http calendar-weather groupwise-account-setup itip-formatter plugin-manager send-options shared-folder groupwise-send-options exchange-account-setup groupwise-status-tracking default-source addressbook-file addressbook-groupwise" 
+plugins_base="calendar-file calendar-http calendar-weather groupwise-account-setup itip-formatter plugin-manager send-options shared-folder groupwise-send-options exchange-account-setup groupwise-status-tracking default-source addressbook-file addressbook-groupwise startup-wizard" 
 
 plugins_all="bbdb subject-thread save-attachments prefer-plain save-calendar select-one-source copy-tool mail-to-meeting mail-to-task folder-unsubscribe mark-calendar-offline audio-inline mailing-list-actions backup-restore new-mail-notify" 
 
@@ -1579,6 +1579,7 @@
 plugins/default-source/Makefile
 plugins/addressbook-file/Makefile
 plugins/addressbook-groupwise/Makefile
+plugins/startup-wizard/Makefile
 smime/Makefile
 smime/lib/Makefile
 smime/gui/Makefile
? 46287.patch
? mail-subject-thread.loT
? print-mail.patch
? wizard-mail.patch
? default/zh_CN/Makefile
? default/zh_CN/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3587
diff -u -r1.3587 ChangeLog
--- ChangeLog	23 Feb 2005 18:56:58 -0000	1.3587
+++ ChangeLog	23 Feb 2005 22:27:58 -0000
@@ -1,3 +1,20 @@
+2005-02-23  JP Rosevear  <jpr novell com>
+
+	* em-utils.c (em_utils_configure_account): pass in accountDruid
+	config id
+
+	* em-account-prefs.c (account_add_clicked): pass in accountDruid
+	config id
+	(account_edit_clicked): pass in accountWizard config id
+	
+	* em-account-editor.h: update protos
+
+	* em-account-editor.c (em_account_editor_new_with_config_id):
+	create a new account editor with a specific config id
+	(em_account_editor_new): pass
+	(em_account_editor_construct): make this static and take the
+	config id as an arg
+
 2005-02-23  Hans Petter Jansson  <hpj novell com>
 
 	* mail-session.c:
Index: em-account-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-account-editor.c,v
retrieving revision 1.21
diff -u -r1.21 em-account-editor.c
--- em-account-editor.c	23 Feb 2005 07:13:46 -0000	1.21
+++ em-account-editor.c	23 Feb 2005 22:27:59 -0000
@@ -202,6 +202,7 @@
 } EMAccountEditorPrivate;
 
 static void emae_refresh_authtype(EMAccountEditor *emae, EMAccountEditorService *service);
+static void em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account_editor_t type, char *config_id);
 
 static GtkVBoxClass *emae_parent;
 
@@ -281,11 +282,11 @@
  * 
  * Return value: 
  **/
-EMAccountEditor *em_account_editor_new(EAccount *account, em_account_editor_t type)
+EMAccountEditor *em_account_editor_new(EAccount *account, em_account_editor_t type, char *config_id)
 {
 	EMAccountEditor *emae = g_object_new(em_account_editor_get_type(), 0);
 
-	em_account_editor_construct(emae, account, type);
+	em_account_editor_construct(emae, account, type, config_id);
 
 	return emae;
 }
@@ -2479,8 +2480,8 @@
 	g_object_unref(emae);
 }
 
-void
-em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account_editor_t type)
+static void
+em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account_editor_t type, char *config_id)
 {
 	EMAccountEditorPrivate *gui = emae->priv;
 	int i, index;
@@ -2516,26 +2517,10 @@
 	gui->providers = g_list_sort(camel_provider_list(TRUE), (GCompareFunc)provider_compare);
 
 	if (type == EMAE_NOTEBOOK) {
-		/** @HookPoint-EMConfig: Mail Account Editor
-		 * @Id: org.gnome.evolution.mail.config.accountEditor
-		 * @Type: E_CONFIG_BOOK
-		 * @Class: org.gnome.evolution.mail.config:1.0
-		 * @Target: EMConfigTargetAccount
-		 *
-		 * The account editor window.
-		 */
-		ec = em_config_new(E_CONFIG_BOOK, "org.gnome.evolution.mail.config.accountEditor");
+		ec = em_config_new(E_CONFIG_BOOK, config_id);
 		items = emae_editor_items;
 	} else {
-		/** @HookPoint-EMConfig: New Mail Account Druid
-		 * @Id: org.gnome.evolution.mail.config.accountDruid
-		 * @Type: E_CONFIG_DRUID
-		 * @Class: org.gnome.evolution.mail.config:1.0
-		 * @Target: EMConfigTargetAccount
-		 *
-		 * The new mail account druid.
-		 */
-		ec = em_config_new(E_CONFIG_DRUID, "org.gnome.evolution.mail.config.accountDruid");
+		ec = em_config_new(E_CONFIG_DRUID, config_id);
 		items = emae_druid_items;
 	}
 
Index: em-account-editor.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-account-editor.h,v
retrieving revision 1.2
diff -u -r1.2 em-account-editor.h
--- em-account-editor.h	20 Sep 2004 05:59:54 -0000	1.2
+++ em-account-editor.h	23 Feb 2005 22:27:59 -0000
@@ -64,8 +64,7 @@
 
 GType em_account_editor_get_type(void);
 
-void em_account_editor_construct(EMAccountEditor *emae, struct _EAccount *account, em_account_editor_t type);
-EMAccountEditor *em_account_editor_new(struct _EAccount *account, em_account_editor_t type);
+EMAccountEditor *em_account_editor_new(struct _EAccount *account, em_account_editor_t type, char *config_id);
 
 gboolean em_account_editor_save (EMAccountEditor *gui);
 void em_account_editor_destroy (EMAccountEditor *gui);
Index: em-account-prefs.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-account-prefs.c,v
retrieving revision 1.16
diff -u -r1.16 em-account-prefs.c
--- em-account-prefs.c	28 Jan 2005 09:07:01 -0000	1.16
+++ em-account-prefs.c	23 Feb 2005 22:27:59 -0000
@@ -145,7 +145,15 @@
 	if (prefs->druid == NULL) {
 		EMAccountEditor *emae;
 
-		emae = em_account_editor_new(NULL, EMAE_DRUID);
+		/** @HookPoint-EMConfig: New Mail Account Druid
+		 * @Id: org.gnome.evolution.mail.config.accountDruid
+		 * @Type: E_CONFIG_DRUID
+		 * @Class: org.gnome.evolution.mail.config:1.0
+		 * @Target: EMConfigTargetAccount
+		 *
+		 * The new mail account druid.
+		 */
+		emae = em_account_editor_new(NULL, EMAE_DRUID, "org.gnome.evolution.mail.config.accountDruid");
 		prefs->druid = emae->editor;
 
 		gtk_window_set_transient_for((GtkWindow *)prefs->druid, (GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)prefs));
@@ -187,7 +195,15 @@
 		if (account) {
 			EMAccountEditor *emae;
 
-			emae = em_account_editor_new(account, EMAE_NOTEBOOK);
+			/** @HookPoint-EMConfig: Mail Account Editor
+			 * @Id: org.gnome.evolution.mail.config.accountEditor
+			 * @Type: E_CONFIG_BOOK
+			 * @Class: org.gnome.evolution.mail.config:1.0
+			 * @Target: EMConfigTargetAccount
+			 *
+			 * The account editor window.
+			 */
+			emae = em_account_editor_new(account, EMAE_NOTEBOOK, "org.gnome.evolution.mail.config.accountEditor");
 			prefs->editor = emae->editor;
 
 			gtk_window_set_transient_for((GtkWindow *)prefs->editor, (GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)prefs));
Index: em-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.c,v
retrieving revision 1.57
diff -u -r1.57 em-utils.c
--- em-utils.c	23 Feb 2005 06:14:21 -0000	1.57
+++ em-utils.c	23 Feb 2005 22:27:59 -0000
@@ -181,7 +181,7 @@
 {
 	EMAccountEditor *emae;
 
-	emae = em_account_editor_new(NULL, EMAE_DRUID);
+	emae = em_account_editor_new(NULL, EMAE_DRUID, "org.gnome.evolution.mail.config.accountDruid");
 	if (parent != NULL)
 		e_dialog_set_transient_for((GtkWindow *)emae->editor, parent);
 
? exchange-account-setup/Makefile
? exchange-account-setup/Makefile.in
? exchange-account-setup/org-gnome-exchange-account-setup.eplug
? groupwise-account-setup/Makefile
? groupwise-account-setup/Makefile.in
? groupwise-account-setup/org-gnome-gw-account-setup.eplug
Index: startup-wizard/.cvsignore
===================================================================
RCS file: startup-wizard/.cvsignore
diff -N startup-wizard/.cvsignore
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ startup-wizard/.cvsignore	24 Feb 2005 00:15:23 -0000
@@ -0,0 +1,3 @@
+Makefile.in
+Makefile
+org-gnome-evolution-startup-wizard.eplug
Index: startup-wizard/ChangeLog
===================================================================
RCS file: startup-wizard/ChangeLog
diff -N startup-wizard/ChangeLog
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ startup-wizard/ChangeLog	24 Feb 2005 00:15:23 -0000
@@ -0,0 +1,4 @@
+2005-02-21  JP Rosevear  <jpr novell com>
+
+	* startup-wizard.c: A plugin the does the startup wizard
+
Index: startup-wizard/Makefile.am
===================================================================
RCS file: startup-wizard/Makefile.am
diff -N startup-wizard/Makefile.am
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ startup-wizard/Makefile.am	24 Feb 2005 00:15:23 -0000
@@ -0,0 +1,20 @@
+INCLUDES = -I .						\
+	-I$(top_srcdir)	                                \
+	$(EVOLUTION_MAIL_CFLAGS)
+
+ EVO_PLUGIN_RULE@
+
+plugin_DATA = org-gnome-evolution-startup-wizard.eplug
+plugin_LTLIBRARIES = liborg-gnome-evolution-startup-wizard.la
+
+liborg_gnome_evolution_startup_wizard_la_SOURCES = 	\
+	startup-wizard.c
+
+liborg_gnome_evolution_startup_wizard_la_LIBADD = 		\
+	$(top_builddir)/e-util/libeutil.la 			\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la		\
+	$(EVOLUTION_MAIL_LIBS)
+
+liborg_gnome_evolution_startup_wizard_la_LDFLAGS = -module -avoid-version
+
+EXTRA_DIST = org-gnome-evolution-startup-wizard.eplug.in
Index: startup-wizard/org-gnome-evolution-startup-wizard.eplug.in
===================================================================
RCS file: startup-wizard/org-gnome-evolution-startup-wizard.eplug.in
diff -N startup-wizard/org-gnome-evolution-startup-wizard.eplug.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ startup-wizard/org-gnome-evolution-startup-wizard.eplug.in	24 Feb 2005 00:15:23 -0000
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<e-plugin-list>
+	  <e-plugin
+	    type="shlib"
+	    id="org.gnome.evolution.plugin.startup-wizard"
+	    location="@PLUGINDIR@/liborg-gnome-evolution-startup-wizard.so"
+	    name="Startup wizard">
+
+		<hook class="org.gnome.evolution.shell.events:1.0">
+			<event
+			   id="upgrade.done"
+			   handle="startup_wizard"
+			   target="upgrade"
+			/>
+		</hook>    
+
+	    <hook class="org.gnome.evolution.mail.config:1.0">
+		      <group target="account" id="org.gnome.evolution.mail.config.accountWizard" check="startup_wizard_check" commit="startup_wizard_commit" abort="startup_wizard_abort">
+			<item type="page" path="50.timezone" factory="startup_wizard_timezone_page"/>
+			<item type="page" path="60.importers" factory="startup_wizard_importer_page"/>
+		      </group>
+	    </hook>
+
+	  </e-plugin>
+</e-plugin-list>
Index: startup-wizard/startup-wizard.c
===================================================================
RCS file: startup-wizard/startup-wizard.c
diff -N startup-wizard/startup-wizard.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ startup-wizard/startup-wizard.c	24 Feb 2005 00:15:24 -0000
@@ -0,0 +1,516 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ *  JP Rosevear <jpr novell com>
+ *  Copyright (C) 2005 Novell, Inc.
+ *
+ *  Permission is hereby granted, free of charge, to any person
+ *  obtaining a copy of this software and associated documentation
+ *  files (the "Software"), to deal in the Software without
+ *  restriction, including without limitation the rights to use, copy,
+ *  modify, merge, publish, distribute, sublicense, and/or sell copies
+ *  of the Software, and to permit persons to whom the Software is
+ *  furnished to do so, subject to the following conditions:
+ *  
+ *  The above copyright notice and this permission notice shall be
+ *  included in all copies or substantial portions of the Software.
+ *  
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ *  DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include <gconf/gconf-client.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <libgnomeui/libgnomeui.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-widget.h>
+#include "widgets/e-timezone-dialog/e-timezone-dialog.h"
+#include "e-util/e-icon-factory.h"
+#include "e-util/e-gtk-utils.h"
+#include "shell/es-event.h"
+#include "shell/importer/GNOME_Evolution_Importer.h"
+#include "mail/em-config.h"
+#include "mail/em-account-editor.h"
+#include "calendar/gui/calendar-config.h"
+
+typedef struct _ImportData {
+	GList *importers;
+	
+	int running;
+	gboolean prepared;
+} ImportData;
+
+typedef struct _IntelligentImporterData {
+	CORBA_Object object;
+	Bonobo_Control control;
+	GtkWidget *widget;
+
+	char *name;
+	char *blurb;
+	char *iid;
+} IntelligentImporterData;
+
+typedef struct _SelectedImporterData{
+	CORBA_Object importer;
+	char *iid;
+} SelectedImporterData;
+
+#define IMPORT_PAGE_DATA "StartupWizard::ImportData"
+#define IMPORT_TIMEZONE_DIALOG "StartupWizard::TimezoneDialog"
+
+void startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target);
+GtkWidget *startup_wizard_timezone_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data);
+GtkWidget *startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data);
+gboolean startup_wizard_check (EPlugin *ep, EConfigHookPageCheckData *check_data);
+void startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target);
+void startup_wizard_abort (EPlugin *ep, EMConfigTargetAccount *target);
+
+void
+startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target)
+{
+	GConfClient *client;
+	GSList *accounts;
+	EMAccountEditor *emae;
+	GnomeDruidPageEdge *start_page;
+	
+	client = gconf_client_get_default ();
+	accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
+	g_object_unref (client);
+	
+	if (accounts != NULL) {
+		g_slist_foreach (accounts, (GFunc) g_free, NULL);
+		g_slist_free (accounts);
+
+		return;
+	}	
+
+	/** @HookPoint-EMConfig: New Mail Account Wizard
+	 * @Id: org.gnome.evolution.mail.config.accountWizard
+	 * @Type: E_CONFIG_DRUID
+	 * @Class: org.gnome.evolution.mail.config:1.0
+	 * @Target: EMConfigTargetAccount
+	 *
+	 * The new mail account druid.
+	 */
+	emae = em_account_editor_new (NULL, EMAE_DRUID, "org.gnome.evolution.mail.config.accountWizard");
+
+	gtk_window_set_title (GTK_WINDOW (emae->editor), _("Evolution Setup Assistant"));
+
+	start_page = GNOME_DRUID_PAGE_EDGE (e_config_page_get ((EConfig *) emae->config, "0.start"));
+	gnome_druid_page_edge_set_title (start_page, _("Welcome"));
+	gnome_druid_page_edge_set_text (start_page, _(""
+					"Welcome to Evolution. The next few screens will allow Evolution to connect "
+					"to your email accounts, and to import files from other applications. \n"
+					"\n"
+					"Please click the \"Forward\" button to continue. "));
+	
+	gtk_widget_show (emae->editor);
+	gtk_main ();
+}
+
+GtkWidget *
+startup_wizard_timezone_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
+{
+	ETimezoneDialog *etd;
+	GtkWidget *page;
+	icaltimezone *zone;
+	
+	etd = e_timezone_dialog_new ();
+	g_object_set_data (G_OBJECT (hook_data->config), IMPORT_TIMEZONE_DIALOG, etd);
+	
+	page = gnome_druid_page_standard_new_with_vals ("Timezone", NULL, NULL);
+	e_timezone_dialog_reparent (etd, GNOME_DRUID_PAGE_STANDARD (page)->vbox);
+
+	zone = calendar_config_get_icaltimezone	();
+	if (zone)
+		e_timezone_dialog_set_timezone (etd, zone);
+	
+	gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page));
+
+	return GTK_WIDGET (page);
+}
+
+GtkWidget *
+startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
+{
+	GtkWidget *page, *label, *sep;
+	GdkPixbuf *pixbuf;
+
+	pixbuf = e_icon_factory_get_icon ("stock_mail-import", E_ICON_SIZE_DIALOG);
+	page = gnome_druid_page_standard_new_with_vals ("Importing files", pixbuf, NULL);
+	g_object_unref (pixbuf);
+
+	label = gtk_label_new (_("Please select the information that you would like to import:"));
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), label, FALSE, FALSE, 3);
+
+	sep = gtk_hseparator_new ();
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), sep, FALSE, FALSE, 3);
+
+	gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page));
+
+	return GTK_WIDGET (page);
+}
+
+static GList *
+get_intelligent_importers (void)
+{
+	Bonobo_ServerInfoList *info_list;
+	GList *iids_ret = NULL;
+	CORBA_Environment ev;
+	char *query;
+	int i;
+
+	CORBA_exception_init (&ev);
+	query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:%s')", BASE_VERSION);
+	info_list = bonobo_activation_query (query, NULL, &ev);
+	g_free (query);
+
+	if (BONOBO_EX (&ev) || info_list == CORBA_OBJECT_NIL) {
+		g_warning ("Cannot find importers -- %s", BONOBO_EX_REPOID (&ev));
+		CORBA_exception_free (&ev);
+		return NULL;
+	}
+	CORBA_exception_free (&ev);
+
+	for (i = 0; i < info_list->_length; i++) {
+		const Bonobo_ServerInfo *info;
+
+		info = info_list->_buffer + i;
+		iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid));
+	}
+
+	return iids_ret;
+}
+ 
+gboolean
+startup_wizard_check (EPlugin *ep, EConfigHookPageCheckData *check_data)
+{
+	EConfig *ec;
+	GnomeDruid *druid;
+	GnomeDruidPage *finish_page, *import_page;
+	GtkWidget *dialog;
+	ImportData *import_data;
+	GList *l, *importers;
+	GtkWidget *table;
+	int running = 0;
+
+	if (strcmp ("60.importers", check_data->pageid))
+		return TRUE;
+
+	ec = check_data->config;
+	
+	import_data = g_object_get_data (G_OBJECT (ec), IMPORT_PAGE_DATA);
+	if (!import_data) {
+		/* FIXME Free this */
+		import_data = g_new0 (ImportData, 1);
+		g_object_set_data (G_OBJECT (ec), IMPORT_PAGE_DATA, import_data);
+	}
+
+	druid = GNOME_DRUID (ec->widget);
+	import_page = GNOME_DRUID_PAGE (e_config_page_get (ec, "60.import"));
+	finish_page = GNOME_DRUID_PAGE (e_config_page_get (ec, "999.end"));
+	
+	if (import_data->prepared == TRUE) {
+		if (import_data->running == 0)
+			gnome_druid_set_page (druid, finish_page);
+		return TRUE;
+	}
+
+	import_data->prepared = TRUE;
+
+	dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO,
+					 GTK_BUTTONS_NONE,
+					 _("Please wait...\nScanning for existing setups"));
+#if !GTK_CHECK_VERSION (2,4,0)
+	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+#endif
+	e_make_widget_backing_stored (dialog);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Starting import"));
+	gtk_widget_show_all (dialog);
+	gtk_widget_show_now (dialog);
+
+	gtk_widget_queue_draw (dialog);
+	gdk_flush ();
+
+	while (gtk_events_pending ()) {
+		gtk_main_iteration ();
+	}
+
+	importers = get_intelligent_importers ();
+	if (importers == NULL) {
+		/* No importers, go directly to finish, do not pass go
+		   Do not collect $200 */
+		gnome_druid_set_page (druid, finish_page);
+		gtk_widget_destroy (dialog);
+		return TRUE;
+	}
+
+	table = gtk_table_new (g_list_length (importers), 2, FALSE);
+	for (l = importers; l; l = l->next) {
+		GtkWidget *label;
+		CORBA_Environment ev;
+		gboolean can_run;
+		char *str;
+		IntelligentImporterData *id;
+
+		id = g_new0 (IntelligentImporterData, 1);
+		id->iid = g_strdup (l->data);
+
+		CORBA_exception_init (&ev);
+		id->object = bonobo_activation_activate_from_id ((char *) id->iid, 0, NULL, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not start %s:%s", id->iid,
+				   CORBA_exception_id (&ev));
+
+			CORBA_exception_free (&ev);
+			/* Clean up the IID */
+			g_free (id->iid);
+			g_free (id);
+			continue;
+		}
+
+		if (id->object == CORBA_OBJECT_NIL) {
+			g_warning ("Could not activate component %s", id->iid);
+			CORBA_exception_free (&ev);
+
+			g_free (id->iid);
+			g_free (id);
+			continue;
+		}
+
+		can_run = GNOME_Evolution_IntelligentImporter_canImport (id->object, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not call canImport(%s): %s", id->iid,
+				   CORBA_exception_id (&ev));
+			bonobo_object_release_unref (id->object, &ev);
+			CORBA_exception_free (&ev);
+
+			g_free (id->iid);
+			g_free (id);
+			continue;
+		}
+
+		if (can_run == FALSE) {
+			bonobo_object_release_unref (id->object, &ev);
+			CORBA_exception_free (&ev);
+			g_free (id->iid);
+			g_free (id);
+			continue;
+		}
+
+		running++;
+		id->name = GNOME_Evolution_IntelligentImporter__get_importername (id->object, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not get name(%s): %s", id->iid,
+				   CORBA_exception_id (&ev));
+			bonobo_object_release_unref (id->object, &ev);
+			CORBA_exception_free (&ev);
+			g_free (id->iid);
+			g_free (id);
+			continue;
+		}
+
+		id->blurb = GNOME_Evolution_IntelligentImporter__get_message (id->object, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not get message(%s): %s",
+				   id->iid, CORBA_exception_id (&ev));
+			bonobo_object_release_unref (id->object, &ev);
+			CORBA_exception_free (&ev);
+			g_free (id->iid);
+			CORBA_free (id->name);
+			g_free (id);
+			continue;
+		}
+
+		id->control = Bonobo_Unknown_queryInterface (id->object,
+							     "IDL:Bonobo/Control:1.0", &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not QI for Bonobo/Control:1.0 %s:%s",
+				   id->iid, CORBA_exception_id (&ev));
+			bonobo_object_release_unref (id->object, &ev);
+			CORBA_exception_free (&ev);
+			g_free (id->iid);
+			CORBA_free (id->name);
+			CORBA_free (id->blurb);
+			continue;
+		}
+
+		if (id->control != CORBA_OBJECT_NIL) {
+			id->widget = bonobo_widget_new_control_from_objref (id->control, CORBA_OBJECT_NIL);
+			gtk_widget_show (id->widget);
+		} else {
+			printf("no control\n");
+			id->widget = gtk_label_new ("");
+			gtk_widget_show (id->widget);
+		}
+
+		CORBA_exception_free (&ev);
+
+		import_data->importers = g_list_prepend (import_data->importers, id);
+		str = g_strdup_printf (_("From %s:"), id->name);
+		label = gtk_label_new (str);
+		g_free (str);
+
+		gtk_misc_set_alignment (GTK_MISC (label), 0, .5); 
+
+		gtk_table_attach (GTK_TABLE (table), label, 0, 1, running - 1,
+				  running, GTK_FILL, 0, 0, 0);
+		gtk_table_attach (GTK_TABLE (table), id->widget, 1, 2,
+				  running - 1, running, GTK_FILL, 0, 3, 0);
+		gtk_widget_show_all (table);
+
+		gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (import_page)->vbox), table,
+				    FALSE, FALSE, 0);
+	}
+
+	if (running == 0) {
+		gnome_druid_set_page (druid, finish_page);
+		gtk_widget_destroy (dialog);
+		return TRUE;
+	}
+
+	import_data->running = running;
+	gtk_widget_destroy (dialog);
+
+	return FALSE;	
+}
+
+static void
+free_importers (ImportData *import_data)
+{
+	GList *l;
+
+	for (l = import_data->importers; l; l = l->next) {
+		IntelligentImporterData *iid;
+
+		iid = l->data;
+		if (iid->object != CORBA_OBJECT_NIL) 
+			bonobo_object_release_unref (iid->object, NULL);
+	}
+
+	g_list_free (import_data->importers);
+}
+
+static void
+start_importers (GList *p)
+{
+	CORBA_Environment ev;
+	
+	for (; p; p = p->next) {
+		SelectedImporterData *sid = p->data;
+
+		CORBA_exception_init (&ev);
+		GNOME_Evolution_IntelligentImporter_importData (sid->importer, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Error importing %s\n%s", sid->iid,
+				   CORBA_exception_id (&ev));
+		}
+		CORBA_exception_free (&ev);
+	}
+}
+
+static void
+do_import (ImportData *import_data)
+{
+	CORBA_Environment ev;
+	GList *l, *selected = NULL;
+
+	for (l = import_data->importers; l; l = l->next) {
+		IntelligentImporterData *importer_data;
+		SelectedImporterData *sid;
+		char *iid;
+
+		importer_data = l->data;
+		iid = g_strdup (importer_data->iid);
+
+		sid = g_new (SelectedImporterData, 1);
+		sid->iid = iid;
+
+		CORBA_exception_init (&ev);
+		sid->importer = bonobo_object_dup_ref (importer_data->object, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Error duplication %s\n(%s)", iid,
+				   CORBA_exception_id (&ev));
+			g_free (iid);
+			CORBA_exception_free (&ev);
+			g_free (sid);
+			continue;
+		}
+		CORBA_exception_free (&ev);
+
+		selected = g_list_prepend (selected, sid);
+	}
+
+	free_importers (import_data);
+
+	if (selected != NULL) {
+		start_importers (selected);
+
+		for (l = selected; l; l = l->next) {
+			SelectedImporterData *sid = l->data;
+
+			CORBA_exception_init (&ev);
+			bonobo_object_release_unref (sid->importer, &ev);
+			CORBA_exception_free (&ev);
+
+			g_free (sid->iid);
+			g_free (sid);
+		}
+		g_list_free (selected);
+	}
+}
+
+void
+startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target)
+{
+	EConfig *ec = ((EConfigTarget *)target)->config;
+	ImportData *import_data;
+	ETimezoneDialog *etd;
+	icaltimezone *zone;
+
+	import_data = g_object_get_data (G_OBJECT (ec), IMPORT_PAGE_DATA);
+	if (import_data)
+		do_import (import_data);		
+	
+	/* Set Timezone */
+	etd = g_object_get_data (G_OBJECT (ec), IMPORT_TIMEZONE_DIALOG);
+	if (etd) {
+		zone = e_timezone_dialog_get_timezone (E_TIMEZONE_DIALOG (etd));
+		if (zone)
+			calendar_config_set_timezone (icaltimezone_get_display_name (zone));
+
+		/* Need to do this otherwise the timezone widget gets destroyed but the
+		   timezone object isn't, and we can get a crash like #22047.  */
+		g_object_unref (etd);
+		g_object_set_data (G_OBJECT (ec), IMPORT_TIMEZONE_DIALOG, NULL);
+	}
+	
+
+	gtk_main_quit ();
+}
+
+void
+startup_wizard_abort (EPlugin *ep, EMConfigTargetAccount *target)
+{
+	EConfig *ec = ((EConfigTarget *)target)->config;
+	ETimezoneDialog *etd;
+
+	etd = g_object_get_data (G_OBJECT (ec), IMPORT_TIMEZONE_DIALOG);
+	if (etd) {
+		/* Need to do this otherwise the timezone widget gets destroyed but the
+		   timezone object isn't, and we can get a crash like #22047.  */
+		g_object_unref (etd);
+		g_object_set_data (G_OBJECT (ec), IMPORT_TIMEZONE_DIALOG, NULL);
+	}
+
+	gtk_main_quit ();
+	exit (0);
+}
Index: exchange-account-setup/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-account-setup/ChangeLog,v
retrieving revision 1.20
diff -u -r1.20 ChangeLog
--- exchange-account-setup/ChangeLog	23 Feb 2005 06:11:58 -0000	1.20
+++ exchange-account-setup/ChangeLog	24 Feb 2005 00:15:24 -0000
@@ -1,3 +1,7 @@
+2005-02-23  JP Rosevear  <jpr novell com>
+
+	* org-gnome-exchange-account-setup.eplug.in: add account wizard item
+
 2005-02-21  Not Zed  <NotZed Ximian com>
 
 	* exchange-account-setup.c (org_gnome_exchange_owa_url): if the
Index: exchange-account-setup/org-gnome-exchange-account-setup.eplug.in
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in,v
retrieving revision 1.12
diff -u -r1.12 org-gnome-exchange-account-setup.eplug.in
--- exchange-account-setup/org-gnome-exchange-account-setup.eplug.in	7 Feb 2005 11:24:16 -0000	1.12
+++ exchange-account-setup/org-gnome-exchange-account-setup.eplug.in	24 Feb 2005 00:15:24 -0000
@@ -33,6 +33,15 @@
                         path="10.receive/10.config/20.owa"
 			factory="org_gnome_exchange_owa_url"/>
 	</group>
+
+        <group
+                target="account"
+                id="org.gnome.evolution.mail.config.accountWizard"
+		check="org_gnome_exchange_check_options">
+                <item type="item_table"
+                        path="10.receive/10.config/20.owa"
+			factory="org_gnome_exchange_owa_url"/>
+	</group>
     </hook>
 
   </e-plugin>
Index: groupwise-account-setup/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/groupwise-account-setup/ChangeLog,v
retrieving revision 1.9
diff -u -r1.9 ChangeLog
--- groupwise-account-setup/ChangeLog	23 Feb 2005 18:56:58 -0000	1.9
+++ groupwise-account-setup/ChangeLog	24 Feb 2005 00:15:24 -0000
@@ -1,3 +1,7 @@
+2005-02-23  JP Rosevear  <jpr novell com>
+
+	* org-gnome-gw-account-setup.eplug.in: add account wizard item
+
 2005-02-23  Hans Petter Jansson  <hpj novell com>
 
 	* camel-gw-listener.c: Include <libedataserverui/e-passwords.h>.
Index: groupwise-account-setup/org-gnome-gw-account-setup.eplug.in
===================================================================
RCS file: /cvs/gnome/evolution/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.in,v
retrieving revision 1.2
diff -u -r1.2 org-gnome-gw-account-setup.eplug.in
--- groupwise-account-setup/org-gnome-gw-account-setup.eplug.in	22 Jan 2005 04:47:58 -0000	1.2
+++ groupwise-account-setup/org-gnome-gw-account-setup.eplug.in	24 Feb 2005 00:15:24 -0000
@@ -20,7 +20,12 @@
 	<item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_gw_account_setup"/>
       </group>
     </hook>
-	
+
+    <hook class="org.gnome.evolution.mail.config:1.0">
+      <group target="account" id="org.gnome.evolution.mail.config.accountWizard">
+	<item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_gw_account_setup"/>
+      </group>
+    </hook>	
     
   </e-plugin>
 </e-plugin-list>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1499
diff -u -r1.1499 ChangeLog
--- ChangeLog	23 Feb 2005 18:56:59 -0000	1.1499
+++ ChangeLog	23 Feb 2005 22:27:45 -0000
@@ -1,3 +1,11 @@
+2005-02-21  JP Rosevear  <jpr novell com>
+ 
+ 	* es-event.c (es_event_target_new_upgrade): create upgrade target
+ 
+ 	* es-event.h: add upgrade target 
+ 
+ 	* e-shell.c (e_shell_attempt_upgrade): emit upgrade.done
+ 
 2005-02-23  Hans Petter Jansson  <hpj novell com>
 
 	* e-shell-window-commands.c:
Index: e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.259
diff -u -r1.259 e-shell.c
--- e-shell.c	23 Feb 2005 18:56:59 -0000	1.259
+++ e-shell.c	23 Feb 2005 22:27:45 -0000
@@ -652,13 +652,6 @@
 	
 	e_shell_attempt_upgrade(shell);
 
-#if 0
-	if (e_shell_startup_wizard_create () == FALSE) {
-		bonobo_object_unref (BONOBO_OBJECT (shell));
-		exit (0);
-	}
-#endif
-
 	priv->is_initialized = TRUE;
 
 	switch (startup_line_mode) {
@@ -781,6 +774,7 @@
 	int done_upgrade = FALSE;
 	char *oldpath;
 	struct stat st;
+	ESEvent *ese;
 
 	gconf_client = gconf_client_get_default();
 
@@ -871,6 +865,16 @@
 	g_free(oldpath);
 	g_object_unref (gconf_client);
 
+	/** @Event: Shell attempted upgrade
+	 * @Id: upgrade.done
+	 * @Target: ESMenuTargetState
+	 * 
+	 * This event is emitted whenever the shell successfully attempts an upgrade.
+	 *
+	 */
+	ese = es_event_peek();
+	e_event_emit((EEvent *)ese, "upgrade.done", (EEventTarget *)es_event_target_new_upgrade(ese, cmajor, cminor, crevision));
+	
 	return TRUE;
 }
 
Index: es-event.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/es-event.c,v
retrieving revision 1.1
diff -u -r1.1 es-event.c
--- es-event.c	25 Oct 2004 04:46:18 -0000	1.1
+++ es-event.c	23 Feb 2005 22:27:45 -0000
@@ -129,6 +129,18 @@
 	return t;
 }
 
+ESEventTargetUpgrade *
+es_event_target_new_upgrade(ESEvent *eme, int major, int minor, int revision)
+{
+	ESEventTargetUpgrade *t = e_event_target_new(&eme->event, ES_EVENT_TARGET_UPGRADE, sizeof(*t));
+
+	t->major = major;
+	t->minor = minor;
+	t->revision = revision;
+
+	return t;	
+}
+
 /* ********************************************************************** */
 
 static void *emeh_parent_class;
@@ -142,6 +154,7 @@
 
 static const EEventHookTargetMap emeh_targets[] = {
 	{ "state", ES_EVENT_TARGET_STATE, emeh_state_masks },
+	{ "upgrade", ES_EVENT_TARGET_UPGRADE, NULL },
 	{ 0 }
 };
 
Index: es-event.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/es-event.h,v
retrieving revision 1.1
diff -u -r1.1 es-event.h
--- es-event.h	25 Oct 2004 04:46:18 -0000	1.1
+++ es-event.h	23 Feb 2005 22:27:45 -0000
@@ -38,6 +38,7 @@
 /* Current target description */
 enum _es_event_target_t {
 	ES_EVENT_TARGET_STATE,
+	ES_EVENT_TARGET_UPGRADE
 };
 
 /* Flags that qualify TARGET_STATE */
@@ -47,6 +48,7 @@
 };
 
 typedef struct _ESEventTargetState ESEventTargetState;
+typedef struct _ESEventTargetUpgrade ESEventTargetUpgrade;
 
 struct _ESEventTargetState {
 	EEventTarget target;
@@ -54,6 +56,14 @@
 	int state;
 };
 
+struct _ESEventTargetUpgrade {
+	EEventTarget target;
+
+	int major;
+	int minor;
+	int revision;
+};
+
 typedef struct _EEventItem ESEventItem;
 
 /* The object */
@@ -72,6 +82,7 @@
 ESEvent *es_event_peek(void);
 
 ESEventTargetState *es_event_target_new_state(ESEvent *emp, int state);
+ESEventTargetUpgrade *es_event_target_new_upgrade(ESEvent *emp, int major, int minor, int revision);
 
 /* ********************************************************************** */
 


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