aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-08-17 12:29:11 +0800
committerIain Holmes <iain@src.gnome.org>2001-08-17 12:29:11 +0800
commit4e60b7d947fc081958acc7b4e17dfdf4e62ec08b (patch)
tree08b84d5b30af9b675acec8c133acf72ec57e14ef
parentdad6d45018fb264dbb94031775b6c4589951e50a (diff)
downloadgsoc2013-evolution-4e60b7d947fc081958acc7b4e17dfdf4e62ec08b.tar
gsoc2013-evolution-4e60b7d947fc081958acc7b4e17dfdf4e62ec08b.tar.gz
gsoc2013-evolution-4e60b7d947fc081958acc7b4e17dfdf4e62ec08b.tar.bz2
gsoc2013-evolution-4e60b7d947fc081958acc7b4e17dfdf4e62ec08b.tar.lz
gsoc2013-evolution-4e60b7d947fc081958acc7b4e17dfdf4e62ec08b.tar.xz
gsoc2013-evolution-4e60b7d947fc081958acc7b4e17dfdf4e62ec08b.tar.zst
gsoc2013-evolution-4e60b7d947fc081958acc7b4e17dfdf4e62ec08b.zip
Startup assistant stuff
svn path=/trunk/; revision=12145
-rw-r--r--ChangeLog4
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/Makefile.am1
-rw-r--r--calendar/gui/calendar-config.c2
-rw-r--r--calendar/gui/dialogs/Makefile.am3
-rw-r--r--calendar/gui/e-timezone-entry.c2
-rw-r--r--configure.in1
-rw-r--r--mail/ChangeLog19
-rw-r--r--mail/GNOME_Evolution_Mail.oaf.in10
-rw-r--r--mail/component-factory.c5
-rw-r--r--mail/mail-account-editor.h4
-rw-r--r--mail/mail-account-gui.c27
-rw-r--r--mail/mail-config-druid.c685
-rw-r--r--mail/mail-config-druid.h7
-rw-r--r--mail/mail-config.c6
-rw-r--r--shell/ChangeLog13
-rw-r--r--shell/Evolution-Wizard.idl37
-rw-r--r--shell/Evolution.idl1
-rw-r--r--shell/Makefile.am7
-rw-r--r--shell/e-setup.c3
-rw-r--r--shell/e-shell-startup-wizard.c845
-rw-r--r--shell/e-shell.c21
-rw-r--r--shell/evolution-wizard.c394
-rw-r--r--shell/evolution-wizard.h86
-rw-r--r--shell/glade/Makefile.am3
-rw-r--r--shell/glade/evolution-startup-wizard.glade252
-rw-r--r--widgets/ChangeLog6
-rw-r--r--widgets/Makefile.am1
-rw-r--r--widgets/e-timezone-dialog/Makefile.am18
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.c (renamed from calendar/gui/dialogs/e-timezone-dialog.c)26
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.glade (renamed from calendar/gui/dialogs/e-timezone-dialog.glade)0
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.h (renamed from calendar/gui/dialogs/e-timezone-dialog.h)0
32 files changed, 2330 insertions, 169 deletions
diff --git a/ChangeLog b/ChangeLog
index f4817db422..b8da653a38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-08-16 "Big Iain" Holmes <iain@ximian.com>
+
+ * configure.in: Add widgets/e-timezone-dialog/Makefile
+
2001-08-16 Jason Leach <jleach@ximian.com>
* AUTHORS: I know what you did last summer!
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 1ffc006d12..017a1cea13 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,13 @@
+2001-08-16 Iain Holmes <iain@ximian.com>
+
+ * gui/Makefile.am: Add the libetimezonedialog.a lib link
+
+ * gui/calendar-config.c: Change the #include for the timezone dialog
+
+ * gui/e-timezone-entry.c: Ditto.
+
+ * gui/dialogs/Makefile.am: Remove the e-timezone-dialog stuff.
+
2001-08-16 Damon Chaplin <damon@ximian.com>
* gui/dialogs/event-page.c: hide the timezone fields for all-day
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 0f9f2fd86a..133e39f1ce 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -148,6 +148,7 @@ evolution_calendar_LDADD = \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
dialogs/libcal-dialogs.a \
+ $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(EXTRA_GNOME_LIBS) \
$(BONOBO_HTML_GNOME_LIBS) \
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index c1c3f89870..b75c267984 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -31,7 +31,7 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-config.h>
#include <libgnomeui/gnome-dialog.h>
-#include "dialogs/e-timezone-dialog.h"
+#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
#include "component-factory.h"
#include "calendar-commands.h"
#include "e-tasks.h"
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index a56cf18d76..6e44ce9dab 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -59,8 +59,6 @@ libcal_dialogs_a_SOURCES = \
delete-comp.h \
e-delegate-dialog.c \
e-delegate-dialog.h \
- e-timezone-dialog.c \
- e-timezone-dialog.h \
event-editor.c \
event-editor.h \
event-page.c \
@@ -86,7 +84,6 @@ glade_DATA = \
alarm-page.glade \
cal-prefs-dialog.glade \
e-delegate-dialog.glade \
- e-timezone-dialog.glade \
event-page.glade \
meeting-page.glade \
recurrence-page.glade \
diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c
index 1cc1e83676..dc3e982b2e 100644
--- a/calendar/gui/e-timezone-entry.c
+++ b/calendar/gui/e-timezone-entry.c
@@ -35,7 +35,7 @@
#include <gtk/gtkentry.h>
#include <gtk/gtksignal.h>
#include <gnome.h>
-#include "dialogs/e-timezone-dialog.h"
+#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
#include "e-timezone-entry.h"
/* The timezone icon for the button. */
diff --git a/configure.in b/configure.in
index 55ebc30a03..92f3a26a70 100644
--- a/configure.in
+++ b/configure.in
@@ -1084,6 +1084,7 @@ camel/tests/smime/Makefile
camel/tests/stream/Makefile
composer/Makefile
widgets/Makefile
+widgets/e-timezone-dialog/Makefile
widgets/meeting-time-sel/Makefile
widgets/misc/Makefile
widgets/menus/Makefile
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0bd4640037..c5cb9ef66c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,22 @@
+2001-08-16 Iain Holmes <iain@ximian.com>
+
+ * GNOME_Evolution_Mail.oaf.in: Add the Wizard stuff.
+
+ * component-factory.c (component_fn): Init the Wizard factory.
+ (mail_load_storages): Check service isn't NULL before it's been
+ dereferenced.
+
+ * mail-account-gui.c (mail_account_gui_setup): Only show the top level
+ widget is it's not NULL.
+ Change the gtk_widget_set_usizes to gtk_widget_hides.
+
+ * mail-config-druid.c: Rewrite to use the EvolutionWizard stuff.
+
+ * mail-config-druid.h: Add stuff to the MailConfigDruid struct.
+
+ * mail-config.c (mail_config_get_default_account): Init the config if
+ it's not been inited.
+
2001-08-16 Jason Leach <jleach@ximian.com>
* mail-tools.c (mail_tool_quote_message): Only starting cutting
diff --git a/mail/GNOME_Evolution_Mail.oaf.in b/mail/GNOME_Evolution_Mail.oaf.in
index 1777903fc3..306a976f53 100644
--- a/mail/GNOME_Evolution_Mail.oaf.in
+++ b/mail/GNOME_Evolution_Mail.oaf.in
@@ -141,4 +141,14 @@
</oaf_attribute>
</oaf_server>
+<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Wizard_Factory"
+ type="exe"
+ location="evolution-mail">
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Wizard"
+ type="factory"
+ location="OAFIID:GNOME_Evolution_Mail_Wizard_Factory">
+</oaf_server>
+
</oaf_info>
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 73147a1dab..bfd9a8a304 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -32,6 +32,7 @@
#include "Evolution.h"
#include "evolution-storage.h"
+#include "evolution-wizard.h"
#include "folder-browser-factory.h"
#include "evolution-shell-component.h"
@@ -735,6 +736,8 @@ component_fn (BonoboGenericFactory *factory, void *closure)
bonobo_object_add_interface (BONOBO_OBJECT (shell_component),
BONOBO_OBJECT (destination_interface));
+ evolution_mail_config_wizard_init ();
+
evolution_shell_component_add_user_creatable_item (shell_component, "message", _("New Mail Message"), _("New _Mail Message"), 'm');
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
@@ -1002,7 +1005,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
name = NULL;
}
- if (service->url == NULL || service->url[0] == '\0' || !service->enabled)
+ if (service == NULL || service->url == NULL || service->url[0] == '\0' || !service->enabled)
continue;
mail_load_storage_by_uri (shell, service->url, name);
diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h
index 34d36294a8..c033ea86cb 100644
--- a/mail/mail-account-editor.h
+++ b/mail/mail-account-editor.h
@@ -41,8 +41,8 @@ extern "C" {
struct _MailAccountEditor {
GnomeDialog parent;
- MailAccountGui *gui;
- GtkNotebook *notebook;
+ MailAccountGui *gui;
+ GtkNotebook *notebook;
};
typedef struct _MailAccountEditor MailAccountEditor;
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 7117eacf47..2ee1fa01e5 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -414,7 +414,7 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
provider = gtk_object_get_data (GTK_OBJECT (widget), "provider");
gui->transport.provider = provider;
-
+
frame = glade_xml_get_widget (gui->xml, "transport_frame");
if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) ||
(CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) &&
@@ -1427,7 +1427,6 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
fstore = item;
hstore = si;
}
-
/* set the menus on the optionmenus */
gtk_option_menu_remove_menu (gui->source.type);
gtk_option_menu_set_menu (gui->source.type, stores);
@@ -1456,31 +1455,33 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
gtk_widget_set_usize (GTK_WIDGET (gui->transport.authtype),
size_req.width, -1);
}
-
- gtk_widget_show_all (top);
+
+ if (top != NULL) {
+ gtk_widget_show_all (top);
+ }
/* Force some other elements to keep their current sizes even if
* widgets are hidden
*/
item = glade_xml_get_widget (gui->xml, "source_frame");
- gtk_widget_set_usize (item, -1, item->allocation.height);
+ gtk_widget_hide (item);
item = glade_xml_get_widget (gui->xml, "source_auth_frame");
- gtk_widget_set_usize (item, -1, item->allocation.height);
+ gtk_widget_hide (item);
item = glade_xml_get_widget (gui->xml, "source_vbox");
- gtk_widget_set_usize (item, -1, item->allocation.height);
+ gtk_widget_hide (item);
item = glade_xml_get_widget (gui->xml, "transport_frame");
- gtk_widget_set_usize (item, -1, item->allocation.height);
+ gtk_widget_hide (item);
item = glade_xml_get_widget (gui->xml, "transport_auth_frame");
- gtk_widget_set_usize (item, -1, item->allocation.height);
+ gtk_widget_hide (item);
item = glade_xml_get_widget (gui->xml, "transport_vbox");
- gtk_widget_set_usize (item, -1, item->allocation.height);
-
+ gtk_widget_hide (item);
+
if (fstore)
gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", gui);
if (ftransport)
gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", gui);
-
+
if (source_proto) {
setup_service (&gui->source, gui->account->source);
gui->source.provider_type = CAMEL_PROVIDER_STORE;
@@ -1498,6 +1499,8 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT;
g_free (transport_proto);
}
+
+
}
static void
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 07468733c9..8ac5850e1b 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -3,6 +3,7 @@
* Authors:
* Jeffrey Stedfast <fejj@ximian.com>
* Dan Winship <danw@ximian.com>
+ * Iain Holmes <iain@ximian.com>
*
* Copyright 2001 Ximian, Inc. (www.ximian.com)
*
@@ -33,6 +34,8 @@
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-druid.h>
+#include <libgnomeui/gnome-druid-page-standard.h>
#include <glade/glade.h>
#include <gtkhtml/gtkhtml.h>
#include <gal/widgets/e-unicode.h>
@@ -42,11 +45,36 @@
#include "mail.h"
#include "mail-session.h"
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-widget.h>
+#include <bonobo/bonobo-generic-factory.h>
+#include <bonobo/bonobo-context.h>
+
+#include <evolution-wizard.h>
static void mail_config_druid_class_init (MailConfigDruidClass *class);
static void mail_config_druid_finalize (GtkObject *obj);
static GtkWindowClass *parent_class;
+/* These globals need fixed FIXME FIXME FIXME FIXME*/
+static GHashTable *page_hash = NULL;
+static GList *page_list = NULL;
+static EvolutionWizard *account_wizard;
+
+#define WIZARD_IID "OAFIID:GNOME_Evolution_Mail_Wizard_Factory"
+
+typedef struct {
+ MailAccountGui *gui;
+ MailConfigDruidIdentity *id_page;
+
+ MailConfigAccount *account;
+ EvolutionWizard *wizard;
+
+ gboolean identity_copied;
+ CamelProvider *last_source;
+} MailConfigWizard;
+
GtkType
mail_config_druid_get_type (void)
{
@@ -85,8 +113,17 @@ static void
mail_config_druid_finalize (GtkObject *obj)
{
MailConfigDruid *druid = (MailConfigDruid *) obj;
+ CORBA_Environment ev;
+
+ gtk_object_destroy (GTK_OBJECT (druid->xml));
- mail_account_gui_destroy (druid->gui);
+ CORBA_exception_init (&ev);
+ Bonobo_EventSource_removeListener ((Bonobo_EventSource) druid->event_source, druid->id, &ev);
+ CORBA_exception_free (&ev);
+
+ bonobo_object_release_unref ((Bonobo_Unknown) druid->event_source, &ev);
+ bonobo_object_unref (BONOBO_OBJECT (druid->listener));
+
((GtkObjectClass *)(parent_class))->finalize (obj);
}
@@ -161,10 +198,19 @@ create_html (const char *name)
return scrolled;
}
+
static void
druid_cancel (GnomeDruid *druid, gpointer user_data)
{
MailConfigDruid *config = user_data;
+ GNOME_Evolution_Wizard wiz;
+ CORBA_Environment ev;
+
+ wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard));
+ CORBA_exception_init (&ev);
+
+ GNOME_Evolution_Wizard_notifyAction (wiz, 0, GNOME_Evolution_Wizard_CANCEL, &ev);
+ CORBA_exception_free (&ev);
gtk_widget_destroy (GTK_WIDGET (config));
}
@@ -173,24 +219,16 @@ static void
druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
{
MailConfigDruid *druid = user_data;
- MailAccountGui *gui = druid->gui;
-
- /* Save the settings for that account */
- mail_account_gui_save (gui);
- if (gui->account->source)
- gui->account->source->enabled = TRUE;
-
- /* Add the account to our list (do it early because future
- steps might want to access config->accounts) */
- mail_config_add_account (gui->account);
+ MailConfigAccount *account;
+ GSList *mini;
- /* Write out the config info */
- mail_config_write ();
+ /* Load up this new account */
+ account = gtk_object_get_data (GTK_OBJECT (account_wizard), "account-data");
+ mini = g_slist_prepend (NULL, account);
+ mail_load_storages (druid->shell, mini, TRUE);
+ g_slist_free (mini);
- /* Load up this new account if necessary */
- if (gui->account->source && gui->account->source->url)
- mail_load_storage_by_uri (druid->shell, gui->account->source->url, gui->account->name);
-
+ gtk_object_set_data (GTK_OBJECT (account_wizard), "account-data", NULL);
gtk_widget_destroy (GTK_WIDGET (druid));
}
@@ -198,45 +236,45 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
static void
identity_changed (GtkWidget *widget, gpointer data)
{
- MailConfigDruid *druid = data;
+ MailConfigWizard *gui = data;
GtkWidget *incomplete;
gboolean next_sensitive;
- next_sensitive = mail_account_gui_identity_complete (druid->gui, &incomplete);
+ next_sensitive = mail_account_gui_identity_complete (gui->gui, &incomplete);
- gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE);
+ evolution_wizard_set_buttons_sensitive (gui->wizard, TRUE, next_sensitive, TRUE, NULL);
if (!next_sensitive)
gtk_widget_grab_focus (incomplete);
}
static void
-identity_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+identity_prepare (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
- gtk_widget_grab_focus (GTK_WIDGET (config->gui->full_name));
- identity_changed (NULL, config);
+ gtk_widget_grab_focus (GTK_WIDGET (gui->gui->full_name));
+ identity_changed (NULL, data);
}
static gboolean
-identity_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+identity_next (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
- if (!config->identity_copied) {
+ if (!gui->identity_copied) {
char *username;
/* Copy the username part of the email address into
* the Username field of the source and transport pages.
*/
- username = gtk_entry_get_text (config->gui->email_address);
+ username = gtk_entry_get_text (gui->gui->email_address);
username = g_strndup (username, strcspn (username, "@"));
- gtk_entry_set_text (config->gui->source.username, username);
- gtk_entry_set_text (config->gui->transport.username, username);
+ gtk_entry_set_text (gui->gui->source.username, username);
+ gtk_entry_set_text (gui->gui->transport.username, username);
g_free (username);
- config->identity_copied = TRUE;
+ gui->identity_copied = TRUE;
}
return FALSE;
@@ -246,93 +284,91 @@ identity_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
static void
source_changed (GtkWidget *widget, gpointer data)
{
- MailConfigDruid *druid = data;
+ MailConfigWizard *gui = data;
GtkWidget *incomplete;
gboolean next_sensitive;
- next_sensitive = mail_account_gui_source_complete (druid->gui, &incomplete);
+ next_sensitive = mail_account_gui_source_complete (gui->gui, &incomplete);
- gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE);
+ evolution_wizard_set_buttons_sensitive (gui->wizard, TRUE, next_sensitive, TRUE, NULL);
if (!next_sensitive)
gtk_widget_grab_focus (incomplete);
}
static void
-source_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+source_prepare (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
- source_changed (NULL, config);
+ source_changed (NULL, gui);
}
static gboolean
-source_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+source_next (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
GtkWidget *transport_page;
/* FIXME: if online, check that the data is good. */
- if (config->gui->source.provider && config->gui->source.provider->extra_conf)
+ if (gui->gui->source.provider && gui->gui->source.provider->extra_conf)
return FALSE;
/* Otherwise, skip to transport page. */
- transport_page = glade_xml_get_widget (config->gui->xml, "transport_page");
+ transport_page = glade_xml_get_widget (gui->gui->xml, "transport_page");
+ evolution_wizard_set_page (gui->wizard, 3, NULL);
+#if 0
gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (transport_page));
+#endif
return TRUE;
}
/* Extra Config Page */
static void
-extra_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+extra_prepare (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
- if (config->gui->source.provider != config->last_source) {
- config->last_source = config->gui->source.provider;
- mail_account_gui_build_extra_conf (config->gui, NULL);
+ if (gui->gui->source.provider != gui->last_source) {
+ gui->last_source = gui->gui->source.provider;
+ mail_account_gui_build_extra_conf (gui->gui, NULL);
}
}
/* Transport Page */
static void
-transport_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+transport_prepare (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
GtkWidget *incomplete;
gboolean next_sensitive;
- next_sensitive = mail_account_gui_transport_complete (config->gui, &incomplete);
+ next_sensitive = mail_account_gui_transport_complete (gui->gui, &incomplete);
- gnome_druid_set_buttons_sensitive (config->druid, TRUE, next_sensitive, TRUE);
+ evolution_wizard_set_buttons_sensitive (gui->wizard, TRUE, next_sensitive, TRUE, NULL);
if (!next_sensitive)
gtk_widget_grab_focus (incomplete);
}
static gboolean
-transport_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+transport_next (EvolutionWizard *wizard, gpointer data)
{
/* FIXME: if online, check that the data is good. */
return FALSE;
}
static gboolean
-transport_back (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+transport_back (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
- if (config->gui->source.provider && config->gui->source.provider->extra_conf)
+ if (gui->gui->source.provider && gui->gui->source.provider->extra_conf)
return FALSE;
else {
- /* jump to the source page, skipping over the extra page */
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (config->gui->xml, "source_page");
- gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (widget));
-
+ evolution_wizard_set_page (wizard, 1, NULL);
return TRUE;
}
}
@@ -340,41 +376,42 @@ transport_back (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
static void
transport_changed (GtkWidget *widget, gpointer data)
{
- transport_prepare (NULL, NULL, data);
+ transport_prepare (NULL, data);
}
/* Management page */
static void
-management_check (MailConfigDruid *druid)
+management_check (MailConfigWizard *wizard)
{
gboolean next_sensitive;
char *text;
- text = gtk_entry_get_text (druid->gui->account_name);
+ text = gtk_entry_get_text (wizard->gui->account_name);
next_sensitive = text && *text;
- gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE);
+ evolution_wizard_set_buttons_sensitive (wizard->wizard, TRUE,
+ next_sensitive, TRUE, NULL);
}
static void
-management_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+management_prepare (EvolutionWizard *wizard, gpointer data)
{
- MailConfigDruid *config = data;
+ MailConfigWizard *gui = data;
char *name;
- name = gtk_entry_get_text (config->gui->email_address);
+ name = gtk_entry_get_text (gui->gui->email_address);
if (name && *name)
- gtk_entry_set_text (config->gui->account_name, name);
+ gtk_entry_set_text (gui->gui->account_name, name);
- management_check (config);
+ management_check (gui);
}
static void
management_changed (GtkWidget *widget, gpointer data)
{
- MailConfigDruid *druid = data;
+ MailConfigWizard *gui = data;
- management_check (druid);
+ management_check (gui);
}
@@ -444,18 +481,140 @@ static struct {
GTK_SIGNAL_FUNC (NULL) }
};
+static int
+page_to_num (gpointer page)
+{
+ gpointer r;
+
+ r = g_hash_table_lookup (page_hash, page);
+ if (r == NULL) {
+ return 0;
+ }
+
+ return GPOINTER_TO_INT (r);
+}
+
+static gboolean
+next_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ gpointer data)
+{
+ GNOME_Evolution_Wizard wiz;
+ CORBA_Environment ev;
+ int pagenum;
+
+ wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard));
+ CORBA_exception_init (&ev);
+
+ pagenum = page_to_num (page);
+ GNOME_Evolution_Wizard_notifyAction (wiz, pagenum, GNOME_Evolution_Wizard_NEXT, &ev);
+ CORBA_exception_free (&ev);
+ return FALSE;
+}
+
+static gboolean
+prepare_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ gpointer data)
+{
+ GNOME_Evolution_Wizard wiz;
+ CORBA_Environment ev;
+ int pagenum;
+
+ wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard));
+ CORBA_exception_init (&ev);
+
+ pagenum = page_to_num (page);
+ GNOME_Evolution_Wizard_notifyAction (wiz, pagenum, GNOME_Evolution_Wizard_PREPARE, &ev);
+ CORBA_exception_free (&ev);
+ return FALSE;
+}
+
+static gboolean
+back_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ gpointer data)
+{
+ GNOME_Evolution_Wizard wiz;
+ CORBA_Environment ev;
+ int pagenum;
+
+ wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard));
+ CORBA_exception_init (&ev);
+
+ pagenum = page_to_num (page);
+ GNOME_Evolution_Wizard_notifyAction (wiz, pagenum, GNOME_Evolution_Wizard_BACK, &ev);
+ CORBA_exception_free (&ev);
+ return FALSE;
+}
+
+static gboolean
+finish_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ gpointer data)
+{
+ GNOME_Evolution_Wizard wiz;
+ CORBA_Environment ev;
+ int pagenum;
+
+ wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard));
+ CORBA_exception_init (&ev);
+
+ pagenum = page_to_num (page);
+ g_print ("Hello\n");
+ GNOME_Evolution_Wizard_notifyAction (wiz, 0, GNOME_Evolution_Wizard_FINISH, &ev);
+ g_print ("Goodbye\n");
+ CORBA_exception_free (&ev);
+
+ druid_finish (page, druid, data);
+ return FALSE;
+}
+
+static void
+wizard_listener_event (BonoboListener *listener,
+ char *event_name,
+ BonoboArg *event_data,
+ CORBA_Environment *ev,
+ MailConfigDruid *druid)
+{
+ CORBA_short buttons, pagenum;
+ GnomeDruidPage *page;
+
+ if (strcmp (event_name, EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE) == 0) {
+ buttons = (int) *((CORBA_short *)event_data->_value);
+ gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid->druid),
+ (buttons & 4) >> 2,
+ (buttons & 2) >> 1,
+ (buttons & 1));
+ } else if (strcmp (event_name, EVOLUTION_WIZARD_SET_SHOW_FINISH) == 0) {
+ gnome_druid_set_show_finish (GNOME_DRUID (druid->druid),
+ (gboolean) *((CORBA_boolean *)event_data->_value));
+ } else if (strcmp (event_name, EVOLUTION_WIZARD_SET_PAGE) == 0) {
+ pagenum = (int) *((CORBA_short *) event_data->_value);
+
+ page = g_list_nth_data (page_list, pagenum - 1);
+ gnome_druid_set_page (GNOME_DRUID (druid->druid), page);
+ }
+}
+
static void
construct (MailConfigDruid *druid)
{
- GtkWidget *widget, *vbox;
- MailConfigAccount *account;
+ GtkWidget *widget;
+ GNOME_Evolution_Wizard corba_wizard;
+ Bonobo_Listener corba_listener;
+ CORBA_Environment ev;
int i;
- account = make_account ();
- druid->gui = mail_account_gui_new (account);
-
+ /* Start account wizard */
+ CORBA_exception_init (&ev);
+ corba_wizard = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev);
+ CORBA_exception_free (&ev);
+ g_assert (account_wizard != NULL);
+
+ druid->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
/* get our toplevel widget and reparent it */
- widget = glade_xml_get_widget (druid->gui->xml, "druid");
+ widget = glade_xml_get_widget (druid->xml, "druid");
gtk_widget_reparent (widget, GTK_WIDGET (druid));
druid->druid = GNOME_DRUID (widget);
@@ -466,74 +625,70 @@ construct (MailConfigDruid *druid)
gtk_window_set_modal (GTK_WINDOW (druid), TRUE);
gtk_object_set (GTK_OBJECT (druid), "type", GTK_WINDOW_DIALOG, NULL);
- /* attach to druid page signals */
+
+ druid->listener = bonobo_listener_new (NULL, NULL);
+ gtk_signal_connect (GTK_OBJECT (druid->listener), "event-notify",
+ GTK_SIGNAL_FUNC (wizard_listener_event), druid);
+ corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (druid->listener));
+ CORBA_exception_init (&ev);
+ druid->event_source = (Bonobo_Unknown) bonobo_object_query_interface (
+ BONOBO_OBJECT (account_wizard), "IDL:Bonobo/EventSource:1.0");
+ g_assert (druid->event_source != CORBA_OBJECT_NIL);
+ druid->id = Bonobo_EventSource_addListener ((Bonobo_EventSource) druid->event_source, corba_listener, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Error adding listener (%s)",
+ CORBA_exception_id (&ev));
+ }
+ CORBA_exception_free (&ev);
+
+ if (page_hash != NULL) {
+ g_hash_table_destroy (page_hash);
+ }
+ page_hash = g_hash_table_new (NULL, NULL);
for (i = 0; pages[i].name != NULL; i++) {
GtkWidget *page;
-
- page = glade_xml_get_widget (druid->gui->xml, pages[i].name);
-
- if (pages[i].next_func)
- gtk_signal_connect (GTK_OBJECT (page), "next",
- pages[i].next_func, druid);
- if (pages[i].prepare_func)
- gtk_signal_connect (GTK_OBJECT (page), "prepare",
- pages[i].prepare_func, druid);
- if (pages[i].back_func)
- gtk_signal_connect (GTK_OBJECT (page), "back",
- pages[i].back_func, druid);
- if (pages[i].finish_func)
- gtk_signal_connect (GTK_OBJECT (page), "finish",
- pages[i].finish_func, druid);
+ GnomeDruidPageStandard *dpage;
+
+ page = glade_xml_get_widget (druid->xml, pages[i].name);
+ /* Store pages */
+ g_hash_table_insert (page_hash, page, GINT_TO_POINTER (i));
+ page_list = g_list_append (page_list, page);
+
+ gtk_signal_connect (GTK_OBJECT (page), "next",
+ GTK_SIGNAL_FUNC (next_func), druid);
+ gtk_signal_connect (GTK_OBJECT (page), "prepare",
+ GTK_SIGNAL_FUNC (prepare_func), druid);
+ gtk_signal_connect (GTK_OBJECT (page), "back",
+ GTK_SIGNAL_FUNC (back_func), druid);
+
+ gtk_signal_connect (GTK_OBJECT (page), "finish",
+ GTK_SIGNAL_FUNC (finish_func), druid);
+
+ if (i != 5) {
+ Bonobo_Control control;
+ GtkWidget *w;
+ CORBA_Environment ev;
+
+ dpage = GNOME_DRUID_PAGE_STANDARD (page);
+
+ CORBA_exception_init (&ev);
+ control = GNOME_Evolution_Wizard_getControl (corba_wizard, i, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Error getting page %d: %s", i,
+ CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ continue;
+ }
+
+ w = bonobo_widget_new_control_from_objref (control,
+ CORBA_OBJECT_NIL);
+ gtk_box_pack_start (GTK_BOX (dpage->vbox), w, TRUE,
+ TRUE, 0);
+ gtk_widget_show_all (w);
+ }
}
gtk_signal_connect (GTK_OBJECT (druid->druid), "cancel", druid_cancel, druid);
- /* Fill in the druid pages */
- vbox = glade_xml_get_widget (druid->gui->xml, "druid_identity_vbox");
- widget = create_html ("identity_html");
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
- widget = glade_xml_get_widget (druid->gui->xml, "identity_required_frame");
- gtk_widget_reparent (widget, vbox);
- gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START);
- widget = glade_xml_get_widget (druid->gui->xml, "identity_optional_frame");
- gtk_widget_reparent (widget, vbox);
- gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START);
-
- vbox = glade_xml_get_widget (druid->gui->xml, "druid_source_vbox");
- widget = create_html ("source_html");
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
- widget = glade_xml_get_widget (druid->gui->xml, "source_vbox");
- gtk_widget_reparent (widget, vbox);
-
- vbox = glade_xml_get_widget (druid->gui->xml, "druid_extra_vbox");
- widget = create_html ("extra_html");
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
- widget = glade_xml_get_widget (druid->gui->xml, "extra_vbox");
- gtk_widget_reparent (widget, vbox);
-
- vbox = glade_xml_get_widget (druid->gui->xml, "druid_transport_vbox");
- widget = create_html ("transport_html");
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
- widget = glade_xml_get_widget (druid->gui->xml, "transport_vbox");
- gtk_widget_reparent (widget, vbox);
-
- vbox = glade_xml_get_widget (druid->gui->xml, "druid_management_vbox");
- widget = create_html ("management_html");
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
- widget = glade_xml_get_widget (druid->gui->xml, "management_frame");
- gtk_widget_reparent (widget, vbox);
-
- /* set up signals, etc */
- gtk_signal_connect (GTK_OBJECT (druid->gui->account_name), "changed", management_changed, druid);
- gtk_signal_connect (GTK_OBJECT (druid->gui->full_name), "changed", identity_changed, druid);
- gtk_signal_connect (GTK_OBJECT (druid->gui->email_address), "changed", identity_changed, druid);
- gtk_signal_connect (GTK_OBJECT (druid->gui->source.hostname), "changed", source_changed, druid);
- gtk_signal_connect (GTK_OBJECT (druid->gui->source.username), "changed", source_changed, druid);
- gtk_signal_connect (GTK_OBJECT (druid->gui->source.path), "changed", source_changed, druid);
- gtk_signal_connect (GTK_OBJECT (druid->gui->transport.hostname), "changed", transport_changed, druid);
- gtk_signal_connect (GTK_OBJECT (druid->gui->transport.username), "changed", transport_changed, druid);
-
- mail_account_gui_setup (druid->gui, GTK_WIDGET (druid));
-
gnome_druid_set_buttons_sensitive (druid->druid, FALSE, TRUE, TRUE);
}
@@ -548,3 +703,253 @@ mail_config_druid_new (GNOME_Evolution_Shell shell)
return new;
}
+
+static BonoboControl *
+get_fn (EvolutionWizard *wizard,
+ int page_num,
+ void *closure)
+{
+ MailConfigWizard *gui = closure;
+ BonoboControl *control;
+ GtkWidget *vbox, *widget;
+ static gboolean first_time = TRUE;
+
+ if (gui->gui == NULL) {
+ if (gui->account == NULL) {
+ gui->account = make_account ();
+ gtk_object_set_data (GTK_OBJECT (wizard), "account-data",
+ gui->account);
+ }
+
+ gui->gui = mail_account_gui_new (gui->account);
+
+ /* set up signals, etc */
+ gtk_signal_connect (GTK_OBJECT (gui->gui->account_name),
+ "changed", management_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->gui->full_name),
+ "changed", identity_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->gui->email_address),
+ "changed", identity_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->gui->source.hostname),
+ "changed", source_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->gui->source.username),
+ "changed", source_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->gui->source.path),
+ "changed", source_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->gui->transport.hostname),
+
+ "changed", transport_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->gui->transport.username),
+ "changed", transport_changed, gui);
+ first_time = TRUE;
+ }
+
+ /* Fill in the druid pages */
+ vbox = gtk_vbox_new (FALSE, 0);
+ switch (page_num) {
+ case 0:
+ widget = create_html ("identity_html");
+ gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
+ widget = glade_xml_get_widget (gui->gui->xml, "identity_required_frame");
+ gtk_widget_reparent (widget, vbox);
+ gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START);
+ widget = glade_xml_get_widget (gui->gui->xml, "identity_optional_frame");
+ gtk_widget_reparent (widget, vbox);
+ gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START);
+ break;
+
+ case 1:
+ widget = create_html ("source_html");
+ gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
+ widget = glade_xml_get_widget (gui->gui->xml, "source_vbox");
+ gtk_widget_reparent (widget, vbox);
+ gtk_widget_show (widget);
+ break;
+
+ case 2:
+ widget = create_html ("extra_html");
+ gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
+ widget = glade_xml_get_widget (gui->gui->xml, "extra_vbox");
+ gtk_widget_reparent (widget, vbox);
+ break;
+
+ case 3:
+ widget = create_html ("management_html");
+ gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
+ widget = glade_xml_get_widget (gui->gui->xml, "transport_vbox");
+ gtk_widget_reparent (widget, vbox);
+ gtk_widget_show (widget);
+ break;
+
+ case 4:
+ widget = glade_xml_get_widget (gui->gui->xml, "management_frame");
+ gtk_widget_reparent (widget, vbox);
+ break;
+
+ default:
+ return NULL;
+ }
+
+ gtk_widget_show (vbox);
+ control = bonobo_control_new (vbox);
+
+ if (first_time) {
+ mail_account_gui_setup (gui->gui, NULL);
+ first_time = FALSE;
+ }
+ return control;
+}
+
+static struct {
+ GtkSignalFunc next_func;
+ GtkSignalFunc prepare_func;
+ GtkSignalFunc back_func;
+ GtkSignalFunc finish_func;
+ GtkSignalFunc help_func;
+} wizard_pages[] = {
+ { GTK_SIGNAL_FUNC (identity_next),
+ GTK_SIGNAL_FUNC (identity_prepare),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL) },
+ { GTK_SIGNAL_FUNC (source_next),
+ GTK_SIGNAL_FUNC (source_prepare),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL) },
+ { GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (extra_prepare),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL) },
+ { GTK_SIGNAL_FUNC (transport_next),
+ GTK_SIGNAL_FUNC (transport_prepare),
+ GTK_SIGNAL_FUNC (transport_back),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL) },
+ { GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (management_prepare),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL),
+ GTK_SIGNAL_FUNC (NULL) }
+};
+
+static void
+wizard_next_cb (EvolutionWizard *wizard,
+ int page_num,
+ MailConfigWizard *gui)
+{
+ if (wizard_pages[page_num].next_func != NULL) {
+ wizard_pages[page_num].next_func (wizard, gui);
+ }
+}
+
+static void
+wizard_prepare_cb (EvolutionWizard *wizard,
+ int page_num,
+ MailConfigWizard *gui)
+{
+ if (wizard_pages[page_num].prepare_func != NULL) {
+ wizard_pages[page_num].prepare_func (wizard, gui);
+ }
+}
+
+static void
+wizard_back_cb (EvolutionWizard *wizard,
+ int page_num,
+ MailConfigWizard *gui)
+{
+ if (wizard_pages[page_num].back_func != NULL) {
+ wizard_pages[page_num].back_func (wizard, gui);
+ }
+}
+
+static void
+wizard_finish_cb (EvolutionWizard *wizard,
+ int page_num,
+ MailConfigWizard *w)
+{
+ MailAccountGui *gui = w->gui;
+
+ /* Add the account to our list (do it first because future
+ steps might want to access config->accounts) */
+ mail_config_add_account (gui->account);
+
+ /* Save the settings for that account */
+ mail_account_gui_save (gui);
+ if (gui->account->source)
+ gui->account->source->enabled = TRUE;
+
+ /* Write out the config info */
+ mail_config_write ();
+ mail_account_gui_destroy (gui);
+ w->gui = NULL;
+ w->account = NULL;
+}
+
+static void
+wizard_cancel_cb (EvolutionWizard *wizard,
+ int page_num,
+ MailConfigWizard *gui)
+{
+ mail_account_gui_destroy (gui->gui);
+ gui->gui = NULL;
+}
+
+static void
+wizard_help_cb (EvolutionWizard *wizard,
+ int page_num,
+ MailConfigWizard *gui)
+{
+}
+
+static BonoboObject *
+evolution_mail_config_wizard_factory_fn (BonoboGenericFactory *factory,
+ void *closure)
+{
+ EvolutionWizard *wizard;
+ MailConfigAccount *account;
+ MailConfigWizard *gui;
+
+ account = make_account ();
+
+ gui = g_new (MailConfigWizard, 1);
+ gui->account = account;
+ gui->gui = NULL;
+
+ wizard = evolution_wizard_new (get_fn, 5, gui);
+ account_wizard = wizard;
+
+ gtk_object_set_data (GTK_OBJECT (account_wizard), "account-data", gui);
+ gui->wizard = wizard;
+
+ gtk_signal_connect (GTK_OBJECT (wizard), "next",
+ GTK_SIGNAL_FUNC (wizard_next_cb), gui);
+ gtk_signal_connect (GTK_OBJECT (wizard), "prepare",
+ GTK_SIGNAL_FUNC (wizard_prepare_cb), gui);
+ gtk_signal_connect (GTK_OBJECT (wizard), "back",
+ GTK_SIGNAL_FUNC (wizard_back_cb), gui);
+ gtk_signal_connect (GTK_OBJECT (wizard), "finish",
+ GTK_SIGNAL_FUNC (wizard_finish_cb), gui);
+ gtk_signal_connect (GTK_OBJECT (wizard), "cancel",
+ GTK_SIGNAL_FUNC (wizard_cancel_cb), gui);
+ gtk_signal_connect (GTK_OBJECT (wizard), "help",
+ GTK_SIGNAL_FUNC (wizard_help_cb), gui);
+ return BONOBO_OBJECT (wizard);
+}
+
+void
+evolution_mail_config_wizard_init (void)
+{
+ BonoboGenericFactory *factory;
+
+ factory = bonobo_generic_factory_new (WIZARD_IID,
+ evolution_mail_config_wizard_factory_fn, NULL);
+
+ if (factory == NULL) {
+ g_warning ("Error starting factory");
+ return;
+ }
+
+ bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
+}
diff --git a/mail/mail-config-druid.h b/mail/mail-config-druid.h
index 0108fe1223..515a7b209c 100644
--- a/mail/mail-config-druid.h
+++ b/mail/mail-config-druid.h
@@ -32,6 +32,7 @@ extern "C" {
#include <libgnomeui/gnome-file-entry.h>
#include <glade/glade.h>
#include <camel.h>
+#include <bonobo/bonobo-listener.h>
#include "shell/Evolution.h"
#include "mail-account-gui.h"
@@ -46,10 +47,15 @@ typedef struct {
GnomeDruid *druid;
MailAccountGui *gui;
+ GladeXML *xml;
GNOME_Evolution_Shell shell;
gboolean identity_copied;
CamelProvider *last_source;
+
+ int id;
+ BonoboListener *listener;
+ Bonobo_EventSource *event_source;
} MailConfigDruid;
typedef struct {
@@ -76,6 +82,7 @@ gint mail_config_druid_get_auto_check_minutes (MailConfigDruid *druid);
char *mail_config_druid_get_transport_url (MailConfigDruid *druid);
gboolean mail_config_druid_get_save_transport_password (MailConfigDruid *druid);
gboolean mail_config_druid_get_transport_requires_auth (MailConfigDruid *druid);
+void evolution_mail_config_wizard_init (void);
#ifdef __cplusplus
}
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 2050da0e05..576bea2038 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1335,7 +1335,11 @@ const MailConfigAccount *
mail_config_get_default_account (void)
{
MailConfigAccount *account;
-
+
+ if (config == NULL) {
+ mail_config_init ();
+ }
+
if (!config->accounts)
return NULL;
diff --git a/shell/ChangeLog b/shell/ChangeLog
index b99c1b262d..9afd5b1eb1 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,16 @@
+3001-08-17 Iain Holmes <iain@ximian.com>
+
+ * Evolution.idl: Add Evolution-Wizard.idl
+
+ * Evolution-Wizard.idl: New file implementing a wizard interface.
+
+ * Makefile.am: Add the wizard stuff and the startup dialog stuff
+
+ * e-shell.c (e_shell_construct): Hide the splash screen and try to start
+ the startup assistant.
+
+ * glade/Makefile.am: Add the evolution-startup-wizard.glade
+
2001-08-16 Jason Leach <jleach@ximian.com>
* e-shell-view-menu.c (authors): Add myself.
diff --git a/shell/Evolution-Wizard.idl b/shell/Evolution-Wizard.idl
new file mode 100644
index 0000000000..222830d737
--- /dev/null
+++ b/shell/Evolution-Wizard.idl
@@ -0,0 +1,37 @@
+/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Interface for a wizard done through Bonobo.
+ *
+ * Authors:
+ * Iain Holmes <iain@ximian.com>
+ *
+ * Copyright (C) 2000, 2001 Ximian, Inc.
+ */
+
+#include <Bonobo.idl>
+
+module GNOME {
+module Evolution {
+
+ interface Wizard : Bonobo::Unknown {
+
+ readonly attribute long pageCount;
+ enum Action {
+ NEXT,
+ PREPARE,
+ BACK,
+ FINISH,
+ CANCEL,
+ HELP
+ };
+
+ exception NoPage {};
+
+ Bonobo::Control getControl (in long pagenumber)
+ raises (NoPage);
+
+ void notifyAction (in long pagenumber, in Action action)
+ raises (NoPage);
+ };
+};
+};
diff --git a/shell/Evolution.idl b/shell/Evolution.idl
index 229b56abaf..ff267c60ea 100644
--- a/shell/Evolution.idl
+++ b/shell/Evolution.idl
@@ -22,3 +22,4 @@
#include <Evolution-Storage.idl>
#include <Evolution-StorageSetView.idl>
#include <Evolution-Shell.idl>
+#include <Evolution-Wizard.idl>
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 719d9fdd4d..b1d943f33d 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -69,7 +69,8 @@ eshellinclude_HEADERS = \
evolution-shell-view.h \
evolution-storage-listener.h \
evolution-storage-set-view-listener.h \
- evolution-storage.h
+ evolution-storage.h \
+ evolution-wizard.h
libeshell_la_SOURCES = \
$(IDL_GENERATED) \
@@ -85,6 +86,7 @@ libeshell_la_SOURCES = \
evolution-storage-listener.c \
evolution-storage-set-view-listener.c \
evolution-storage.c \
+ evolution-wizard.c \
$(eshellinclude_HEADERS)
# Evolution executable
@@ -127,6 +129,7 @@ evolution_SOURCES = \
e-shell-importer.h \
e-shell-offline-handler.c \
e-shell-offline-handler.h \
+ e-shell-startup-wizard.c \
e-shell-user-creatable-items-handler.c \
e-shell-user-creatable-items-handler.h \
e-shell-utils.c \
@@ -168,8 +171,10 @@ evolution_SOURCES = \
evolution_LDADD = \
libeshell.la \
importer/libevolution-importer.la \
+ $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/libical/src/libical/libical.la \
$(EXTRA_GNOME_LIBS) \
$(GNOME_PRINT_LIBS) \
$(GTKHTML_LIBS) \
diff --git a/shell/e-setup.c b/shell/e-setup.c
index a25f7d5187..4c31b6b1cb 100644
--- a/shell/e-setup.c
+++ b/shell/e-setup.c
@@ -300,8 +300,9 @@ e_setup (const char *evolution_directory)
struct stat statinfo;
char *file;
- if (stat (evolution_directory, &statinfo) != 0)
+ if (stat (evolution_directory, &statinfo) != 0) {
return copy_default_stuff (evolution_directory);
+ }
if (! S_ISDIR (statinfo.st_mode)) {
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c
new file mode 100644
index 0000000000..72a10c7c19
--- /dev/null
+++ b/shell/e-shell-startup-wizard.c
@@ -0,0 +1,845 @@
+/*
+ * e-shell-startup-wizard.c
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: Iain Holmes <iain@ximian.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gnome.h>
+#include <glade/glade.h>
+#include <liboaf/liboaf.h>
+
+#include <bonobo/bonobo-object.h>
+#include <bonobo/bonobo-widget.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
+
+#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
+#include "importer/GNOME_Evolution_Importer.h"
+
+#include <evolution-wizard.h>
+#include "Evolution.h"
+
+typedef struct _TimezoneDialogPage {
+ GtkWidget *page;
+ GtkWidget *vbox;
+ GtkObject *etd;
+} TimezoneDialogPage;
+
+typedef struct _ImportDialogPage {
+ GtkWidget *page;
+ GtkWidget *vbox;
+ GtkWidget *placeholder, *clist;
+
+ GList *importers;
+ int running;
+} ImportDialogPage;
+
+typedef struct _MailDialogPage {
+ GtkWidget *page;
+ GtkWidget *vbox;
+ GtkWidget *widget;
+
+ Bonobo_Control control;
+} MailDialogPage;
+
+typedef struct _SWData {
+ GladeXML *wizard;
+ GtkWidget *dialog;
+ GtkWidget *druid;
+
+ GnomeDruidPage *start, *finish;
+
+ MailDialogPage *id_page;
+ MailDialogPage *source_page;
+ MailDialogPage *extra_page;
+ MailDialogPage *transport_page;
+ MailDialogPage *management_page;
+
+ TimezoneDialogPage *timezone_page;
+ ImportDialogPage *import_page;
+
+ gboolean cancel;
+ CORBA_Object mailer;
+ Bonobo_EventSource event_source;
+ BonoboListener *listener;
+ int id;
+
+ Bonobo_ConfigDatabase db;
+} SWData;
+
+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;
+
+static GHashTable *page_hash;
+
+static void
+druid_event_notify_cb (BonoboListener *listener,
+ const char *name,
+ BonoboArg *arg,
+ CORBA_Environment *ev,
+ SWData *data)
+{
+ int buttons;
+
+ if (strcmp (name, EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE) == 0) {
+ buttons = (int) *((CORBA_short *)arg->_value);
+ gnome_druid_set_buttons_sensitive (GNOME_DRUID (data->druid),
+ (buttons & 4) >> 2,
+ (buttons & 2) >> 1,
+ (buttons & 1));
+ } else {
+ g_print ("event_name: %s\n", name);
+ }
+}
+
+static void
+make_mail_dialog_pages (SWData *data)
+{
+ CORBA_Environment ev;
+ CORBA_Object object;
+
+ CORBA_exception_init (&ev);
+ data->mailer = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Could not start mailer (%s)", CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ CORBA_exception_free (&ev);
+ if (data->mailer == CORBA_OBJECT_NIL) {
+ g_warning ("Could not activate mailer.");
+ return;
+ }
+
+ CORBA_exception_init (&ev);
+ data->event_source = Bonobo_Unknown_queryInterface (data->mailer, "IDL:Bonobo/EventSource:1.0", &ev);
+ CORBA_exception_free (&ev);
+ data->listener = bonobo_listener_new (NULL, NULL);
+ gtk_signal_connect (GTK_OBJECT (data->listener), "event-notify",
+ GTK_SIGNAL_FUNC (druid_event_notify_cb), data);
+ object = bonobo_object_corba_objref (BONOBO_OBJECT (data->listener));
+ CORBA_exception_init (&ev);
+ data->id = Bonobo_EventSource_addListener (data->event_source, object, &ev);
+ CORBA_exception_free (&ev);
+}
+
+static int
+page_to_num (GnomeDruidPage *page)
+{
+ return GPOINTER_TO_INT (g_hash_table_lookup (page_hash, page));
+}
+
+static gboolean
+next_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ SWData *data)
+{
+ CORBA_Environment ev;
+ int pagenum;
+
+ CORBA_exception_init (&ev);
+ pagenum = page_to_num (page);
+ GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_NEXT, &ev);
+ CORBA_exception_free (&ev);
+ return FALSE;
+}
+
+static gboolean
+prepare_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ SWData *data)
+{
+ CORBA_Environment ev;
+ int pagenum;
+
+ CORBA_exception_init (&ev);
+ pagenum = page_to_num (page);
+ GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_PREPARE, &ev);
+ CORBA_exception_free (&ev);
+ return FALSE;
+}
+
+static gboolean
+back_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ SWData *data)
+{
+ CORBA_Environment ev;
+ int pagenum;
+
+ CORBA_exception_init (&ev);
+ pagenum = page_to_num (page);
+ GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_BACK, &ev);
+ CORBA_exception_free (&ev);
+ return FALSE;
+}
+
+static void
+free_importers (SWData *data)
+{
+ GList *l;
+
+ for (l = data->import_page->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 (data->import_page->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 (SWData *data)
+{
+ CORBA_Environment ev;
+ GList *l, *selected = NULL;
+
+ for (l = GTK_CLIST (data->import_page->clist)->selection; l; l = l->next) {
+ IntelligentImporterData *importer_data;
+ SelectedImporterData *sid;
+ char *iid;
+
+ importer_data = g_list_nth_data (data->import_page->importers, GPOINTER_TO_INT (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 (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);
+ }
+}
+
+static gboolean
+finish_func (GnomeDruidPage *page,
+ GnomeDruid *druid,
+ SWData *data)
+{
+ CORBA_Environment ev;
+ char *displayname, *tz;
+
+ /* Notify mailer */
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Wizard_notifyAction (data->mailer, 0, GNOME_Evolution_Wizard_FINISH, &ev);
+ CORBA_exception_free (&ev);
+
+ /* Set Timezone */
+ CORBA_exception_init (&ev);
+
+ e_timezone_dialog_get_timezone (E_TIMEZONE_DIALOG (data->timezone_page->etd), &displayname);
+ if (displayname == NULL) {
+ tz = g_strdup ("");
+ } else {
+ tz = g_strdup (displayname);
+ g_free (displayname);
+ }
+
+ bonobo_config_set_string (data->db, "/Calendar/Display/Timezone", tz, &ev);
+ g_free (tz);
+ CORBA_exception_free (&ev);
+
+ do_import (data);
+
+ /* Free data */
+ data->cancel = FALSE;
+ gtk_widget_destroy (data->dialog);
+ gtk_main_quit ();
+}
+
+static void
+connect_page (GtkWidget *page,
+ SWData *data)
+{
+ gtk_signal_connect (GTK_OBJECT (page), "next",
+ GTK_SIGNAL_FUNC (next_func), data);
+ gtk_signal_connect (GTK_OBJECT (page), "prepare",
+ GTK_SIGNAL_FUNC (prepare_func), data);
+ gtk_signal_connect (GTK_OBJECT (page), "back",
+ GTK_SIGNAL_FUNC (back_func), data);
+ gtk_signal_connect (GTK_OBJECT (page), "finish",
+ GTK_SIGNAL_FUNC (finish_func), data);
+}
+
+static MailDialogPage *
+make_identity_page (SWData *data)
+{
+ MailDialogPage *page;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
+ page = g_new0 (MailDialogPage, 1);
+ page->page = glade_xml_get_widget (data->wizard, "identity-page");
+ g_return_val_if_fail (page->page != NULL, NULL);
+
+ connect_page (page->page, data);
+ g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (0));
+ page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox;
+
+ CORBA_exception_init (&ev);
+ page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 0, &ev);
+ CORBA_exception_free (&ev);
+
+ page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL);
+ gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0);
+ gtk_widget_show_all (page->widget);
+
+ return page;
+}
+
+static MailDialogPage *
+make_receive_page (SWData *data)
+{
+ MailDialogPage *page;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
+ page = g_new0 (MailDialogPage, 1);
+ page->page = glade_xml_get_widget (data->wizard, "receive-page");
+ g_return_val_if_fail (page->page != NULL, NULL);
+
+ connect_page (page->page, data);
+ g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (1));
+ page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox;
+
+ CORBA_exception_init (&ev);
+ page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 1, &ev);
+ CORBA_exception_free (&ev);
+
+ page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL);
+ gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0);
+ gtk_widget_show_all (page->widget);
+
+ return page;
+}
+
+static MailDialogPage *
+make_extra_page (SWData *data)
+{
+ MailDialogPage *page;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
+ page = g_new0 (MailDialogPage, 1);
+ page->page = glade_xml_get_widget (data->wizard, "extra-page");
+ g_return_val_if_fail (page->page != NULL, NULL);
+
+ connect_page (page->page, data);
+ g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (2));
+ page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox;
+
+ CORBA_exception_init (&ev);
+ page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 2, &ev);
+ CORBA_exception_free (&ev);
+
+ page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL);
+ gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0);
+ gtk_widget_show_all (page->widget);
+
+ return page;
+}
+
+static MailDialogPage *
+make_transport_page (SWData *data)
+{
+ MailDialogPage *page;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
+ page = g_new0 (MailDialogPage, 1);
+ page->page = glade_xml_get_widget (data->wizard, "send-page");
+ g_return_val_if_fail (page->page != NULL, NULL);
+
+ connect_page (page->page, data);
+ g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (3));
+ page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox;
+
+ CORBA_exception_init (&ev);
+ page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 3, &ev);
+ CORBA_exception_free (&ev);
+
+ page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL);
+ gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0);
+ gtk_widget_show_all (page->widget);
+
+ return page;
+}
+
+static MailDialogPage *
+make_management_page (SWData *data)
+{
+ MailDialogPage *page;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
+ page = g_new0 (MailDialogPage, 1);
+ page->page = glade_xml_get_widget (data->wizard, "management-page");
+ g_return_val_if_fail (page->page != NULL, NULL);
+
+ connect_page (page->page, data);
+ g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (4));
+ page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox;
+
+ CORBA_exception_init (&ev);
+ page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 4, &ev);
+ CORBA_exception_free (&ev);
+
+ page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL);
+ gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0);
+ gtk_widget_show_all (page->widget);
+
+ return page;
+}
+
+static TimezoneDialogPage *
+make_timezone_page (SWData *data)
+{
+ TimezoneDialogPage *page;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
+ page = g_new0 (TimezoneDialogPage, 1);
+ page->page = glade_xml_get_widget (data->wizard, "timezone-page");
+ g_return_val_if_fail (page->page != NULL, NULL);
+
+ page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox;
+
+ page->etd = e_timezone_dialog_new ();
+ e_timezone_dialog_reparent (page->etd, page->vbox);
+
+ return page;
+}
+
+static GList *
+get_intelligent_importers (void)
+{
+ OAF_ServerInfoList *info_list;
+ GList *iids_ret = NULL;
+ CORBA_Environment ev;
+ int i;
+
+ CORBA_exception_init (&ev);
+ info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev);
+ CORBA_exception_free (&ev);
+
+ for (i = 0; i < info_list->_length; i++) {
+ const OAF_ServerInfo *info;
+
+ info = info_list->_buffer + i;
+ iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid));
+ }
+
+ return iids_ret;
+}
+
+static void
+dialog_mapped (GtkWidget *w,
+ gpointer data)
+{
+ while (gtk_events_pending ()) {
+ gtk_main_iteration ();
+ }
+}
+
+static gboolean
+prepare_importer_page (GnomeDruidPage *page,
+
+ GnomeDruid *druid,
+ SWData *data)
+{
+ GtkWidget *dialog;
+ ImportDialogPage *import;
+ GList *l, *importers;
+ GtkWidget *dummy;
+ int running = 0;
+
+ dialog = gnome_message_box_new (_("Please wait...\nScanning for existing setups"), GNOME_MESSAGE_BOX_INFO, NULL);
+ gtk_signal_connect (GTK_OBJECT (dialog), "map",
+ GTK_SIGNAL_FUNC (dialog_mapped), NULL);
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Starting Intelligent Importers"));
+ gtk_widget_show_all (dialog);
+ while (gtk_events_pending ()) {
+ gtk_main_iteration ();
+ }
+
+ import = data->import_page;
+ 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, GNOME_DRUID_PAGE (data->finish))
+;
+ gtk_widget_destroy (dialog);
+ return TRUE;
+ }
+
+ for (l = importers; l; l = l->next) {
+ IntelligentImporterData *id;
+ CORBA_Environment ev;
+ gboolean can_run;
+ char *text[1];
+
+ id = g_new0 (IntelligentImporterData, 1);
+ id->iid = g_strdup (l->data);
+
+ CORBA_exception_init (&ev);
+ id->object = oaf_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 {
+ id->widget = gtk_label_new ("");
+ gtk_widget_show (id->widget);
+ }
+
+ CORBA_exception_free (&ev);
+
+ import->importers = g_list_prepend (import->importers, id);
+ gtk_notebook_prepend_page (GTK_NOTEBOOK (import->placeholder),
+ id->widget, NULL);
+ text[0] = id->name;
+ gtk_clist_prepend (GTK_CLIST (import->clist), text);
+ }
+
+ if (running == 0) {
+ gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->finish));
+ gtk_widget_destroy (dialog);
+ return TRUE;
+ }
+
+ import->running = running;
+ dummy = gtk_drawing_area_new ();
+ gtk_widget_show (dummy);
+ gtk_notebook_append_page (GTK_NOTEBOOK (import->placeholder), dummy, NULL);
+ /* Set the start to the blank page */
+ gtk_notebook_set_page (GTK_NOTEBOOK (import->placeholder), running);
+
+ gtk_widget_destroy (dialog);
+ return FALSE;
+}
+
+static void
+select_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *ev,
+ SWData *data)
+{
+ ImportDialogPage *page;
+
+ page = data->import_page;
+ gtk_notebook_set_page (GTK_NOTEBOOK (page->placeholder), row);
+}
+
+static void
+unselect_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *ev,
+ SWData *data)
+{
+ ImportDialogPage *page;
+
+ page = data->import_page;
+ if (clist->selection == NULL) {
+ gtk_notebook_set_page (GTK_NOTEBOOK (page->placeholder), page->running);
+ } else {
+ gtk_notebook_set_page (GTK_NOTEBOOK (page->placeholder),
+ GPOINTER_TO_INT (clist->selection->data));
+ }
+}
+
+static ImportDialogPage *
+make_importer_page (SWData *data)
+{
+ ImportDialogPage *page;
+ char *titles[1];
+ GtkWidget *hbox, *sw;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
+ page = g_new0 (ImportDialogPage, 1);
+ page->page = glade_xml_get_widget (data->wizard, "import-page");
+ g_return_val_if_fail (page->page != NULL, NULL);
+
+ gtk_signal_connect (GTK_OBJECT (page->page), "prepare",
+ GTK_SIGNAL_FUNC (prepare_importer_page), data);
+ page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox;
+
+ titles[0] = ".";
+ page->clist = gtk_clist_new_with_titles (1, titles);
+ gtk_clist_column_titles_hide (GTK_CLIST (page->clist));
+ gtk_clist_set_selection_mode (GTK_CLIST (page->clist), GTK_SELECTION_MULTIPLE);
+ gtk_signal_connect (GTK_OBJECT (page->clist), "select-row",
+ GTK_SIGNAL_FUNC (select_row_cb), data);
+ gtk_signal_connect (GTK_OBJECT (page->clist), "unselect-row",
+ GTK_SIGNAL_FUNC (unselect_row_cb), data);
+
+ hbox = gtk_hbox_new (FALSE, 2);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
+ gtk_box_pack_start (GTK_BOX (page->vbox), hbox, TRUE, TRUE, 0);
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_usize (sw, 300, 150);
+ gtk_container_add (GTK_CONTAINER (sw), page->clist);
+ gtk_box_pack_start (GTK_BOX (hbox), sw, FALSE, FALSE, 0);
+
+ page->placeholder = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (page->placeholder), FALSE);
+ gtk_box_pack_start (GTK_BOX (hbox), page->placeholder, TRUE, TRUE, 0);
+
+ return page;
+}
+
+static void
+startup_wizard_cancel (GnomeDruid *druid,
+ SWData *data)
+{
+ /* Free data */
+ data->cancel = TRUE;
+ gtk_widget_destroy (data->dialog);
+ gtk_main_quit ();
+}
+
+gboolean
+e_shell_startup_wizard_create (void)
+{
+ SWData *data;
+ CORBA_Environment ev;
+ gboolean runbefore;
+
+ data = g_new0 (SWData, 1);
+
+ CORBA_exception_init (&ev);
+ data->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+ if (BONOBO_EX (&ev) || data->db == CORBA_OBJECT_NIL) {
+ g_warning ("Error starting wombat: (%s)", CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ g_free (data);
+
+ return FALSE;
+ }
+
+ runbefore = bonobo_config_get_boolean (data->db, "/Shell/RunBefore", &ev);
+ CORBA_exception_free (&ev);
+
+ if (runbefore == TRUE) {
+ g_print ("Already run\n");
+ bonobo_object_release_unref (data->db, NULL);
+ g_free (data);
+
+ return TRUE;
+ }
+
+ data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/evolution-startup-wizard.glade", NULL);
+ g_return_val_if_fail (data->wizard != NULL, FALSE);
+ data->dialog = glade_xml_get_widget (data->wizard, "startup-wizard");
+ g_return_val_if_fail (data->dialog != NULL, FALSE);
+ gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "startup-wizard",
+ "Evolution:shell");
+
+ page_hash = g_hash_table_new (NULL, NULL);
+ data->druid = glade_xml_get_widget (data->wizard, "startup-druid");
+ g_return_val_if_fail (data->druid != NULL, FALSE);
+ gnome_druid_set_buttons_sensitive (GNOME_DRUID (data->druid),
+ FALSE, TRUE, FALSE);
+
+ gtk_signal_connect (GTK_OBJECT (data->druid), "cancel",
+ GTK_SIGNAL_FUNC (startup_wizard_cancel), data);
+
+ data->start = glade_xml_get_widget (data->wizard, "start-page");
+ data->finish = glade_xml_get_widget (data->wizard, "done-page");
+ g_return_val_if_fail (data->start != NULL, FALSE);
+ g_return_val_if_fail (data->finish != NULL, FALSE);
+ gtk_signal_connect (GTK_OBJECT (data->finish), "finish",
+ GTK_SIGNAL_FUNC (finish_func), data);
+
+ make_mail_dialog_pages (data);
+ data->id_page = make_identity_page (data);
+ data->source_page = make_receive_page (data);
+ data->extra_page = make_extra_page (data);
+ data->transport_page = make_transport_page (data);
+ data->management_page = make_management_page (data);
+
+ data->timezone_page = make_timezone_page (data);
+ data->import_page = make_importer_page (data);
+
+ g_return_val_if_fail (data->id_page != NULL, FALSE);
+ g_return_val_if_fail (data->source_page != NULL, FALSE);
+ g_return_val_if_fail (data->extra_page != NULL, FALSE);
+ g_return_val_if_fail (data->transport_page != NULL, FALSE);
+ g_return_val_if_fail (data->management_page != NULL, FALSE);
+ g_return_val_if_fail (data->timezone_page != NULL, FALSE);
+ g_return_val_if_fail (data->import_page != NULL, FALSE);
+
+ gnome_druid_set_buttons_sensitive (data->druid, FALSE, TRUE, TRUE);
+ gtk_widget_show_all (data->dialog);
+
+ gtk_main ();
+
+ /* Sync database */
+ bonobo_config_set_boolean (data->db, "/Shell/RunBefore", TRUE, &ev);
+ Bonobo_ConfigDatabase_sync (data->db, &ev);
+ bonobo_object_release_unref (data->db, NULL);
+ CORBA_exception_free (&ev);
+
+ return !data->cancel;
+}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 08a9ee4607..ea6e25bcd4 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -961,9 +961,24 @@ e_shell_construct (EShell *shell,
can tell the components we are here. */
set_owner_on_components (shell);
- /* Run the intelligent importers to find see if any data needs
- importing. */
- intelligent_importer_init ();
+ if (show_splash) {
+ gtk_widget_destroy (splash);
+ }
+
+ if (e_shell_startup_wizard_create () == FALSE) {
+ /* FIXME: Need to kill all components somehow */
+ exit (0);
+ }
+ shortcut_path = g_concat_dir_and_file (local_directory, "shortcuts.xml");
+ priv->shortcuts = e_shortcuts_new (priv->storage_set,
+ priv->folder_type_registry,
+ shortcut_path);
+ g_assert (priv->shortcuts != NULL);
+
+ if (e_shortcuts_get_num_groups (priv->shortcuts) == 0)
+ e_shortcuts_add_default_group (priv->shortcuts);
+
+ g_free (shortcut_path);
if (show_splash)
gtk_widget_destroy (splash);
diff --git a/shell/evolution-wizard.c b/shell/evolution-wizard.c
new file mode 100644
index 0000000000..0d21cd9eed
--- /dev/null
+++ b/shell/evolution-wizard.c
@@ -0,0 +1,394 @@
+/*
+ * evolution-wizard.c
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: Iain Holmes <iain@ximian.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <gtk/gtksignal.h>
+#include <gtk/gtkmarshal.h>
+#include <gtk/gtktypeutils.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-main.h>
+#include <bonobo/bonobo-event-source.h>
+
+#include "evolution-wizard.h"
+#include "Evolution.h"
+
+struct _EvolutionWizardPrivate {
+ EvolutionWizardGetControlFn get_fn;
+ BonoboEventSource *event_source;
+
+ void *closure;
+ int page_count;
+};
+
+enum {
+ NEXT,
+ PREPARE,
+ BACK,
+ FINISH,
+ CANCEL,
+ HELP,
+ LAST_SIGNAL
+};
+
+#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
+
+static GtkObjectClass *parent_class;
+static guint32 signals[LAST_SIGNAL] = { 0 };
+
+static CORBA_long
+impl_GNOME_Evolution_Wizard__get_pageCount (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionWizard *wizard;
+ EvolutionWizardPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ wizard = EVOLUTION_WIZARD (bonobo_object);
+ priv = wizard->priv;
+
+ return priv->page_count;
+}
+
+static Bonobo_Control
+impl_GNOME_Evolution_Wizard_getControl (PortableServer_Servant servant,
+ CORBA_long pagenumber,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionWizard *wizard;
+ EvolutionWizardPrivate *priv;
+ BonoboControl *control;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ wizard = EVOLUTION_WIZARD (bonobo_object);
+ priv = wizard->priv;
+
+ if (pagenumber < 0 || pagenumber >= priv->page_count) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_GNOME_Evolution_Wizard_NoPage, NULL);
+ return CORBA_OBJECT_NIL;
+ }
+
+ control = priv->get_fn (wizard, pagenumber, priv->closure);
+ if (control == NULL)
+ return CORBA_OBJECT_NIL;
+
+ return (Bonobo_Control) CORBA_Object_duplicate (BONOBO_OBJREF (control), ev);
+}
+
+static void
+impl_GNOME_Evolution_Wizard_notifyAction (PortableServer_Servant servant,
+ CORBA_long pagenumber,
+ GNOME_Evolution_Wizard_Action action,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionWizard *wizard;
+ EvolutionWizardPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ wizard = EVOLUTION_WIZARD (bonobo_object);
+ priv = wizard->priv;
+
+ if (pagenumber < 0 || pagenumber >= priv->page_count) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_GNOME_Evolution_Wizard_NoPage, NULL);
+ return;
+ }
+
+ g_print ("Emit something\n");
+ switch (action) {
+ case GNOME_Evolution_Wizard_NEXT:
+ gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[NEXT],
+ pagenumber);
+ break;
+
+ case GNOME_Evolution_Wizard_PREPARE:
+ gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[PREPARE],
+ pagenumber);
+ break;
+
+ case GNOME_Evolution_Wizard_BACK:
+ gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[BACK],
+ pagenumber);
+ break;
+
+ case GNOME_Evolution_Wizard_FINISH:
+ g_print ("Emit finish\n");
+ gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[FINISH],
+ pagenumber);
+ break;
+
+ case GNOME_Evolution_Wizard_CANCEL:
+ gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[CANCEL],
+ pagenumber);
+ break;
+
+ case GNOME_Evolution_Wizard_HELP:
+ gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[HELP],
+ pagenumber);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+static void
+evolution_wizard_destroy (GtkObject *object)
+{
+ EvolutionWizard *wizard;
+
+ wizard = EVOLUTION_WIZARD (object);
+ if (wizard->priv == NULL) {
+ return;
+ }
+
+ g_free (wizard->priv);
+ wizard->priv = NULL;
+
+ parent_class->destroy (object);
+}
+
+static void
+evolution_wizard_class_init (EvolutionWizardClass *klass)
+{
+ GtkObjectClass *object_class;
+ POA_GNOME_Evolution_Wizard__epv *epv = &klass->epv;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = evolution_wizard_destroy;
+
+ signals[NEXT] = gtk_signal_new ("next", GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionWizardClass, next),
+ gtk_marshal_NONE__INT, GTK_TYPE_NONE,
+ 1, GTK_TYPE_INT);
+ signals[PREPARE] = gtk_signal_new ("prepare", GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionWizardClass, prepare),
+ gtk_marshal_NONE__INT, GTK_TYPE_NONE,
+ 1, GTK_TYPE_INT);
+ signals[BACK] = gtk_signal_new ("back", GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionWizardClass, back),
+ gtk_marshal_NONE__INT, GTK_TYPE_NONE,
+ 1, GTK_TYPE_INT);
+ signals[FINISH] = gtk_signal_new ("finish", GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionWizardClass, finish),
+ gtk_marshal_NONE__INT, GTK_TYPE_NONE,
+ 1, GTK_TYPE_INT);
+ signals[CANCEL] = gtk_signal_new ("cancel", GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionWizardClass, cancel),
+ gtk_marshal_NONE__INT, GTK_TYPE_NONE,
+ 1, GTK_TYPE_INT);
+ signals[HELP] = gtk_signal_new ("help", GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionWizardClass, help),
+ gtk_marshal_NONE__INT, GTK_TYPE_NONE,
+ 1, GTK_TYPE_INT);
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ epv->_get_pageCount = impl_GNOME_Evolution_Wizard__get_pageCount;
+ epv->getControl = impl_GNOME_Evolution_Wizard_getControl;
+ epv->notifyAction = impl_GNOME_Evolution_Wizard_notifyAction;
+}
+
+static void
+evolution_wizard_init (EvolutionWizard *wizard)
+{
+ wizard->priv = g_new0 (EvolutionWizardPrivate, 1);
+}
+
+BONOBO_X_TYPE_FUNC_FULL (EvolutionWizard, GNOME_Evolution_Wizard,
+ PARENT_TYPE, evolution_wizard);
+
+EvolutionWizard *
+evolution_wizard_construct (EvolutionWizard *wizard,
+ BonoboEventSource *event_source,
+ EvolutionWizardGetControlFn get_fn,
+ int num_pages,
+ void *closure)
+{
+ EvolutionWizardPrivate *priv;
+
+ g_return_val_if_fail (BONOBO_IS_EVENT_SOURCE (event_source), NULL);
+ g_return_val_if_fail (IS_EVOLUTION_WIZARD (wizard), NULL);
+
+ priv = wizard->priv;
+ priv->get_fn = get_fn;
+ priv->page_count = num_pages;
+ priv->closure = closure;
+
+ priv->event_source = event_source;
+ bonobo_object_add_interface (BONOBO_OBJECT (wizard),
+ BONOBO_OBJECT (event_source));
+
+ return wizard;
+}
+
+EvolutionWizard *
+evolution_wizard_new_full (EvolutionWizardGetControlFn get_fn,
+ int num_pages,
+ BonoboEventSource *event_source,
+ void *closure)
+{
+ EvolutionWizard *wizard;
+
+ g_return_val_if_fail (num_pages > 0, NULL);
+ g_return_val_if_fail (BONOBO_IS_EVENT_SOURCE (event_source), NULL);
+
+ wizard = gtk_type_new (evolution_wizard_get_type ());
+
+ return evolution_wizard_construct (wizard, event_source, get_fn, num_pages, closure);
+}
+
+EvolutionWizard *
+evolution_wizard_new (EvolutionWizardGetControlFn get_fn,
+ int num_pages,
+ void *closure)
+{
+ BonoboEventSource *event_source;
+
+ g_return_val_if_fail (num_pages > 0, NULL);
+
+ event_source = bonobo_event_source_new ();
+
+ return evolution_wizard_new_full (get_fn, num_pages, event_source, closure);
+}
+
+void
+evolution_wizard_set_buttons_sensitive (EvolutionWizard *wizard,
+ gboolean back_sensitive,
+ gboolean next_sensitive,
+ gboolean cancel_sensitive,
+ CORBA_Environment *opt_ev)
+{
+ EvolutionWizardPrivate *priv;
+ CORBA_Environment ev;
+ CORBA_any any;
+ CORBA_short s;
+
+ g_return_if_fail (IS_EVOLUTION_WIZARD (wizard));
+
+ priv = wizard->priv;
+
+ if (opt_ev == NULL) {
+ CORBA_exception_init (&ev);
+ } else {
+ ev = *opt_ev;
+ }
+
+ s = back_sensitive << 2 | next_sensitive << 1 | cancel_sensitive;
+ any._type = (CORBA_TypeCode) TC_short;
+ any._value = &s;
+
+ bonobo_event_source_notify_listeners (priv->event_source,
+ EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE,
+ &any, &ev);
+ if (opt_ev == NULL && BONOBO_EX (&ev)) {
+ g_warning ("ERROR(%s): %s", __FUNCTION__, CORBA_exception_id (&ev));
+ }
+
+ if (opt_ev == NULL) {
+ CORBA_exception_free (&ev);
+ }
+}
+
+void
+evolution_wizard_set_show_finish (EvolutionWizard *wizard,
+ gboolean show_finish,
+ CORBA_Environment *opt_ev)
+{
+ EvolutionWizardPrivate *priv;
+ CORBA_Environment ev;
+ CORBA_any any;
+ CORBA_boolean b;
+
+ g_return_if_fail (IS_EVOLUTION_WIZARD (wizard));
+
+ priv = wizard->priv;
+ if (opt_ev == NULL) {
+ CORBA_exception_init (&ev);
+ } else {
+ ev = *opt_ev;
+ }
+
+ b = show_finish;
+ any._type = (CORBA_TypeCode) TC_boolean;
+ any._value = &b;
+
+ bonobo_event_source_notify_listeners (priv->event_source,
+ EVOLUTION_WIZARD_SET_SHOW_FINISH,
+ &any, &ev);
+ if (opt_ev == NULL && BONOBO_EX (&ev)) {
+ g_warning ("ERROR(%s): %s", __FUNCTION__, CORBA_exception_id (&ev));
+ }
+
+ if (opt_ev == NULL) {
+ CORBA_exception_free (&ev);
+ }
+}
+
+void
+evolution_wizard_set_page (EvolutionWizard *wizard,
+ int page_number,
+ CORBA_Environment *opt_ev)
+{
+ EvolutionWizardPrivate *priv;
+ CORBA_Environment ev;
+ CORBA_any any;
+ CORBA_short s;
+
+ g_return_if_fail (IS_EVOLUTION_WIZARD (wizard));
+
+ priv = wizard->priv;
+
+ g_return_if_fail (page_number >= 0 && page_number < priv->page_count);
+
+ if (opt_ev == NULL) {
+ CORBA_exception_init (&ev);
+ } else {
+ ev = *opt_ev;
+ }
+
+ s = page_number;
+ any._type = (CORBA_TypeCode) TC_short;
+ any._value = &s;
+
+ bonobo_event_source_notify_listeners (priv->event_source,
+ EVOLUTION_WIZARD_SET_PAGE,
+ &any, &ev);
+
+ if (opt_ev == NULL && BONOBO_EX (&ev)) {
+ g_warning ("ERROR(%s): %s", __FUNCTION__, CORBA_exception_id (&ev));
+ }
+
+ if (opt_ev == NULL) {
+ CORBA_exception_free (&ev);
+ }
+}
+
+BonoboEventSource *
+evolution_wizard_get_event_source (EvolutionWizard *wizard)
+{
+ g_return_val_if_fail (IS_EVOLUTION_WIZARD (wizard), NULL);
+
+ return wizard->priv->event_source;
+}
diff --git a/shell/evolution-wizard.h b/shell/evolution-wizard.h
new file mode 100644
index 0000000000..617d7bb3a5
--- /dev/null
+++ b/shell/evolution-wizard.h
@@ -0,0 +1,86 @@
+/*
+ * evolution-wizard.h
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: Iain Holmes <iain@ximian.com>
+ */
+
+#ifndef __EVOLUTION_WIZARD_H__
+#define __EVOLUTION_WIZARD_H__
+
+#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-event-source.h>
+
+#include <Evolution.h>
+
+BEGIN_GNOME_DECLS
+
+typedef struct _EvolutionWizard EvolutionWizard;
+typedef struct _EvolutionWizardPrivate EvolutionWizardPrivate;
+
+#define EVOLUTION_WIZARD_SET_PAGE "GNOME::Evolution::Wizard_setPage"
+#define EVOLUTION_WIZARD_SET_SHOW_FINISH "GNOME::Evolution::Wizard_setShowFinish"
+#define EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE "GNOME::Evolution::Wizard_setButtonsSensitive"
+
+#define EVOLUTION_WIZARD_TYPE (evolution_wizard_get_type ())
+#define EVOLUTION_WIZARD(o) (GTK_CHECK_CAST ((o), EVOLUTION_WIZARD_TYPE, EvolutionWizard))
+#define EVOLUTION_WIZARD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), EVOLUTION_WIZARD_TYPE, EvolutionWizardClass))
+#define IS_EVOLUTION_WIZARD(o) (GTK_CHECK_TYPE ((o), EVOLUTION_WIZARD_TYPE))
+#define IS_EVOLUTION_WIZARD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EVOLUTION_WIZARD_TYPE))
+
+typedef BonoboControl *(* EvolutionWizardGetControlFn) (EvolutionWizard *wizard,
+ int page_number,
+ void *closure);
+
+struct _EvolutionWizard {
+ BonoboXObject object;
+
+ EvolutionWizardPrivate *priv;
+};
+
+typedef struct {
+ BonoboXObjectClass parent_class;
+
+ POA_GNOME_Evolution_Wizard__epv epv;
+
+ void (* next) (EvolutionWizard *wizard, int page_number);
+ void (* prepare) (EvolutionWizard *wizard, int page_number);
+ void (* back) (EvolutionWizard *wizard, int page_number);
+ void (* finish) (EvolutionWizard *wizard, int page_number);
+ void (* cancel) (EvolutionWizard *wizard, int page_number);
+ void (* help) (EvolutionWizard *wizard, int page_number);
+} EvolutionWizardClass;
+
+GtkType evolution_wizard_get_type (void);
+
+EvolutionWizard *evolution_wizard_construct (EvolutionWizard *wizard,
+ BonoboEventSource *event_source,
+ EvolutionWizardGetControlFn get_fn,
+ int num_pages,
+ void *closure);
+EvolutionWizard *evolution_wizard_new_full (EvolutionWizardGetControlFn get_fn,
+ int num_pages,
+ BonoboEventSource *event_source,
+ void *closure);
+EvolutionWizard *evolution_wizard_new (EvolutionWizardGetControlFn get_fn,
+ int num_pages,
+ void *closure);
+
+void evolution_wizard_set_buttons_sensitive (EvolutionWizard *wizard,
+ gboolean back_sensitive,
+ gboolean next_sensitive,
+ gboolean cancel_sensitive,
+ CORBA_Environment *opt_ev);
+void evolution_wizard_set_show_finish (EvolutionWizard *wizard,
+ gboolean show_finish,
+ CORBA_Environment *opt_ev);
+void evolution_wizard_set_page (EvolutionWizard *wizard,
+ int page_number,
+ CORBA_Environment *opt_ev);
+
+BonoboEventSource * evolution_wizard_get_event_source (EvolutionWizard *wizard);
+
+END_GNOME_DECLS
+
+#endif /* __EVOLUTION_WIZARD_H__ */
diff --git a/shell/glade/Makefile.am b/shell/glade/Makefile.am
index 9a29a07b2c..4ef31d8057 100644
--- a/shell/glade/Makefile.am
+++ b/shell/glade/Makefile.am
@@ -2,6 +2,7 @@ gladedir = $(datadir)/evolution/glade
glade_DATA = \
e-active-connection-dialog.glade \
- e-shell-folder-creation-dialog.glade
+ e-shell-folder-creation-dialog.glade \
+ evolution-startup-wizard.glade
EXTRA_DIST = $(glade_DATA)
diff --git a/shell/glade/evolution-startup-wizard.glade b/shell/glade/evolution-startup-wizard.glade
new file mode 100644
index 0000000000..092382a1a2
--- /dev/null
+++ b/shell/glade/evolution-startup-wizard.glade
@@ -0,0 +1,252 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>Evolution-startup-wizard</name>
+ <program_name>evolution-startup-wizard</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+</project>
+
+<widget>
+ <class>GtkWindow</class>
+ <name>startup-wizard</name>
+ <width>687</width>
+ <height>0</height>
+ <visible>False</visible>
+ <title>window1</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+
+ <widget>
+ <class>GnomeDruid</class>
+ <name>startup-druid</name>
+
+ <widget>
+ <class>GnomeDruidPageStart</class>
+ <name>start-page</name>
+ <title>First Time Startup Configuration</title>
+ <text>Welcome to the Evolution first time configuration assistant.
+
+This will help you:
+ - configure your email settings
+ - set your timezone.
+ - import your old email and contacts
+
+What you will need:
+ - email server information (ask your email administrator for help)
+
+First a directory will be created in your home directory for Evolution to
+store it's configuration settings.</text>
+ <title_color>255,255,255</title_color>
+ <text_color>0,0,0</text_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+ <textbox_color>255,255,255</textbox_color>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageStandard</class>
+ <name>identity-page</name>
+ <title>Identity</title>
+ <title_color>255,255,255</title_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDruidPageStandard:vbox</child_name>
+ <name>druid-vbox2</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageStandard</class>
+ <name>receive-page</name>
+ <title>Receiving Email</title>
+ <title_color>255,255,255</title_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDruidPageStandard:vbox</child_name>
+ <name>druid-vbox3</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageStandard</class>
+ <name>extra-page</name>
+ <title>Receiving Email</title>
+ <title_color>255,255,255</title_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDruidPageStandard:vbox</child_name>
+ <name>druid-vbox8</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageStandard</class>
+ <name>send-page</name>
+ <title>Sending Email</title>
+ <title_color>255,255,255</title_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDruidPageStandard:vbox</child_name>
+ <name>druid-vbox5</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageStandard</class>
+ <name>management-page</name>
+ <title>Account Management</title>
+ <title_color>255,255,255</title_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDruidPageStandard:vbox</child_name>
+ <name>druid-vbox9</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageStandard</class>
+ <name>timezone-page</name>
+ <title>Timezone </title>
+ <title_color>255,255,255</title_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDruidPageStandard:vbox</child_name>
+ <name>druid-vbox6</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageStandard</class>
+ <name>import-page</name>
+ <title>Importing Data</title>
+ <title_color>255,255,255</title_color>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDruidPageStandard:vbox</child_name>
+ <name>druid-vbox7</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDruidPageFinish</class>
+ <name>done-page</name>
+ <title>Done</title>
+ <text>Your configuration is complete.</text>
+ <background_color>0,0,1</background_color>
+ <logo_background_color>255,255,255</logo_background_color>
+ <textbox_color>255,255,255</textbox_color>
+ <text_color>0,0,0</text_color>
+ <title_color>255,255,255</title_color>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index 0f500314fd..9fd38ac4fd 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,3 +1,9 @@
+2001-08-18 Iain Holmes <iain@ximian.com>
+
+ * Makefile.am: Add the e-timezone-dialog dir.
+
+ * e-timezone-dialog/*: Add new files.
+
2001-08-10 Christopher James Lahey <clahey@ximian.com>
* menus/gal-view-menus.c (build_menus): Don't display the Define
diff --git a/widgets/Makefile.am b/widgets/Makefile.am
index b5380daa7f..665c70c4da 100644
--- a/widgets/Makefile.am
+++ b/widgets/Makefile.am
@@ -1,5 +1,6 @@
SUBDIRS = \
+ e-timezone-dialog \
misc \
meeting-time-sel \
menus
diff --git a/widgets/e-timezone-dialog/Makefile.am b/widgets/e-timezone-dialog/Makefile.am
new file mode 100644
index 0000000000..798958a471
--- /dev/null
+++ b/widgets/e-timezone-dialog/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(EXTRA_GNOME_CFLAGS) \
+ -DMAP_DIR=\""$(datadir)/images/evolution"\" \
+ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
+ -DG_LOG_DOMAIN=__FILE__
+
+noinst_LIBRARIES = \
+ libetimezonedialog.a
+
+libetimezonedialog_a_SOURCES = \
+ e-timezone-dialog.c \
+ e-timezone-dialog.h
+
+gladedir = $(datadir)/evolution/glade
+glade_DATA = e-timezone-dialog.glade
+
+EXTRA_DIST = $(glade_DATA)
diff --git a/calendar/gui/dialogs/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c
index 1379470707..31fc7f77e3 100644
--- a/calendar/gui/dialogs/e-timezone-dialog.c
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.c
@@ -55,6 +55,7 @@ struct _ETimezoneDialogPrivate {
/* Widgets from the Glade file */
GtkWidget *app;
+ GtkWidget *table;
GtkWidget *map_window;
GtkWidget *timezone_preview;
GtkWidget *timezone_combo;
@@ -245,6 +246,7 @@ e_timezone_dialog_construct (ETimezoneDialog *etd)
/* Load the content widgets */
+ g_print ("Loading: %s\n", EVOLUTION_GLADEDIR "/e-timezone-dialog.glade");
priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/e-timezone-dialog.glade",
NULL);
if (!priv->xml) {
@@ -307,11 +309,13 @@ get_widgets (ETimezoneDialog *etd)
priv->map_window = GW ("map-window");
priv->timezone_combo = GW ("timezone-combo");
priv->timezone_preview = GW ("timezone-preview");
+ priv->table = GW ("table1");
return (priv->app
&& priv->map_window
&& priv->timezone_combo
- && priv->timezone_preview);
+ && priv->timezone_preview
+ && priv->table);
}
@@ -583,7 +587,7 @@ e_timezone_dialog_set_timezone (ETimezoneDialog *etd,
}
-GtkWidget*
+GtkWidget *
e_timezone_dialog_get_toplevel (ETimezoneDialog *etd)
{
ETimezoneDialogPrivate *priv;
@@ -657,3 +661,21 @@ on_combo_changed (GtkEditable *entry, ETimezoneDialog *etd)
g_free (priv->tzid);
priv->tzid = NULL;
}
+
+/**
+ * e_timezone_dialog_reparent:
+ * @etd: #ETimezoneDialog.
+ * @new_parent: The new parent widget.
+ *
+ * Takes the internal widgets out of the dialog and put them into @new_parent
+ */
+void
+e_timezone_dialog_reparent (ETimezoneDialog *etd,
+ GtkWidget *new_parent)
+{
+ ETimezoneDialogPrivate *priv;
+
+ priv = etd->priv;
+
+ gtk_widget_reparent (priv->table, new_parent);
+}
diff --git a/calendar/gui/dialogs/e-timezone-dialog.glade b/widgets/e-timezone-dialog/e-timezone-dialog.glade
index 15254056c7..15254056c7 100644
--- a/calendar/gui/dialogs/e-timezone-dialog.glade
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.glade
diff --git a/calendar/gui/dialogs/e-timezone-dialog.h b/widgets/e-timezone-dialog/e-timezone-dialog.h
index 4f6f9dd934..4f6f9dd934 100644
--- a/calendar/gui/dialogs/e-timezone-dialog.h
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.h