diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-08-31 07:21:56 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-08-31 07:21:56 +0800 |
commit | 553de94865892fa7473f55d71a2fdf266e5359b7 (patch) | |
tree | 81c1a44e612040308d61a9fd6a091e0baecd42fc /shell | |
parent | d1587991064d100b1dccfdd34b293c67b603d0d0 (diff) | |
download | gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar.gz gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar.zst gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.zip |
Fix the Pine and Netscape importers. Give them a nice progress reporting GUI.
Revert Jason's changes so that creating a folder works again.
svn path=/trunk/; revision=12536
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 18 | ||||
-rw-r--r-- | shell/e-local-storage.c | 53 | ||||
-rw-r--r-- | shell/evolution-storage.c | 58 |
3 files changed, 96 insertions, 33 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index a736d59c11..61b4d54dcc 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,21 @@ +2001-08-29 Iain Holmes <iain@ximian.com> + + * e-local-storage.c (notify_listener): Function to create CORBAany + and notify listeners. + (component_async_create_folder_callback): Notify the listener again. + (create_folder): Handle the Bonobo_Listener again and make it async. + (impl_async_create_folder): Pass CORBA_OBJECT_NIL as the listener. + (bonobo_interface_create_folder_cb): Make async. + + * evolution-storage.c (notify_bonobo_listener): Removed this broken + broken function. + (impl_Storage_async_create_folder): Make async, duplicate the listener + instead of notifying it. + (impl_Storage_async_remove_folder): Notify listener by hand. + (e_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER): Return of the + worst signal marshaller in Scotland. + (class_init): Use the above marshaller for the create_folder signal. + 2001-08-30 Jeffrey Stedfast <fejj@ximian.com> * e-shell-folder-creation-dialog.c (entry_name_is_valid): Check diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 275b9be88e..0006be090d 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -55,6 +55,7 @@ #include "e-local-storage.h" +#include <bonobo/bonobo-exception.h> #define PARENT_TYPE E_TYPE_STORAGE static EStorageClass *parent_class = NULL; @@ -215,8 +216,33 @@ load_all_folders (ELocalStorage *local_storage) /* Callbacks for the async methods invoked on the `Evolution::ShellComponent's. */ +static void +notify_listener (const Bonobo_Listener listener, + EStorageResult result, + const char *physical_path) +{ + CORBA_any any; + GNOME_Evolution_Storage_FolderResult folder_result; + CORBA_Environment ev; + + folder_result.result = result; + folder_result.path = CORBA_string_dup (physical_path ? physical_path : ""); + any._type = TC_GNOME_Evolution_Storage_FolderResult; + any._value = &folder_result; + + CORBA_exception_init (&ev); + Bonobo_Listener_event (listener, "evolution-shell:folder_created", + &any, &ev); + if (BONOBO_EX (&ev)) { + g_warning ("Exception notifing listener: %s\n", + CORBA_exception_id (&ev)); + } + CORBA_exception_free (&ev); +} + struct _AsyncCreateFolderCallbackData { EStorage *storage; + Bonobo_Listener listener; char *path; char *display_name; @@ -266,6 +292,10 @@ component_async_create_folder_callback (EvolutionShellComponentClient *shell_com bonobo_object_unref (BONOBO_OBJECT (shell_component_client)); + if (callback_data->listener != CORBA_OBJECT_NIL) + notify_listener (callback_data->listener, storage_result, + callback_data->physical_path); + if (callback_data->callback != NULL) (* callback_data->callback) (callback_data->storage, storage_result, @@ -334,8 +364,9 @@ create_folder_directory (ELocalStorage *local_storage, return E_STORAGE_OK; } -static EStorageResult +static void create_folder (ELocalStorage *local_storage, + const Bonobo_Listener listener, const char *path, const char *type, const char *description, @@ -356,20 +387,24 @@ create_folder (ELocalStorage *local_storage, component_client = e_folder_type_registry_get_handler_for_type (priv->folder_type_registry, type); if (component_client == NULL) { + if (listener != CORBA_OBJECT_NIL) + notify_listener (listener, E_STORAGE_INVALIDTYPE, NULL); if (callback != NULL) (* callback) (storage, E_STORAGE_INVALIDTYPE, data); - return E_STORAGE_INVALIDTYPE; + return; } g_assert (g_path_is_absolute (path)); result = create_folder_directory (local_storage, path, type, description, &physical_path); if (result != E_STORAGE_OK) { - g_warning ("physical_path: %s", physical_path); if (callback != NULL) (* callback) (storage, result, data); + if (listener != CORBA_OBJECT_NIL) + notify_listener (listener, result, NULL); + g_free (physical_path); - return result; + return; } folder_name = g_basename (path); @@ -389,6 +424,7 @@ create_folder (ELocalStorage *local_storage, callback_data->description = g_strdup (description); callback_data->physical_uri = physical_uri; callback_data->physical_path = physical_path; + callback_data->listener = listener; callback_data->callback = callback; callback_data->callback_data = data; @@ -399,8 +435,6 @@ create_folder (ELocalStorage *local_storage, type, component_async_create_folder_callback, callback_data); - - return result; } struct _AsyncRemoveFolderCallbackData { @@ -607,7 +641,7 @@ impl_async_create_folder (EStorage *storage, local_storage = E_LOCAL_STORAGE (storage); - create_folder (local_storage, path, type, description, callback, data); + create_folder (local_storage, CORBA_OBJECT_NIL, path, type, description, callback, data); } @@ -887,8 +921,9 @@ impl_async_xfer_folder (EStorage *storage, /* Callbacks for the `Evolution::Storage' interface we are exposing to the outside world. */ -static int +static void bonobo_interface_create_folder_cb (EvolutionStorage *storage, + const Bonobo_Listener listener, const char *path, const char *type, const char *description, @@ -899,7 +934,7 @@ bonobo_interface_create_folder_cb (EvolutionStorage *storage, local_storage = E_LOCAL_STORAGE (data); - return create_folder (local_storage, path, type, description, NULL, NULL); + create_folder (local_storage, listener, path, type, description, NULL, NULL); } static int diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index da76c619ee..45d999c93b 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -291,23 +291,6 @@ storage_gtk_to_corba_result (EvolutionStorageResult result) } static void -notify_bonobo_listener (const Bonobo_Listener listener, - EvolutionStorageResult result, - const char *physical_path, - CORBA_Environment *ev) -{ - CORBA_any any; - GNOME_Evolution_Storage_FolderResult folder_result; - - folder_result.result = storage_gtk_to_corba_result (result); - folder_result.path = CORBA_string_dup (physical_path ? physical_path : ""); - any._type = TC_GNOME_Evolution_Storage_FolderResult; - any._value = &folder_result; - - Bonobo_Listener_event (listener, "result", &any, ev); -} - -static void impl_Storage_async_create_folder (PortableServer_Servant servant, const CORBA_char *path, const CORBA_char *type, @@ -317,17 +300,15 @@ impl_Storage_async_create_folder (PortableServer_Servant servant, CORBA_Environment *ev) { BonoboObject *bonobo_object; + CORBA_Object obj_dup; EvolutionStorage *storage; - int int_result; bonobo_object = bonobo_object_from_servant (servant); storage = EVOLUTION_STORAGE (bonobo_object); - int_result = GNOME_Evolution_Storage_UNSUPPORTED_OPERATION; + obj_dup = CORBA_Object_duplicate (listener, ev); gtk_signal_emit (GTK_OBJECT (storage), signals[CREATE_FOLDER], - path, type, description, parent_physical_uri, &int_result); - - notify_bonobo_listener (listener, int_result, path, ev); + obj_dup, path, type, description, parent_physical_uri); } @@ -341,6 +322,8 @@ impl_Storage_async_remove_folder (PortableServer_Servant servant, BonoboObject *bonobo_object; EvolutionStorage *storage; int int_result; + CORBA_any any; + GNOME_Evolution_Storage_Result corba_result; bonobo_object = bonobo_object_from_servant (servant); storage = EVOLUTION_STORAGE (bonobo_object); @@ -349,7 +332,11 @@ impl_Storage_async_remove_folder (PortableServer_Servant servant, gtk_signal_emit (GTK_OBJECT (storage), signals[REMOVE_FOLDER], path, physical_uri, &int_result); - notify_bonobo_listener (listener, int_result, path, ev); + corba_result = storage_gtk_to_corba_result (int_result); + any._type = TC_GNOME_Evolution_Storage_Result; + any._value = &corba_result; + + Bonobo_Listener_event (listener, "result", &any, ev); } static void @@ -511,6 +498,29 @@ corba_class_init (void) vepv->GNOME_Evolution_Storage_epv = evolution_storage_get_epv (); } +/* The worst signal marshaller in Scotland */ +typedef void (*GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER) (GtkObject *, + gpointer, gpointer, gpointer, gpointer, gpointer, + gpointer user_data); + +static void +e_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER (GtkObject *object, + GtkSignalFunc func, + gpointer func_data, + GtkArg *args) +{ + GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER rfunc; + + rfunc = (GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER) func; + (*rfunc) (object, + GTK_VALUE_POINTER (args[0]), + GTK_VALUE_POINTER (args[1]), + GTK_VALUE_POINTER (args[2]), + GTK_VALUE_POINTER (args[3]), + GTK_VALUE_POINTER (args[4]), + func_data); +} + static void class_init (EvolutionStorageClass *klass) { @@ -526,7 +536,7 @@ class_init (EvolutionStorageClass *klass) object_class->type, GTK_SIGNAL_OFFSET (EvolutionStorageClass, create_folder), - e_marshal_INT__POINTER_POINTER_POINTER_POINTER, + e_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER, GTK_TYPE_INT, 4, GTK_TYPE_STRING, GTK_TYPE_STRING, |