aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-corba-storage.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2003-03-15 02:13:58 +0800
committerDan Winship <danw@src.gnome.org>2003-03-15 02:13:58 +0800
commit0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399 (patch)
tree3ca29899a3cfc9ee08329c99151c49fe0b55fed9 /shell/e-corba-storage.c
parent1df1d4aead3ebacf457f637c6df2a5e8539b7fbf (diff)
downloadgsoc2013-evolution-0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399.tar
gsoc2013-evolution-0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399.tar.gz
gsoc2013-evolution-0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399.tar.bz2
gsoc2013-evolution-0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399.tar.lz
gsoc2013-evolution-0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399.tar.xz
gsoc2013-evolution-0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399.tar.zst
gsoc2013-evolution-0f75c9693668acf8e5a1f8ca3e7aa3cd2cd0d399.zip
add a Bonobo::Listener to this like the other async interfaces, rather
* Evolution-Storage.idl (asyncOpenFolder): add a Bonobo::Listener to this like the other async interfaces, rather than having a hacky way to signal failure. * evolution-storage.c (impl_Storage_asyncOpenFolder): Update to take a listener and emit it as part of the signal (evolution_storage_class_init): update OPEN_FOLDER signal prototype. * e-shell-marshal.list (NONE:POINTER,STRING): add, for changed EvolutionStorage open_folder signal * e-storage.c (e_storage_async_open_folder): add a callback arg (impl_async_open_folder): call the callback with NOTIMPLEMENTED. (class_init): remove the CLOSE_FOLDER signal (e_storage_has_subfolders): Don't emit CLOSE_FOLDER since it doesn't exist any more, and this function is used for that side effect any more anyway. * e-corba-storage.c (async_open_folder): add the callback arg and create a proper closure. (async_open_folder_idle): Call the callback in case of error. Create a listener and pass that to the CORBA call. (async_open_cb): Listener callback. * e-storage-set.c (storage_set_view_folder_opened): Pass a callback to e_storage_async_open_folder. (async_open_cb): emit CLOSE_FOLDER if the open failed (storage_close_folder_cb): Remove this since the signal no longer exists. svn path=/trunk/; revision=20297
Diffstat (limited to 'shell/e-corba-storage.c')
-rw-r--r--shell/e-corba-storage.c81
1 files changed, 60 insertions, 21 deletions
diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c
index 1aee5e7091..05c90bfcd7 100644
--- a/shell/e-corba-storage.c
+++ b/shell/e-corba-storage.c
@@ -458,44 +458,83 @@ async_xfer_folder (EStorage *storage,
CORBA_exception_free (&ev);
}
-static gboolean
-async_open_folder_idle (gpointer data)
+struct async_open_closure {
+ EStorageDiscoveryCallback callback;
+ EStorage *storage;
+ void *data;
+ char *path;
+};
+
+static void
+async_open_cb (BonoboListener *listener, const char *event_name,
+ const CORBA_any *any, CORBA_Environment *ev,
+ gpointer user_data)
{
- gpointer *pair = data;
+ struct async_open_closure *closure = user_data;
+ GNOME_Evolution_Storage_Result *corba_result;
+ EStorageResult result;
+
+ corba_result = any->_value;
+ result = e_corba_storage_corba_result_to_storage_result (*corba_result);
+
+ (* closure->callback) (closure->storage, result, closure->path, closure->data);
- EStorage *storage = pair[0];
- char *path = pair[1];
+ bonobo_object_unref (BONOBO_OBJECT (listener));
+ g_free (closure->path);
+ g_free (closure);
+}
+static gboolean
+async_open_folder_idle (gpointer data)
+{
+ struct async_open_closure *closure = data;
+ EStorage *storage = closure->storage;
ECorbaStorage *corba_storage;
+ BonoboListener *listener;
+ Bonobo_Listener corba_listener;
CORBA_Environment ev;
corba_storage = E_CORBA_STORAGE (storage);
-
- if (corba_storage->priv != NULL) {
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Storage_asyncOpenFolder (corba_storage->priv->storage_interface,
- path, &ev);
- CORBA_exception_free (&ev);
+ if (corba_storage->priv == NULL) {
+ (* closure->callback) (storage, E_STORAGE_GENERICERROR,
+ closure->path, closure->data);
+ g_free (closure->path);
+ g_free (closure);
+ return FALSE;
}
- g_object_unref (storage);
- g_free (path);
- g_free (pair);
+ listener = bonobo_listener_new (async_open_cb, closure);
+ corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener));
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Storage_asyncOpenFolder (corba_storage->priv->storage_interface,
+ closure->path, corba_listener, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ (* closure->callback) (storage, E_STORAGE_GENERICERROR,
+ closure->path, closure->data);
+ bonobo_object_unref (BONOBO_OBJECT (listener));
+ g_free (closure->path);
+ g_free (closure);
+ }
+ CORBA_exception_free (&ev);
return FALSE;
}
static void
async_open_folder (EStorage *storage,
- const char *path)
+ const char *path,
+ EStorageDiscoveryCallback callback,
+ void *data)
{
- gpointer *pair = g_new (gpointer, 2);
- pair[0] = storage;
- g_object_ref (storage);
- pair[1] = g_strdup (path);
+ struct async_open_closure *closure;
+
+ closure = g_new (struct async_open_closure, 1);
+ closure->callback = callback;
+ closure->storage = storage;
+ closure->data = data;
+ closure->path = g_strdup (path);
- g_idle_add (async_open_folder_idle, pair);
+ g_idle_add (async_open_folder_idle, closure);
}