aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog33
-rw-r--r--shell/Evolution-Storage.idl3
-rw-r--r--shell/e-corba-storage.c81
-rw-r--r--shell/e-shell-marshal.list1
-rw-r--r--shell/e-storage-set.c33
-rw-r--r--shell/e-storage.c28
-rw-r--r--shell/e-storage.h10
-rw-r--r--shell/evolution-storage.c10
-rw-r--r--shell/evolution-storage.h1
9 files changed, 137 insertions, 63 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 88f6c8df16..7994f32b12 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,36 @@
+2003-03-14 Dan Winship <danw@ximian.com>
+
+ * 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.
+
2003-03-11 Dan Winship <danw@ximian.com>
* e-shell-startup-wizard.c (start_wizard): If the wizard factory
diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl
index 26313b6825..2d6928938b 100644
--- a/shell/Evolution-Storage.idl
+++ b/shell/Evolution-Storage.idl
@@ -82,7 +82,8 @@ module Evolution {
in Bonobo::Listener listener);
/* Open remote nodes. */
- void asyncOpenFolder (in string path);
+ void asyncOpenFolder (in string path,
+ in Bonobo::Listener listener);
/* Set unread count. */
void updateFolder (in string path,
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);
}
diff --git a/shell/e-shell-marshal.list b/shell/e-shell-marshal.list
index 6ff6579189..027a53e725 100644
--- a/shell/e-shell-marshal.list
+++ b/shell/e-shell-marshal.list
@@ -12,6 +12,7 @@ NONE:POINTER,POINTER,POINTER
NONE:POINTER,POINTER,POINTER,BOOL
NONE:POINTER,POINTER,POINTER,POINTER
NONE:POINTER,POINTER,POINTER,POINTER,POINTER
+NONE:POINTER,STRING
NONE:POINTER,STRING,BOOL
NONE:POINTER,STRING,STRING
NONE:POINTER,STRING,STRING,BOOL
diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c
index ffc8755bf5..2978ea7572 100644
--- a/shell/e-storage-set.c
+++ b/shell/e-storage-set.c
@@ -246,21 +246,6 @@ storage_removed_folder_cb (EStorage *storage,
g_free (full_path);
}
-static void
-storage_close_folder_cb (EStorage *storage,
- const char *path,
- void *data)
-{
- EStorageSet *storage_set;
- char *full_path;
-
- storage_set = E_STORAGE_SET (data);
-
- full_path = make_full_path (storage, path);
- g_signal_emit (storage_set, signals[CLOSE_FOLDER], 0, full_path);
- g_free (full_path);
-}
-
static EStorage *
get_storage_for_path (EStorageSet *storage_set,
@@ -549,8 +534,6 @@ e_storage_set_add_storage (EStorageSet *storage_set,
G_CALLBACK (storage_updated_folder_cb), storage_set);
g_signal_connect (storage, "removed_folder",
G_CALLBACK (storage_removed_folder_cb), storage_set);
- g_signal_connect (storage, "close_folder",
- G_CALLBACK (storage_close_folder_cb), storage_set);
priv->storages = g_list_append (priv->storages, storage);
@@ -664,6 +647,19 @@ e_storage_set_get_folder (EStorageSet *storage_set,
static void
+async_open_cb (EStorage *storage, EStorageResult result,
+ const char *path, gpointer storage_set)
+{
+ if (result != E_STORAGE_OK) {
+ char *full_path;
+
+ full_path = make_full_path (storage, path);
+ g_signal_emit (storage_set, signals[CLOSE_FOLDER], 0, full_path);
+ g_free (full_path);
+ }
+}
+
+static void
storage_set_view_folder_opened (EStorageSetView *storage_set_view,
const char *path,
EStorageSet *storage_set)
@@ -675,7 +671,8 @@ storage_set_view_folder_opened (EStorageSetView *storage_set_view,
if (storage == NULL)
return;
- e_storage_async_open_folder (storage, subpath);
+ e_storage_async_open_folder (storage, subpath,
+ async_open_cb, storage_set);
}
GtkWidget *
diff --git a/shell/e-storage.c b/shell/e-storage.c
index d311135fe1..6825485f9d 100644
--- a/shell/e-storage.c
+++ b/shell/e-storage.c
@@ -64,7 +64,6 @@ enum {
NEW_FOLDER,
UPDATED_FOLDER,
REMOVED_FOLDER,
- CLOSE_FOLDER,
LAST_SIGNAL
};
@@ -229,9 +228,11 @@ impl_async_xfer_folder (EStorage *storage,
static void
impl_async_open_folder (EStorage *storage,
- const char *path)
+ const char *path,
+ EStorageDiscoveryCallback callback,
+ void *data)
{
- ;
+ (*callback) (storage, E_STORAGE_NOTIMPLEMENTED, path, data);
}
static gboolean
@@ -311,15 +312,6 @@ class_init (EStorageClass *class)
e_shell_marshal_NONE__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
- signals[CLOSE_FOLDER] =
- g_signal_new ("close_folder",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EStorageClass, close_folder),
- NULL, NULL,
- e_shell_marshal_NONE__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
}
static void
@@ -498,17 +490,21 @@ e_storage_async_xfer_folder (EStorage *storage,
void
e_storage_async_open_folder (EStorage *storage,
- const char *path)
+ const char *path,
+ EStorageDiscoveryCallback callback,
+ void *data)
{
g_return_if_fail (storage != NULL);
g_return_if_fail (E_IS_STORAGE (storage));
g_return_if_fail (path != NULL);
g_return_if_fail (g_path_is_absolute (path));
- if (g_hash_table_lookup (storage->priv->pseudofolders, path) == NULL)
+ if (g_hash_table_lookup (storage->priv->pseudofolders, path) == NULL) {
+ (* callback) (storage, E_STORAGE_OK, path, data);
return;
+ }
- (* ES_CLASS (storage)->async_open_folder) (storage, path);
+ (* ES_CLASS (storage)->async_open_folder) (storage, path, callback, data);
}
@@ -742,8 +738,6 @@ e_storage_has_subfolders (EStorage *storage,
priv = storage->priv;
- g_signal_emit (storage, signals[CLOSE_FOLDER], 0, path);
-
if (g_hash_table_lookup (priv->pseudofolders, path))
return TRUE;
diff --git a/shell/e-storage.h b/shell/e-storage.h
index 31d2ff7c1a..e7793b8c90 100644
--- a/shell/e-storage.h
+++ b/shell/e-storage.h
@@ -112,7 +112,9 @@ struct _EStorageClass {
void *data);
void (* async_open_folder) (EStorage *storage,
- const char *path);
+ const char *path,
+ EStorageDiscoveryCallback callback,
+ void *data);
gboolean (* supports_shared_folders) (EStorage *storage);
void (* async_discover_shared_folder) (EStorage *storage,
@@ -165,8 +167,10 @@ void e_storage_async_xfer_folder (EStorage *storage,
const gboolean remove_source,
EStorageResultCallback callback,
void *data);
-void e_storage_async_open_folder (EStorage *storage,
- const char *path);
+void e_storage_async_open_folder (EStorage *storage,
+ const char *path,
+ EStorageDiscoveryCallback callback,
+ void *data);
const char *e_storage_result_to_string (EStorageResult result);
diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c
index 0b349e6319..aa11130911 100644
--- a/shell/evolution-storage.c
+++ b/shell/evolution-storage.c
@@ -453,16 +453,19 @@ impl_Storage_updateFolder (PortableServer_Servant servant,
static void
impl_Storage_asyncOpenFolder (PortableServer_Servant servant,
const CORBA_char *path,
+ Bonobo_Listener listener,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EvolutionStorage *storage;
+ CORBA_Object obj_dup;
bonobo_object = bonobo_object_from_servant (servant);
storage = EVOLUTION_STORAGE (bonobo_object);
+ obj_dup = CORBA_Object_duplicate (listener, ev);
g_signal_emit (storage, signals[OPEN_FOLDER], 0,
- path);
+ obj_dup, path);
}
static void
@@ -762,8 +765,9 @@ evolution_storage_class_init (EvolutionStorageClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EvolutionStorageClass, open_folder),
NULL, NULL,
- e_shell_marshal_NONE__STRING,
- G_TYPE_NONE, 1,
+ e_shell_marshal_NONE__POINTER_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER,
G_TYPE_STRING);
signals[DISCOVER_SHARED_FOLDER]
diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h
index 6d9fa78330..209f43a339 100644
--- a/shell/evolution-storage.h
+++ b/shell/evolution-storage.h
@@ -104,6 +104,7 @@ struct _EvolutionStorageClass {
gboolean remove_source);
void (*open_folder) (EvolutionStorage *storage,
+ const Bonobo_Listener listener,
const char *path);
void (*update_folder) (EvolutionStorage *storage,