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



On Mon, 2005-02-28 at 10:14 -0500, JP Rosevear wrote:
> On Mon, 2005-02-28 at 13:41 +0800, Not Zed wrote:
> > 
> > Well do you have the patch?
> 
> A patch for the two small issues? No.  A patch was attached to the mail
> 3 minutes before this though with the big updates.

Oh, I guess you meant that startup-wizard.c was missing.  Not sure why
that was since it was in the last one and other files in the dir are
there.  New patch attached.

> > I suspect #1 is window manager, and/or the fact it all runs in the
> > main thread.
> 
> Seems to work ok

"in 2.0".

The cause actually appears to be the fact that e-config.c sets the type
hint to DIALOG.  I set it to NORMAL (which the old wizard did), however
e_config_create_window calls gtk_widget_show on the window so it has no
affect in my code.  All the places that use em-account-editor also call
gtk_widget_show on the config window, as do addressbook uses.  Calendar
uses do not though so that would also have to be fixed if we removed the
e-config.c gtk_widget_show call. Alternatively I could just hide the
druid during the import which might make more sense anyhow since the
user already hit apply.

> > #2 i dont know, i'd probably have to step it.
> 
> I'd sent mail to meeks on friday, just got a response this morning I'll
> grok through.

Talked to meeks and federico today, it appears to be a bonobo or
socket/plug issue propogating the state.  Seems minor given the
circumstances i describe (in fact if you subsequently leave the
importers page and then return to it a third time without causing a
dialog rebuild, the control is sensitized properly).

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
? plugins/wizard-plugins.diff
? plugins/addressbook-file/Makefile
? plugins/addressbook-file/Makefile.in
? plugins/addressbook-file/org-gnome-addressbook-file.eplug
? plugins/addressbook-groupwise/Makefile
? plugins/addressbook-groupwise/Makefile.in
? plugins/addressbook-groupwise/org-gnome-addressbook-groupwise.eplug
? plugins/backup-restore/restore-fixes.patch
? plugins/default-source/Makefile
? plugins/default-source/Makefile.in
? plugins/default-source/org-gnome-default-source.eplug
? plugins/exchange-account-setup/Makefile
? plugins/exchange-account-setup/Makefile.in
? plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug
? plugins/groupwise-account-setup/Makefile
? plugins/groupwise-account-setup/Makefile.in
? plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug
? plugins/groupwise-send-options/Makefile
? plugins/groupwise-send-options/Makefile.in
? plugins/groupwise-send-options/org-gnome-compose-send-options.eplug
? plugins/groupwise-status-tracking/Makefile
? plugins/groupwise-status-tracking/Makefile.in
? plugins/groupwise-status-tracking/org-gnome-status-track.eplug
? plugins/itip-formatter/evolution-backup.tar.gz
? plugins/itip-formatter/recur-string.patch
? plugins/itip-formatter/temp.patch
? plugins/itip-formatter/temp2.patch
? plugins/new-mail-notify/Makefile
? plugins/new-mail-notify/Makefile.in
? plugins/new-mail-notify/new-mail-plugin-id.patch
? plugins/new-mail-notify/org-gnome-new-mail-notify.eplug
? plugins/send-options/Makefile
? plugins/send-options/Makefile.in
? plugins/send-options/org-gnome-send-options.eplug
? plugins/shared-folder/Makefile
? plugins/shared-folder/Makefile.in
? plugins/shared-folder/org-gnome-shared-folder.eplug
? shell/33287.patch
? shell/corrections.text
? shell/display.patch
? shell/evolution-old
? shell/shell-wizard.patch
? shell/tmp.patch
? shell/wizard-shell.patch
? mail/46287.patch
? mail/mail-subject-thread.loT
? mail/print-mail.patch
? mail/wizard-mail.patch
? mail/default/zh_CN/Makefile
? mail/default/zh_CN/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1444
diff -u -r1.1444 ChangeLog
--- ChangeLog	28 Feb 2005 02:24:03 -0000	1.1444
+++ ChangeLog	1 Mar 2005 00:05:42 -0000
@@ -1,3 +1,7 @@
+2005-02-28  JP Rosevear  <jpr novell com>
+ 
+ 	* configure.in: add startup wizard plugin
+	
 2005-02-27  JP Rosevear  <jpr novell com>
 
 	* configure.in: add mail/default/de to ac_output to fix the build
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.787
diff -u -r1.787 configure.in
--- configure.in	28 Feb 2005 02:24:03 -0000	1.787
+++ configure.in	1 Mar 2005 00:05:43 -0000
@@ -1335,7 +1335,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" 
 
@@ -1582,6 +1582,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
Index: plugins/exchange-account-setup/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-account-setup/ChangeLog,v
retrieving revision 1.24
diff -u -r1.24 ChangeLog
--- plugins/exchange-account-setup/ChangeLog	27 Feb 2005 10:05:22 -0000	1.24
+++ plugins/exchange-account-setup/ChangeLog	1 Mar 2005 00:05:43 -0000
@@ -1,3 +1,7 @@
+2005-02-28  JP Rosevear  <jpr novell com>
+
+	* org-gnome-exchange-account-setup.eplug.in: add account wizard item
+
 2005-02-27  Sushma Rai  <rsushma novell com>
 
 	* exchange-account-setup.c (org_gnome_exchange_settings): Storing the 
Index: plugins/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.13
diff -u -r1.13 org-gnome-exchange-account-setup.eplug.in
--- plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in	25 Feb 2005 15:54:20 -0000	1.13
+++ plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in	1 Mar 2005 00:05:43 -0000
@@ -34,6 +34,24 @@
                         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>
+
+        <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: plugins/groupwise-account-setup/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/groupwise-account-setup/ChangeLog,v
retrieving revision 1.10
diff -u -r1.10 ChangeLog
--- plugins/groupwise-account-setup/ChangeLog	25 Feb 2005 15:54:20 -0000	1.10
+++ plugins/groupwise-account-setup/ChangeLog	1 Mar 2005 00:05:43 -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-24  Bj�Torkelsson  <torkel acc umu se>
 
         * org-gnome-gw-account-setup.eplug.in: Added author and fixed
Index: plugins/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.3
diff -u -r1.3 org-gnome-gw-account-setup.eplug.in
--- plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.in	25 Feb 2005 15:54:20 -0000	1.3
+++ plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.in	1 Mar 2005 00:05:43 -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: plugins/startup-wizard/.cvsignore
===================================================================
RCS file: plugins/startup-wizard/.cvsignore
diff -N plugins/startup-wizard/.cvsignore
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/startup-wizard/.cvsignore	1 Mar 2005 00:05:43 -0000
@@ -0,0 +1,3 @@
+Makefile.in
+Makefile
+org-gnome-evolution-startup-wizard.eplug
Index: plugins/startup-wizard/ChangeLog
===================================================================
RCS file: plugins/startup-wizard/ChangeLog
diff -N plugins/startup-wizard/ChangeLog
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/startup-wizard/ChangeLog	1 Mar 2005 00:05:43 -0000
@@ -0,0 +1,4 @@
+2005-02-21  JP Rosevear  <jpr novell com>
+
+	* startup-wizard.c: A plugin the does the startup wizard
+
Index: plugins/startup-wizard/Makefile.am
===================================================================
RCS file: plugins/startup-wizard/Makefile.am
diff -N plugins/startup-wizard/Makefile.am
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/startup-wizard/Makefile.am	1 Mar 2005 00:05:43 -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: plugins/startup-wizard/org-gnome-evolution-startup-wizard.eplug.in
===================================================================
RCS file: plugins/startup-wizard/org-gnome-evolution-startup-wizard.eplug.in
diff -N plugins/startup-wizard/org-gnome-evolution-startup-wizard.eplug.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/startup-wizard/org-gnome-evolution-startup-wizard.eplug.in	1 Mar 2005 00:05:43 -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" 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: plugins/startup-wizard/startup-wizard.c
===================================================================
RCS file: plugins/startup-wizard/startup-wizard.c
diff -N plugins/startup-wizard/startup-wizard.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/startup-wizard/startup-wizard.c	1 Mar 2005 00:05:43 -0000
@@ -0,0 +1,456 @@
+/* -*- 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 _IntelligentImporterData {
+	CORBA_Object object;
+	Bonobo_Control control;
+	
+	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);
+
+static GList *useable_importers = NULL;
+gboolean useable_importers_init = FALSE;
+
+static void
+free_importers ()
+{
+	GList *l;
+
+	for (l = useable_importers; l; l = l->next) {
+		IntelligentImporterData *iid;
+
+		/* FIXME free the rest */
+		iid = l->data;
+		if (iid->object != CORBA_OBJECT_NIL) 
+			bonobo_object_release_unref (iid->object, NULL);
+	}
+
+	g_list_free (useable_importers);
+	useable_importers = NULL;
+}
+
+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;
+}
+
+static void
+init_importers ()
+{
+	GList *importer_ids, *l;
+
+	if (useable_importers_init)
+		return;
+	
+	useable_importers_init = TRUE;
+	
+	importer_ids = get_intelligent_importers ();
+	if (!importer_ids)
+		return;
+
+	for (l = importer_ids; l; l = l->next) {
+		CORBA_Environment ev;
+		CORBA_Object object;
+		Bonobo_Control control;
+		char *iid = l->data;
+		char *name, *blurb;
+		IntelligentImporterData *id;
+		gboolean can_run;
+
+		CORBA_exception_init (&ev);
+		object = bonobo_activation_activate_from_id (iid, 0, NULL, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not start %s:%s", iid, CORBA_exception_id (&ev));
+
+			CORBA_exception_free (&ev);
+			continue;
+		}
+
+		if (object == CORBA_OBJECT_NIL) {
+			g_warning ("Could not activate component %s", iid);
+
+			CORBA_exception_free (&ev);
+			continue;
+		}
+
+		can_run = GNOME_Evolution_IntelligentImporter_canImport (object, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not call canImport(%s): %s", iid, CORBA_exception_id (&ev));
+
+			bonobo_object_release_unref (object, &ev);
+			CORBA_exception_free (&ev);
+			continue;
+		}
+		
+		if (can_run == FALSE) {
+			bonobo_object_release_unref (object, &ev);
+			CORBA_exception_free (&ev);
+			continue;
+		}
+
+		name = GNOME_Evolution_IntelligentImporter__get_importername (object, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not get name(%s): %s", iid, CORBA_exception_id (&ev));
+
+			bonobo_object_release_unref (object, &ev);
+			CORBA_exception_free (&ev);
+			continue;
+		}
+
+		blurb = GNOME_Evolution_IntelligentImporter__get_message (object, &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not get message(%s): %s", iid, CORBA_exception_id (&ev));
+
+			bonobo_object_release_unref (object, &ev);
+			CORBA_exception_free (&ev);
+			CORBA_free (name);
+			continue;
+		}
+
+		control = Bonobo_Unknown_queryInterface (object, "IDL:Bonobo/Control:1.0", &ev);
+		if (BONOBO_EX (&ev)) {
+			g_warning ("Could not QI for Bonobo/Control:1.0 %s:%s", iid, CORBA_exception_id (&ev));
+
+			bonobo_object_release_unref (object, &ev);
+			CORBA_exception_free (&ev);
+			CORBA_free (name);
+			CORBA_free (blurb);
+			continue;
+		}
+
+		if (control == CORBA_OBJECT_NIL) {
+			g_warning ("Could not get importer control for %s", iid);
+
+			bonobo_object_release_unref (object, &ev);
+			CORBA_exception_free (&ev);
+			CORBA_free (name);
+			CORBA_free (blurb);
+			continue;
+		}
+
+		CORBA_exception_free (&ev);
+
+		id = g_new0 (IntelligentImporterData, 1);
+		id->iid = g_strdup (iid);
+		id->object = object;
+		id->name = name;
+		id->blurb = blurb;
+		id->control = control;
+
+		useable_importers = g_list_prepend (useable_importers, id);
+	}
+}
+
+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"));
+	gtk_window_set_type_hint (GTK_WINDOW (emae->editor), GDK_WINDOW_TYPE_HINT_NORMAL);
+	gtk_window_set_wmclass (GTK_WINDOW (emae->editor), "startup-wizard", "Evolution:shell");
+
+	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, *table;
+	GList *l;
+	int i;
+	
+	init_importers ();
+	if (!useable_importers)
+		return NULL;
+	
+	page = gnome_druid_page_standard_new_with_vals ("Importing files", NULL, NULL);
+
+	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);
+	
+	table = gtk_table_new (g_list_length (useable_importers), 2, FALSE);
+	for (l = useable_importers, i = 0; l; l = l->next, i++) {
+		IntelligentImporterData *id = l->data;
+		GtkWidget *widget;
+		char *str;
+		
+		CORBA_Environment ev;
+		CORBA_exception_init (&ev);
+
+		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);
+
+		widget = bonobo_widget_new_control_from_objref (id->control, CORBA_OBJECT_NIL);
+
+		gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i + 1, GTK_FILL, 0, 0, 0);
+		gtk_table_attach (GTK_TABLE (table), widget, 1, 2, i, i + 1, GTK_FILL, 0, 3, 0);
+		gtk_widget_show_all (table);
+	
+		gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), table,
+				    FALSE, FALSE, 0);
+	}
+	
+	gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page));
+
+	return GTK_WIDGET (page);
+}
+
+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 ()
+{
+	CORBA_Environment ev;
+	GList *l, *selected = NULL;
+
+	for (l = useable_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 ();
+
+	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;
+	ETimezoneDialog *etd;
+	icaltimezone *zone;
+
+	/* This frees the importers */
+	do_import ();
+	
+	/* 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;
+
+	free_importers ();
+	
+	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: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1501
diff -u -r1.1501 ChangeLog
--- shell/ChangeLog	28 Feb 2005 18:48:56 -0000	1.1501
+++ shell/ChangeLog	1 Mar 2005 00:05:44 -0000
@@ -1,7 +1,7 @@
 2005-02-28  JP Rosevear  <jpr novell com>
 
 	* e-shell-window-commands.c (command_submit_bug): update authors
-	list for about dialogs
+	list for about dialog
 
 2005-02-21  JP Rosevear  <jpr novell com>
   
Index: shell/e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.259
diff -u -r1.259 e-shell.c
--- shell/e-shell.c	23 Feb 2005 18:56:59 -0000	1.259
+++ shell/e-shell.c	1 Mar 2005 00:05: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: shell/es-event.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/es-event.c,v
retrieving revision 1.1
diff -u -r1.1 es-event.c
--- shell/es-event.c	25 Oct 2004 04:46:18 -0000	1.1
+++ shell/es-event.c	1 Mar 2005 00:05: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: shell/es-event.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/es-event.h,v
retrieving revision 1.1
diff -u -r1.1 es-event.h
--- shell/es-event.h	25 Oct 2004 04:46:18 -0000	1.1
+++ shell/es-event.h	1 Mar 2005 00:05: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);
 
 /* ********************************************************************** */
 
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3597
diff -u -r1.3597 ChangeLog
--- mail/ChangeLog	28 Feb 2005 04:51:26 -0000	1.3597
+++ mail/ChangeLog	1 Mar 2005 00:05:48 -0000
@@ -1,3 +1,20 @@
+2005-02-28  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-24  Not Zed  <NotZed Ximian com>
 
 	** See bug #72609
Index: mail/em-account-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-account-editor.c,v
retrieving revision 1.22
diff -u -r1.22 em-account-editor.c
--- mail/em-account-editor.c	24 Feb 2005 01:48:15 -0000	1.22
+++ mail/em-account-editor.c	1 Mar 2005 00:05:49 -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 *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 *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, id);
 
 	return emae;
 }
@@ -2483,8 +2484,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 *id)
 {
 	EMAccountEditorPrivate *gui = emae->priv;
 	int i, index;
@@ -2520,26 +2521,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, 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, id);
 		items = emae_druid_items;
 	}
 
Index: mail/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
--- mail/em-account-editor.h	20 Sep 2004 05:59:54 -0000	1.2
+++ mail/em-account-editor.h	1 Mar 2005 00:05:49 -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 *id);
 
 gboolean em_account_editor_save (EMAccountEditor *gui);
 void em_account_editor_destroy (EMAccountEditor *gui);
Index: mail/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
--- mail/em-account-prefs.c	28 Jan 2005 09:07:01 -0000	1.16
+++ mail/em-account-prefs.c	1 Mar 2005 00:05:49 -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: mail/em-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.c,v
retrieving revision 1.57
diff -u -r1.57 em-utils.c
--- mail/em-utils.c	23 Feb 2005 06:14:21 -0000	1.57
+++ mail/em-utils.c	1 Mar 2005 00:05:50 -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);
 


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