diff options
author | Dan Winship <danw@src.gnome.org> | 2003-02-25 23:45:53 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2003-02-25 23:45:53 +0800 |
commit | e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db (patch) | |
tree | 44158e253006506645cd11834c1222cc8a343cdf | |
parent | 176204b94f0a36a105b4bb7e7ac7a5d6e9f0638b (diff) | |
download | gsoc2013-evolution-e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db.tar gsoc2013-evolution-e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db.tar.gz gsoc2013-evolution-e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db.tar.bz2 gsoc2013-evolution-e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db.tar.lz gsoc2013-evolution-e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db.tar.xz gsoc2013-evolution-e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db.tar.zst gsoc2013-evolution-e9b3db536dcbedc71dc6a5a733ac8cd8711eb0db.zip |
Change this to let the Wizard provide an array of title/icon/control
* Evolution-Wizard.idl: Change this to let the Wizard provide an
array of title/icon/control triplets, instead of just controls, so
the shell doesn't need to know the name of each page a priori.
* glade/evolution-startup-wizard.glade: Remove the mailer-specific
pages, which are now inserted at run time based on info from the
mailer.
* evolution-wizard.c: Update for new idl.
(evolution_wizard_new): Now takes no arguments.
(evolution_wizard_add_page): New function to add page info to the
wizard.
* e-shell-startup-wizard.c: Various renamings to make this
slightly less mailer-centric, though it still explicitly launches
the mailer startup wizard.
(make_corba_page): Replaces make_identity_page, make_receive_page,
etc. Uses the new Wizard idl to generically create a page and
insert it into the druid.
(e_shell_startup_wizard_create): Update
svn path=/trunk/; revision=20053
-rw-r--r-- | shell/ChangeLog | 23 | ||||
-rw-r--r-- | shell/Evolution-Wizard.idl | 13 | ||||
-rw-r--r-- | shell/e-shell-startup-wizard.c | 284 | ||||
-rw-r--r-- | shell/evolution-wizard.c | 201 | ||||
-rw-r--r-- | shell/evolution-wizard.h | 56 | ||||
-rw-r--r-- | shell/glade/evolution-startup-wizard.glade | 340 |
6 files changed, 300 insertions, 617 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 02358efdc3..aeac883394 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,28 @@ 2003-02-25 Dan Winship <danw@ximian.com> + * Evolution-Wizard.idl: Change this to let the Wizard provide an + array of title/icon/control triplets, instead of just controls, so + the shell doesn't need to know the name of each page a priori. + + * glade/evolution-startup-wizard.glade: Remove the mailer-specific + pages, which are now inserted at run time based on info from the + mailer. + + * evolution-wizard.c: Update for new idl. + (evolution_wizard_new): Now takes no arguments. + (evolution_wizard_add_page): New function to add page info to the + wizard. + + * e-shell-startup-wizard.c: Various renamings to make this + slightly less mailer-centric, though it still explicitly launches + the mailer startup wizard. + (make_corba_page): Replaces make_identity_page, make_receive_page, + etc. Uses the new Wizard idl to generically create a page and + insert it into the druid. + (e_shell_startup_wizard_create): Update + +2003-02-25 Dan Winship <danw@ximian.com> + * e-shell-startup-wizard.c (connect_page, make_importer_page): Use g_signal_connect_after to connect to the "prepare" signal to work around a GnomeDruidPageStandard bug (b.g.o 81869) diff --git a/shell/Evolution-Wizard.idl b/shell/Evolution-Wizard.idl index 222830d737..145774f70b 100644 --- a/shell/Evolution-Wizard.idl +++ b/shell/Evolution-Wizard.idl @@ -15,7 +15,15 @@ module Evolution { interface Wizard : Bonobo::Unknown { - readonly attribute long pageCount; + struct Page { + string title; + Icon icon; + Bonobo::Control control; + }; + typedef sequence<Page> PageList; + + readonly attribute PageList pages; + enum Action { NEXT, PREPARE, @@ -27,9 +35,6 @@ module Evolution { exception NoPage {}; - Bonobo::Control getControl (in long pagenumber) - raises (NoPage); - void notifyAction (in long pagenumber, in Action action) raises (NoPage); }; diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c index 9e90180704..6041634ace 100644 --- a/shell/e-shell-startup-wizard.c +++ b/shell/e-shell-startup-wizard.c @@ -20,11 +20,14 @@ * Authors: Iain Holmes <iain@ximian.com> */ +/* WARNING: I LEAK. */ + #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "e-shell-startup-wizard.h" +#include "e-shell-corba-icon-utils.h" #include "e-timezone-dialog/e-timezone-dialog.h" #include "e-util/e-gtk-utils.h" @@ -68,34 +71,20 @@ typedef struct _ImportDialogPage { gboolean prepared; } ImportDialogPage; -typedef struct _MailDialogPage { - GtkWidget *page; - GtkWidget *vbox; - GtkWidget *widget; - - Bonobo_Control control; -} MailDialogPage; - typedef struct _SWData { GladeXML *wizard; GtkWidget *dialog; GtkWidget *druid; GtkWidget *start, *finish; - - MailDialogPage *id_page; - MailDialogPage *source_page; - MailDialogPage *extra_page; - MailDialogPage *transport_page; - MailDialogPage *management_page; - + GPtrArray *corba_pages; TimezoneDialogPage *timezone_page; ImportDialogPage *import_page; gboolean cancel; - CORBA_Object mailer; - Bonobo_EventSource event_source; + GNOME_Evolution_Wizard corba_wizard; BonoboListener *listener; + GNOME_Evolution_Wizard_PageList *pagelist; } SWData; typedef struct _IntelligentImporterData { @@ -145,33 +134,32 @@ druid_event_notify_cb (BonoboListener *listener, } static void -make_mail_dialog_pages (SWData *data) +make_corba_dialog_pages (SWData *data) { CORBA_Environment ev; CORBA_Object object; + Bonobo_EventSource event_source; CORBA_exception_init (&ev); - data->mailer = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev); + data->corba_wizard = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev); if (BONOBO_EX (&ev)) { -#if 0 - e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not start the Evolution Mailer Assistant interface\n(%s)"), CORBA_exception_id (&ev)); -#endif - g_warning ("Could not start mailer (%s)", CORBA_exception_id (&ev)); + g_warning ("Could not start CORBA wizard (%s)", CORBA_exception_id (&ev)); CORBA_exception_free (&ev); - data->mailer = CORBA_OBJECT_NIL; + data->corba_wizard = CORBA_OBJECT_NIL; return; } - CORBA_exception_free (&ev); - if (data->mailer == CORBA_OBJECT_NIL) { - e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not start the Evolution Mailer Assistant interface\n")); + CORBA_exception_init (&ev); + data->pagelist = GNOME_Evolution_Wizard__get_pages (data->corba_wizard, &ev); + if (BONOBO_EX (&ev)) { + g_warning ("Could not get CORBA wizard pages (%s)", CORBA_exception_id (&ev)); + CORBA_exception_free (&ev); + data->pagelist = CORBA_OBJECT_NIL; return; } CORBA_exception_init (&ev); - data->event_source = Bonobo_Unknown_queryInterface (data->mailer, "IDL:Bonobo/EventSource:1.0", &ev); + event_source = Bonobo_Unknown_queryInterface (data->corba_wizard, "IDL:Bonobo/EventSource:1.0", &ev); CORBA_exception_free (&ev); data->listener = bonobo_listener_new (NULL, NULL); g_signal_connect (data->listener, "event-notify", @@ -179,7 +167,9 @@ make_mail_dialog_pages (SWData *data) object = bonobo_object_corba_objref (BONOBO_OBJECT (data->listener)); CORBA_exception_init (&ev); - Bonobo_EventSource_addListener (data->event_source, object, &ev); + Bonobo_EventSource_addListener (event_source, object, &ev); + CORBA_exception_free (&ev); + bonobo_object_release_unref (event_source, &ev); CORBA_exception_free (&ev); } @@ -199,7 +189,7 @@ next_func (GnomeDruidPage *page, CORBA_exception_init (&ev); pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_NEXT, &ev); + GNOME_Evolution_Wizard_notifyAction (data->corba_wizard, pagenum, GNOME_Evolution_Wizard_NEXT, &ev); CORBA_exception_free (&ev); /* If on last page we own, let druid goto next page */ @@ -219,7 +209,7 @@ prepare_func (GnomeDruidPage *page, CORBA_exception_init (&ev); pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_PREPARE, &ev); + GNOME_Evolution_Wizard_notifyAction (data->corba_wizard, pagenum, GNOME_Evolution_Wizard_PREPARE, &ev); CORBA_exception_free (&ev); return FALSE; } @@ -234,7 +224,7 @@ back_func (GnomeDruidPage *page, CORBA_exception_init (&ev); pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_BACK, &ev); + GNOME_Evolution_Wizard_notifyAction (data->corba_wizard, pagenum, GNOME_Evolution_Wizard_BACK, &ev); CORBA_exception_free (&ev); /* if we're on page 0, let the druid go back to the start page, if we have one */ @@ -343,7 +333,7 @@ finish_func (GnomeDruidPage *page, /* Notify mailer */ CORBA_exception_init (&ev); - GNOME_Evolution_Wizard_notifyAction (data->mailer, 0, GNOME_Evolution_Wizard_FINISH, &ev); + GNOME_Evolution_Wizard_notifyAction (data->corba_wizard, 0, GNOME_Evolution_Wizard_FINISH, &ev); CORBA_exception_free (&ev); /* Set Timezone */ @@ -400,187 +390,31 @@ connect_page (GtkWidget *page, G_CALLBACK (prepare_func), data); } -static MailDialogPage * -make_identity_page (SWData *data) -{ - MailDialogPage *page; - CORBA_Environment ev; - - g_return_val_if_fail (data != NULL, NULL); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, 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_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 0, &ev); - if (BONOBO_EX (&ev) || page->control == CORBA_OBJECT_NIL) { - g_warning ("Error creating page: %s", CORBA_exception_id (&ev)); - g_free (page); - CORBA_exception_free (&ev); - - return NULL; - } - - 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); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, 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_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 1, &ev); - if (BONOBO_EX (&ev) || page->control == CORBA_OBJECT_NIL) { - g_warning ("Error creating page: %s", CORBA_exception_id (&ev)); - g_free (page); - CORBA_exception_free (&ev); - - return NULL; - } - - 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) +static GtkWidget * +make_corba_page (SWData *data, int n, GtkWidget *prev) { - MailDialogPage *page; - CORBA_Environment ev; - - g_return_val_if_fail (data != NULL, NULL); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, NULL); - - page = g_new0 (MailDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "extra-page"); - page_list = g_list_append (page_list, page->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); - if (BONOBO_EX (&ev) || page->control == CORBA_OBJECT_NIL) { - g_warning ("Error creating page: %s", CORBA_exception_id (&ev)); - g_free (page); - CORBA_exception_free (&ev); - - return NULL; - } - - 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); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, 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_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 3, &ev); - if (BONOBO_EX (&ev) || page->control == CORBA_OBJECT_NIL) { - g_warning ("Error creating page: %s", CORBA_exception_id (&ev)); - g_free (page); - CORBA_exception_free (&ev); - - return NULL; - } - - 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); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, 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_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 4, &ev); - if (BONOBO_EX (&ev) || page->control == CORBA_OBJECT_NIL) { - g_warning ("Error creating page: %s", CORBA_exception_id (&ev)); - g_free (page); - CORBA_exception_free (&ev); - - return NULL; - } - - 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); + GNOME_Evolution_Wizard_Page *corba_page; + GdkPixbuf *icon; + GtkWidget *page, *body; + + corba_page = &data->pagelist->_buffer[n]; + icon = e_new_gdk_pixbuf_from_corba_icon (&corba_page->icon, -1, -1); + page = gnome_druid_page_standard_new_with_vals (corba_page->title, + icon, NULL); + g_object_unref (icon); + + body = bonobo_widget_new_control_from_objref (corba_page->control, + CORBA_OBJECT_NIL); + gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), + body, TRUE, TRUE, 0); + gtk_widget_show_all (page); + + gnome_druid_insert_page (GNOME_DRUID (data->druid), + GNOME_DRUID_PAGE (prev), + GNOME_DRUID_PAGE (page)); + connect_page (page, data); + g_hash_table_insert (page_hash, page, GINT_TO_POINTER (n)); + page_list = g_list_append (page_list, page); return page; } @@ -853,6 +687,8 @@ e_shell_startup_wizard_create (void) GConfClient *client; SWData *data; GSList *accounts; + GtkWidget *page; + int i; client = gconf_client_get_default (); accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL); @@ -888,23 +724,17 @@ e_shell_startup_wizard_create (void) g_return_val_if_fail (data->finish != NULL, FALSE); g_signal_connect (data->finish, "finish", G_CALLBACK (finish_func), data); - make_mail_dialog_pages (data); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, TRUE); + make_corba_dialog_pages (data); + g_return_val_if_fail (data->corba_wizard != CORBA_OBJECT_NIL, TRUE); + g_return_val_if_fail (data->pagelist != CORBA_OBJECT_NIL, TRUE); - 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); + page = data->start; + for (i = 0; i < data->pagelist->_length; i++) + page = make_corba_page (data, i, page); data->timezone_page = make_timezone_page (data); data->import_page = make_importer_page (data); - g_return_val_if_fail (data->id_page != NULL, TRUE); - g_return_val_if_fail (data->source_page != NULL, TRUE); - g_return_val_if_fail (data->extra_page != NULL, TRUE); - g_return_val_if_fail (data->transport_page != NULL, TRUE); - g_return_val_if_fail (data->management_page != NULL, TRUE); g_return_val_if_fail (data->timezone_page != NULL, TRUE); g_return_val_if_fail (data->import_page != NULL, TRUE); diff --git a/shell/evolution-wizard.c b/shell/evolution-wizard.c index 2e197517c7..83b3a57778 100644 --- a/shell/evolution-wizard.c +++ b/shell/evolution-wizard.c @@ -2,7 +2,7 @@ /* * evolution-wizard.c * - * Copyright (C) 2000, 2001, 2002 Ximian, Inc. + * Copyright (C) 2000-2003 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -17,8 +17,6 @@ * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. - * - * Authors: Iain Holmes <iain@ximian.com> */ #ifdef HAVE_CONFIG_H @@ -37,15 +35,20 @@ #include "Evolution.h" #include "e-shell-marshal.h" +#include "e-shell-corba-icon-utils.h" struct _EvolutionWizardPrivate { - EvolutionWizardGetControlFn get_fn; BonoboEventSource *event_source; - void *closure; - int page_count; + GPtrArray *pages; }; +typedef struct { + char *title; + GdkPixbuf *icon; + BonoboControl *control; +} EvolutionWizardPage; + enum { NEXT, PREPARE, @@ -61,46 +64,31 @@ enum { 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, +static GNOME_Evolution_Wizard_PageList * +impl_GNOME_Evolution_Wizard__get_pages (PortableServer_Servant servant, CORBA_Environment *ev) { BonoboObject *bonobo_object; EvolutionWizard *wizard; - EvolutionWizardPrivate *priv; - BonoboControl *control; + EvolutionWizardPage *page; + GNOME_Evolution_Wizard_PageList *pages; + int i; 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; - } + pages = GNOME_Evolution_Wizard_PageList__alloc (); + pages->_maximum = pages->_length = wizard->priv->pages->len; + pages->_buffer = GNOME_Evolution_Wizard_PageList_allocbuf (pages->_maximum); + for (i = 0; i < wizard->priv->pages->len; i++) { + page = wizard->priv->pages->pdata[i]; - control = priv->get_fn (wizard, pagenumber, priv->closure); - if (control == NULL) - return CORBA_OBJECT_NIL; + pages->_buffer[i].title = CORBA_string_dup (page->title); + e_store_corba_icon_from_pixbuf (page->icon, &pages->_buffer[i].icon); + pages->_buffer[i].control = BONOBO_OBJREF (page->control); + } - return (Bonobo_Control) CORBA_Object_duplicate (BONOBO_OBJREF (control), ev); + return pages; } static void @@ -118,8 +106,8 @@ impl_GNOME_Evolution_Wizard_notifyAction (PortableServer_Servant servant, priv = wizard->priv; if (pagenumber < 0 - || pagenumber > priv->page_count - || (action != GNOME_Evolution_Wizard_BACK && pagenumber == priv->page_count)) { + || pagenumber > priv->pages->len + || (action != GNOME_Evolution_Wizard_BACK && pagenumber == priv->pages->len)) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Wizard_NoPage, NULL); return; @@ -139,11 +127,11 @@ impl_GNOME_Evolution_Wizard_notifyAction (PortableServer_Servant servant, break; case GNOME_Evolution_Wizard_FINISH: - g_signal_emit (bonobo_object, signals[FINISH], 0, pagenumber); + g_signal_emit (bonobo_object, signals[FINISH], 0); break; case GNOME_Evolution_Wizard_CANCEL: - g_signal_emit (bonobo_object, signals[CANCEL], 0, pagenumber); + g_signal_emit (bonobo_object, signals[CANCEL], 0); break; case GNOME_Evolution_Wizard_HELP: @@ -156,25 +144,44 @@ impl_GNOME_Evolution_Wizard_notifyAction (PortableServer_Servant servant, } + static void -impl_dispose (GObject *object) +free_page (EvolutionWizardPage *page) { - /* (Nothing to do here.) */ + g_free (page->title); + g_object_unref (page->icon); + bonobo_object_unref (page->control); - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + g_free (page); } static void -impl_finalize (GObject *object) +dispose (GObject *object) { - EvolutionWizard *wizard; + EvolutionWizard *wizard = EVOLUTION_WIZARD (object); + int i; - wizard = EVOLUTION_WIZARD (object); - if (wizard->priv == NULL) - return; + if (wizard->priv->event_source) { + bonobo_object_unref (wizard->priv->event_source); + wizard->priv->event_source = NULL; + } + + if (wizard->priv->pages) { + for (i = 0; i < wizard->priv->pages->len; i++) + free_page (wizard->priv->pages->pdata[i]); + g_ptr_array_free (wizard->priv->pages, TRUE); + wizard->priv->pages = NULL; + } + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +finalize (GObject *object) +{ + EvolutionWizard *wizard = EVOLUTION_WIZARD (object); g_free (wizard->priv); - wizard->priv = NULL; (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -187,8 +194,8 @@ evolution_wizard_class_init (EvolutionWizardClass *klass) POA_GNOME_Evolution_Wizard__epv *epv = &klass->epv; object_class = G_OBJECT_CLASS (klass); - object_class->dispose = impl_dispose; - object_class->finalize = impl_finalize; + object_class->dispose = dispose; + object_class->finalize = finalize; signals[NEXT] = g_signal_new ("next", @@ -223,18 +230,16 @@ evolution_wizard_class_init (EvolutionWizardClass *klass) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EvolutionWizardClass, finish), NULL, NULL, - e_shell_marshal_NONE__INT, - G_TYPE_NONE, 1, - G_TYPE_INT); + e_shell_marshal_NONE__NONE, + G_TYPE_NONE, 0); signals[CANCEL] = g_signal_new ("cancel", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EvolutionWizardClass, cancel), NULL, NULL, - e_shell_marshal_NONE__INT, - G_TYPE_NONE, 1, - G_TYPE_INT); + e_shell_marshal_NONE__NONE, + G_TYPE_NONE, 0); signals[HELP] = g_signal_new ("help", G_OBJECT_CLASS_TYPE (object_class), @@ -247,8 +252,7 @@ evolution_wizard_class_init (EvolutionWizardClass *klass) parent_class = g_type_class_ref(PARENT_TYPE); - epv->_get_pageCount = impl_GNOME_Evolution_Wizard__get_pageCount; - epv->getControl = impl_GNOME_Evolution_Wizard_getControl; + epv->_get_pages = impl_GNOME_Evolution_Wizard__get_pages; epv->notifyAction = impl_GNOME_Evolution_Wizard_notifyAction; } @@ -256,64 +260,40 @@ static void evolution_wizard_init (EvolutionWizard *wizard) { wizard->priv = g_new0 (EvolutionWizardPrivate, 1); + + wizard->priv->event_source = bonobo_event_source_new (); + bonobo_object_add_interface (BONOBO_OBJECT (wizard), + BONOBO_OBJECT (wizard->priv->event_source)); + + wizard->priv->pages = g_ptr_array_new (); } BONOBO_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) +evolution_wizard_new (void) { - 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; + return g_object_new (EVOLUTION_TYPE_WIZARD, NULL); } -EvolutionWizard * -evolution_wizard_new_full (EvolutionWizardGetControlFn get_fn, - int num_pages, - BonoboEventSource *event_source, - void *closure) +void +evolution_wizard_add_page (EvolutionWizard *wizard, + const char *title, + GdkPixbuf *icon, + GtkWidget *page) { - EvolutionWizard *wizard; - - g_return_val_if_fail (num_pages > 0, NULL); - g_return_val_if_fail (BONOBO_IS_EVENT_SOURCE (event_source), NULL); + EvolutionWizardPage *new; - wizard = g_object_new (evolution_wizard_get_type (), NULL); + new = g_new (EvolutionWizardPage, 1); + new->title = g_strdup (title); + new->icon = icon; + g_object_ref (icon); + new->control = bonobo_control_new (page); - return evolution_wizard_construct (wizard, event_source, get_fn, num_pages, closure); + g_ptr_array_add (wizard->priv->pages, new); } -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, @@ -327,7 +307,7 @@ evolution_wizard_set_buttons_sensitive (EvolutionWizard *wizard, CORBA_any any; CORBA_short s; - g_return_if_fail (IS_EVOLUTION_WIZARD (wizard)); + g_return_if_fail (EVOLUTION_IS_WIZARD (wizard)); priv = wizard->priv; @@ -363,7 +343,7 @@ evolution_wizard_set_show_finish (EvolutionWizard *wizard, CORBA_any any; CORBA_boolean b; - g_return_if_fail (IS_EVOLUTION_WIZARD (wizard)); + g_return_if_fail (EVOLUTION_IS_WIZARD (wizard)); priv = wizard->priv; if (opt_ev == NULL) { @@ -398,11 +378,11 @@ evolution_wizard_set_page (EvolutionWizard *wizard, CORBA_any any; CORBA_short s; - g_return_if_fail (IS_EVOLUTION_WIZARD (wizard)); + g_return_if_fail (EVOLUTION_IS_WIZARD (wizard)); priv = wizard->priv; - g_return_if_fail (page_number >= 0 && page_number < priv->page_count); + g_return_if_fail (page_number >= 0 && page_number < priv->pages->len); if (opt_ev == NULL) { CORBA_exception_init (&ev); @@ -427,10 +407,3 @@ evolution_wizard_set_page (EvolutionWizard *wizard, } } -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 index 7bfcfe71af..46e4f0819a 100644 --- a/shell/evolution-wizard.h +++ b/shell/evolution-wizard.h @@ -1,9 +1,22 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* * evolution-wizard.h * - * Copyright (C) 2001 Ximian, Inc. + * Copyright (C) 2000-2003 Ximian, Inc. * - * Authors: Iain Holmes <iain@ximian.com> + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ #ifndef __EVOLUTION_WIZARD_H__ @@ -11,7 +24,6 @@ #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-event-source.h> #include "Evolution.h" @@ -22,15 +34,11 @@ typedef struct _EvolutionWizardPrivate EvolutionWizardPrivate; #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); +#define EVOLUTION_TYPE_WIZARD (evolution_wizard_get_type ()) +#define EVOLUTION_WIZARD(o) (GTK_CHECK_CAST ((o), EVOLUTION_TYPE_WIZARD, EvolutionWizard)) +#define EVOLUTION_WIZARD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), EVOLUTION_TYPE_WIZARD, EvolutionWizardClass)) +#define EVOLUTION_IS_WIZARD(o) (GTK_CHECK_TYPE ((o), EVOLUTION_TYPE_WIZARD)) +#define EVOLUTION_IS_WIZARD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EVOLUTION_TYPE_WIZARD)) struct _EvolutionWizard { BonoboObject object; @@ -46,25 +54,19 @@ typedef struct { 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 (* finish) (EvolutionWizard *wizard); + void (* cancel) (EvolutionWizard *wizard); 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); +EvolutionWizard *evolution_wizard_new (void); + +void evolution_wizard_add_page (EvolutionWizard *wizard, + const char *title, + GdkPixbuf *icon, + GtkWidget *page); void evolution_wizard_set_buttons_sensitive (EvolutionWizard *wizard, gboolean back_sensitive, @@ -78,6 +80,4 @@ void evolution_wizard_set_page (EvolutionWizard *wizard, int page_number, CORBA_Environment *opt_ev); -BonoboEventSource * evolution_wizard_get_event_source (EvolutionWizard *wizard); - #endif /* __EVOLUTION_WIZARD_H__ */ diff --git a/shell/glade/evolution-startup-wizard.glade b/shell/glade/evolution-startup-wizard.glade index 73c8c987a3..2e06c7c04e 100644 --- a/shell/glade/evolution-startup-wizard.glade +++ b/shell/glade/evolution-startup-wizard.glade @@ -1,255 +1,107 @@ <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" > +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> - <requires lib="gnome" /> - - <widget class="GtkWindow" id="startup-wizard"> - <property name="visible">no</property> - <property name="title" translatable="yes">Evolution Setup Assistant</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="allow_shrink">no</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child> - <widget class="GnomeDruid" id="startup-druid"> - <property name="visible">yes</property> - - <child> - <widget class="GnomeDruidPageEdge" id="start-page"> - <property name="title" translatable="yes">Welcome</property> - <property name="text" translatable="yes">Welcome to Evolution. The next few screens will allow +<requires lib="gnome"/> + +<widget class="GtkWindow" id="startup-wizard"> + <property name="title" translatable="yes">Evolution Setup Assistant</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + + <child> + <widget class="GnomeDruid" id="startup-druid"> + <property name="border_width">4</property> + <property name="visible">True</property> + <property name="show_help">False</property> + + <child> + <widget class="GnomeDruidPageEdge" id="start-page"> + <property name="visible">True</property> + <property name="position">GNOME_EDGE_START</property> + <property name="title" translatable="yes">Welcome</property> + <property name="text" translatable="yes">Welcome to Evolution. The next few screens will allow Evolution to connect to your email accounts, and to import files from other applications. Please click the "Forward" button to continue. </property> - <property name="logo_image">evolution.png</property> - <property name="position">GNOME_EDGE_START</property> - <property name="visible">yes</property> - <property name="title_color">#ffffff</property> - <property name="text_color">#000000</property> - <property name="background_color">#000001</property> - <property name="logo_background_color">#010101</property> - <property name="textbox_color">#ffffff</property> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="identity-page"> - <property name="title" translatable="yes">Identity</property> - <property name="logo">mail-config-druid-identity.png</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000001</property> - <property name="logo_background">#010101</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox2"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="receive-page"> - <property name="title" translatable="yes">Receiving Email</property> - <property name="logo">mail-config-druid-receive.png</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000001</property> - <property name="logo_background">#010101</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox3"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="extra-page"> - <property name="title" translatable="yes">Receiving Email</property> - <property name="logo">mail-config-druid-receive.png</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000001</property> - <property name="logo_background">#010101</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox8"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="send-page"> - <property name="title" translatable="yes">Sending Email</property> - <property name="logo">mail-config-druid-send.png</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000001</property> - <property name="logo_background">#010101</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox5"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="management-page"> - <property name="title" translatable="yes">Account Management</property> - <property name="logo">mail-config-druid-account-name.png</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000001</property> - <property name="logo_background">#010101</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox9"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="timezone-page"> - <property name="title" translatable="yes">Timezone </property> - <property name="logo">timezone-48.png</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000001</property> - <property name="logo_background">#010101</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox6"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="import-page"> - <property name="title" translatable="yes">Importing Files</property> - <property name="logo">import.png</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000001</property> - <property name="logo_background">#010101</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox7"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageEdge" id="done-page"> - <property name="title" translatable="yes">Done</property> - <property name="text" translatable="yes">You have successfully entered all of the information + <property name="title_color">#ffffffffffff</property> + <property name="text_color">#000000000000</property> + <property name="background_color">#000000000101</property> + <property name="logo_background_color">#010101010101</property> + <property name="textbox_color">#ffffffffffff</property> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageStandard" id="timezone-page"> + <property name="visible">True</property> + <property name="title" translatable="yes">Timezone </property> + <property name="title_foreground">#e9e0bfffe798</property> + <property name="background">#08c8082be798</property> + <property name="logo_background">#6b18081ce1d3</property> + <property name="logo">timezone-48.png</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="druid-vbox6"> + <property name="border_width">16</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageStandard" id="import-page"> + <property name="visible">True</property> + <property name="title" translatable="yes">Importing Files</property> + <property name="title_foreground">#e9e0bfffe798</property> + <property name="background">#0ad8082be798</property> + <property name="logo_background">#6b18081ce1d3</property> + <property name="logo">import.png</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="druid-vbox7"> + <property name="border_width">16</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageEdge" id="done-page"> + <property name="visible">True</property> + <property name="position">GNOME_EDGE_FINISH</property> + <property name="title" translatable="yes">Done</property> + <property name="text" translatable="yes">You have successfully entered all of the information needed to set up Evolution. Click the "Apply" button to save your settings. </property> - <property name="logo_image">evolution.png</property> - <property name="position">GNOME_EDGE_FINISH</property> - <property name="visible">yes</property> - <property name="title_color">#ffffff</property> - <property name="text_color">#000000</property> - <property name="background_color">#000001</property> - <property name="logo_background_color">#010101</property> - <property name="textbox_color">#ffffff</property> - </widget> - </child> - </widget> - </child> - </widget> + <property name="title_color">#ffffffffffff</property> + <property name="text_color">#000000000000</property> + <property name="background_color">#000000000101</property> + <property name="logo_background_color">#010101010101</property> + <property name="textbox_color">#ffffffffffff</property> + </widget> + </child> + </widget> + </child> +</widget> + </glade-interface> |