diff options
author | Milan Crha <mcrha@redhat.com> | 2009-08-18 22:00:23 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-18 22:00:23 +0800 |
commit | de528db6c18b7ecee83bb8b52850d935c1244ebf (patch) | |
tree | e5c153870853da0f9e317f8eb5e78394e00bd528 | |
parent | 9ff9063fe66817737f89decc3fdadb473fa51278 (diff) | |
download | gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.gz gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.bz2 gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.lz gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.xz gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.zst gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.zip |
BugĀ 567260 - Migrate from GnomeDruid to GtkAssistant
-rw-r--r-- | e-util/e-config.c | 458 | ||||
-rw-r--r-- | e-util/e-config.h | 25 | ||||
-rw-r--r-- | e-util/e-import.h | 2 | ||||
-rw-r--r-- | mail/em-account-editor.c | 172 | ||||
-rw-r--r-- | mail/em-account-editor.h | 4 | ||||
-rw-r--r-- | mail/em-config.h | 2 | ||||
-rw-r--r-- | mail/mail-config.glade | 145 | ||||
-rw-r--r-- | modules/addressbook/addressbook-config.c | 2 | ||||
-rw-r--r-- | modules/mail/em-account-prefs.c | 34 | ||||
-rw-r--r-- | plugins/backup-restore/backup-restore.c | 112 | ||||
-rw-r--r-- | plugins/backup-restore/org-gnome-backup-restore.eplug.xml | 2 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-account-setup.c | 4 | ||||
-rw-r--r-- | plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml | 2 | ||||
-rw-r--r-- | plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml | 2 | ||||
-rw-r--r-- | plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml | 2 | ||||
-rw-r--r-- | plugins/startup-wizard/startup-wizard.c | 54 | ||||
-rw-r--r-- | shell/e-shell-importer.c | 27 |
17 files changed, 526 insertions, 523 deletions
diff --git a/e-util/e-config.c b/e-util/e-config.c index 412c00b649..9974da72cb 100644 --- a/e-util/e-config.c +++ b/e-util/e-config.c @@ -30,10 +30,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-standard.h> -#include <libgnomeui/gnome-druid-page-edge.h> - #include "e-config.h" #include <glib/gi18n.h> @@ -79,12 +75,19 @@ struct _check_node { gpointer data; }; +struct _finish_page_node { + struct _finish_page_node *next, *prev; + + gchar *pageid; + gboolean is_finish; + gint orig_type; +}; + struct _EConfigPrivate { EDList menus; EDList widgets; EDList checks; - - struct _widget_node *druid_page; /* current druid page if using the druid */ + EDList finish_pages; }; static GObjectClass *ep_parent; @@ -100,6 +103,7 @@ ep_init(GObject *o) e_dlist_init(&p->menus); e_dlist_init(&p->widgets); e_dlist_init(&p->checks); + e_dlist_init(&p->finish_pages); } static void @@ -110,6 +114,7 @@ ep_finalise(GObject *o) struct _menu_node *mnode; struct _widget_node *wn; struct _check_node *cn; + struct _finish_page_node *fp; d(printf("finalising EConfig %p\n", o)); @@ -135,6 +140,11 @@ ep_finalise(GObject *o) g_free(cn); } + while ( (fp = (struct _finish_page_node *) e_dlist_remhead (&p->finish_pages)) ) { + g_free (fp->pageid); + g_free (fp); + } + g_free(p); ((GObjectClass *)ep_parent)->finalize(o); @@ -204,7 +214,7 @@ e_config_get_type(void) * e_config_construct: * @ep: The instance to initialise. * @type: The type of configuration manager, @E_CONFIG_BOOK or - * @E_CONFIG_DRUID. + * @E_CONFIG_ASSISTANT. * @id: The name of the configuration window this manager drives. * * Used by implementing classes to initialise base parameters. @@ -213,7 +223,7 @@ e_config_get_type(void) **/ EConfig *e_config_construct(EConfig *ep, gint type, const gchar *id) { - g_return_val_if_fail (type == E_CONFIG_BOOK || type == E_CONFIG_DRUID, NULL); + g_return_val_if_fail (type == E_CONFIG_BOOK || type == E_CONFIG_ASSISTANT, NULL); ep->type = type; ep->id = g_strdup(id); @@ -269,7 +279,7 @@ e_config_add_items(EConfig *ec, GSList *items, EConfigItemsFunc commitfunc, ECon * is being checked. * * The page check function is used to validate input before allowing - * the druid to continue or the notebook to close. + * the assistant to continue or the notebook to close. **/ void e_config_add_page_check(EConfig *ec, const gchar *pageid, EConfigCheckFunc check, gpointer data) @@ -284,6 +294,48 @@ e_config_add_page_check(EConfig *ec, const gchar *pageid, EConfigCheckFunc check e_dlist_addtail(&ec->priv->checks, (EDListNode *)cn); } +static struct _finish_page_node * +find_page_finish (EConfig *ec, const gchar *pageid) +{ + struct _finish_page_node *fp; + + for (fp = (struct _finish_page_node *) ec->priv->finish_pages.head; fp->next; fp = fp->next) { + if (g_str_equal (fp->pageid, pageid)) + return fp; + } + + return NULL; +} + +/** + * e_config_set_page_is_finish: + * @ec: Initialised implementing instance of EConfig. + * @pageid: pageid to change the value on. + * @can_finish: whether the pageid can finish immediately or not. + * + * With is_finish set on the pageid the page is treated as the last page in an assistant. + **/ +void +e_config_set_page_is_finish (EConfig *ec, const gchar *pageid, gboolean is_finish) +{ + struct _finish_page_node *fp; + + fp = find_page_finish (ec, pageid); + + if (is_finish) { + if (!fp) { + fp = g_malloc0 (sizeof (*fp)); + fp->pageid = g_strdup (pageid); + e_dlist_addtail (&ec->priv->finish_pages, (EDListNode *)fp); + } + + fp->is_finish = TRUE; + } else { + if (fp) + fp->is_finish = FALSE; + } +} + static void ec_add_static_items(EConfig *ec) { @@ -309,83 +361,131 @@ ep_cmp(gconstpointer ap, gconstpointer bp) return strcmp(a->item->path, b->item->path); } +static struct _widget_node * +ec_assistant_find_page (EConfig *ec, GtkWidget *page, gint *page_index) +{ + struct _widget_node *wn; + + g_return_val_if_fail (ec != NULL, NULL); + g_return_val_if_fail (GTK_IS_ASSISTANT (ec->widget), NULL); + g_return_val_if_fail (page != NULL, NULL); + + for (wn = (struct _widget_node *)ec->priv->widgets.head; wn->next; wn = wn->next) { + if (wn->frame == page + && (wn->item->type == E_CONFIG_PAGE + || wn->item->type == E_CONFIG_PAGE_START + || wn->item->type == E_CONFIG_PAGE_FINISH)) + break; + } + + if (wn->frame != page) + wn = NULL; + + if (page_index) { + if (wn) { + GtkAssistant *assistant = GTK_ASSISTANT (ec->widget); + gint index, count = gtk_assistant_get_n_pages (assistant); + + for (index = 0; index < count; index++) { + if (gtk_assistant_get_nth_page (assistant, index) == page) + break; + } + + if (index == count) + index = -1; + *page_index = index; + } else { + *page_index = -1; + } + } + + return wn; +} + static void -ec_druid_check_current(EConfig *ec) +ec_assistant_check_current (EConfig *ec) { - g_return_if_fail(ec->priv->druid_page != NULL); + struct _widget_node *wn; + struct _finish_page_node *fp; + GtkAssistant *assistant; + GtkWidget *page; + gint page_no; - if (e_config_page_check(ec, ec->priv->druid_page->item->path)) { - gtk_widget_set_sensitive(((GnomeDruid *)ec->widget)->next, TRUE); - } else { - gtk_widget_set_sensitive(((GnomeDruid *)ec->widget)->next, FALSE); + g_return_if_fail (GTK_IS_ASSISTANT (ec->widget)); + + assistant = GTK_ASSISTANT (ec->widget); + page_no = gtk_assistant_get_current_page (assistant); + + /* no page selected yet */ + if (page_no == -1) + return; + + page = gtk_assistant_get_nth_page (assistant, page_no); + g_return_if_fail (page != NULL); + + wn = ec_assistant_find_page (ec, page, NULL); + g_return_if_fail (wn != NULL); + + /* this should come first, as the check function can change the finish state of the page */ + gtk_assistant_set_page_complete (assistant, page, e_config_page_check (ec, wn->item->path)); + + fp = find_page_finish (ec, wn->item->path); + if (fp) { + GtkAssistantPageType pt = gtk_assistant_get_page_type (assistant, page); + + if (fp->is_finish && pt != GTK_ASSISTANT_PAGE_CONFIRM) { + if (fp->orig_type == GTK_ASSISTANT_PAGE_CONTENT) + fp->orig_type = pt; + gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONFIRM); + } else if (!fp->is_finish && pt != fp->orig_type) { + gtk_assistant_set_page_type (assistant, page, fp->orig_type); + } } + + gtk_assistant_update_buttons_state (assistant); } static void -ec_druid_cancel(GnomeDruid *druid, struct _widget_node *wn) +ec_assistant_cancel (GtkAssistant *assistant, EConfig *config) { - d(printf("finishing druid, calling abort\n")); - e_config_abort(wn->config); + d(printf("finishing assistant, calling abort\n")); + e_config_abort (config); - if (wn->config->window) - gtk_widget_destroy(wn->config->window); + if (config->window) + gtk_widget_destroy (config->window); } static void -ec_druid_finish(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) +ec_assistant_apply (GtkAssistant *assistant, EConfig *config) { - d(printf("finishing druid, calling commit\n")); - e_config_commit(wn->config); + d(printf("finishing assistant, calling commit\n")); + e_config_commit (config); /* TODO: allow the commit to fail? Do we care? */ - if (wn->config->window) - gtk_widget_destroy(wn->config->window); + if (config->window) + gtk_widget_destroy (config->window); } static void -ec_druid_prepare(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) +ec_assistant_prepare (GtkAssistant *assistant, GtkWidget *page, EConfig *config) { - d(printf("prepare page '%s'\n", wn->item->path)); - wn->config->priv->druid_page = wn; - ec_druid_check_current(wn->config); + d(printf("prepare page '%p'\n", page)); + ec_assistant_check_current (config); } -static gboolean -ec_druid_prev(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) +static gint +ec_assistant_forward (gint current_page, gpointer user_data) { - EConfig *ec = wn->config; - - d(printf("prev page from '%s'\n", wn->item->path)); - if (wn->prev) { - for (wn = wn->prev;wn->prev;wn=wn->prev) { - if (!wn->empty && wn->frame != NULL - && (wn->item->type == E_CONFIG_PAGE - || wn->item->type == E_CONFIG_PAGE_START - || wn->item->type == E_CONFIG_PAGE_FINISH)) - break; - } - } + EConfig *ec = user_data; + struct _widget_node *wn; + gint next_page = current_page; - if (wn->prev) { - d(printf(" is %s\n",wn->item->path)); - gnome_druid_set_page((GnomeDruid *)ec->widget, (GnomeDruidPage *)wn->frame); - ec->priv->druid_page = wn; - } else { - /* do we need to indicate first? */ - ec->priv->druid_page = NULL; - } + d(printf("next page from '%d'\n", current_page)); - return wn->prev != NULL; -} + wn = ec_assistant_find_page (ec, gtk_assistant_get_nth_page (GTK_ASSISTANT (ec->widget), current_page), NULL); -static gboolean -ec_druid_next(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) -{ - EConfig *ec = wn->config; - - d(printf("next page from '%s'\n", wn->item->path)); - if (wn->next) { - for (wn = wn->next;wn->next;wn=wn->next) { + if (wn && wn->next) { + for (wn = wn->next; wn->next; wn = wn->next) { if (!wn->empty && wn->frame != NULL && (wn->item->type == E_CONFIG_PAGE || wn->item->type == E_CONFIG_PAGE_START @@ -394,25 +494,23 @@ ec_druid_next(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) } } - if (wn->next) { + if (wn && wn->next) { d(printf(" is %s\n",wn->item->path)); - gnome_druid_set_page((GnomeDruid *)ec->widget, (GnomeDruidPage *)wn->frame); - ec->priv->druid_page = wn; - } else { - /* do we need to indicate last? */ - ec->priv->druid_page = NULL; + ec_assistant_find_page (ec, wn->frame, &next_page); } - return wn->next != NULL; + return next_page; } static void -ec_rebuild(EConfig *emp) +ec_rebuild (EConfig *emp) { struct _EConfigPrivate *p = emp->priv; struct _widget_node *wn, *sectionnode = NULL, *pagenode = NULL; - GtkWidget *book = NULL, *page = NULL, *section = NULL, *root = NULL, *druid = NULL; + GtkWidget *book = NULL, *page = NULL, *section = NULL, *root = NULL, *assistant = NULL; gint pageno = 0, sectionno = 0, itemno = 0; + struct _widget_node *last_active_page = NULL; + gboolean is_assistant; d(printf("target changed, rebuilding:\n")); @@ -421,6 +519,15 @@ ec_rebuild(EConfig *emp) * into the two base types, but there would be a lot of code * duplication */ + /* because rebuild destroys pages, and destroying active page causes crashes */ + is_assistant = emp->widget && GTK_IS_ASSISTANT (emp->widget); + if (is_assistant) { + gint page_index = gtk_assistant_get_current_page (GTK_ASSISTANT (emp->widget)); + if (page_index != -1) + last_active_page = ec_assistant_find_page (emp, gtk_assistant_get_nth_page (GTK_ASSISTANT (emp->widget), page_index), NULL); + gtk_assistant_set_current_page (GTK_ASSISTANT (emp->widget), 0); + } + for (wn = (struct _widget_node *)p->widgets.head;wn->next;wn=wn->next) { struct _EConfigItem *item = wn->item; const gchar *translated_label = NULL; @@ -464,35 +571,39 @@ ec_rebuild(EConfig *emp) /* Now process the item */ switch (item->type) { case E_CONFIG_BOOK: - case E_CONFIG_DRUID: - /* Only one of BOOK or DRUID may be define, it + case E_CONFIG_ASSISTANT: + /* Only one of BOOK or ASSISTANT may be define, it is used by the defining code to mark the type of the config window. It is cross-checked with the code's defined type. */ if (root != NULL) { - g_warning("EConfig book/druid redefined at: %s", item->path); + g_warning("EConfig book/assistant redefined at: %s", item->path); break; } if (wn->widget == NULL) { if (item->type != emp->type) { - g_warning("EConfig book/druid type mismatch"); + g_warning("EConfig book/assistant type mismatch"); break; } if (item->factory) { root = item->factory(emp, item, NULL, wn->widget, wn->context->data); } else if (item->type == E_CONFIG_BOOK) { - root = book = gtk_notebook_new(); - gtk_widget_show(book); - } else if (item->type == E_CONFIG_DRUID) { - root = druid = gnome_druid_new(); - gtk_widget_show(druid); + root = gtk_notebook_new(); + gtk_widget_show (root); + } else if (item->type == E_CONFIG_ASSISTANT) { + root = gtk_assistant_new (); } else abort(); - if (item->type == E_CONFIG_DRUID) - g_signal_connect(root, "cancel", G_CALLBACK(ec_druid_cancel), wn); + if (item->type == E_CONFIG_ASSISTANT) { + g_signal_connect (root, "cancel", G_CALLBACK (ec_assistant_cancel), emp); + g_signal_connect (root, "close", G_CALLBACK (ec_assistant_cancel), emp); + g_signal_connect (root, "apply", G_CALLBACK (ec_assistant_apply), emp); + g_signal_connect (root, "prepare", G_CALLBACK (ec_assistant_prepare), emp); + gtk_assistant_set_forward_page_func (GTK_ASSISTANT (root), ec_assistant_forward, emp, NULL); + } emp->widget = root; wn->widget = root; @@ -503,7 +614,7 @@ ec_rebuild(EConfig *emp) if (item->type == E_CONFIG_BOOK) book = root; else - druid = root; + assistant = root; page = NULL; pagenode = NULL; @@ -518,8 +629,8 @@ ec_rebuild(EConfig *emp) g_warning("EConfig page defined before container widget: %s", item->path); break; } - if (emp->type != E_CONFIG_DRUID) { - g_warning("EConfig druid start/finish pages can't be used on E_CONFIG_BOOKs"); + if (emp->type != E_CONFIG_ASSISTANT) { + g_warning("EConfig assistant start/finish pages can't be used on E_CONFIG_BOOKs"); break; } @@ -527,21 +638,41 @@ ec_rebuild(EConfig *emp) if (item->factory) { page = item->factory(emp, item, root, wn->frame, wn->context->data); } else { - page = gnome_druid_page_edge_new(item->type == E_CONFIG_PAGE_START?GNOME_EDGE_START:GNOME_EDGE_FINISH); - gtk_widget_show(page); - gnome_druid_page_edge_set_title((GnomeDruidPageEdge *)page, translated_label); - gnome_druid_insert_page((GnomeDruid *)druid, pagenode?(GnomeDruidPage *)pagenode->frame:NULL, (GnomeDruidPage *)page); - } - if (page) { - if (item->type == E_CONFIG_PAGE_FINISH) { - g_signal_connect(page, "back", G_CALLBACK(ec_druid_prev), wn); - g_signal_connect(page, "finish", G_CALLBACK(ec_druid_finish), wn); - } else - g_signal_connect(page, "next", G_CALLBACK(ec_druid_next), wn); + page = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); + if (pagenode) { + /* put after */ + gint index = -1; + ec_assistant_find_page (emp, pagenode->frame, &index); + gtk_assistant_insert_page (GTK_ASSISTANT (assistant), page, index + 1); + } else { + gtk_assistant_prepend_page (GTK_ASSISTANT (assistant), page); + } + + gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, item->type == E_CONFIG_PAGE_START ? GTK_ASSISTANT_PAGE_INTRO : GTK_ASSISTANT_PAGE_CONFIRM); + gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, translated_label); + gtk_widget_show_all (page); } + wn->frame = page; wn->widget = page; + + if (page) { + const gchar *empty_xpm_img[] = { + "48 1 2 1", + " c None", + ". c #FFFFFF", + " "}; + + /* left side place with a blue background on a start and finish page */ + GdkPixbuf *spacer = gdk_pixbuf_new_from_xpm_data (empty_xpm_img); + + gtk_assistant_set_page_side_image (GTK_ASSISTANT (assistant), page, spacer); + + g_object_unref (spacer); + } } + pageno++; page = NULL; pagenode = wn; /* need this for previous page linking */ @@ -550,15 +681,12 @@ ec_rebuild(EConfig *emp) sectionno = 1; /* never want to hide these */ break; case E_CONFIG_PAGE: { - gint connect = 0; /* connect druid signals */ - /* CONFIG_PAGEs depend on the config type. E_CONFIG_BOOK: The page is a VBox, stored in the notebook. - E_CONFIG_DRUID - The page is a GnomeDruidPageStandard, - any sections automatically added are added to - the vbox inside it. */ + E_CONFIG_ASSISTANT + The page is a VBox, stored in the GtkAssistant, + any sections automatically added inside it. */ sectionno = 0; if (root == NULL) { g_warning("EConfig page defined before container widget: %s", item->path); @@ -567,15 +695,8 @@ ec_rebuild(EConfig *emp) if (item->factory) { page = item->factory(emp, item, root, wn->frame, wn->context->data); - if (emp->type == E_CONFIG_DRUID) { - if (page) { - if (GNOME_IS_DRUID_PAGE_STANDARD(page)) { - connect = wn->frame != page; - wn->frame = page; - page = ((GnomeDruidPageStandard *)page)->vbox; - } - } else - wn->frame = page; + if (emp->type == E_CONFIG_ASSISTANT) { + wn->frame = page; } else { wn->frame = page; if (page) @@ -584,14 +705,22 @@ ec_rebuild(EConfig *emp) if (page) sectionno = 1; } else if (wn->widget == NULL) { - if (emp->type == E_CONFIG_DRUID) { - w = gnome_druid_page_standard_new(); - gtk_widget_show(w); - gnome_druid_page_standard_set_title((GnomeDruidPageStandard *)w, translated_label); - gnome_druid_insert_page((GnomeDruid *)druid, pagenode?(GnomeDruidPage *)pagenode->frame:NULL, (GnomeDruidPage *)w); - wn->frame = w; - page = ((GnomeDruidPageStandard *)w)->vbox; - connect = TRUE; + if (emp->type == E_CONFIG_ASSISTANT) { + page = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); + if (pagenode) { + /* put after */ + gint index = -1; + ec_assistant_find_page (emp, pagenode->frame, &index); + gtk_assistant_insert_page (GTK_ASSISTANT (assistant), page, index + 1); + } else { + gtk_assistant_prepend_page (GTK_ASSISTANT (assistant), page); + } + gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, translated_label); + gtk_widget_show_all (page); + + wn->frame = page; } else { w = gtk_label_new_with_mnemonic (translated_label); gtk_widget_show(w); @@ -607,15 +736,8 @@ ec_rebuild(EConfig *emp) d(printf("page %d:%s widget %p\n", pageno, item->path, page)); if (wn->widget && wn->widget != page) { - d(printf("destroy old widget for page '%s'\n", item->path)); - gtk_widget_destroy(wn->widget); - } - - if (connect) { - g_signal_connect(wn->frame, "next", G_CALLBACK(ec_druid_next), wn); - g_signal_connect(wn->frame, "back", G_CALLBACK(ec_druid_prev), wn); - /* GnomeDruid bug, need to connect_after */ - g_signal_connect_after(wn->frame, "prepare", G_CALLBACK(ec_druid_prepare), wn); + d(printf("destroy old widget for page '%s' (%p)\n", item->path, wn->widget)); + gtk_widget_destroy (wn->widget); } pageno++; @@ -629,8 +751,7 @@ ec_rebuild(EConfig *emp) case E_CONFIG_SECTION: case E_CONFIG_SECTION_TABLE: /* The section factory is always called with - the parent vbox object. Even for druid - pages. */ + the parent vbox object. Even for assistant pages. */ if (page == NULL) { /*g_warning("EConfig section '%s' has no parent page", item->path);*/ section = NULL; @@ -768,6 +889,13 @@ ec_rebuild(EConfig *emp) gtk_notebook_set_show_border((GtkNotebook *)book, FALSE); } } + + if (is_assistant && last_active_page) { + gint page_index = -1; + + ec_assistant_find_page (emp, last_active_page->frame, &page_index); + gtk_assistant_set_current_page (GTK_ASSISTANT (emp->widget), page_index); + } } /** @@ -805,7 +933,7 @@ ec_widget_destroy(GtkWidget *w, EConfig *ec) * * Create the widget described by @emp. Only the core widget * appropriate for the given type is created, i.e. a GtkNotebook for - * the E_CONFIG_BOOK type and a GnomeDruid for the E_CONFIG_DRUID + * the E_CONFIG_BOOK type and a GtkAssistant for the E_CONFIG_ASSISTANT * type. * * This object will be self-driving, but will not close itself once @@ -859,6 +987,11 @@ e_config_create_widget(EConfig *emp) /* FIXME: for some reason ec_rebuild puts the widget on page 1, this is just to override that */ if (emp->type == E_CONFIG_BOOK) gtk_notebook_set_current_page((GtkNotebook *)emp->widget, 0); + else { + gtk_assistant_set_current_page (GTK_ASSISTANT (emp->widget), 0); + gtk_window_set_position (GTK_WINDOW (emp->widget), GTK_WIN_POS_CENTER); + gtk_widget_show (emp->widget); + } return emp->widget; } @@ -882,9 +1015,9 @@ ec_dialog_response(GtkWidget *d, gint id, EConfig *ec) * * Create a managed GtkWindow object from @emp. This window will be * fully driven by the EConfig @emp. If @emp.type is - * @E_CONFIG_DRUID, then this will be a toplevel GtkWindow containing - * a GnomeDruid. If it is @E_CONFIG_BOOK then it will be a GtkDialog - * containing a Nnotebook. + * @E_CONFIG_ASSISTANT, then this will be a toplevel GtkWindow containing + * a GtkAssistant. If it is @E_CONFIG_BOOK then it will be a GtkDialog + * containing a Notebook. * * Unless reffed otherwise, the management object @emp will be * finalised when the widget is. @@ -913,11 +1046,9 @@ e_config_create_window(EConfig *emp, GtkWindow *parent, const gchar *title) gtk_box_pack_start((GtkBox *)gtk_dialog_get_content_area (((GtkDialog *)w)), emp->widget, TRUE, TRUE, 0); } else { - /* response is handled directly by the druid stuff */ - w = gtk_window_new(GTK_WINDOW_TOPLEVEL); + /* response is handled directly by the assistant stuff */ + w = emp->widget; gtk_window_set_title ((GtkWindow *)w, title); - gtk_container_add((GtkContainer *)w, emp->widget); - gtk_window_set_type_hint((GtkWindow *)w, GDK_WINDOW_TYPE_HINT_DIALOG); } emp->window = w; @@ -926,17 +1057,11 @@ e_config_create_window(EConfig *emp, GtkWindow *parent, const gchar *title) return w; } -static gboolean -ec_idle_handler_for_rebuild (gpointer data) +static void +ec_call_page_check (EConfig *emp) { - EConfig *emp = (EConfig*) data; - - ec_rebuild (emp); - if (emp->type == E_CONFIG_DRUID) { - if (emp->priv->druid_page) { - gnome_druid_set_page((GnomeDruid *)emp->widget, (GnomeDruidPage *)emp->priv->druid_page->frame); - ec_druid_check_current(emp); - } + if (emp->type == E_CONFIG_ASSISTANT) { + ec_assistant_check_current (emp); } else { if (emp->window) { if (e_config_page_check(emp, NULL)) { @@ -946,6 +1071,16 @@ ec_idle_handler_for_rebuild (gpointer data) } } } +} + +static gboolean +ec_idle_handler_for_rebuild (gpointer data) +{ + EConfig *emp = (EConfig*) data; + + ec_rebuild (emp); + ec_call_page_check (emp); + return FALSE; } @@ -959,29 +1094,15 @@ ec_idle_handler_for_rebuild (gpointer data) * %E_CONFIG_TARGET_CHANGED_REBUILD, then the entire configuration * widget may be recreated based on the changed target. * - * This is used to sensitise Druid next/back buttons and the Apply + * This is used to sensitise Assistant next/back buttons and the Apply * button for the Notebook mode. **/ void e_config_target_changed(EConfig *emp, e_config_target_change_t how) { if (how == E_CONFIG_TARGET_CHANGED_REBUILD) { g_idle_add (ec_idle_handler_for_rebuild, emp); - return; - } - - if (emp->type == E_CONFIG_DRUID) { - if (emp->priv->druid_page) { - gnome_druid_set_page((GnomeDruid *)emp->widget, (GnomeDruidPage *)emp->priv->druid_page->frame); - ec_druid_check_current(emp); - } } else { - if (emp->window) { - if (e_config_page_check(emp, NULL)) { - gtk_dialog_set_response_sensitive((GtkDialog *)emp->window, GTK_RESPONSE_OK, TRUE); - } else { - gtk_dialog_set_response_sensitive((GtkDialog *)emp->window, GTK_RESPONSE_OK, FALSE); - } - } + ec_call_page_check (emp); } /* virtual method/signal? */ @@ -992,7 +1113,7 @@ void e_config_target_changed(EConfig *emp, e_config_target_change_t how) * @ec: * * Signify that the stateful configuration changes must be discarded - * to all listeners. This is used by self-driven druid or notebook, or + * to all listeners. This is used by self-driven assistant or notebook, or * may be used by code using the widget directly. **/ void e_config_abort(EConfig *ec) @@ -1012,7 +1133,7 @@ void e_config_abort(EConfig *ec) * @ec: * * Signify that the stateful configuration changes should be saved. - * This is used by the self-driven druid or notebook, or may be used + * This is used by the self-driven assistant or notebook, or may be used * by code driving the widget directly. **/ void e_config_commit(EConfig *ec) @@ -1046,8 +1167,9 @@ gboolean e_config_page_check(EConfig *ec, const gchar *pageid) if ((pageid == NULL || mnode->pageid == NULL || strcmp(mnode->pageid, pageid) == 0) - && !mnode->check(ec, pageid, mnode->data)) + && !mnode->check(ec, pageid, mnode->data)) { return FALSE; + } return TRUE; } @@ -1060,7 +1182,7 @@ gboolean e_config_page_check(EConfig *ec, const gchar *pageid) * Retrieve the page widget corresponding to @pageid. * * Return value: The page widget. It will be the root GtkNotebook - * container or the GnomeDruidPage object. + * container or the GtkVBox object inside the assistant. **/ GtkWidget *e_config_page_get(EConfig *ec, const gchar *pageid) { @@ -1258,7 +1380,7 @@ static gpointer emph_parent_class; static const EPluginHookTargetKey ech_item_types[] = { { "book", E_CONFIG_BOOK }, - { "druid", E_CONFIG_DRUID }, + { "assistant", E_CONFIG_ASSISTANT }, { "page", E_CONFIG_PAGE }, { "page_start", E_CONFIG_PAGE_START }, diff --git a/e-util/e-config.h b/e-util/e-config.h index e6ff495520..1550f8895c 100644 --- a/e-util/e-config.h +++ b/e-util/e-config.h @@ -76,18 +76,18 @@ enum _e_config_target_change_t { * enum _e_config_t - configuration item type. * * @E_CONFIG_BOOK: A notebook item. Only one of this or - * @E_CONFIG_DRUID may be included in the item list for the entire + * @E_CONFIG_ASSISTANT may be included in the item list for the entire * configuration description. - * @E_CONFIG_DRUID: A druid item. Only one of this or @E_CONFIG_BOOK + * @E_CONFIG_ASSISTANT: An assistant item. Only one of this or @E_CONFIG_BOOK * may be included in the item list for the entire configutation * description. * @E_CONFIG_PAGE: A configuration page. The item @label will be - * either the notebook tab label or the druid page title if no factory + * either the notebook tab label or the assistant page title if no factory * is supplied. - * @E_CONFIG_PAGE_START: A druid start page. Only one of these may be - * supplied for a druid and it should be the first page in the druid. - * @E_CONFIG_PAGE_FINISH: A druid finish page. Only one of these may - * be supplied for a druid and it should be the last page of the druid. + * @E_CONFIG_PAGE_START: An assistant start page. Only one of these may be + * supplied for a assistant and it should be the first page in the assistant. + * @E_CONFIG_PAGE_FINISH: An assistant finish page. Only one of these may + * be supplied for an assistant and it should be the last page of the assistant. * @E_CONFIG_SECTION: A section in the configuration page. A page for * this section must have already been defined. The item @label if * supplied will be setup as a borderless hig-compliant frame title. @@ -109,11 +109,11 @@ enum _e_config_target_change_t { enum _e_config_t { /* use one and only one of these for any given config-window id */ E_CONFIG_BOOK, - E_CONFIG_DRUID, + E_CONFIG_ASSISTANT, E_CONFIG_PAGE, - E_CONFIG_PAGE_START, /* only allowed in druid types */ - E_CONFIG_PAGE_FINISH, /* only allowed in druid types */ + E_CONFIG_PAGE_START, /* only allowed in assistant types */ + E_CONFIG_PAGE_FINISH, /* only allowed in assistant types */ E_CONFIG_SECTION, E_CONFIG_SECTION_TABLE, E_CONFIG_ITEM, @@ -175,7 +175,7 @@ struct _EConfigTarget { * @id: The globally unique identifider for this configuration window, * used for hooking into it. * @target: The current target. - * @widget: The GtkNoteBook or GnomeDruid created after + * @widget: The GtkNoteBook or GtkAssistant created after * :create_widget() is called that represents the merged and combined * configuration window. * @window: If :create_window() is called, then the containing @@ -188,7 +188,7 @@ struct _EConfig { struct _EConfigPrivate *priv; - gint type; /* E_CONFIG_BOOK or E_CONFIG_DRUID */ + gint type; /* E_CONFIG_BOOK or E_CONFIG_ASSISTANT */ gchar *id; @@ -231,6 +231,7 @@ EConfig *e_config_construct(EConfig *, gint type, const gchar *id); void e_config_add_items(EConfig *, GSList *items, EConfigItemsFunc commitfunc, EConfigItemsFunc abortfunc, EConfigItemsFunc freefunc, gpointer data); void e_config_add_page_check(EConfig *, const gchar *pageid, EConfigCheckFunc, gpointer data); +void e_config_set_page_is_finish (EConfig *ec, const gchar *pageid, gboolean is_finish); void e_config_set_target(EConfig *emp, EConfigTarget *target); GtkWidget *e_config_create_widget(EConfig *); diff --git a/e-util/e-import.h b/e-util/e-import.h index 5a3165e117..9e409a30fb 100644 --- a/e-util/e-import.h +++ b/e-util/e-import.h @@ -60,7 +60,7 @@ enum _e_import_target_t { * @type: target type * @priority: Priority of importer. Higher values will be processed first. * @supported: Callback to see if this target is supported by the importer. - * @get_widget: A widget factory for this importer, if it needs any extra information in the druid. It will update the target. + * @get_widget: A widget factory for this importer, if it needs any extra information in the assistant. It will update the target. * @import: Run the import. * @user_data: User data for the callbacks; * diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 782cbec2de..af4be14a69 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -26,7 +26,7 @@ work before merge can occur: verify behaviour. - work out what to do with the startup druid. + work out what to do with the startup assistant. also need to work out: how to remove unecessary items from a service url once @@ -48,9 +48,6 @@ #include <glade/glade.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-standard.h> - #include "shell/e-shell.h" #include "e-util/e-error.h" #include "e-util/e-account-utils.h" @@ -190,7 +187,7 @@ struct _EMAccountEditorPrivate { const gchar *widgets_name[5]; gint widgets_index; - /* for druid page preparation */ + /* for assistant page preparation */ guint identity_set:1; guint receive_set:1; guint send_set:1; @@ -2071,6 +2068,60 @@ emae_setup_service (EMAccountEditor *emae, EMAccountEditorService *service, Glad camel_url_free (url); } +static GtkWidget * +emae_create_basic_assistant_page (GtkAssistant *assistant, const gchar *page_id) +{ + const gchar *title = NULL, *label = NULL; + GtkAssistantPageType page_type = GTK_ASSISTANT_PAGE_CONTENT; + GtkWidget *vbox, *lbl; + gboolean fill_space = FALSE; + + g_return_val_if_fail (page_id != NULL, NULL); + + if (g_ascii_strcasecmp (page_id, "start_page") == 0) { + page_type = GTK_ASSISTANT_PAGE_INTRO; + fill_space = TRUE; + title = _("Mail Configuration"); + label = _("Welcome to the Evolution Mail Configuration Assistant.\n\nClick \"Forward\" to begin."); + } else if (g_ascii_strcasecmp (page_id, "identity_page") == 0) { + title = _("Identity"); + label = _("Please enter your name and email address below. The \"optional\" fields below do not need to be filled in, unless you wish to include this information in email you send."); + } else if (g_ascii_strcasecmp (page_id, "source_page") == 0) { + title = _("Receiving Email"); + label = _("Please configure the following account settings."); + } else if (g_ascii_strcasecmp (page_id, "transport_page") == 0) { + title = _("Sending Email"); + label = _("Please enter information about the way you will send mail. If you are not sure, ask your system administrator or Internet Service Provider."); + } else if (g_ascii_strcasecmp (page_id, "management_page") == 0) { + title = _("Account Management"); + label = _("Please enter a descriptive name for this account in the space below.\nThis name will be used for display purposes only."); + } else if (g_ascii_strcasecmp (page_id, "finish_page") == 0) { + page_type = GTK_ASSISTANT_PAGE_CONFIRM; + fill_space = TRUE; + title = _("Done"); + label = _("Congratulations, your mail configuration is complete.\n\nYou are now ready to send and receive email using Evolution.\n\nClick \"Apply\" to save your settings."); + } else { + g_return_val_if_reached (NULL); + } + + vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); + + lbl = gtk_label_new (label); + gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5); + gtk_label_set_line_wrap (GTK_LABEL (lbl), TRUE); + + gtk_box_pack_start (GTK_BOX (vbox), lbl, fill_space, fill_space, 0); + + gtk_widget_show_all (vbox); + + gtk_assistant_append_page (assistant, vbox); + gtk_assistant_set_page_title (assistant, vbox, title); + gtk_assistant_set_page_type (assistant, vbox, page_type); + + return vbox; +} + /* do not re-order these, the order is used by various code to look up emae->priv->identity_entries[] */ static struct { const gchar *name; @@ -2126,7 +2177,7 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget xml = glade_xml_new (gladefile, item->label, NULL); g_free (gladefile); - /* Management & Identity fields, in the druid the management frame is relocated to the last page later on */ + /* Management & Identity fields, in the assistant the management frame is relocated to the last page later on */ for (i=0;i<sizeof (emae_identity_entries)/sizeof (emae_identity_entries[0]);i++) gui->identity_entries[i] = emae_account_entry (emae, emae_identity_entries[i].name, emae_identity_entries[i].item, xml); @@ -2152,22 +2203,12 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget w = glade_xml_get_widget (xml, item->label); if (emae->type == EMAE_PAGES) { gtk_box_pack_start ((GtkBox *)emae->pages[0], w, TRUE, TRUE, 0); - } else if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) { - GladeXML *druidxml; - GtkWidget *page; - - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - druidxml = glade_xml_new (gladefile, "identity_page", NULL); - g_free (gladefile); + } else if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) { + GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "identity_page"); - page = glade_xml_get_widget (druidxml, "identity_page"); + gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0); - gtk_box_pack_start ((GtkBox*)((GnomeDruidPageStandard *)page)->vbox, w, TRUE, TRUE, 0); w = page; - g_object_unref (druidxml); - gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page); } else { gtk_notebook_append_page ((GtkNotebook *)parent, w, gtk_label_new (_("Identity"))); } @@ -2203,22 +2244,12 @@ emae_receive_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget w = glade_xml_get_widget (xml, item->label); if (emae->type == EMAE_PAGES) { gtk_box_pack_start ((GtkBox *)emae->pages[1], w, TRUE, TRUE, 0); - } else if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) { - GladeXML *druidxml; - GtkWidget *page; + } else if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) { + GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "source_page"); - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - druidxml = glade_xml_new (gladefile, "source_page", NULL); - g_free (gladefile); + gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0); - page = glade_xml_get_widget (druidxml, "source_page"); - - gtk_box_pack_start ((GtkBox*)((GnomeDruidPageStandard *)page)->vbox, w, TRUE, TRUE, 0); w = page; - g_object_unref (druidxml); - gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page); } else { gtk_notebook_append_page ((GtkNotebook *)parent, w, gtk_label_new (_("Receiving Email"))); } @@ -2673,22 +2704,12 @@ emae_send_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *ol w = glade_xml_get_widget (xml, item->label); if (emae->type == EMAE_PAGES) { gtk_box_pack_start ((GtkBox *)emae->pages[2], w, TRUE, TRUE, 0); - } else if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) { - GladeXML *druidxml; - GtkWidget *page; - - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - druidxml = glade_xml_new (gladefile, "transport_page", NULL); - g_free (gladefile); + } else if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) { + GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "transport_page"); - page = glade_xml_get_widget (druidxml, "transport_page"); + gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0); - gtk_box_pack_start ((GtkBox*)((GnomeDruidPageStandard *)page)->vbox, w, TRUE, TRUE, 0); w = page; - g_object_unref (druidxml); - gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page); } else { gtk_notebook_append_page ((GtkNotebook *)parent, w, gtk_label_new (_("Sending Email"))); } @@ -2884,59 +2905,32 @@ emae_management_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg GtkWidget *w; w = gui->management_frame; - if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) { - GladeXML *druidxml; - GtkWidget *page; - gchar *gladefile; + if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) { + GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "management_page"); - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - druidxml = glade_xml_new (gladefile, "management_page", NULL); - g_free (gladefile); + gtk_widget_reparent (w, page); - page = glade_xml_get_widget (druidxml, "management_page"); - - gtk_widget_reparent (w, ((GnomeDruidPageStandard *)page)->vbox); w = page; - g_object_unref (druidxml); - gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page); } return w; } static GtkWidget * -emae_widget_druid_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) +emae_widget_assistant_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { - GladeXML *druidxml; - GtkWidget *w; - gchar *gladefile; EMAccountEditor *emae = (EMAccountEditor *)data; if (emae->type == EMAE_PAGES) return NULL; - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - druidxml = glade_xml_new (gladefile, item->label, NULL); - g_free (gladefile); - - w = glade_xml_get_widget (druidxml, item->label); - /* i think the glade file has issues, we need to show all on at least the end page */ - gtk_widget_show_all (w); - g_object_unref (druidxml); - - gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)w); - - return w; + return emae_create_basic_assistant_page (GTK_ASSISTANT (parent), item->label); } -/* plugin meta-data for "org.gnome.evolution.mail.config.accountDruid" */ -static EMConfigItem emae_druid_items[] = { - { E_CONFIG_DRUID, (gchar *) "" }, - { E_CONFIG_PAGE_START, (gchar *) "0.start", (gchar *) "start_page", emae_widget_druid_glade }, +/* plugin meta-data for "org.gnome.evolution.mail.config.accountAssistant" */ +static EMConfigItem emae_assistant_items[] = { + { E_CONFIG_ASSISTANT, (gchar *) "" }, + { E_CONFIG_PAGE_START, (gchar *) "0.start", (gchar *) "start_page", emae_widget_assistant_page }, { E_CONFIG_PAGE, (gchar *) "00.identity", (gchar *) "vboxIdentityBorder", emae_identity_page }, { E_CONFIG_SECTION, (gchar *) "00.identity/00.name", (gchar *) "account_vbox", emae_widget_glade }, @@ -2962,10 +2956,10 @@ static EMConfigItem emae_druid_items[] = { { E_CONFIG_PAGE, (gchar *) "40.management", (gchar *) "management_frame", emae_management_page }, - { E_CONFIG_PAGE_FINISH, (gchar *) "999.end", (gchar *) "finish_page", emae_widget_druid_glade }, + { E_CONFIG_PAGE_FINISH, (gchar *) "999.end", (gchar *) "finish_page", emae_widget_assistant_page }, { 0 }, }; -static gboolean emae_druid_items_translated = FALSE; +static gboolean emae_assistant_items_translated = FALSE; static void emae_free (EConfig *ec, GSList *items, gpointer data) @@ -3079,9 +3073,9 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data) new_account = (original_account == NULL); /* We use the page-check of various pages to 'prepare' or - pre-load their values, only in the druid */ + pre-load their values, only in the assistant */ if (pageid - && ((EConfig *)emae->priv->config)->type == E_CONFIG_DRUID) { + && ((EConfig *)emae->priv->config)->type == E_CONFIG_ASSISTANT) { if (!strcmp (pageid, "00.identity")) { if (!emae->priv->identity_set) { gchar *uname; @@ -3342,14 +3336,14 @@ em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, co emae_editor_items_translated = TRUE; } } else { - ec = em_config_new (E_CONFIG_DRUID, id); - items = emae_druid_items; - if (!emae_druid_items_translated) { + ec = em_config_new (E_CONFIG_ASSISTANT, id); + items = emae_assistant_items; + if (!emae_assistant_items_translated) { for (i=0;items[i].path;i++) { if (items[i].label) items[i].label = _(items[i].label); } - emae_druid_items_translated = TRUE; + emae_assistant_items_translated = TRUE; } } diff --git a/mail/em-account-editor.h b/mail/em-account-editor.h index b8913e2a83..83e9cd4885 100644 --- a/mail/em-account-editor.h +++ b/mail/em-account-editor.h @@ -54,7 +54,7 @@ typedef struct _EMAccountEditorPrivate EMAccountEditorPrivate; typedef enum { EMAE_NOTEBOOK, - EMAE_DRUID, + EMAE_ASSISTANT, EMAE_PAGES } EMAccountEditorType; @@ -64,7 +64,7 @@ struct _EMAccountEditor { EMAccountEditorPrivate *priv; EMAccountEditorType type; - GtkWidget *editor; /* gtknotebook or druid, depending on type */ + GtkWidget *editor; /* gtknotebook or gtkassistant, depending on type */ EMConfig *config; /* driver object */ diff --git a/mail/em-config.h b/mail/em-config.h index 656a40ec38..05401f026f 100644 --- a/mail/em-config.h +++ b/mail/em-config.h @@ -67,7 +67,7 @@ struct _EMConfigTargetAccount { EAccount *account; /* Need also: working account, not just real account, so changes can be propagated around - And some mechamism for controlling the gui if we're running inside a druid, e.g. enabling 'next' */ + And some mechamism for controlling the gui if we're running inside an assistant, e.g. enabling 'next' */ }; typedef struct _EConfigItem EMConfigItem; diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 62d19304a9..bc88e6e0b4 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -4,151 +4,6 @@ <!-- interface-requires gnome 2298.56488 --> <!-- interface-requires gtk+ 2.16 --> <!-- interface-naming-policy toplevel-contextual --> - <widget class="GtkWindow" id="account_druid"> - <property name="title" translatable="yes">Evolution Account Assistant</property> - <child> - <widget class="GnomeDruid" id="druid"> - <property name="visible">True</property> - <property name="border_width">4</property> - <child> - <widget class="GnomeDruidPageEdge" id="start_page"> - <property name="visible">True</property> - <property name="position">Edge Start</property> - <property name="title" translatable="yes">Mail Configuration</property> - <property name="text" translatable="yes">Welcome to the Evolution Mail Configuration Assistant. - -Click "Forward" to begin.</property> - </widget> - </child> - <child> - <widget class="GnomeDruidPageStandard" id="identity_page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Identity</property> - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid_identity_vbox"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="spacing">12</property> - <child> - <widget class="GtkLabel" id="identity_help"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Please enter your name and email address below. The "optional" fields below do not need to be filled in, unless you wish to include this information in email you send.</property> - <property name="wrap">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GnomeDruidPageStandard" id="source_page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Receiving Email</property> - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid_source_vbox"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="spacing">12</property> - <child> - <widget class="GtkLabel" id="extra_help"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Please configure the following account settings.</property> - <property name="wrap">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GnomeDruidPageStandard" id="transport_page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Sending Email</property> - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid_transport_vbox"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="spacing">12</property> - <child> - <widget class="GtkLabel" id="transport_help"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Please enter information about the way you will send mail. If you are not sure, ask your system administrator or Internet Service Provider.</property> - <property name="wrap">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GnomeDruidPageStandard" id="management_page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Account Management</property> - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid_management_vbox"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="spacing">12</property> - <child> - <widget class="GtkLabel" id="management_help"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Please enter a descriptive name for this account in the space below. -This name will be used for display purposes only.</property> - <property name="wrap">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GnomeDruidPageEdge" id="finish_page"> - <property name="visible">True</property> - <property name="position">Edge Finish</property> - <property name="title" translatable="yes">Done</property> - <property name="text" translatable="yes">Congratulations, your mail configuration is complete. - -You are now ready to send and receive email -using Evolution. - -Click "Apply" to save your settings.</property> - </widget> - </child> - </widget> - </child> - </widget> <widget class="GtkWindow" id="account_editor"> <property name="title" translatable="yes">Account Editor</property> <child> diff --git a/modules/addressbook/addressbook-config.c b/modules/addressbook/addressbook-config.c index 86b355e095..901ee4353b 100644 --- a/modules/addressbook/addressbook-config.c +++ b/modules/addressbook/addressbook-config.c @@ -91,7 +91,7 @@ struct _AddressbookSourceDialog { GtkWidget *window; - /* Source selection (druid only) */ + /* Source selection (assistant only) */ ESourceList *source_list; GSList *menu_source_groups; diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c index f2c646d5ed..0f86cd8341 100644 --- a/modules/mail/em-account-prefs.c +++ b/modules/mail/em-account-prefs.c @@ -45,8 +45,8 @@ ((obj), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsPrivate)) struct _EMAccountPrefsPrivate { - gpointer druid; /* weak pointer */ - gpointer editor; /* weak pointer */ + gpointer assistant; /* weak pointer */ + gpointer editor; /* weak pointer */ }; static gpointer parent_class; @@ -104,30 +104,30 @@ account_prefs_add_account (EAccountManager *manager) priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager); - if (priv->druid != NULL) { - gtk_window_present (GTK_WINDOW (priv->druid)); + if (priv->assistant != NULL) { + gtk_window_present (GTK_WINDOW (priv->assistant)); return; } parent = gtk_widget_get_toplevel (GTK_WIDGET (manager)); parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - /** @HookPoint-EMConfig: New Mail Account Druid - * @Id: org.gnome.evolution.mail.config.accountDruid - * @Type: E_CONFIG_DRUID + /** @HookPoint-EMConfig: New Mail Account Assistant + * @Id: org.gnome.evolution.mail.config.accountAssistant + * @Type: E_CONFIG_ASSISTANT * @Class: org.gnome.evolution.mail.config:1.0 * @Target: EMConfigTargetAccount * - * The new mail account druid. + * The new mail account assistant. */ emae = em_account_editor_new ( - NULL, EMAE_DRUID, - "org.gnome.evolution.mail.config.accountDruid"); - priv->druid = emae->editor; + NULL, EMAE_ASSISTANT, + "org.gnome.evolution.mail.config.accountAssistant"); + priv->assistant = emae->editor; - g_object_add_weak_pointer (G_OBJECT (priv->druid), &priv->druid); - gtk_window_set_transient_for (GTK_WINDOW (priv->druid), parent); - gtk_widget_show (priv->druid); + g_object_add_weak_pointer (G_OBJECT (priv->assistant), &priv->assistant); + gtk_window_set_transient_for (GTK_WINDOW (priv->assistant), parent); + gtk_widget_show (priv->assistant); } static void @@ -232,10 +232,10 @@ account_prefs_dispose (GObject *object) priv = EM_ACCOUNT_PREFS_GET_PRIVATE (object); - if (priv->druid != NULL) { + if (priv->assistant != NULL) { g_object_remove_weak_pointer ( - G_OBJECT (priv->druid), &priv->druid); - priv->druid = NULL; + G_OBJECT (priv->assistant), &priv->assistant); + priv->assistant = NULL; } if (priv->editor != NULL) { diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c index 560fa5c63c..6df2763698 100644 --- a/plugins/backup-restore/backup-restore.c +++ b/plugins/backup-restore/backup-restore.c @@ -31,8 +31,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <glib/gstdio.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-standard.h> #include "mail/em-config.h" #include "mail/em-account-editor.h" #include "e-util/e-error.h" @@ -105,7 +103,7 @@ dialog_prompt_user(GtkWindow *parent, const gchar *string, const gchar *tag, con /* We should hardcode this to true */ gtk_toggle_button_set_active ((GtkToggleButton *)check, TRUE); gtk_container_set_border_width((GtkContainer *)check, 12); - gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0); + gtk_box_pack_start ((GtkBox *)gtk_dialog_get_content_area ((GtkDialog *) mbox), check, TRUE, TRUE, 0); gtk_widget_show (check); button = gtk_dialog_run ((GtkDialog *) mbox); @@ -235,77 +233,74 @@ action_settings_restore_cb (GtkAction *action, } static void -check_toggled (GtkToggleButton *button, GnomeDruid *druid) +check_toggled (GtkToggleButton *button, GtkAssistant *assistant) { - GtkWidget *box = g_object_get_data ((GObject *)button, "box"); - gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button); - gchar *prevfile = g_object_get_data ((GObject *)druid, "restore-file"); + GtkWidget *box = g_object_get_data ((GObject *)button, "box"); + gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button); gtk_widget_set_sensitive (box, state); - gnome_druid_set_show_finish (druid, state); - if (state && !prevfile) - gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE); - else - gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE); - g_object_set_data ((GObject *)druid, "restore", GINT_TO_POINTER (state?1:0)); + g_object_set_data ((GObject *)assistant, "restore", GINT_TO_POINTER (state?1:0)); + e_config_target_changed ((EConfig *) g_object_get_data ((GObject *)assistant, "restore-config"), E_CONFIG_TARGET_CHANGED_STATE); } static void -restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data) +file_changed (GtkFileChooser *chooser, GtkAssistant *assistant) { - gboolean state = GPOINTER_TO_INT(g_object_get_data((GObject *)druid, "restore")) ? TRUE:FALSE; - gchar *file = g_object_get_data ((GObject *)druid, "restore-file"); + gchar *file = NULL, *prevfile = NULL; + gchar *uri = NULL; - if (state) { - if (!file ||!sanity_check (file)) { - e_error_run ((GtkWindow *)druid, "org.gnome.backup-restore:invalid-backup", NULL); - } else - restore (file, TRUE); + uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (chooser)); + e_file_update_save_path (uri, TRUE); - } + file = gtk_file_chooser_get_filename (chooser); + prevfile = g_object_get_data ((GObject *)assistant, "restore-file"); + g_object_set_data ((GObject *)assistant, "restore-file", file); + g_free (prevfile); + + e_config_target_changed ((EConfig *) g_object_get_data ((GObject *)assistant, "restore-config"), E_CONFIG_TARGET_CHANGED_STATE); } -static void -file_changed (GtkFileChooser *chooser, GnomeDruid *druid) +static gboolean +backup_restore_check (EConfig *ec, const gchar *pageid, gpointer data) { - gchar *file = NULL, *prevfile=NULL; - gchar *uri = NULL; + GtkAssistant *assistant = data; + gint do_restore; + gchar *file; - uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (chooser)); - e_file_update_save_path(uri, TRUE); + g_return_val_if_fail (data != NULL, FALSE); + g_return_val_if_fail (GTK_IS_ASSISTANT (data), FALSE); - file = gtk_file_chooser_get_filename (chooser); - prevfile = g_object_get_data ((GObject *)druid, "restore-file"); - g_object_set_data ((GObject *)druid, "restore-file", file); - g_free (prevfile); - if (file) { - gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE); - } else - gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE); + do_restore = GPOINTER_TO_INT (g_object_get_data ((GObject *)assistant, "restore")); + file = g_object_get_data ((GObject *)assistant, "restore-file"); + e_config_set_page_is_finish (ec, "0.startup_page.10.backup_restore", do_restore); + + return !do_restore || file; } + GtkWidget * backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data) { - GtkWidget *page; - GtkWidget *box, *hbox, *label, *cbox, *button; + GtkWidget *page, *hbox, *label, *cbox, *button; + GtkAssistant *assistant = GTK_ASSISTANT (hook_data->parent); + + page = gtk_vbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); - page = gnome_druid_page_standard_new_with_vals (_("Restore from backup"), NULL, NULL); hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new (_("You can restore Evolution from your backup. It can restore all the Mails, Calendars, Tasks, Memos, Contacts. It also restores all your personal settings, mail filters etc.")); gtk_label_set_line_wrap ((GtkLabel *)label, TRUE); gtk_label_set_single_line_mode ((GtkLabel *)label, FALSE); gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 6); - box = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 6); cbox = gtk_check_button_new_with_mnemonic (_("_Restore Evolution from the backup file")); - g_signal_connect (cbox, "toggled", G_CALLBACK (check_toggled), hook_data->parent); + g_signal_connect (cbox, "toggled", G_CALLBACK (check_toggled), assistant); gtk_box_pack_start ((GtkBox *)hbox, cbox, FALSE, FALSE, 6); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 6); g_object_set_data ((GObject *)cbox, "box", hbox); @@ -313,24 +308,37 @@ backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data) gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 12); button = gtk_file_chooser_button_new (_("Choose a file to restore"), GTK_FILE_CHOOSER_ACTION_OPEN); - g_signal_connect (button, "selection-changed", G_CALLBACK (file_changed), hook_data->parent); + g_signal_connect (button, "selection-changed", G_CALLBACK (file_changed), assistant); gtk_file_chooser_button_set_width_chars ((GtkFileChooserButton *)button, 20); gtk_box_pack_start ((GtkBox *)hbox, button, FALSE, FALSE, 0); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); gtk_widget_set_sensitive (hbox, FALSE); - gtk_container_add ((GtkContainer *) GNOME_DRUID_PAGE_STANDARD (page)->vbox, box); - gtk_widget_show_all (box); - gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page)); - g_object_set_data ((GObject *)hook_data->parent, "restore", GINT_TO_POINTER (FALSE)); - g_signal_connect (page, "finish", G_CALLBACK (restore_wizard), NULL); + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_title (assistant, page, _("Restore from backup")); + gtk_widget_show_all (page); + + g_object_set_data ((GObject *)assistant, "restore", GINT_TO_POINTER (FALSE)); + g_object_set_data ((GObject *)assistant, "restore-config", hook_data->config); + + e_config_add_page_check (hook_data->config, "0.startup_page.10.backup_restore", backup_restore_check, assistant); + return GTK_WIDGET (page); } void backup_restore_commit (EPlugin *ep, EMConfigTargetAccount *target) { - /* Nothing really */ - printf("commit\n"); + GtkWidget *assistant = target->target.config->widget; + gboolean state = GPOINTER_TO_INT (g_object_get_data ((GObject *)assistant, "restore")) ? TRUE : FALSE; + gchar *file = g_object_get_data ((GObject *)assistant, "restore-file"); + + if (state) { + if (!file || !sanity_check (file)) { + e_error_run ((GtkWindow *)assistant, "org.gnome.backup-restore:invalid-backup", NULL); + } else { + restore (file, TRUE); + } + } } void diff --git a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml index 6d92cf48ae..c78b376296 100644 --- a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml +++ b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml @@ -24,7 +24,7 @@ <hook class="org.gnome.evolution.mail.config:1.0"> <group target="account" id="org.gnome.evolution.mail.config.accountWizard" commit="backup_restore_commit" abort="backup_restore_abort"> - <item type="page" path="0.startup_page.10" factory="backup_restore_page"/> + <item type="page" path="0.startup_page.10.backup_restore" factory="backup_restore_page"/> </group> </hook> diff --git a/plugins/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c index 296e44282c..5943d5f3df 100644 --- a/plugins/exchange-operations/exchange-account-setup.c +++ b/plugins/exchange-operations/exchange-account-setup.c @@ -668,7 +668,7 @@ construct_owa_url (CamelURL *url) return owa_url; } -/* used by editor and druid - same code */ +/* used by editor and assistant - same code */ GtkWidget * org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) { @@ -734,7 +734,7 @@ org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) /* url has hostname but not owa_url. * Account has been created using x-c-s or evo is upgraded to 2.2 - * When invoked from druid, hostname will get set after validation, + * When invoked from assistant, hostname will get set after validation, * so this condition will never be true during account creation. */ owa_url = construct_owa_url (url); diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml index 381ac94e4c..063d5c98c6 100644 --- a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml +++ b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml @@ -33,7 +33,7 @@ <group target="account" - id="org.gnome.evolution.mail.config.accountDruid" + id="org.gnome.evolution.mail.config.accountAssistant" check="org_gnome_exchange_check_options"> <item type="item_table" path="10.receive/10.config/20.owa" diff --git a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml b/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml index 16947d89c7..f99606f8a4 100644 --- a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml +++ b/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml @@ -6,7 +6,7 @@ <_description>Add Novell GroupWise support to Evolution.</_description> <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountDruid"> + <group target="account" id="org.gnome.evolution.mail.config.accountAssistant"> <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> </group> </hook> diff --git a/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml b/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml index 68ae2fe8dd..e90ce650cb 100644 --- a/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml +++ b/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml @@ -6,7 +6,7 @@ <_description>Add Hula support to Evolution.</_description> <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountDruid"> + <group target="account" id="org.gnome.evolution.mail.config.accountAssistant"> <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_evolution_hula_account_setup"/> </group> </hook> diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c index 9c7ffe699b..14c4c6cffe 100644 --- a/plugins/startup-wizard/startup-wizard.c +++ b/plugins/startup-wizard/startup-wizard.c @@ -24,9 +24,6 @@ #include <gconf/gconf-client.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-edge.h> -#include <libgnomeui/gnome-druid-page-standard.h> #include "e-util/e-error.h" #include "e-util/e-import.h" #include "shell/e-shell.h" @@ -57,9 +54,11 @@ void startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) { EMAccountEditor *emae; - GnomeDruidPageEdge *start_page; + GtkWidget *start_page; GConfClient *client; GSList *accounts; + EConfig *config; + GList *page_children; client = gconf_client_get_default (); accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL); @@ -74,28 +73,36 @@ startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) /** @HookPoint-EMConfig: New Mail Account Wizard * @Id: org.gnome.evolution.mail.config.accountWizard - * @Type: E_CONFIG_DRUID + * @Type: E_CONFIG_ASSISTANT * @Class: org.gnome.evolution.mail.config:1.0 * @Target: EMConfigTargetAccount * - * The new mail account druid. + * The new mail account assistant. */ emae = em_account_editor_new ( - NULL, EMAE_DRUID, + NULL, EMAE_ASSISTANT, "org.gnome.evolution.mail.config.accountWizard"); gtk_window_set_title ( GTK_WINDOW (emae->editor), _("Evolution Setup Assistant")); - start_page = GNOME_DRUID_PAGE_EDGE ( - e_config_page_get ((EConfig *) emae->config, "0.start")); - gnome_druid_page_edge_set_title (start_page, _("Welcome")); - gnome_druid_page_edge_set_text ( - start_page, _("" - "Welcome to Evolution. The next few screens will allow Evolution to connect " - "to your email accounts, and to import files from other applications. \n" - "\n" - "Please click the \"Forward\" button to continue. ")); + config = (EConfig *) emae->config; + start_page = e_config_page_get (config, "0.start"); + + gtk_assistant_set_page_title (GTK_ASSISTANT (config->widget), start_page, _("Welcome")); + page_children = gtk_container_get_children (GTK_CONTAINER (start_page)); + if (page_children) { + GtkLabel *label = GTK_LABEL (page_children->data); + if (label) { + gtk_label_set_text (label, _("" + "Welcome to Evolution. The next few screens will allow Evolution to connect " + "to your email accounts, and to import files from other applications. \n" + "\n" + "Please click the \"Forward\" button to continue. ")); + } + + g_list_free (page_children); + } g_signal_connect ( emae->editor, "delete-event", @@ -122,13 +129,14 @@ startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data if (import_importers == NULL) return NULL; - page = gnome_druid_page_standard_new_with_vals (_("Importing files"), NULL, NULL); + page = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); label = gtk_label_new (_("Please select the information that you would like to import:")); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), label, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (page), label, FALSE, FALSE, 3); sep = gtk_hseparator_new (); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), sep, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (page), sep, FALSE, FALSE, 3); table = gtk_table_new(g_slist_length(import_importers), 2, FALSE); for (l = import_importers; l; l = l->next) { @@ -151,10 +159,12 @@ startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data gtk_table_attach((GtkTable *)table, w, 1, 2, row, row+1, GTK_FILL, 0, 3, 0); row++; } - gtk_widget_show(table); - gtk_box_pack_start((GtkBox *)((GnomeDruidPageStandard *)page)->vbox, table, FALSE, FALSE, 3); - gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page)); + gtk_box_pack_start (GTK_BOX (page), table, FALSE, FALSE, 3); + + gtk_widget_show_all (page); + gtk_assistant_append_page (GTK_ASSISTANT (hook_data->parent), page); + gtk_assistant_set_page_title (GTK_ASSISTANT (hook_data->parent), page, _("Importing files")); return page; } diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 6f3471d8dd..01f67af470 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -296,7 +296,7 @@ importer_file_page_new (ImportData *data) row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_label_set_mnemonic_widget(GTK_LABEL(label), page->filetype); - gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 10); + gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 12); gtk_widget_show_all (table); @@ -312,7 +312,7 @@ importer_dest_page_new (ImportData *data) page->vbox = gtk_vbox_new (FALSE, 5); - gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 10); + gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 12); return page; } @@ -331,7 +331,7 @@ importer_type_page_new (ImportData *data) page->file = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (page->intelligent), _("Import a _single file")); gtk_box_pack_start (GTK_BOX (page->vbox), page->file, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 10); + gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 12); gtk_widget_show_all (page->vbox); @@ -352,7 +352,7 @@ importer_importer_page_new (ImportData *data) sep = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (page->vbox), sep, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 10); + gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 12); gtk_widget_show_all (page->vbox); @@ -657,10 +657,15 @@ import_assistant_prepare (GtkAssistant *assistant, GtkWidget *page, gpointer use void e_shell_importer_start_import (EShellWindow *shell_window) { + const gchar *empty_xpm_img[] = { + "48 1 2 1", + " c None", + ". c #FFFFFF", + " "}; ImportData *data = g_new0 (ImportData, 1); GtkWidget *html, *page; static gboolean dialog_open = FALSE; - GdkPixbuf *icon; + GdkPixbuf *icon, *spacer; GtkAssistant *assistant; if (dialog_open) { @@ -670,6 +675,7 @@ e_shell_importer_start_import (EShellWindow *shell_window) data->import = e_import_new ("org.gnome.evolution.shell.importer"); icon = e_icon_factory_get_icon ("stock_mail-import", GTK_ICON_SIZE_DIALOG); + spacer = gdk_pixbuf_new_from_xpm_data (empty_xpm_img); dialog_open = TRUE; data->window = shell_window; @@ -677,11 +683,15 @@ e_shell_importer_start_import (EShellWindow *shell_window) assistant = GTK_ASSISTANT (data->assistant); + gtk_window_set_position (GTK_WINDOW (assistant), GTK_WIN_POS_CENTER); + gtk_window_set_title (GTK_WINDOW (assistant), _("Evolution Import Assistant")); + gtk_window_set_default_size (GTK_WINDOW (assistant), 500, 330); + /* Start page */ page = gtk_label_new (""); gtk_label_set_line_wrap (GTK_LABEL (page), TRUE); - gtk_misc_set_alignment (GTK_MISC (page), 0.0, 0.0); - gtk_misc_set_padding (GTK_MISC (page), 10, 10); + gtk_misc_set_alignment (GTK_MISC (page), 0.0, 0.5); + gtk_misc_set_padding (GTK_MISC (page), 12, 12); gtk_label_set_text (GTK_LABEL (page), _( "Welcome to the Evolution Import Assistant.\n" "With this assistant you will be guided through the process of importing external files into Evolution.")); @@ -690,6 +700,7 @@ e_shell_importer_start_import (EShellWindow *shell_window) gtk_assistant_set_page_header_image (assistant, page, icon); gtk_assistant_set_page_title (assistant, page, _("Evolution Import Assistant")); gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_INTRO); + gtk_assistant_set_page_side_image (assistant, page, spacer); gtk_assistant_set_page_complete (assistant, page, TRUE); /* Intelligent or direct import page */ @@ -747,6 +758,7 @@ e_shell_importer_start_import (EShellWindow *shell_window) gtk_assistant_set_page_header_image (assistant, page, icon); gtk_assistant_set_page_title (assistant, page, _("Import File")); gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONFIRM); + gtk_assistant_set_page_side_image (assistant, page, spacer); gtk_assistant_set_page_complete (assistant, page, TRUE); /* setup the rest */ @@ -762,6 +774,7 @@ e_shell_importer_start_import (EShellWindow *shell_window) g_object_weak_ref ((GObject *)assistant, import_assistant_weak_notify, data); g_object_unref (icon); + g_object_unref (spacer); gtk_assistant_update_buttons_state (assistant); |