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/importer | |
parent | 8360a36e2d24298cdbc5ad7d13c81b8b76f2a3e0 (diff) | |
download | gsoc2013-evolution-7a316616d6857334adcca14ae0cd8029128cb672.tar.gz 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/importer')
-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 |
6 files changed, 192 insertions, 140 deletions
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> |