aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-storage-set.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-06-11 01:56:46 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-06-11 01:56:46 +0800
commitbbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2 (patch)
treeedcd34154f3281bd860ce40f67d7fc736d340e75 /shell/e-storage-set.c
parente8e0d04d0c8a5eb18a62d98e5a62d126756fa79f (diff)
downloadgsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar
gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.gz
gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.bz2
gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.lz
gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.xz
gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.tar.zst
gsoc2013-evolution-bbb6a6942fdfbb2684c37ee6aa55f8c6e5b5a9f2.zip
Implemented folder creation dialog (File -> New -> Folder). To make
it really work though, the components should implement creation functionality by passing an appropriate function pointer in `e_shell_component_new()' for @create_folder_fn. svn path=/trunk/; revision=3504
Diffstat (limited to 'shell/e-storage-set.c')
-rw-r--r--shell/e-storage-set.c95
1 files changed, 78 insertions, 17 deletions
diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c
index 33dc366afe..a779023bab 100644
--- a/shell/e-storage-set.c
+++ b/shell/e-storage-set.c
@@ -153,6 +153,37 @@ storage_removed_folder_cb (EStorage *storage,
}
+static EStorage *
+get_storage_for_path (EStorageSet *storage_set,
+ const char *path,
+ const char **subpath_return)
+{
+ EStorage *storage;
+ char *storage_name;
+ const char *first_separator;
+
+ g_return_val_if_fail (g_path_is_absolute (path), NULL);
+
+ /* Skip initial separator. */
+ path++;
+
+ first_separator = strchr (path, G_DIR_SEPARATOR);
+
+ if (first_separator == NULL || first_separator == path || first_separator[1] == 0) {
+ *subpath_return = NULL;
+ return NULL;
+ }
+
+ storage_name = g_strndup (path, first_separator - path);
+ storage = e_storage_set_get_storage (storage_set, storage_name);
+ g_free (storage_name);
+
+ *subpath_return = first_separator;
+
+ return storage;
+}
+
+
/* GtkObject methods. */
static void
@@ -412,30 +443,16 @@ e_storage_set_get_folder (EStorageSet *storage_set,
const char *path)
{
EStorage *storage;
- const char *first_separator;
- char *storage_name;
+ const char *subpath;
g_return_val_if_fail (storage_set != NULL, NULL);
g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL);
g_return_val_if_fail (path != NULL, NULL);
g_return_val_if_fail (g_path_is_absolute (path), NULL);
- /* Skip initial separator. */
- path++;
-
- first_separator = strchr (path, G_DIR_SEPARATOR);
-
- if (first_separator == NULL || first_separator == path || first_separator[1] == 0)
- return NULL;
-
- storage_name = g_strndup (path, first_separator - path);
- storage = e_storage_set_get_storage (storage_set, storage_name);
- g_free (storage_name);
-
- if (storage == NULL)
- return NULL;
+ storage = get_storage_for_path (storage_set, path, &subpath);
- return e_storage_get_folder (storage, first_separator);
+ return e_storage_get_folder (storage, subpath);
}
@@ -453,6 +470,50 @@ e_storage_set_new_view (EStorageSet *storage_set)
}
+void
+e_storage_set_async_create_folder (EStorageSet *storage_set,
+ const char *path,
+ const char *type,
+ const char *description,
+ EStorageResultCallback callback,
+ void *data)
+{
+ EStorage *storage;
+ const char *subpath;
+
+ g_return_if_fail (storage_set != NULL);
+ g_return_if_fail (E_IS_STORAGE_SET (storage_set));
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (g_path_is_absolute (path));
+ g_return_if_fail (type != NULL);
+ g_return_if_fail (callback != NULL);
+
+ storage = get_storage_for_path (storage_set, path, &subpath);
+
+ e_storage_async_create_folder (storage, subpath, type, description, callback, data);
+}
+
+void
+e_storage_set_async_remove_folder (EStorageSet *storage_set,
+ const char *path,
+ EStorageResultCallback callback,
+ void *data)
+{
+ EStorage *storage;
+ const char *subpath;
+
+ g_return_if_fail (storage_set != NULL);
+ g_return_if_fail (E_IS_STORAGE_SET (storage_set));
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (g_path_is_absolute (path));
+ g_return_if_fail (callback != NULL);
+
+ storage = get_storage_for_path (storage_set, path, &subpath);
+
+ e_storage_async_remove_folder (storage, path, callback, data);
+}
+
+
EFolderTypeRegistry *
e_storage_set_get_folder_type_registry (EStorageSet *storage_set)
{