aboutsummaryrefslogtreecommitdiffstats
path: root/shell/importer
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-03-23 10:09:29 +0800
committerIain Holmes <iain@src.gnome.org>2001-03-23 10:09:29 +0800
commit35c7cc901818b753634113241f1d85231d4624c3 (patch)
tree36c225a7d4a2ed0f4f4ba6931fda38827134e1fe /shell/importer
parent01e19198a88f491251dd2c3d824bd771eebc3e3e (diff)
downloadgsoc2013-evolution-35c7cc901818b753634113241f1d85231d4624c3.tar
gsoc2013-evolution-35c7cc901818b753634113241f1d85231d4624c3.tar.gz
gsoc2013-evolution-35c7cc901818b753634113241f1d85231d4624c3.tar.bz2
gsoc2013-evolution-35c7cc901818b753634113241f1d85231d4624c3.tar.lz
gsoc2013-evolution-35c7cc901818b753634113241f1d85231d4624c3.tar.xz
gsoc2013-evolution-35c7cc901818b753634113241f1d85231d4624c3.tar.zst
gsoc2013-evolution-35c7cc901818b753634113241f1d85231d4624c3.zip
Fix some warnings, Allow the importers to import into any folder. Update
Fix some warnings, Allow the importers to import into any folder. Update all importers for this change. Don't emit the create_folder callback if the folder to be created already exists. This should fix the libibex crash when importing. svn path=/trunk/; revision=8912
Diffstat (limited to 'shell/importer')
-rw-r--r--shell/importer/GNOME_Evolution_Importer.idl4
-rw-r--r--shell/importer/evolution-importer-client.c6
-rw-r--r--shell/importer/evolution-importer-client.h3
-rw-r--r--shell/importer/evolution-importer-listener.c8
-rw-r--r--shell/importer/evolution-importer.c4
-rw-r--r--shell/importer/evolution-importer.h1
-rw-r--r--shell/importer/importer.c20
7 files changed, 33 insertions, 13 deletions
diff --git a/shell/importer/GNOME_Evolution_Importer.idl b/shell/importer/GNOME_Evolution_Importer.idl
index 7dec5e7e0c..adeb900dde 100644
--- a/shell/importer/GNOME_Evolution_Importer.idl
+++ b/shell/importer/GNOME_Evolution_Importer.idl
@@ -71,13 +71,15 @@ module Evolution {
/**
* loadFile:
* @filename: The filename of the file.
+ * @folderpath: The full pathname to the folder.
*
* Loads the file and prepares an Importer object that can
* process files of this type.
*
* Returns: An Importer object.
*/
- boolean loadFile (in string filename);
+ boolean loadFile (in string filename,
+ in string folderpath);
};
interface IntelligentImporter : Bonobo::Unknown {
diff --git a/shell/importer/evolution-importer-client.c b/shell/importer/evolution-importer-client.c
index 9b3bc3490f..34598227a1 100644
--- a/shell/importer/evolution-importer-client.c
+++ b/shell/importer/evolution-importer-client.c
@@ -162,6 +162,7 @@ evolution_importer_client_support_format (EvolutionImporterClient *client,
* evolution_importer_client_load_file:
* @client: The EvolutionImporterClient.
* @filename: The file to load.
+ * @folderpath: The full path to the folder, or NULL for Inbox.
*
* Loads and initialises the importer.
*
@@ -169,7 +170,8 @@ evolution_importer_client_support_format (EvolutionImporterClient *client,
*/
gboolean
evolution_importer_client_load_file (EvolutionImporterClient *client,
- const char *filename)
+ const char *filename,
+ const char *folderpath)
{
GNOME_Evolution_Importer corba_importer;
gboolean result;
@@ -182,7 +184,7 @@ evolution_importer_client_load_file (EvolutionImporterClient *client,
CORBA_exception_init (&ev);
corba_importer = bonobo_object_corba_objref (BONOBO_OBJECT (client));
result = GNOME_Evolution_Importer_loadFile (corba_importer,
- filename, &ev);
+ filename, folderpath, &ev);
CORBA_exception_free (&ev);
return result;
diff --git a/shell/importer/evolution-importer-client.h b/shell/importer/evolution-importer-client.h
index 178d20254f..e9a343dc80 100644
--- a/shell/importer/evolution-importer-client.h
+++ b/shell/importer/evolution-importer-client.h
@@ -59,7 +59,8 @@ EvolutionImporterClient *evolution_importer_client_new_from_id (const char *id);
gboolean evolution_importer_client_support_format (EvolutionImporterClient *client,
const char *filename);
gboolean evolution_importer_client_load_file (EvolutionImporterClient *client,
- const char *filename);
+ const char *filename,
+ const char *folderpath);
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-listener.c b/shell/importer/evolution-importer-listener.c
index 62dc35b19c..84d6ad22b3 100644
--- a/shell/importer/evolution-importer-listener.c
+++ b/shell/importer/evolution-importer-listener.c
@@ -185,7 +185,6 @@ evolution_importer_listener_init (EvolutionImporterListener *listener)
static void
evolution_importer_listener_construct (EvolutionImporterListener *listener,
- GNOME_Evolution_ImporterListener corba_object,
EvolutionImporterListenerCallback callback,
void *closure)
{
@@ -193,14 +192,11 @@ evolution_importer_listener_construct (EvolutionImporterListener *listener,
g_return_if_fail (listener != NULL);
g_return_if_fail (EVOLUTION_IS_IMPORTER_LISTENER (listener));
- g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
g_return_if_fail (callback != NULL);
priv = listener->priv;
priv->callback = callback;
priv->closure = closure;
-
- bonobo_object_construct (BONOBO_OBJECT (listener), corba_object);
}
/**
@@ -217,12 +213,10 @@ evolution_importer_listener_new (EvolutionImporterListenerCallback callback,
void *closure)
{
EvolutionImporterListener *listener;
- GNOME_Evolution_ImporterListener corba_object;
listener = gtk_type_new (evolution_importer_listener_get_type ());
- evolution_importer_listener_construct (listener, corba_object,
- callback, closure);
+ evolution_importer_listener_construct (listener, callback, closure);
return listener;
}
diff --git a/shell/importer/evolution-importer.c b/shell/importer/evolution-importer.c
index c48390c9e5..af3acf487b 100644
--- a/shell/importer/evolution-importer.c
+++ b/shell/importer/evolution-importer.c
@@ -72,6 +72,7 @@ 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 *folderpath,
CORBA_Environment *ev)
{
EvolutionImporter *importer;
@@ -81,7 +82,8 @@ impl_GNOME_Evolution_Importer_loadFile (PortableServer_Servant servant,
priv = importer->priv;
if (priv->load_file_fn != NULL)
- return (priv->load_file_fn) (importer, filename, priv->closure);
+ return (priv->load_file_fn) (importer, filename,
+ folderpath, priv->closure);
else
return FALSE;
}
diff --git a/shell/importer/evolution-importer.h b/shell/importer/evolution-importer.h
index a5f6e07e87..3df870bbf3 100644
--- a/shell/importer/evolution-importer.h
+++ b/shell/importer/evolution-importer.h
@@ -47,6 +47,7 @@ typedef gboolean (* EvolutionImporterSupportFormatFn) (EvolutionImporter *import
void *closure);
typedef gboolean (* EvolutionImporterLoadFileFn) (EvolutionImporter *importer,
const char *filename,
+ const char *folderpath,
void *closure);
typedef void (* EvolutionImporterProcessItemFn) (EvolutionImporter *importer,
CORBA_Object listener,
diff --git a/shell/importer/importer.c b/shell/importer/importer.c
index 5286a1b04d..a82bf72db2 100644
--- a/shell/importer/importer.c
+++ b/shell/importer/importer.c
@@ -60,6 +60,15 @@ typedef struct _ImportData {
char *choosen_iid;
} ImportData;
+#define IMPORTER_DEBUG
+#ifdef IMPORTER_DEBUG
+#define IN g_print ("=====> %s (%d)\n", __FUNCTION__, __LINE__)
+#define OUT g_print ("<==== %s (%d)\n", __FUNCTION__, __LINE__)
+#else
+#define IN
+#define OUT
+#endif
+
/* Some HTML helper functions from mail/mail-config-gui.c */
static void
html_size_req (GtkWidget *widget,
@@ -149,6 +158,7 @@ import_cb (EvolutionImporterListener *listener,
ImporterComponentData *icd = (ImporterComponentData *) data;
char *label;
+ IN;
if (icd->stop != TRUE) {
if (result == EVOLUTION_IMPORTER_NOT_READY) {
/* Importer isn't ready yet.
@@ -163,11 +173,13 @@ import_cb (EvolutionImporterListener *listener,
gtk_main_iteration ();
gtk_timeout_add (5000, importer_timeout_fn, data);
+ OUT;
return;
}
if (result == EVOLUTION_IMPORTER_BUSY) {
gtk_timeout_add (5000, importer_timeout_fn, data);
+ OUT;
return;
}
@@ -181,6 +193,7 @@ import_cb (EvolutionImporterListener *listener,
g_idle_add_full (G_PRIORITY_LOW, importer_timeout_fn,
data, NULL);
+ OUT;
return;
}
}
@@ -191,6 +204,8 @@ import_cb (EvolutionImporterListener *listener,
bonobo_object_unref (BONOBO_OBJECT (icd->listener));
bonobo_object_unref (BONOBO_OBJECT (icd->client));
g_free (icd);
+
+ OUT;
}
static gboolean
@@ -199,6 +214,7 @@ importer_timeout_fn (gpointer data)
ImporterComponentData *icd = (ImporterComponentData *) data;
char *label;
+ IN;
label = g_strdup_printf (_("Importing %s\nImporting item %d."),
icd->filename, icd->item);
gtk_label_set_text (GTK_LABEL (icd->contents), label);
@@ -207,6 +223,7 @@ importer_timeout_fn (gpointer data)
gtk_main_iteration ();
evolution_importer_client_process_item (icd->client, icd->listener);
+ OUT;
return FALSE;
}
@@ -338,7 +355,8 @@ start_import (const char *filename,
icd->client = evolution_importer_client_new_from_id (real_iid);
g_free (real_iid);
- if (evolution_importer_client_load_file (icd->client, filename) == FALSE) {
+ /* NULL for folderpath means use Inbox */
+ if (evolution_importer_client_load_file (icd->client, filename, NULL) == FALSE) {
label = g_strdup_printf (_("Error loading %s"), filename);
gtk_label_set_text (GTK_LABEL (icd->contents), label);
g_free (label);