diff options
author | JP Rosevear <jpr@ximian.com> | 2004-02-05 05:08:31 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-02-05 05:08:31 +0800 |
commit | 7a316616d6857334adcca14ae0cd8029128cb672 (patch) | |
tree | 20d7685213dbf4b8579d90e9e6296e24830a7c0b /shell | |
parent | 8360a36e2d24298cdbc5ad7d13c81b8b76f2a3e0 (diff) | |
download | gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.tar gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.tar.gz gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.tar.bz2 gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.tar.lz gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.tar.xz gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.tar.zst gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.zip |
add extra page
2004-02-04 JP Rosevear <jpr@ximian.com>
* importer/import.glade: add extra page
* importer/evolution-importer.h: update protos
* importer/evolution-importer.c: hold the createControl function
(impl_GNOME_Evolution_Importer_createControl): implement
(impl_GNOME_Evolution_Importer_loadFile): remove dead args
* importer/evolution-importer-client.h: update/add protos
* importer/evolution-importer-client.c
(evolution_importer_client_create_control): wrapper
(evolution_importer_client_load_file): we don't take physical_uri
and folder_type as args any more
* importer/GNOME_Evolution_Importer.idl: add createControl method
and remove extraneous loadFile args
* e-shell-window-commands.c (command_import): uncomment
* e-shell-importer.h: update proto
* e-shell-importer.c: remove DEPRECATED hack and tidy includes
(get_iid_for_filetype): use query define
(start_import): we don't take a file name and client directly now
(create_plugin_menu): user query define
(importer_dest_page_new): create vbox
(import_druid_finish): we no longer do folder selection here
(next_file_page): create the client here
(prepare_dest_page): show the importer control
(next_dest_page): skip to the finish
(back_finish_page): back to the destination page
(e_shell_importer_start_import): set up the destination page
* Makefile.am: build import files again
svn path=/trunk/; revision=24619
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 38 | ||||
-rw-r--r-- | shell/Makefile.am | 2 | ||||
-rw-r--r-- | shell/e-shell-importer.c | 243 | ||||
-rw-r--r-- | shell/e-shell-importer.h | 2 | ||||
-rw-r--r-- | shell/e-shell-window-commands.c | 5 | ||||
-rw-r--r-- | shell/importer/GNOME_Evolution_Importer.idl | 6 | ||||
-rw-r--r-- | shell/importer/evolution-importer-client.c | 39 | ||||
-rw-r--r-- | shell/importer/evolution-importer-client.h | 6 | ||||
-rw-r--r-- | shell/importer/evolution-importer.c | 28 | ||||
-rw-r--r-- | shell/importer/evolution-importer.h | 18 | ||||
-rw-r--r-- | shell/importer/import.glade | 235 |
11 files changed, 354 insertions, 268 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 9195c3a89c..f940f124c5 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,43 @@ 2004-02-04 JP Rosevear <jpr@ximian.com> + * importer/import.glade: add extra page + + * importer/evolution-importer.h: update protos + + * importer/evolution-importer.c: hold the createControl function + (impl_GNOME_Evolution_Importer_createControl): implement + (impl_GNOME_Evolution_Importer_loadFile): remove dead args + + * importer/evolution-importer-client.h: update/add protos + + * importer/evolution-importer-client.c + (evolution_importer_client_create_control): wrapper + (evolution_importer_client_load_file): we don't take physical_uri + and folder_type as args any more + + * importer/GNOME_Evolution_Importer.idl: add createControl method + and remove extraneous loadFile args + + * e-shell-window-commands.c (command_import): uncomment + + * e-shell-importer.h: update proto + + * e-shell-importer.c: remove DEPRECATED hack and tidy includes + (get_iid_for_filetype): use query define + (start_import): we don't take a file name and client directly now + (create_plugin_menu): user query define + (importer_dest_page_new): create vbox + (import_druid_finish): we no longer do folder selection here + (next_file_page): create the client here + (prepare_dest_page): show the importer control + (next_dest_page): skip to the finish + (back_finish_page): back to the destination page + (e_shell_importer_start_import): set up the destination page + + * Makefile.am: build import files again + +2004-02-04 JP Rosevear <jpr@ximian.com> + * e-shell-view-menu[hc]: remove dead files 2004-02-04 JP Rosevear <jpr@ximian.com> diff --git a/shell/Makefile.am b/shell/Makefile.am index fc53ea164f..db789739a1 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -142,6 +142,8 @@ evolution_SOURCES = \ e-shell-folder-title-bar.h \ e-shell-offline-handler.c \ e-shell-offline-handler.h \ + e-shell-importer.c \ + e-shell-importer.h \ e-shell-settings-dialog.c \ e-shell-settings-dialog.h \ e-shell-startup-wizard.c \ diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index e34563eb03..8dd01c1c0d 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -24,9 +24,6 @@ #include <config.h> #endif -#undef GTK_DISABLE_DEPRECATED -#undef G_DISABLE_DEPRECATED - #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -46,9 +43,8 @@ #include <bonobo/bonobo-widget.h> #include "e-shell.h" -#include "e-shell-view.h" +#include "e-shell-window.h" #include "e-shell-constants.h" -#include "e-shell-folder-selection-dialog.h" #include "importer/evolution-importer-client.h" @@ -69,6 +65,10 @@ typedef struct _ImportDialogFilePage { gboolean need_filename; } ImportDialogFilePage; +typedef struct _ImportDialogDestPage { + GtkWidget *vbox; +} ImportDialogDestPage; + typedef struct _ImportDialogTypePage { GtkWidget *vbox; GtkWidget *intelligent; @@ -85,23 +85,27 @@ typedef struct _ImportDialogImporterPage { typedef struct _ImportData { EShell *shell; - EShellView *view; + EShellWindow *window; GladeXML *wizard; GtkWidget *dialog; GtkWidget *druid; + GtkWidget *control; ImportDialogFilePage *filepage; + ImportDialogDestPage *destpage; ImportDialogTypePage *typepage; ImportDialogImporterPage *importerpage; GtkWidget *filedialog; GtkWidget *typedialog; + GtkWidget *destdialog; GtkWidget *intelligent; GnomeDruidPageEdge *start; GnomeDruidPageEdge *finish; GtkWidget *vbox; char *choosen_iid; + EvolutionImporterClient *client; } ImportData; typedef struct _IntelligentImporterData { @@ -119,9 +123,9 @@ typedef struct _SelectedImporterData{ char *iid; } SelectedImporterData; -/* - #define IMPORTER_DEBUG -*/ +#define IMPORTER_REPO_ID_QUERY "repo_ids.has ('IDL:GNOME/Evolution/Importer:" BASE_VERSION "')" +#define IMPORTER_DEBUG + #ifdef IMPORTER_DEBUG #define IN g_print ("=====> %s (%d)\n", G_GNUC_FUNCTION, __LINE__) #define OUT g_print ("<==== %s (%d)\n", G_GNUC_FUNCTION, __LINE__) @@ -143,6 +147,9 @@ static struct { "You can select \"Automatic\" if you do not know, and " "Evolution will attempt to work it out.") }, + { "dest_html", + N_("Choose the destination for this import") + }, { "intelligent_html", N_("Please select the information that you would like to import:") }, @@ -369,7 +376,7 @@ get_iid_for_filetype (const char *filename) int i, len = 0; CORBA_exception_init (&ev); - info_list = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); + info_list = bonobo_activation_query (IMPORTER_REPO_ID_QUERY, NULL, &ev); for (i = 0; i < info_list->_length; i++) { CORBA_Environment ev2; @@ -447,14 +454,10 @@ show_error (const char *message, } static void -start_import (const char *physical_uri, - const char *filename, - const char *iid, - const char *folder_type) +start_import (const char *filename, EvolutionImporterClient *client) { ImporterComponentData *icd; char *label; - char *real_iid; struct stat buf; if (stat (filename, &buf) == -1) { @@ -467,24 +470,8 @@ start_import (const char *physical_uri, return; } - if (iid == NULL || strcmp (iid, "Automatic") == 0) { - /* Work out the component to use */ - real_iid = get_iid_for_filetype (filename); - } else { - real_iid = g_strdup (iid); - } - - if (real_iid == NULL) { - char *message; - - message = g_strdup_printf (_("There is no importer that is able to handle\n%s"), filename); - show_error (message, _("Evolution Error")); - g_free (message); - - return; - } - icd = g_new (ImporterComponentData, 1); + icd->client = g_object_ref (client); icd->stop = FALSE; icd->dialog = GTK_DIALOG (gtk_dialog_new_with_buttons(_("Importing"), NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -493,8 +480,7 @@ start_import (const char *physical_uri, g_object_weak_ref (G_OBJECT(icd->dialog), dialog_destroy_notify, icd); - label = g_strdup_printf (_("Importing %s.\nStarting %s"), - filename, real_iid); + label = g_strdup_printf (_("Importing %s.\n"), filename); icd->contents = gtk_label_new (label); g_free (label); @@ -502,23 +488,8 @@ start_import (const char *physical_uri, gtk_widget_show_all (GTK_WIDGET (icd->dialog)); while (gtk_events_pending ()) gtk_main_iteration (); - - icd->client = evolution_importer_client_new_from_id (real_iid); - if (icd->client == NULL) { - label = g_strdup_printf (_("Error starting %s"), real_iid); - g_free (real_iid); - gtk_label_set_text (GTK_LABEL (icd->contents), label); - g_free (label); - while (gtk_events_pending ()) - gtk_main_iteration (); - - g_object_unref (icd->dialog); - g_free (icd); - return; - } - g_free (real_iid); - if (evolution_importer_client_load_file (icd->client, filename, physical_uri, folder_type) == FALSE) { + if (evolution_importer_client_load_file (icd->client, filename) == FALSE) { label = g_strdup_printf (_("Error loading %s"), filename); show_error (label, _("Evolution Error")); @@ -595,7 +566,7 @@ create_plugin_menu (ImportData *data) gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); CORBA_exception_init (&ev); - info_list = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); + info_list = bonobo_activation_query (IMPORTER_REPO_ID_QUERY, NULL, &ev); for (i = 0; i < info_list->_length; i++) { const Bonobo_ServerInfo *info; char *name = NULL; @@ -671,6 +642,19 @@ importer_file_page_new (ImportData *data) return page; } + +static ImportDialogDestPage * +importer_dest_page_new (ImportData *data) +{ + ImportDialogDestPage *page; + + page = g_new0 (ImportDialogDestPage, 1); + + page->vbox = gtk_vbox_new (FALSE, 5); + + return page; +} + static ImportDialogTypePage * importer_type_page_new (ImportData *data) { @@ -930,36 +914,6 @@ import_druid_weak_notify (void *blah, } static void -folder_selected (EShellFolderSelectionDialog *dialog, - const char *path, - ImportData *data) -{ - EFolder *folder; - char *filename, *iid; - - iid = g_strdup (data->choosen_iid); - filename = gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (data->filepage->filename), FALSE); - - folder = e_storage_set_get_folder (e_shell_get_storage_set (data->shell), path); - g_assert (folder != NULL); - - gtk_widget_destroy (data->dialog); - gtk_widget_hide (GTK_WIDGET (dialog)); - - start_import (e_folder_get_physical_uri (folder), filename, iid, e_folder_get_type_string (folder)); - - g_free (iid); - g_free (filename); -} - -static void -folder_cancelled (EShellFolderSelectionDialog *dialog, - ImportData *data) -{ - gtk_widget_destroy (data->dialog); -} - -static void free_importers (ImportData *data) { GList *l; @@ -1050,26 +1004,17 @@ import_druid_finish (GnomeDruidPage *page, GnomeDruid *druid, ImportData *data) { - GtkWidget *folder; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->typepage->intelligent))) { do_import (data); - gtk_widget_destroy (data->dialog); } else { - folder = e_shell_folder_selection_dialog_new (data->shell, - _("Select folder"), - _("Select a destination folder for importing this data"), - e_shell_view_get_current_uri (data->view), - NULL, TRUE); - - g_signal_connect (folder, "folder_selected", - G_CALLBACK (folder_selected), data); - g_signal_connect (folder, "cancelled", - G_CALLBACK (folder_cancelled), data); - - gtk_widget_hide (data->dialog); - gtk_widget_show (folder); + char *filename; + + filename = gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (data->filepage->filename), FALSE); + start_import (filename, data->client); + g_free (filename); } + + gtk_widget_destroy (data->dialog); } static gboolean @@ -1088,16 +1033,65 @@ next_file_page (GnomeDruidPage *page, GnomeDruid *druid, ImportData *data) { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->finish)); - return TRUE; + char *real_iid = NULL; + + if (data->choosen_iid == NULL || strcmp (data->choosen_iid, "Automatic") == 0) { + char *filename; + + /* Work out the component to use */ + + /* FIXME Would should carry around the filename probably */ + filename = gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (data->filepage->filename), FALSE); + real_iid = get_iid_for_filetype (filename); + g_free (filename); + } else { + real_iid = g_strdup (data->choosen_iid); + } + + if (!real_iid) { + g_message ("No iid"); + gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog)); + + return TRUE; + } + + if (data->client) + g_object_unref (data->client); + data->client = evolution_importer_client_new_from_id (real_iid); + g_free (real_iid); + + if (!data->client) { + g_message ("No importer"); + gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog)); + + return TRUE; + } + + g_message ("Success"); + return FALSE; } static gboolean -back_file_page (GnomeDruidPage *page, +prepare_dest_page (GnomeDruidPage *page, + GnomeDruid *druid, + ImportData *data) +{ + /* Add the widget */ + if (data->control) + gtk_container_remove (GTK_CONTAINER (data->destpage->vbox), data->control); + data->control = evolution_importer_client_create_control (data->client); + gtk_container_add (GTK_CONTAINER (data->destpage->vbox), data->control); + gtk_widget_show_all (data->destpage->vbox); + + return FALSE; +} + +static gboolean +next_dest_page (GnomeDruidPage *page, GnomeDruid *druid, ImportData *data) { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->typedialog)); + gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->finish)); return TRUE; } @@ -1127,7 +1121,7 @@ back_finish_page (GnomeDruidPage *page, gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->typedialog)); } } else { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog)); + gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->destdialog)); } return TRUE; @@ -1142,15 +1136,6 @@ back_intelligent_page (GnomeDruidPage *page, return TRUE; } -static gboolean -next_intelligent_page (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) -{ - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->finish)); - return TRUE; -} - static void dialog_weak_notify (void *data, GObject *where_the_dialog_was) @@ -1161,7 +1146,7 @@ dialog_weak_notify (void *data, } void -e_shell_importer_start_import (void) +e_shell_importer_start_import (EShellWindow *shell_window) { ImportData *data = g_new0 (ImportData, 1); GtkWidget *html; @@ -1172,14 +1157,14 @@ e_shell_importer_start_import (void) } dialog_open = TRUE; - data->view = E_SHELL_VIEW (user_data); - data->shell = e_shell_view_get_shell (data->view); + data->window = shell_window; + data->shell = e_shell_window_peek_shell (data->window); data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/import.glade", NULL, NULL); data->dialog = glade_xml_get_widget (data->wizard, "importwizard"); gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "importdruid", "Evolution:shell"); - gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (user_data)); + gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (shell_window)); g_object_weak_ref ((GObject *)data->dialog, dialog_weak_notify, &dialog_open); data->druid = glade_xml_get_widget (data->wizard, "druid1"); @@ -1189,8 +1174,10 @@ e_shell_importer_start_import (void) gtk_button_set_use_underline ((GtkButton *)((GnomeDruid *)data->druid)->finish, TRUE); gtk_button_set_label((GtkButton *)((GnomeDruid *)data->druid)->finish, _("_Import")); + /* Start page */ data->start = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page0")); + /* Intelligent or direct import page */ data->typedialog = glade_xml_get_widget (data->wizard, "page1"); g_signal_connect (data->typedialog, "next", G_CALLBACK (next_type_page), data); @@ -1201,9 +1188,8 @@ e_shell_importer_start_import (void) gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->typedialog)->vbox), data->typepage->vbox, TRUE, TRUE, 0); + /* Intelligent importer source page */ data->intelligent = glade_xml_get_widget (data->wizard, "page2-intelligent"); - g_signal_connect (data->intelligent, "next", - G_CALLBACK (next_intelligent_page), data); g_signal_connect (data->intelligent, "back", G_CALLBACK (back_intelligent_page), data); g_signal_connect_after (data->intelligent, "prepare", @@ -1217,18 +1203,12 @@ e_shell_importer_start_import (void) 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"); 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); - g_signal_connect (data->filedialog, "back", - G_CALLBACK (back_file_page), data); - - data->finish = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page3")); - g_signal_connect (data->finish, "back", - G_CALLBACK (back_finish_page), data); - data->filepage = importer_file_page_new (data); html = create_help ("file_html"); @@ -1237,7 +1217,22 @@ e_shell_importer_start_import (void) gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->filedialog)->vbox), data->filepage->vbox, TRUE, TRUE, 0); + /* 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); + /* Finish page */ + data->finish = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page4")); + g_signal_connect (data->finish, "back", + G_CALLBACK (back_finish_page), data); + g_signal_connect (data->finish, "finish", G_CALLBACK (import_druid_finish), data); diff --git a/shell/e-shell-importer.h b/shell/e-shell-importer.h index 3e139dc846..4b3d79acf9 100644 --- a/shell/e-shell-importer.h +++ b/shell/e-shell-importer.h @@ -23,6 +23,6 @@ #ifndef _E_SHELL_IMPORTER_H_ #define _E_SHELL_IMPORTER_H_ -void e_shell_importer_start_import (void); +void e_shell_importer_start_import (EShellWindow *shell_window); #endif diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c index 9640d86a0d..2154fc387b 100644 --- a/shell/e-shell-window-commands.c +++ b/shell/e-shell-window-commands.c @@ -27,6 +27,7 @@ #include "e-shell-window-commands.h" #include "e-shell-about-box.h" +#include "e-shell-importer.h" #include "e-shell-window.h" #include "evolution-shell-component-utils.h" @@ -75,9 +76,7 @@ command_import (BonoboUIComponent *uih, EShellWindow *window, const char *path) { - g_warning ("Import not implemented!"); - - /* e_shell_importer_start_import (); FIXME TODO */ + e_shell_importer_start_import (window); } static void diff --git a/shell/importer/GNOME_Evolution_Importer.idl b/shell/importer/GNOME_Evolution_Importer.idl index 775ba47377..e33ca150ae 100644 --- a/shell/importer/GNOME_Evolution_Importer.idl +++ b/shell/importer/GNOME_Evolution_Importer.idl @@ -56,6 +56,8 @@ module Evolution { */ string getError (); + void createControl (out Bonobo::Control control); + /** * supportFormat: * @filename: The filename of the file. @@ -79,9 +81,7 @@ module Evolution { * * Returns: An Importer object. */ - boolean loadFile (in string filename, - in string folderpath, - in string foldertype); + boolean loadFile (in string filename); }; interface IntelligentImporter : Bonobo::Unknown { diff --git a/shell/importer/evolution-importer-client.c b/shell/importer/evolution-importer-client.c index 1f6807b3c8..78a3e551f8 100644 --- a/shell/importer/evolution-importer-client.c +++ b/shell/importer/evolution-importer-client.c @@ -30,6 +30,8 @@ #include <glib.h> #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-main.h> +#include <bonobo/bonobo-widget.h> +#include <bonobo/bonobo-exception.h> #include <gal/util/e-util.h> #include "GNOME_Evolution_Importer.h" @@ -117,6 +119,32 @@ evolution_importer_client_new_from_id (const char *id) } /* API */ +GtkWidget * +evolution_importer_client_create_control (EvolutionImporterClient *client) +{ + GNOME_Evolution_Importer corba_importer; + GtkWidget *widget = NULL; + Bonobo_Control control; + CORBA_Environment ev; + + g_return_val_if_fail (client != NULL, FALSE); + g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), FALSE); + + CORBA_exception_init (&ev); + corba_importer = client->objref; + GNOME_Evolution_Importer_createControl (corba_importer, &control, &ev); + + if (!BONOBO_EX (&ev)) { + /* FIXME Pass in container? */ + widget = bonobo_widget_new_control_from_objref (control, NULL); + gtk_widget_show (widget); + } + + CORBA_exception_free (&ev); + + return widget; +} + /** * evolution_importer_client_support_format: * @client: The EvolutionImporterClient. @@ -159,10 +187,7 @@ evolution_importer_client_support_format (EvolutionImporterClient *client, * Returns: TRUE on sucess, FALSE on failure. */ gboolean -evolution_importer_client_load_file (EvolutionImporterClient *client, - const char *filename, - const char *physical_uri, - const char *folder_type) +evolution_importer_client_load_file (EvolutionImporterClient *client, const char *filename) { GNOME_Evolution_Importer corba_importer; gboolean result; @@ -174,11 +199,7 @@ evolution_importer_client_load_file (EvolutionImporterClient *client, CORBA_exception_init (&ev); corba_importer = client->objref; - result = GNOME_Evolution_Importer_loadFile (corba_importer, - filename, - physical_uri ? physical_uri : "", - folder_type ? folder_type : "", - &ev); + result = GNOME_Evolution_Importer_loadFile (corba_importer, filename, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("Oh there *WAS* an exception.\nIt was %s", CORBA_exception_id (&ev)); diff --git a/shell/importer/evolution-importer-client.h b/shell/importer/evolution-importer-client.h index 46b38e851a..449ab4ce4b 100644 --- a/shell/importer/evolution-importer-client.h +++ b/shell/importer/evolution-importer-client.h @@ -24,6 +24,7 @@ #define EVOLUTION_IMPORTER_CLIENT_H #include <glib.h> +#include <gtk/gtkwidget.h> #include <importer/evolution-importer.h> #include <importer/evolution-importer-listener.h> @@ -57,12 +58,11 @@ GType evolution_importer_client_get_type (void); EvolutionImporterClient *evolution_importer_client_new (const CORBA_Object objref); EvolutionImporterClient *evolution_importer_client_new_from_id (const char *id); +GtkWidget *evolution_importer_client_create_control (EvolutionImporterClient *client); gboolean evolution_importer_client_support_format (EvolutionImporterClient *client, const char *filename); gboolean evolution_importer_client_load_file (EvolutionImporterClient *client, - const char *filename, - const char *physical_uri, - const char *folder_type); + const char *filename); void evolution_importer_client_process_item (EvolutionImporterClient *client, EvolutionImporterListener *listener); const char *evolution_importer_client_get_error (EvolutionImporterClient *client); diff --git a/shell/importer/evolution-importer.c b/shell/importer/evolution-importer.c index cd419b4ca9..430e1b2da8 100644 --- a/shell/importer/evolution-importer.c +++ b/shell/importer/evolution-importer.c @@ -35,6 +35,7 @@ static BonoboObjectClass *parent_class = NULL; struct _EvolutionImporterPrivate { + EvolutionImporterCreateControlFn create_control_fn; EvolutionImporterLoadFileFn load_file_fn; EvolutionImporterSupportFormatFn support_format_fn; EvolutionImporterProcessItemFn process_item_fn; @@ -50,6 +51,21 @@ evolution_importer_from_servant (PortableServer_Servant servant) return EVOLUTION_IMPORTER (bonobo_object_from_servant (servant)); } +static void +impl_GNOME_Evolution_Importer_createControl (PortableServer_Servant servant, + Bonobo_Control *control, + CORBA_Environment *ev) +{ + EvolutionImporter *importer; + EvolutionImporterPrivate *priv; + + importer = evolution_importer_from_servant (servant); + priv = importer->priv; + + if (priv->create_control_fn != NULL) + (priv->create_control_fn) (importer, control, priv->closure); +} + static CORBA_boolean impl_GNOME_Evolution_Importer_supportFormat (PortableServer_Servant servant, const CORBA_char *filename, @@ -71,8 +87,6 @@ impl_GNOME_Evolution_Importer_supportFormat (PortableServer_Servant servant, static CORBA_boolean impl_GNOME_Evolution_Importer_loadFile (PortableServer_Servant servant, const CORBA_char *filename, - const CORBA_char *physical_uri, - const CORBA_char *folder_type, CORBA_Environment *ev) { EvolutionImporter *importer; @@ -82,7 +96,7 @@ impl_GNOME_Evolution_Importer_loadFile (PortableServer_Servant servant, priv = importer->priv; if (priv->load_file_fn != NULL) - return (priv->load_file_fn) (importer, filename, physical_uri, folder_type, priv->closure); + return (priv->load_file_fn) (importer, filename, priv->closure); else return FALSE; } @@ -152,6 +166,7 @@ evolution_importer_class_init (EvolutionImporterClass *klass) object_class->finalize = finalise; parent_class = g_type_class_ref(PARENT_TYPE); + epv->createControl = impl_GNOME_Evolution_Importer_createControl; epv->supportFormat = impl_GNOME_Evolution_Importer_supportFormat; epv->loadFile = impl_GNOME_Evolution_Importer_loadFile; epv->processItem = impl_GNOME_Evolution_Importer_processItem; @@ -172,6 +187,7 @@ evolution_importer_init (EvolutionImporter *importer) static void evolution_importer_construct (EvolutionImporter *importer, + EvolutionImporterCreateControlFn create_control_fn, EvolutionImporterSupportFormatFn support_format_fn, EvolutionImporterLoadFileFn load_file_fn, EvolutionImporterProcessItemFn process_item_fn, @@ -187,6 +203,7 @@ evolution_importer_construct (EvolutionImporter *importer, g_return_if_fail (process_item_fn != NULL); priv = importer->priv; + priv->create_control_fn = create_control_fn; priv->support_format_fn = support_format_fn; priv->load_file_fn = load_file_fn; priv->process_item_fn = process_item_fn; @@ -209,7 +226,8 @@ evolution_importer_construct (EvolutionImporter *importer, * Returns: A newly created EvolutionImporter object. */ EvolutionImporter * -evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, +evolution_importer_new (EvolutionImporterCreateControlFn create_control_fn, + EvolutionImporterSupportFormatFn support_format_fn, EvolutionImporterLoadFileFn load_file_fn, EvolutionImporterProcessItemFn process_item_fn, EvolutionImporterGetErrorFn get_error_fn, @@ -218,7 +236,7 @@ evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, EvolutionImporter *importer; importer = g_object_new(evolution_importer_get_type (), NULL); - evolution_importer_construct (importer, support_format_fn, load_file_fn, + evolution_importer_construct (importer, create_control_fn, support_format_fn, load_file_fn, process_item_fn, get_error_fn, closure); return importer; } diff --git a/shell/importer/evolution-importer.h b/shell/importer/evolution-importer.h index d2fd94be0f..5fc5edc34d 100644 --- a/shell/importer/evolution-importer.h +++ b/shell/importer/evolution-importer.h @@ -42,13 +42,15 @@ typedef struct _EvolutionImporter EvolutionImporter; typedef struct _EvolutionImporterPrivate EvolutionImporterPrivate; typedef struct _EvolutionImporterClass EvolutionImporterClass; +typedef void (* EvolutionImporterCreateControlFn) (EvolutionImporter *importer, + Bonobo_Control *control, + void *closure); + typedef gboolean (* EvolutionImporterSupportFormatFn) (EvolutionImporter *importer, const char *filename, void *closure); typedef gboolean (* EvolutionImporterLoadFileFn) (EvolutionImporter *importer, const char *filename, - const char *physical_uri, - const char *folder_type, void *closure); typedef void (* EvolutionImporterProcessItemFn) (EvolutionImporter *importer, CORBA_Object listener, @@ -83,11 +85,13 @@ struct _EvolutionImporterClass { GType evolution_importer_get_type (void); -EvolutionImporter *evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, - EvolutionImporterLoadFileFn load_file_fn, - EvolutionImporterProcessItemFn process_item_fn, - EvolutionImporterGetErrorFn get_error_fn, - void *closure); +EvolutionImporter *evolution_importer_new (EvolutionImporterCreateControlFn create_control_fn, + EvolutionImporterSupportFormatFn support_format_fn, + EvolutionImporterLoadFileFn load_file_fn, + EvolutionImporterProcessItemFn process_item_fn, + EvolutionImporterGetErrorFn get_error_fn, + void *closure); + #ifdef __cplusplus } diff --git a/shell/importer/import.glade b/shell/importer/import.glade index 27bcd2decb..d0e1106a3a 100644 --- a/shell/importer/import.glade +++ b/shell/importer/import.glade @@ -1,119 +1,128 @@ <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" > +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> - <requires lib="gnome" /> - - <widget class="GtkWindow" id="importwizard"> - <property name="visible">no</property> - <property name="title" translatable="yes">Evolution Import Assistant</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="allow_shrink">no</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child> - <widget class="GnomeDruid" id="druid1"> - <property name="visible">yes</property> - - <child> - <widget class="GnomeDruidPageEdge" id="page0"> - <property name="title" translatable="yes">Evolution Import Assistant</property> - <property name="text" translatable="yes">Welcome to the Evolution Import Assistant. +<requires lib="gnome"/> + +<widget class="GtkWindow" id="importwizard"> + <property name="title" translatable="yes">Evolution Import Assistant</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + + <child> + <widget class="GnomeDruid" id="druid1"> + <property name="border_width">4</property> + <property name="visible">True</property> + <property name="show_help">False</property> + + <child> + <widget class="GnomeDruidPageEdge" id="page0"> + <property name="visible">True</property> + <property name="position">GNOME_EDGE_START</property> + <property name="title" translatable="yes">Evolution Import Assistant</property> + <property name="text" translatable="yes">Welcome to the Evolution Import Assistant. With this assistant you will be guided through the process of importing external files into Evolution.</property> - <property name="logo_image">import.png</property> - <property name="position">GNOME_EDGE_START</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="page1"> - <property name="title" translatable="yes">Importer Type (step 1 of 3)</property> - <property name="logo">import.png</property> - <property name="visible">yes</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox2"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="page2-file"> - <property name="title" translatable="yes">Select a File (step 2 of 3)</property> - <property name="logo">import.png</property> - <property name="visible">yes</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox1"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="page2-intelligent"> - <property name="title" translatable="yes">Select Importers (step 2 of 3)</property> - <property name="logo">import.png</property> - <property name="visible">yes</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox3"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageEdge" id="page3"> - <property name="title" translatable="yes">Import File (step 3 of 3)</property> - <property name="text" translatable="yes">Click "Import" to begin importing the file into Evolution. </property> - <property name="logo_image">import.png</property> - <property name="position">GNOME_EDGE_FINISH</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - </widget> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageStandard" id="page1"> + <property name="visible">True</property> + <property name="title" translatable="yes">Importer Type (step 1 of 3)</property> + <property name="logo">import.png</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="druid-vbox2"> + <property name="border_width">16</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageStandard" id="page2-file"> + <property name="visible">True</property> + <property name="title" translatable="yes">Select a File (step 2 of 3)</property> + <property name="logo">import.png</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="druid-vbox1"> + <property name="border_width">16</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageStandard" id="page3-file"> + <property name="visible">True</property> + <property name="title" translatable="yes">Import to...</property> + <property name="logo">import.png</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="druid-vbox3"> + <property name="border_width">16</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageStandard" id="page2-intelligent"> + <property name="visible">True</property> + <property name="title" translatable="yes">Select Importers (step 2 of 3)</property> + <property name="logo">import.png</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="druid-vbox3"> + <property name="border_width">16</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageEdge" id="page4"> + <property name="visible">True</property> + <property name="position">GNOME_EDGE_FINISH</property> + <property name="title" translatable="yes">Import File (step 3 of 3)</property> + <property name="text" translatable="yes">Click "Import" to begin importing the file into Evolution. </property> + </widget> + </child> + </widget> + </child> +</widget> + </glade-interface> |