From 278c1fa77ba74f70a8d55e6d679f73372034fb14 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 8 Aug 2008 23:12:59 +0000 Subject: Work through more compilation errors. Rewrite EMultiConfigDialog to not use ETable. svn path=/branches/kill-bonobo/; revision=35942 --- shell/e-shell-importer.c | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index bf2a67f9b0..adf662aacf 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -85,7 +85,6 @@ typedef struct _ImportDialogImporterPage { } ImportDialogImporterPage; typedef struct _ImportData { - EShell *shell; EShellWindow *window; GladeXML *wizard; @@ -242,29 +241,6 @@ item_selected (GtkWidget *item, filename_changed(data->filepage->filename, data); } -#if 0 -static int -compare_info_name (const void *data1, const void *data2) -{ - const Bonobo_ServerInfo *info1 = (Bonobo_ServerInfo *)data1; - const Bonobo_ServerInfo *info2 = (Bonobo_ServerInfo *)data2; - const char *name1 = get_name_from_component_info (info1); - const char *name2 = get_name_from_component_info (info2); - - /* If we can't find a name for a plug-in, its iid will be used - * for display. Put such plug-ins at the end of the list since - * their displayed name won't be really user-friendly - */ - if (name1 == NULL) { - return -1; - } - if (name2 == NULL) { - return 1; - } - return g_utf8_collate (name1, name2); -} -#endif - static ImportDialogFilePage * importer_file_page_new (ImportData *data) { @@ -678,7 +654,6 @@ e_shell_importer_start_import (EShellWindow *shell_window) dialog_open = TRUE; data->window = shell_window; - data->shell = e_shell_window_peek_shell (data->window); gladefile = g_build_filename (EVOLUTION_GLADEDIR, "import.glade", NULL); data->wizard = glade_xml_new (gladefile, NULL, NULL); -- cgit v1.2.3 From c0a255eb90769638d57ae4122932f75c46e4e531 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 11 Sep 2008 15:34:29 +0000 Subject: Merge revisions 36016:36303 from trunk. svn path=/branches/kill-bonobo/; revision=36307 --- shell/e-shell-importer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index adf662aacf..c01d19dea5 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -132,9 +132,7 @@ static struct { }, { "file_html", N_("Choose the file that you want to import into Evolution, " - "and select what type of file it is from the list.\n\n" - "You can select \"Automatic\" if you do not know, and " - "Evolution will attempt to work it out.") + "and select what type of file it is from the list.") }, { "dest_html", N_("Choose the destination for this import") -- cgit v1.2.3 From 6b2295c93a40f6010d94399666a8e099aded8e85 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 19 Sep 2008 18:21:06 +0000 Subject: Fix some miscellaneous address book bugs. Kill e-shell-constants.h. svn path=/branches/kill-bonobo/; revision=36392 --- shell/e-shell-importer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index c01d19dea5..bea25420fb 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -48,7 +48,6 @@ #include "e-shell.h" #include "e-shell-window.h" -#include "e-shell-constants.h" #include "e-shell-importer.h" -- cgit v1.2.3 From b2cda1d0c6d44f53f71bad9e256f41188677dfba Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 1 Oct 2008 20:56:04 +0000 Subject: Merge revisions 36016:36533 from trunk. svn path=/branches/kill-bonobo/; revision=36534 --- shell/e-shell-importer.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index bea25420fb..6ce54e8292 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -1,23 +1,23 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* importer.c - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.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. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * 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. + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. * - * Author: Iain Holmes + * Authors: + * Iain Holmes + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * */ #include -- cgit v1.2.3 From 2393a5d17e92435cb3d7726b04ff6f4a5c27c8db Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 24 May 2009 11:54:43 -0400 Subject: Eliminate redundant E_ICON_SIZE_* enumeration. --- shell/e-shell-importer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 8a639342b1..69a30ee3a6 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -676,7 +676,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", E_ICON_SIZE_DIALOG); + icon = e_icon_factory_get_icon ("stock_mail-import", GTK_ICON_SIZE_DIALOG); dialog_open = TRUE; data->window = shell_window; -- cgit v1.2.3 From e4afd3f9fb962ea1295a0657ec9f83a427829171 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 May 2009 23:21:02 -0400 Subject: Remove trailing whitespace, again. --- shell/e-shell-importer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index cb990f973b..74a89cc2ec 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see + * License along with the program; if not, see * * * Authors: -- cgit v1.2.3 From 948235c3d1076dbe6ed2e57a24c16a083bbd9f01 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 10:29:19 -0400 Subject: Prefer GLib basic types over C types. --- shell/e-shell-importer.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 84d5d64877..b87da837ca 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -146,10 +146,10 @@ static struct { #define num_info (sizeof (info) / sizeof (info[0])) static GtkWidget * -create_help (const char *name) +create_help (const gchar *name) { GtkWidget *label; - int i; + gint i; for (i = 0; i < num_info; i++) { if (!strcmp (name, info[i].name)) @@ -174,8 +174,8 @@ filename_changed (GtkWidget *widget, ImportData *data) { ImportDialogFilePage *page; - const char *filename; - int fileok; + const gchar *filename; + gint fileok; page = data->filepage; @@ -188,7 +188,7 @@ filename_changed (GtkWidget *widget, gboolean valid; GSList *l; EImportImporter *first = NULL; - int i=0, firstitem=0; + gint i=0, firstitem=0; g_free(page->target->uri_src); page->target->uri_src = g_filename_to_uri(filename, NULL, NULL); @@ -257,7 +257,7 @@ importer_file_page_new (ImportData *data) GtkWidget *table, *label; GtkCellRenderer *cell; GtkListStore *store; - int row = 0; + gint row = 0; page = g_new0 (ImportDialogFilePage, 1); @@ -366,7 +366,7 @@ prepare_intelligent_page (GnomeDruidPage *dpage, { GSList *l; GtkWidget *table; - int row; + gint row; ImportDialogImporterPage *page = data->importerpage; if (page->target != NULL) @@ -388,7 +388,7 @@ prepare_intelligent_page (GnomeDruidPage *dpage, row = 0; for (;l;l=l->next) { EImportImporter *eii = l->data; - char *str; + gchar *str; GtkWidget *w, *label; w = e_import_get_widget(data->import, (EImportTarget *)page->target, eii); @@ -432,7 +432,7 @@ import_druid_esc (GnomeDruid *druid, } static void -import_druid_weak_notify (void *blah, +import_druid_weak_notify (gpointer blah, GObject *where_the_object_was) { ImportData *data = (ImportData *) blah; @@ -451,7 +451,7 @@ import_druid_weak_notify (void *blah, } static void -import_status(EImport *import, const char *what, int pc, void *d) +import_status(EImport *import, const gchar *what, gint pc, gpointer d) { ImportData *data = d; @@ -467,7 +467,7 @@ import_dialog_response(GtkDialog *d, guint button, ImportData *data) } static void -import_done(EImport *ei, void *d) +import_done(EImport *ei, gpointer d) { ImportData *data = d; @@ -476,7 +476,7 @@ import_done(EImport *ei, void *d) } static void -import_intelligent_done(EImport *ei, void *d) +import_intelligent_done(EImport *ei, gpointer d) { ImportData *data = d; @@ -495,7 +495,7 @@ import_druid_finish (GnomeDruidPage *page, ImportData *data) { EImportCompleteFunc done = NULL; - char *msg = NULL; + gchar *msg = NULL; if (gtk_toggle_button_get_active((GtkToggleButton *)data->typepage->intelligent)) { data->importerpage->current = data->importerpage->importers; @@ -653,7 +653,7 @@ back_intelligent_page (GnomeDruidPage *page, } static void -dialog_weak_notify (void *data, +dialog_weak_notify (gpointer data, GObject *where_the_dialog_was) { gboolean *dialog_open = (gboolean *) data; @@ -668,7 +668,7 @@ e_shell_importer_start_import (EShellWindow *shell_window) GtkWidget *html; static gboolean dialog_open = FALSE; GdkPixbuf *icon; - char *gladefile; + gchar *gladefile; if (dialog_open) { return; -- cgit v1.2.3 From 14f8eee012382f04090ea9277e9567d5f32e8bf0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 28 May 2009 13:06:29 -0400 Subject: Whitespace cleanup. --- shell/e-shell-importer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index b87da837ca..c11797631b 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -416,7 +416,7 @@ static void import_druid_cancel (GnomeDruid *druid, ImportData *data) { - gtk_widget_destroy (GTK_WIDGET (data->dialog)); + gtk_widget_destroy (GTK_WIDGET (data->dialog)); } static gboolean -- cgit v1.2.3 From 374bd42f69aca2e132fd854c9619f3d7491f1f96 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 12 Jul 2009 23:33:07 -0400 Subject: Fix excessive whitespace. --- shell/e-shell-importer.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index c11797631b..e8185fac3b 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -159,7 +159,6 @@ create_help (const gchar *name) if (i >= num_info) g_warning ("i > num_info\n"); - label = gtk_label_new(i < num_info ? _(info[i].text): NULL); gtk_widget_show (label); gtk_label_set_line_wrap((GtkLabel *)label, TRUE); @@ -731,7 +730,6 @@ e_shell_importer_start_import (EShellWindow *shell_window) gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->intelligent)->vbox), data->importerpage->vbox, TRUE, TRUE, 0); - /* File selection and file type page */ data->filedialog = glade_xml_get_widget (data->wizard, "page2-file"); gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (data->filedialog), icon); -- cgit v1.2.3 From 1f56992e474023ceca14e57515019cccabd0d083 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 5 Aug 2009 19:17:58 +0200 Subject: Bug #563795 - Crashed while importing an mbox file in local folder --- shell/e-shell-importer.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index e8185fac3b..0c9b6f8924 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -415,7 +415,10 @@ static void import_druid_cancel (GnomeDruid *druid, ImportData *data) { - gtk_widget_destroy (GTK_WIDGET (data->dialog)); + if (data->import_dialog) + gtk_dialog_response (GTK_DIALOG (data->import_dialog), GTK_RESPONSE_CANCEL); + else + gtk_widget_destroy (GTK_WIDGET (data->dialog)); } static gboolean @@ -436,6 +439,15 @@ import_druid_weak_notify (gpointer blah, { ImportData *data = (ImportData *) blah; + if (data->import_dialog && (GObject *)data->import_dialog != where_the_object_was) { + /* postpone freeing of 'data' after the 'import_dialog' will stop, + but also indicate that the 'dialog' gone already */ + data->dialog = NULL; + g_object_weak_ref ((GObject *)data->import_dialog, import_druid_weak_notify, data); + gtk_dialog_response (GTK_DIALOG (data->import_dialog), GTK_RESPONSE_CANCEL); + return; + } + if (data->importerpage->target) e_import_target_free(data->import, data->importerpage->target); g_slist_free(data->importerpage->importers); @@ -469,9 +481,16 @@ static void import_done(EImport *ei, gpointer d) { ImportData *data = d; + gboolean have_dialog = data->dialog != NULL; + + gtk_widget_destroy (data->import_dialog); - gtk_widget_destroy(data->import_dialog); - gtk_widget_destroy(data->dialog); + /* if doesn't have dialog, then the 'data' pointer is freed + on the above destroy call */ + if (have_dialog) { + data->import_dialog = NULL; + gtk_widget_destroy (data->dialog); + } } static void -- cgit v1.2.3 From 260c0c8e1eabeefd3d364f62114b4aa8d2b0028e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 13 Aug 2009 18:52:21 -0400 Subject: =?UTF-8?q?Bug=20567260=20=E2=80=93=20Migrate=20from=20GnomeDruid?= =?UTF-8?q?=20to=20GtkAssistant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/e-shell-importer.c | 291 ++++++++++++++++++++++------------------------- 1 file changed, 134 insertions(+), 157 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 0c9b6f8924..6f3471d8dd 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -34,10 +34,6 @@ #include -#include -#include -#include - #include "misc/e-gui-utils.h" #include "e-util/e-dialog-utils.h" @@ -83,9 +79,7 @@ typedef struct _ImportDialogImporterPage { typedef struct _ImportData { EShellWindow *window; - GladeXML *wizard; - GtkWidget *dialog; - GtkWidget *druid; + GtkWidget *assistant; ImportDialogFilePage *filepage; ImportDialogDestPage *destpage; ImportDialogTypePage *typepage; @@ -95,8 +89,6 @@ typedef struct _ImportData { GtkWidget *typedialog; GtkWidget *destdialog; GtkWidget *intelligent; - GnomeDruidPageEdge *start; - GnomeDruidPageEdge *finish; GtkWidget *vbox; EImport *import; @@ -235,7 +227,7 @@ filename_changed (GtkWidget *widget, } } - gnome_druid_set_buttons_sensitive(GNOME_DRUID (data->druid), TRUE, fileok, TRUE, FALSE); + gtk_assistant_set_page_complete (GTK_ASSISTANT (data->assistant), page->vbox, fileok); } static void @@ -304,6 +296,8 @@ 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_widget_show_all (table); return page; @@ -318,6 +312,8 @@ importer_dest_page_new (ImportData *data) page->vbox = gtk_vbox_new (FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 10); + return page; } @@ -335,7 +331,10 @@ 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_widget_show_all (page->vbox); + return page; } @@ -353,23 +352,25 @@ 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_widget_show_all (page->vbox); return page; } -static gboolean -prepare_intelligent_page (GnomeDruidPage *dpage, - GnomeDruid *druid, - ImportData *data) +static void +prepare_intelligent_page (GtkAssistant *assistant, GtkWidget *apage, ImportData *data) { GSList *l; GtkWidget *table; gint row; ImportDialogImporterPage *page = data->importerpage; - if (page->target != NULL) - return FALSE; + if (page->target != NULL) { + gtk_assistant_set_page_complete (assistant, apage, FALSE); + return; + } page->target = e_import_target_new_home(data->import, g_get_home_dir()); @@ -379,8 +380,8 @@ prepare_intelligent_page (GnomeDruidPage *dpage, if (l == NULL) { gtk_box_pack_start(GTK_BOX (data->importerpage->vbox), create_help("nodata_html"), FALSE, TRUE, 0); - gnome_druid_set_buttons_sensitive(druid, TRUE, FALSE, TRUE, FALSE); - return TRUE; + gtk_assistant_set_page_complete (assistant, apage, FALSE); + return; } table = gtk_table_new(g_slist_length(l), 2, FALSE); @@ -408,33 +409,30 @@ prepare_intelligent_page (GnomeDruidPage *dpage, gtk_widget_show(table); gtk_box_pack_start((GtkBox *)data->importerpage->vbox, table, FALSE, FALSE, 0); - return FALSE; + gtk_assistant_set_page_complete (assistant, apage, TRUE); } static void -import_druid_cancel (GnomeDruid *druid, - ImportData *data) +import_assistant_cancel (GtkAssistant *assistant, ImportData *data) { if (data->import_dialog) gtk_dialog_response (GTK_DIALOG (data->import_dialog), GTK_RESPONSE_CANCEL); else - gtk_widget_destroy (GTK_WIDGET (data->dialog)); + gtk_widget_destroy (GTK_WIDGET (data->assistant)); } static gboolean -import_druid_esc (GnomeDruid *druid, - GdkEventKey *event, - ImportData *data) +import_assistant_esc (GtkAssistant *assistant, GdkEventKey *event, ImportData *data) { if (event->keyval == GDK_Escape) { - gtk_widget_destroy (GTK_WIDGET (data->dialog)); + gtk_widget_destroy (GTK_WIDGET (assistant)); return TRUE; } else return FALSE; } static void -import_druid_weak_notify (gpointer blah, +import_assistant_weak_notify (gpointer blah, GObject *where_the_object_was) { ImportData *data = (ImportData *) blah; @@ -442,8 +440,8 @@ import_druid_weak_notify (gpointer blah, if (data->import_dialog && (GObject *)data->import_dialog != where_the_object_was) { /* postpone freeing of 'data' after the 'import_dialog' will stop, but also indicate that the 'dialog' gone already */ - data->dialog = NULL; - g_object_weak_ref ((GObject *)data->import_dialog, import_druid_weak_notify, data); + data->assistant = NULL; + g_object_weak_ref ((GObject *)data->import_dialog, import_assistant_weak_notify, data); gtk_dialog_response (GTK_DIALOG (data->import_dialog), GTK_RESPONSE_CANCEL); return; } @@ -457,7 +455,6 @@ import_druid_weak_notify (gpointer blah, g_object_unref(data->import); - g_object_unref(data->wizard); g_free(data); } @@ -481,7 +478,7 @@ static void import_done(EImport *ei, gpointer d) { ImportData *data = d; - gboolean have_dialog = data->dialog != NULL; + gboolean have_dialog = data->assistant != NULL; gtk_widget_destroy (data->import_dialog); @@ -489,7 +486,7 @@ import_done(EImport *ei, gpointer d) on the above destroy call */ if (have_dialog) { data->import_dialog = NULL; - gtk_widget_destroy (data->dialog); + gtk_widget_destroy (data->assistant); } } @@ -508,9 +505,7 @@ import_intelligent_done(EImport *ei, gpointer d) } static void -import_druid_finish (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) +import_assistant_apply (GtkAssistant *assistant, ImportData *data) { EImportCompleteFunc done = NULL; gchar *msg = NULL; @@ -543,16 +538,14 @@ import_druid_finish (GnomeDruidPage *page, e_import_import(data->import, data->import_target, data->import_importer, import_status, import_done, data); } else { - gtk_widget_destroy(data->dialog); + gtk_widget_destroy(data->assistant); } g_free(msg); } -static gboolean -prepare_file_page (GnomeDruidPage *dpage, - GnomeDruid *druid, - ImportData *data) +static void +prepare_file_page (GtkAssistant *assistant, GtkWidget *apage, ImportData *data) { GSList *importers, *imp; GtkListStore *store; @@ -560,7 +553,7 @@ prepare_file_page (GnomeDruidPage *dpage, if (page->target != NULL) { filename_changed(data->filepage->filename, data); - return FALSE; + return; } page->target = e_import_target_new_uri(data->import, NULL, NULL); @@ -589,23 +582,10 @@ prepare_file_page (GnomeDruidPage *dpage, filename_changed (data->filepage->filename, data); g_signal_connect (page->filetype, "changed", G_CALLBACK (filetype_changed_cb), data); - - return FALSE; } static gboolean -next_file_page (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) -{ - /* We dont sensitise the next button if we're not already usable */ - return FALSE; -} - -static gboolean -prepare_dest_page (GnomeDruidPage *dpage, - GnomeDruid *druid, - ImportData *data) +prepare_dest_page (GtkAssistant *assistant, GtkWidget *apage, ImportData *data) { ImportDialogDestPage *page = data->destpage; @@ -619,174 +599,171 @@ prepare_dest_page (GnomeDruidPage *dpage, gtk_widget_show(page->control); } - gtk_box_pack_start((GtkBox *)data->destpage->vbox, page->control, TRUE, TRUE, 0); + gtk_box_pack_start ((GtkBox *)data->destpage->vbox, page->control, TRUE, TRUE, 0); + gtk_assistant_set_page_complete (assistant, apage, TRUE); return FALSE; } -static gboolean -next_dest_page (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) -{ - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->finish)); - return TRUE; -} - -static gboolean -next_type_page (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) +static void +dialog_weak_notify (gpointer data, + GObject *where_the_dialog_was) { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->typepage->intelligent))) { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->intelligent)); - } else { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog)); - } + gboolean *dialog_open = (gboolean *) data; - return TRUE; + *dialog_open = FALSE; } -static gboolean -back_finish_page (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) +enum { + PAGE_START, + PAGE_INTELI_OR_DIRECT, + PAGE_INTELI_SOURCE, + PAGE_FILE_CHOOSE, + PAGE_FILE_DEST, + PAGE_FINISH +}; + +static gint +forward_cb (gint current_page, gpointer user_data) { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->typepage->intelligent))) { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->intelligent)); - } else { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->destdialog)); + ImportData *data = user_data; + + switch (current_page) { + case PAGE_INTELI_OR_DIRECT: + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->typepage->intelligent))) + return PAGE_INTELI_SOURCE; + else + return PAGE_FILE_CHOOSE; + case PAGE_INTELI_SOURCE: + return PAGE_FINISH; } - return TRUE; -} - -static gboolean -back_intelligent_page (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) -{ - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->typedialog)); - return TRUE; + return current_page + 1; } static void -dialog_weak_notify (gpointer data, - GObject *where_the_dialog_was) +import_assistant_prepare (GtkAssistant *assistant, GtkWidget *page, gpointer user_data) { - gboolean *dialog_open = (gboolean *) data; - - *dialog_open = FALSE; + ImportData *data = user_data; + + if (page == data->importerpage->vbox) + prepare_intelligent_page (assistant, page, data); + else if (page == data->filepage->vbox) + prepare_file_page (assistant, page, data); + else if (page == data->destpage->vbox) + prepare_dest_page (assistant, page, data); } void e_shell_importer_start_import (EShellWindow *shell_window) { ImportData *data = g_new0 (ImportData, 1); - GtkWidget *html; + GtkWidget *html, *page; static gboolean dialog_open = FALSE; GdkPixbuf *icon; - gchar *gladefile; + GtkAssistant *assistant; if (dialog_open) { return; } - data->import = e_import_new("org.gnome.evolution.shell.importer"); + data->import = e_import_new ("org.gnome.evolution.shell.importer"); icon = e_icon_factory_get_icon ("stock_mail-import", GTK_ICON_SIZE_DIALOG); dialog_open = TRUE; data->window = shell_window; + data->assistant = gtk_assistant_new (); - gladefile = g_build_filename (EVOLUTION_GLADEDIR, "import.glade", NULL); - data->wizard = glade_xml_new (gladefile, NULL, NULL); - g_free (gladefile); - data->dialog = glade_xml_get_widget (data->wizard, "importwizard"); - gtk_window_set_default_size (GTK_WINDOW (data->dialog), 480, 320); - gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "importdruid", - "Evolution:shell"); - e_dialog_set_transient_for (GTK_WINDOW (data->dialog), GTK_WIDGET (shell_window)); - g_object_weak_ref ((GObject *)data->dialog, dialog_weak_notify, &dialog_open); - - data->druid = glade_xml_get_widget (data->wizard, "druid1"); - g_signal_connect (data->druid, "cancel", - G_CALLBACK (import_druid_cancel), data); - g_signal_connect (data->druid, "key_press_event", - G_CALLBACK (import_druid_esc), data); - - gtk_button_set_use_underline ((GtkButton *)((GnomeDruid *)data->druid)->finish, TRUE); - gtk_button_set_label((GtkButton *)((GnomeDruid *)data->druid)->finish, _("_Import")); + assistant = GTK_ASSISTANT (data->assistant); /* Start page */ - data->start = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page0")); - gnome_druid_page_edge_set_logo (data->start, icon); + 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_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.")); + + gtk_assistant_append_page (assistant, page); + 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_complete (assistant, page, TRUE); /* Intelligent or direct import page */ - data->typedialog = glade_xml_get_widget (data->wizard, "page1"); - gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (data->typedialog), icon); - g_signal_connect (data->typedialog, "next", - G_CALLBACK (next_type_page), data); data->typepage = importer_type_page_new (data); html = create_help ("type_html"); gtk_box_pack_start (GTK_BOX (data->typepage->vbox), html, FALSE, TRUE, 0); gtk_box_reorder_child (GTK_BOX (data->typepage->vbox), html, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->typedialog)->vbox), data->typepage->vbox, TRUE, TRUE, 0); + page = data->typepage->vbox; + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_header_image (assistant, page, icon); + gtk_assistant_set_page_title (assistant, page, _("Importer Type")); + gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_set_page_complete (assistant, page, TRUE); /* Intelligent importer source page */ - data->intelligent = glade_xml_get_widget (data->wizard, "page2-intelligent"); - gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (data->intelligent), icon); - g_signal_connect (data->intelligent, "back", - G_CALLBACK (back_intelligent_page), data); - g_signal_connect_after (data->intelligent, "prepare", - G_CALLBACK (prepare_intelligent_page), data); - data->importerpage = importer_importer_page_new (data); html = create_help ("intelligent_html"); gtk_box_pack_start (GTK_BOX (data->importerpage->vbox), html, FALSE, TRUE, 0); gtk_box_reorder_child (GTK_BOX (data->importerpage->vbox), html, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->intelligent)->vbox), data->importerpage->vbox, TRUE, TRUE, 0); + page = data->importerpage->vbox; + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_header_image (assistant, page, icon); + gtk_assistant_set_page_title (assistant, page, _("Select Information to Import")); + gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); /* File selection and file type page */ - data->filedialog = glade_xml_get_widget (data->wizard, "page2-file"); - gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (data->filedialog), icon); - g_signal_connect_after (data->filedialog, "prepare", - G_CALLBACK (prepare_file_page), data); - g_signal_connect (data->filedialog, "next", - G_CALLBACK (next_file_page), data); data->filepage = importer_file_page_new (data); - html = create_help ("file_html"); gtk_box_pack_start (GTK_BOX (data->filepage->vbox), html, FALSE, TRUE, 0); gtk_box_reorder_child (GTK_BOX (data->filepage->vbox), html, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->filedialog)->vbox), data->filepage->vbox, TRUE, TRUE, 0); + page = data->filepage->vbox; + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_header_image (assistant, page, icon); + gtk_assistant_set_page_title (assistant, page, _("Select a File")); + gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); /* File destination page */ - data->destdialog = glade_xml_get_widget (data->wizard, "page3-file"); - g_signal_connect_after (data->destdialog, "prepare", - G_CALLBACK (prepare_dest_page), data); - g_signal_connect (data->destdialog, "next", - G_CALLBACK (next_dest_page), data); - data->destpage = importer_dest_page_new (data); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->destdialog)->vbox), data->destpage->vbox, TRUE, TRUE, 0); + page = data->destpage->vbox; + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_header_image (assistant, page, icon); + gtk_assistant_set_page_title (assistant, page, _("Import Location")); + gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT); /* Finish page */ - data->finish = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page4")); - gnome_druid_page_edge_set_logo (data->finish, icon); - g_signal_connect (data->finish, "back", - G_CALLBACK (back_finish_page), data); + page = gtk_label_new (""); + gtk_misc_set_alignment (GTK_MISC (page), 0.5, 0.5); + gtk_label_set_text (GTK_LABEL (page), _("Click \"Apply\" to begin importing the file into Evolution.")); + + gtk_assistant_append_page (assistant, page); + 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_complete (assistant, page, TRUE); - g_signal_connect (data->finish, "finish", - G_CALLBACK (import_druid_finish), data); + /* setup the rest */ + g_object_weak_ref ((GObject *)assistant, dialog_weak_notify, &dialog_open); - g_object_weak_ref ((GObject *)data->dialog, import_druid_weak_notify, data); + gtk_assistant_set_forward_page_func (assistant, forward_cb, data, NULL); + + g_signal_connect (assistant, "key_press_event", G_CALLBACK (import_assistant_esc), data); + g_signal_connect (assistant, "cancel", G_CALLBACK (import_assistant_cancel), data); + g_signal_connect (assistant, "prepare", G_CALLBACK (import_assistant_prepare), data); + g_signal_connect (assistant, "apply", G_CALLBACK (import_assistant_apply), data); + + g_object_weak_ref ((GObject *)assistant, import_assistant_weak_notify, data); g_object_unref (icon); - gtk_widget_show_all (data->dialog); + gtk_assistant_update_buttons_state (assistant); + + gtk_widget_show_all (data->assistant); } -- cgit v1.2.3 From de528db6c18b7ecee83bb8b52850d935c1244ebf Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 18 Aug 2009 10:00:23 -0400 Subject: =?UTF-8?q?Bug=C2=A0567260=20-=20Migrate=20from=20GnomeDruid=20to?= =?UTF-8?q?=20GtkAssistant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/e-shell-importer.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'shell/e-shell-importer.c') 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); -- cgit v1.2.3 From 0f7f4cfe38b3c4cd83efbe9922ae15c5aee00317 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 30 Aug 2009 00:48:57 -0400 Subject: Coding style and whitespace cleanup. --- shell/e-shell-importer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 01f67af470..aba3546443 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -417,7 +417,7 @@ import_assistant_cancel (GtkAssistant *assistant, ImportData *data) { if (data->import_dialog) gtk_dialog_response (GTK_DIALOG (data->import_dialog), GTK_RESPONSE_CANCEL); - else + else gtk_widget_destroy (GTK_WIDGET (data->assistant)); } -- cgit v1.2.3