aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-04-19 03:01:23 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-04-19 03:01:23 +0800
commitb6df9d55cb6d3b348c831f4591398a0acc8247d9 (patch)
tree3b1f0dca459cfede1e137decfb65364e4f7b1c3d /camel/camel-folder.c
parent39eed88537557a8fab36894ee1bb4ab248f7261a (diff)
downloadgsoc2013-evolution-b6df9d55cb6d3b348c831f4591398a0acc8247d9.tar
gsoc2013-evolution-b6df9d55cb6d3b348c831f4591398a0acc8247d9.tar.gz
gsoc2013-evolution-b6df9d55cb6d3b348c831f4591398a0acc8247d9.tar.bz2
gsoc2013-evolution-b6df9d55cb6d3b348c831f4591398a0acc8247d9.tar.lz
gsoc2013-evolution-b6df9d55cb6d3b348c831f4591398a0acc8247d9.tar.xz
gsoc2013-evolution-b6df9d55cb6d3b348c831f4591398a0acc8247d9.tar.zst
gsoc2013-evolution-b6df9d55cb6d3b348c831f4591398a0acc8247d9.zip
implemented (partially) have to write CamelStore before finishing it.
1999-04-18 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/camel-folder.c: (camel_folder_create): implemented (partially) have to write CamelStore before finishing it. * camel/camel-folder.h (CamelFolder): added full_name field (CamelFolderClass): added set/get_full_name methods Some more work svn path=/trunk/; revision=853
Diffstat (limited to 'camel/camel-folder.c')
-rw-r--r--camel/camel-folder.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index c1af6c7bbe..93b91f94b0 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -22,14 +22,19 @@
*/
#include "camel-folder.h"
+#include "gstring-util.h"
static GtkObjectClass *camel_folder_parent_class=NULL;
+/* Returns the class for a CamelFolder */
+#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
static void camel_folder_open(CamelFolder *folder);
static void camel_folder_close(CamelFolder *folder, gboolean expunge);
static void camel_folder_set_name(CamelFolder *folder, GString *name_string);
+static void camel_folder_set_full_name(CamelFolder *folder, GString *name_string);
static GString *camel_folder_get_name(CamelFolder *folder);
+static GString *camel_folder_get_full_name(CamelFolder *folder);
static gboolean camel_folder_can_hold_folders(CamelFolder *folder);
static gboolean camel_folder_can_hold_messages(CamelFolder *folder);
static gboolean camel_folder_exists(CamelFolder *folder);
@@ -132,6 +137,23 @@ camel_folder_set_name(CamelFolder *folder, GString *name_string)
}
+/**
+ * camel_folder_set_full_name : set the (full) name of the folder
+ *
+ * set the name of the folder.
+ * The old name object is freed.
+ *
+ * @name_string: new name of the folder
+ *
+ **/
+static void
+camel_folder_set_full_name(CamelFolder *folder, GString *name_string)
+{
+ if (folder->full_name) g_string_free(folder->full_name, 0);;
+ folder->full_name = name_string;
+}
+
+
/**
* camel_folder_get_name : get the (short) name of the folder
@@ -149,6 +171,22 @@ camel_folder_get_name(CamelFolder *folder)
}
+/**
+ * camel_folder_get_full_name : get the (full) name of the folder
+ *
+ * get the name of the folder. The fully qualified name
+ * can be obtained with the get_full_ame method (not implemented)
+ *
+ * @Return Value: name of the folder
+ *
+ **/
+static GString *
+camel_folder_get_full_name(CamelFolder *folder)
+{
+ return folder->full_name;
+}
+
+
/**
* camel_folder_can_hold_folders : tests if the folder can contain other folders
*
@@ -218,3 +256,51 @@ camel_folder_get_folder(CamelFolder *folder, GString *folderName)
}
+
+
+/**
+ * create : create the folder object on the physical store
+ *
+ * This routine physically creates the folder object on
+ * the store. Having created the object does not
+ * mean the folder physically exists. If it does not
+ * exists, this routine will create it.
+ * if the folder full name contains more than one level
+ * of hierarchy, all folders between the current folder
+ * and the last folder name will be created if not existing.
+ *
+ **/
+static void
+camel_folder_create(CamelFolder *folder)
+{
+ GString *prefix;
+ gchar dich_result;
+ CamelFolder *parent;
+ gchar sep;
+
+#warning Finish it when CamelStore is done
+
+ /*g_assert(folder->parent_store);*/
+ g_assert(folder->name);
+
+ if ( CF_CLASS(folder)->exists(folder) ) return;
+ /* sep = camel_store_get_separator(folder->parent_store); */
+ if (folder->parent_folder) camel_folder_create(folder->parent_folder);
+ else {
+ if (folder->full_name) {
+ dich_result = g_string_right_dichotomy(folder->full_name, sep, &prefix, NULL, STRIP_TRAILING);
+ if (dich_result!='o') {
+ g_warning("I have to handle the case where the path is not OK\n");
+ return;
+ } else {
+ /*
+ parent = camel_store_get_folder(folder->parentStore,prefix);
+ camel_folder_create(parent);
+ [parent free];
+ */
+ }
+ }
+ }
+}
+
+