aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2003-03-15 03:58:36 +0800
committerDan Winship <danw@src.gnome.org>2003-03-15 03:58:36 +0800
commit35ff6769cb500b826678ae64504befc1c9c4757e (patch)
tree8728b8b6a4092dede79f5591668867726af23ff6 /shell
parent238c20117fc8d3fdddb270e3ef197593e45e1a85 (diff)
downloadgsoc2013-evolution-35ff6769cb500b826678ae64504befc1c9c4757e.tar
gsoc2013-evolution-35ff6769cb500b826678ae64504befc1c9c4757e.tar.gz
gsoc2013-evolution-35ff6769cb500b826678ae64504befc1c9c4757e.tar.bz2
gsoc2013-evolution-35ff6769cb500b826678ae64504befc1c9c4757e.tar.lz
gsoc2013-evolution-35ff6769cb500b826678ae64504befc1c9c4757e.tar.xz
gsoc2013-evolution-35ff6769cb500b826678ae64504befc1c9c4757e.tar.zst
gsoc2013-evolution-35ff6769cb500b826678ae64504befc1c9c4757e.zip
Add (e_storage_declare_has_subfolders): Rename from
* e-storage.c (e_storage_get_has_subfolders): Add (e_storage_declare_has_subfolders): Rename from e_storage_has_subfolders to make it clearer that this is a setter, not a getter. (Can't call it e_storage_set_has_subfolders because that sounds like it belongs in e-storage-set.) * e-corba-storage.c (impl_StorageListener_notifyHasSubfolders): update for e_storage_declare_has_subfolders name change (get_folder): Override the default EStorage implementation: if asked for a folder under a not-yet-expanded folder, attempt to force the parent(s) to expand so that the child is available. Fixes part of #30415 svn path=/trunk/; revision=20302
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog15
-rw-r--r--shell/e-corba-storage.c44
-rw-r--r--shell/e-storage.c28
-rw-r--r--shell/e-storage.h14
4 files changed, 94 insertions, 7 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 7994f32b12..aa83239acb 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,20 @@
2003-03-14 Dan Winship <danw@ximian.com>
+ * e-storage.c (e_storage_get_has_subfolders): Add
+ (e_storage_declare_has_subfolders): Rename from
+ e_storage_has_subfolders to make it clearer that this is a setter,
+ not a getter. (Can't call it e_storage_set_has_subfolders because
+ that sounds like it belongs in e-storage-set.)
+
+ * e-corba-storage.c (impl_StorageListener_notifyHasSubfolders):
+ update for e_storage_declare_has_subfolders name change
+ (get_folder): Override the default EStorage implementation: if
+ asked for a folder under a not-yet-expanded folder, attempt to
+ force the parent(s) to expand so that the child is available.
+ Fixes part of #30415
+
+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.
diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c
index 05c90bfcd7..8cef8f1064 100644
--- a/shell/e-corba-storage.c
+++ b/shell/e-corba-storage.c
@@ -187,7 +187,7 @@ impl_StorageListener_notifyHasSubfolders (PortableServer_Servant servant,
storage_listener_servant = (StorageListenerServant *) servant;
storage = storage_listener_servant->storage;
- if (! e_storage_has_subfolders (storage, path, message)) {
+ if (! e_storage_declare_has_subfolders (storage, path, message)) {
g_warning ("Cannot register subfolder tree -- %s\n", path);
CORBA_exception_set (ev,
CORBA_USER_EXCEPTION,
@@ -293,6 +293,47 @@ impl_finalize (GObject *object)
/* EStorage methods. */
+static void
+get_folder_cb (EStorage *storage, EStorageResult result,
+ const char *path, gpointer data)
+{
+ gboolean *done = data;
+
+ *done = TRUE;
+}
+
+static EFolder *
+get_folder (EStorage *storage, const char *path)
+{
+ EFolder *folder;
+ char *path_dup, *p;
+
+ folder = (* E_STORAGE_CLASS (parent_class)->get_folder) (storage, path);
+ if (folder)
+ return folder;
+
+ /* If @path points to a part of the storage that hasn't been
+ * opened yet, do that.
+ */
+ path_dup = g_strdup (path);
+ p = strchr (path_dup + 1, '/');
+ while (p) {
+ *p = '\0';
+ if (e_storage_get_has_subfolders (storage, path_dup)) {
+ gboolean done = FALSE;
+
+ e_storage_async_open_folder (storage, path_dup,
+ get_folder_cb, &done);
+ while (!done)
+ gtk_main_iteration (TRUE);
+ }
+ *p = '/';
+ p = strchr (p + 1, '/');
+ }
+
+ return (* E_STORAGE_CLASS (parent_class)->get_folder) (storage, path);
+}
+
struct async_folder_closure {
EStorageResultCallback callback;
EStorage *storage;
@@ -714,6 +755,7 @@ class_init (ECorbaStorageClass *klass)
object_class->finalize = impl_finalize;
storage_class = E_STORAGE_CLASS (klass);
+ storage_class->get_folder = get_folder;
storage_class->async_create_folder = async_create_folder;
storage_class->async_remove_folder = async_remove_folder;
storage_class->async_xfer_folder = async_xfer_folder;
diff --git a/shell/e-storage.c b/shell/e-storage.c
index 6825485f9d..1f54ee5afa 100644
--- a/shell/e-storage.c
+++ b/shell/e-storage.c
@@ -720,10 +720,16 @@ e_storage_new_folder (EStorage *storage,
return TRUE;
}
+/* This really should be called e_storage_set_has_subfolders, but then
+ * it would look like it was an EStorageSet function. (Fact o' the
+ * day: The word "set" has more distinct meanings than any other word
+ * in the English language.) Anyway, we now return you to your
+ * regularly scheduled source code, already in progress.
+ */
gboolean
-e_storage_has_subfolders (EStorage *storage,
- const char *path,
- const char *message)
+e_storage_declare_has_subfolders (EStorage *storage,
+ const char *path,
+ const char *message)
{
EStoragePrivate *priv;
GList *subfolders, *f;
@@ -762,6 +768,22 @@ e_storage_has_subfolders (EStorage *storage,
}
gboolean
+e_storage_get_has_subfolders (EStorage *storage,
+ const char *path)
+{
+ EStoragePrivate *priv;
+
+ g_return_val_if_fail (storage != NULL, FALSE);
+ g_return_val_if_fail (E_IS_STORAGE (storage), FALSE);
+ g_return_val_if_fail (path != NULL, FALSE);
+ g_return_val_if_fail (g_path_is_absolute (path), FALSE);
+
+ priv = storage->priv;
+
+ return g_hash_table_lookup (priv->pseudofolders, path) != NULL;
+}
+
+gboolean
e_storage_removed_folder (EStorage *storage,
const char *path)
{
diff --git a/shell/e-storage.h b/shell/e-storage.h
index e7793b8c90..bd0cc5da22 100644
--- a/shell/e-storage.h
+++ b/shell/e-storage.h
@@ -195,9 +195,17 @@ char *e_storage_get_path_for_physical_uri (EStorage *storage,
const char *physical_uri);
/* Protected. C++ anyone? */
-gboolean e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder);
-gboolean e_storage_has_subfolders (EStorage *storage, const char *path, const char *message);
-gboolean e_storage_removed_folder (EStorage *storage, const char *path);
+gboolean e_storage_new_folder (EStorage *storage,
+ const char *path,
+ EFolder *folder);
+gboolean e_storage_removed_folder (EStorage *storage,
+ const char *path);
+
+gboolean e_storage_declare_has_subfolders (EStorage *storage,
+ const char *path,
+ const char *message);
+gboolean e_storage_get_has_subfolders (EStorage *storage,
+ const char *path);
#ifdef __cplusplus
}