aboutsummaryrefslogtreecommitdiffstats
path: root/shell/evolution-storage.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-02-15 05:50:48 +0800
committerDan Winship <danw@src.gnome.org>2001-02-15 05:50:48 +0800
commit3245f9dacf18e68ed5e1bc18226d0ffe65c7bf6c (patch)
tree8767588191220389f5b4d37ca62126e1627a416d /shell/evolution-storage.c
parent3192e9ed0bbd475c22e8f74e8ce7c8ac1297abda (diff)
downloadgsoc2013-evolution-3245f9dacf18e68ed5e1bc18226d0ffe65c7bf6c.tar.gz
gsoc2013-evolution-3245f9dacf18e68ed5e1bc18226d0ffe65c7bf6c.tar.zst
gsoc2013-evolution-3245f9dacf18e68ed5e1bc18226d0ffe65c7bf6c.zip
add asyncCreateFolder and asyncRemoveFolder interfaces. (Use
* Evolution-Storage.idl: add asyncCreateFolder and asyncRemoveFolder interfaces. (Use Bonobo::Listener rather than creating a new listener interface.) * Evolution-LocalStorage.idl: Remove the Evolution::LocalStorageOpsListener interface, which wasn't being used. * evolution-storage.c (impl_Storage_async_create_folder, impl_Storage_async_remove_folder): implement by emitting signals on the EvolutionStorage object. Convert from EvolutionStorageResult to GNOME_Evolution_Storage_Result (blah!) (class_init): Set up the new "create_folder" and "remove_folder" signals. * e-corba-storage.c (async_create_folder, async_remove_folder): Implement, using the new Evolution::Storage IDL. Convert from GNOME_Evolution_Storage_Result to EStorageResult (blah!) * e-storage-set.c (e_storage_set_async_create_folder): Don't allow a NULL description (since it doesn't allow a NULL anythign else). * e-shell-folder-creation-dialog.c (dialog_clicked_cb): Pass "" rather than NULL for the description. svn path=/trunk/; revision=8230
Diffstat (limited to 'shell/evolution-storage.c')
-rw-r--r--shell/evolution-storage.c127
1 files changed, 124 insertions, 3 deletions
diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c
index 1424042653..dd9387715d 100644
--- a/shell/evolution-storage.c
+++ b/shell/evolution-storage.c
@@ -62,6 +62,15 @@ struct _EvolutionStoragePrivate {
};
+enum {
+ CREATE_FOLDER,
+ REMOVE_FOLDER,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+
/* Utility functions. */
static void
@@ -240,6 +249,92 @@ impl_Storage__get_name (PortableServer_Servant servant,
return CORBA_string_dup (priv->name);
}
+static GNOME_Evolution_Storage_Result
+storage_gtk_to_corba_result (EvolutionStorageResult result)
+{
+ GNOME_Evolution_Storage_Result corba_result;
+
+ switch (result) {
+ case EVOLUTION_STORAGE_OK:
+ return GNOME_Evolution_Storage_OK;
+ case EVOLUTION_STORAGE_ERROR_UNSUPPORTED_OPERATION:
+ return GNOME_Evolution_Storage_UNSUPPORTED_OPERATION;
+ case EVOLUTION_STORAGE_ERROR_UNSUPPORTED_TYPE:
+ return GNOME_Evolution_Storage_UNSUPPORTED_TYPE;
+ case EVOLUTION_STORAGE_ERROR_INVALID_URI:
+ return GNOME_Evolution_Storage_INVALID_URI;
+ case EVOLUTION_STORAGE_ERROR_ALREADY_EXISTS:
+ return GNOME_Evolution_Storage_ALREADY_EXISTS;
+ case EVOLUTION_STORAGE_ERROR_DOES_NOT_EXIST:
+ return GNOME_Evolution_Storage_DOES_NOT_EXIST;
+ case EVOLUTION_STORAGE_ERROR_PERMISSION_DENIED:
+ return GNOME_Evolution_Storage_PERMISSION_DENIED;
+ case EVOLUTION_STORAGE_ERROR_NO_SPACE:
+ return GNOME_Evolution_Storage_NO_SPACE;
+ case EVOLUTION_STORAGE_ERROR_NOT_EMPTY:
+ return GNOME_Evolution_Storage_NOT_EMPTY;
+ default:
+ return GNOME_Evolution_Storage_GENERIC_ERROR;
+ }
+}
+
+static void
+impl_Storage_async_create_folder (PortableServer_Servant servant,
+ const CORBA_char *path,
+ const CORBA_char *type,
+ const CORBA_char *description,
+ const CORBA_char *parent_physical_uri,
+ const Bonobo_Listener listener,
+ CORBA_Environment *ev)
+{
+ 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);
+
+ int_result = GNOME_Evolution_Storage_UNSUPPORTED_OPERATION;
+ gtk_signal_emit (GTK_OBJECT (storage), signals[CREATE_FOLDER],
+ path, type, description, parent_physical_uri,
+ &int_result);
+
+ 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
+impl_Storage_async_remove_folder (PortableServer_Servant servant,
+ const CORBA_char *path,
+ const CORBA_char *physical_uri,
+ const Bonobo_Listener listener,
+ CORBA_Environment *ev)
+{
+ 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);
+
+ int_result = GNOME_Evolution_Storage_UNSUPPORTED_OPERATION;
+ gtk_signal_emit (GTK_OBJECT (storage), signals[REMOVE_FOLDER],
+ path, physical_uri, &int_result);
+
+ 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
impl_Storage_add_listener (PortableServer_Servant servant,
const GNOME_Evolution_StorageListener listener,
@@ -352,6 +447,30 @@ class_init (EvolutionStorageClass *klass)
parent_class = gtk_type_class (bonobo_object_get_type ());
+ signals[CREATE_FOLDER] = gtk_signal_new ("create_folder",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionStorageClass,
+ create_folder),
+ e_marshal_INT__POINTER_POINTER_POINTER_POINTER,
+ GTK_TYPE_INT, 4,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING);
+
+ signals[REMOVE_FOLDER] = gtk_signal_new ("remove_folder",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionStorageClass,
+ remove_folder),
+ e_marshal_INT__POINTER_POINTER,
+ GTK_TYPE_INT, 2,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING);
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+
corba_class_init ();
}
@@ -378,9 +497,11 @@ evolution_storage_get_epv (void)
POA_GNOME_Evolution_Storage__epv *epv;
epv = g_new0 (POA_GNOME_Evolution_Storage__epv, 1);
- epv->_get_name = impl_Storage__get_name;
- epv->addListener = impl_Storage_add_listener;
- epv->removeListener = impl_Storage_remove_listener;
+ epv->_get_name = impl_Storage__get_name;
+ epv->asyncCreateFolder = impl_Storage_async_create_folder;
+ epv->asyncRemoveFolder = impl_Storage_async_remove_folder;
+ epv->addListener = impl_Storage_add_listener;
+ epv->removeListener = impl_Storage_remove_listener;
return epv;
}