aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog5
-rw-r--r--addressbook/backend/ebook/evolution-gnomecard-importer.c1
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/importers/Makefile.am8
-rw-r--r--mail/importers/evolution-mbox-importer.c6
-rw-r--r--mail/importers/evolution-outlook-importer.c6
-rw-r--r--mail/importers/netscape-importer.c14
-rw-r--r--shell/ChangeLog19
-rw-r--r--shell/e-local-storage.c79
-rw-r--r--shell/e-storage.h3
-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
17 files changed, 152 insertions, 43 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 2e127a6751..5ede0f8bfd 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-22 Iain Holmes <iain@ximian.com>
+
+ * backend/ebook/evolution-gnomecard-importer.c: Update to the new
+ IDL.
+
2001-03-20 Miguel de Icaza <miguel@ximian.com>
* gui/component/addressbook.c (update_pixmaps): Added artwork from
diff --git a/addressbook/backend/ebook/evolution-gnomecard-importer.c b/addressbook/backend/ebook/evolution-gnomecard-importer.c
index 508f1fe16a..42ab35d223 100644
--- a/addressbook/backend/ebook/evolution-gnomecard-importer.c
+++ b/addressbook/backend/ebook/evolution-gnomecard-importer.c
@@ -141,6 +141,7 @@ importer_destroy_cb (GtkObject *object,
static gboolean
load_file_fn (EvolutionImporter *importer,
const char *filename,
+ const char *folderpath,
void *closure)
{
GnomeCardImporter *gci;
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ae7bf1a4e4..28206eac84 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2001-03-22 Iain Holmes <iain@ximian.com>
+
+ * importers/evolution-outlook-importer.c: Update for new IDL.
+
+ * importers/evolution-mbox-importer.c: Update for new IDL.
+
+ * importers/Makefile.am: Build the elm importer.
+
2001-03-22 Jeffrey Stedfast <fejj@ximian.com>
* mail-accounts.c (mail_double_click): New callback to handle a
diff --git a/mail/importers/Makefile.am b/mail/importers/Makefile.am
index ee26f19215..f93115f950 100644
--- a/mail/importers/Makefile.am
+++ b/mail/importers/Makefile.am
@@ -1,7 +1,7 @@
importersdir = $(pkglibdir)/evolution-mail-importers/$(VERSION)
importers_LTLIBRARIES = liboutlook.la libmbox.la libiinetscape.la \
- libiipine.la
+ libiipine.la libiielm.la
INCLUDES = -I.. \
-I$(srcdir)/.. \
@@ -25,11 +25,15 @@ libiinetscape_la_LDFLAGS = -version-info 0:0:0
libiipine_la_SOURCES = pine-importer.c
libiipine_la_LDFLAGS = -version-info 0:0:0
+libiielm_la_SOURCES = elm-importer.c
+libiielm_la_LDFLAGS = -version-info 0:0:0
+
oafdir = $(datadir)/oaf
oaf_in_files = GNOME_Evolution_Mail_Mbox_Importer.oaf.in \
GNOME_Evolution_Mail_Outlook_Importer.oaf.in \
GNOME_Evolution_Mail_Netscape_Intelligent_Importer.oaf.in \
- GNOME_Evolution_Mail_Pine_Intelligent_Importer.oaf.in
+ GNOME_Evolution_Mail_Pine_Intelligent_Importer.oaf.in \
+ GNOME_Evolution_Mail_Elm_Intelligent_Importer.oaf.in
oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index b39691f0dc..aa701d9f25 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -171,6 +171,7 @@ importer_destroy_cb (GtkObject *object,
static gboolean
load_file_fn (EvolutionImporter *eimporter,
const char *filename,
+ const char *folderpath,
void *closure)
{
MboxImporter *mbi;
@@ -196,7 +197,10 @@ load_file_fn (EvolutionImporter *eimporter,
}
importer->mstream = NULL;
- importer->folder = mail_tool_get_local_inbox (NULL);
+ if (folderpath == NULL)
+ importer->folder = mail_tool_get_local_inbox (NULL);
+ else
+ importer->folder = mail_tool_uri_to_folder (folderpath, NULL);
if (importer->folder == NULL){
g_print ("Bad folder\n");
diff --git a/mail/importers/evolution-outlook-importer.c b/mail/importers/evolution-outlook-importer.c
index a92f5086ab..7f8a361697 100644
--- a/mail/importers/evolution-outlook-importer.c
+++ b/mail/importers/evolution-outlook-importer.c
@@ -218,6 +218,7 @@ importer_destroy_cb (GtkObject *object,
static gboolean
load_file_fn (EvolutionImporter *eimporter,
const char *filename,
+ const char *folderpath,
void *closure)
{
OutlookImporter *oli;
@@ -256,7 +257,10 @@ load_file_fn (EvolutionImporter *eimporter,
importer->mstream = NULL;
- importer->folder = mail_tool_get_local_inbox (NULL);
+ if (folderpath == NULL)
+ importer->folder = mail_tool_get_local_inbox (NULL);
+ else
+ importer->folder = mail_tool_uri_to_folder (folderpath);
if (importer->folder == NULL){
g_warning ("Bad folder");
diff --git a/mail/importers/netscape-importer.c b/mail/importers/netscape-importer.c
index 8752ce4de9..9a6ec5eac9 100644
--- a/mail/importers/netscape-importer.c
+++ b/mail/importers/netscape-importer.c
@@ -44,6 +44,8 @@
#include <importer/evolution-intelligent-importer.h>
#include <importer/GNOME_Evolution_Importer.h>
+#include <evolution-storage.h>
+
#include "mail-importer.h"
#include "mail-tools.h"
@@ -52,6 +54,7 @@ static char *nsmail_dir = NULL;
extern char *evolution_dir;
#define NETSCAPE_INTELLIGENT_IMPORTER_IID "OAFIID:GNOME_Evolution_Mail_Netscape_Intelligent_Importer_Factory"
+#define MBOX_IMPORTER_IID "OAFIID:GNOME_Evolution_Mail_Mbox_ImporterFactory"
#define KEY "netscape-mail-imported"
/*#define SUPER_IMPORTER_DEBUG*/
@@ -229,7 +232,7 @@ netscape_import_file (NetscapeImporter *importer,
char *protocol;
CamelException *ex;
CamelFolder *folder;
-
+
/* Do import */
d(g_warning ("Importing %s as %s\n", filename, fullpath));
@@ -242,6 +245,8 @@ netscape_import_file (NetscapeImporter *importer,
return;
}
+ g_free (protocol);
+
if (folder == NULL) {
g_warning ("Folder for %s is NULL", fullpath);
camel_exception_free (ex);
@@ -267,6 +272,7 @@ netscape_dir_created (BonoboListener *listener,
CORBA_Environment *ev,
NetscapeImporter *importer)
{
+ EvolutionStorageResult storage_result;
NetscapeCreateDirectoryData *data;
GList *l;
GNOME_Evolution_Storage_FolderResult *result;
@@ -277,8 +283,11 @@ netscape_dir_created (BonoboListener *listener,
}
result = event_data->_value;
+ storage_result = result->result;
fullpath = result->path;
+ g_warning ("path: %s\tresult: %d", fullpath, storage_result);
+
l = importer->dir_list;
importer->dir_list = g_list_remove_link (importer->dir_list, l);
data = l->data;
@@ -286,7 +295,8 @@ netscape_dir_created (BonoboListener *listener,
/* Import the file */
/* We got the folder, so try to import the file into it. */
- netscape_import_file (data->importer, data->path, fullpath);
+ if (fullpath != NULL || *fullpath != '\0')
+ netscape_import_file (data->importer, data->path, fullpath);
g_free (data->parent);
g_free (data->path);
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 001b047f4f..ccee247b77 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,22 @@
+2001-03-22 Iain Holmes <iain@ximian.com>
+
+ * importer/evolution-importer-listener.c (evolution_importer_listener_new):
+ Remove the usage of the corba_object thing.
+ (evolution_importer_listener_construct): Ditto.
+
+ * e-local-storage.c (real_do_folder_create): Revert the e_mkdir_hier call
+ to two seperate calls to mkdir. If the directory exists, just call the
+ callback and notify the listener.
+
+ * importer/GNOME_Evolution_Importer.idl: Add a folderpath paramater to the
+ loadFile method.
+
+ * importer/evolution-importer.[ch]: Update for the new folderpath param.
+
+ * importer/evolution-importer-client.[ch]: Ditto.
+
+ * importer/importer.c: Ditto.
+
2001-03-22 Ettore Perazzoli <ettore@ximian.com>
* e-storage-set-view.c (motion_notify_event): Unref the target
diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c
index 15247295e0..3417776731 100644
--- a/shell/e-local-storage.c
+++ b/shell/e-local-storage.c
@@ -449,6 +449,28 @@ impl_get_name (EStorage *storage)
return E_LOCAL_STORAGE_NAME;
}
+const char *invalid_names[6] = {
+ "Calendar",
+ "Contacts",
+ "Trash",
+ "Executive-Summary",
+ "Tasks",
+ NULL};
+/* Checks that @foldername isn't an invalid name like Trash, Calendar etc */
+static gboolean
+check_valid_name (const char *foldername)
+{
+ int i;
+
+ g_return_val_if_fail (foldername != NULL, FALSE);
+ for (i = 0; invalid_names[i] != NULL; i++) {
+ if (strcmp (invalid_names[i], foldername) == 0)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
real_do_folder_create (ELocalStorage *local_storage,
Bonobo_Listener listener,
@@ -476,11 +498,21 @@ real_do_folder_create (ELocalStorage *local_storage,
(* callback) (storage, E_STORAGE_INVALIDTYPE, data);
notify_listener (listener, E_STORAGE_INVALIDTYPE, NULL);
+ return;
}
g_assert (g_path_is_absolute (path));
folder_name = g_basename (path);
+ /* Some validity checks */
+ if (!check_valid_name (folder_name)) {
+ if (callback != NULL)
+ (*callback) (storage, E_STORAGE_INVALIDNAME, data);
+
+ notify_listener (listener, E_STORAGE_INVALIDNAME, NULL);
+ return;
+ }
+
if (folder_name == path + 1) {
/* We want a direct child of the root, so we don't need to create a
`subfolders' directory. */
@@ -496,20 +528,24 @@ real_do_folder_create (ELocalStorage *local_storage,
parent_physical_path = get_physical_path (local_storage, parent_path);
subfolders_directory_physical_path = g_concat_dir_and_file (parent_physical_path,
SUBFOLDER_DIR_NAME);
-
-#if 0
- if (! g_file_exists (subfolders_directory_physical_path)
+ if (! g_file_exists (subfolders_directory_physical_path)
&& mkdir (subfolders_directory_physical_path, 0700) == -1) {
- g_free (parent_path);
- g_free (subfolders_directory_physical_path);
- g_free (parent_physical_path);
- if (callback != NULL)
- (* callback) (storage,
- errno_to_storage_result (), data);
- return errno_to_storage_result ();
+ if (errno != EEXIST) {
+ /* Really bad error which we can't recover from */
+ g_free (parent_path);
+ g_free (subfolders_directory_physical_path);
+ g_free (parent_physical_path);
+ if (callback != NULL)
+ (* callback) (storage,
+ errno_to_storage_result (),
+ data);
+
+ notify_listener (listener,
+ errno_to_storage_result (), NULL);
+ return;
+ }
}
-#endif
-
+
physical_path = g_concat_dir_and_file (subfolders_directory_physical_path,
folder_name);
g_free (subfolders_directory_physical_path);
@@ -518,17 +554,14 @@ real_do_folder_create (ELocalStorage *local_storage,
/* Create the directory that holds the folder. */
- if (e_mkdir_hier (physical_path, 0700) == -1) {
-
- /* Bad error which we can't recover from */
- if (errno != EEXIST) {
- notify_listener (listener, errno_to_storage_result (),
- physical_path);
- g_free (physical_path);
- if (callback != NULL)
- (* callback) (storage,
- errno_to_storage_result (), data);
- }
+ if (mkdir (physical_path, 0700) == -1) {
+ notify_listener (listener, errno_to_storage_result (),
+ physical_path);
+ g_free (physical_path);
+ if (callback != NULL)
+ (* callback) (storage,
+ errno_to_storage_result (), data);
+ return;
}
/* Finally tell the component to do the job of creating the physical files in
diff --git a/shell/e-storage.h b/shell/e-storage.h
index 5a986a5b1a..bd3ef5a61c 100644
--- a/shell/e-storage.h
+++ b/shell/e-storage.h
@@ -55,7 +55,8 @@ enum _EStorageResult {
E_STORAGE_NOTIMPLEMENTED,
E_STORAGE_PERMISSIONDENIED,
E_STORAGE_UNSUPPORTEDOPERATION,
- E_STORAGE_UNSUPPORTEDTYPE
+ E_STORAGE_UNSUPPORTEDTYPE,
+ E_STORAGE_INVALIDNAME
};
typedef enum _EStorageResult EStorageResult;
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);