aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorbertrand <bertrand@helixcode.com>2000-01-22 10:58:12 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-01-22 10:58:12 +0800
commit84423c930ecc93ce93040bfd49e20c68670d4364 (patch)
tree1eb47e691f93c353405d85a1d320442191f5f61b /camel
parente8a2fed920088141d8ed47c6803bc166b18c5418 (diff)
downloadgsoc2013-evolution-84423c930ecc93ce93040bfd49e20c68670d4364.tar
gsoc2013-evolution-84423c930ecc93ce93040bfd49e20c68670d4364.tar.gz
gsoc2013-evolution-84423c930ecc93ce93040bfd49e20c68670d4364.tar.bz2
gsoc2013-evolution-84423c930ecc93ce93040bfd49e20c68670d4364.tar.lz
gsoc2013-evolution-84423c930ecc93ce93040bfd49e20c68670d4364.tar.xz
gsoc2013-evolution-84423c930ecc93ce93040bfd49e20c68670d4364.tar.zst
gsoc2013-evolution-84423c930ecc93ce93040bfd49e20c68670d4364.zip
test the mbox provider.
2000-01-21 bertrand <bertrand@helixcode.com> * tests/test10.c: test the mbox provider. * camel/camel-folder.c (_set_name): if camel_folder_get_mode returns an exception, return it instead of overriding it with a new one. (camel_folder_is_open): make the is_open method public. (_set_name): use the is_open instead of get_mode. (_set_name): set the fullname even in the case where the folder has no parent. (_set_name): use %c, not %d to add the separator char into the full path. svn path=/trunk/; revision=1606
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-folder.c43
-rw-r--r--camel/camel-folder.h1
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c1
3 files changed, 39 insertions, 6 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 3b22011d55..69e1df9694 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -477,7 +477,9 @@ _set_name (CamelFolder *folder,
"name parameter is NULL");
return;
}
-
+
+ CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder name is %s\n", name);
+
if (!folder->parent_store) {
camel_exception_set (ex,
@@ -486,10 +488,11 @@ _set_name (CamelFolder *folder,
return;
}
- /* the set_name method is valid only only on
+ /* the set_name method is valid only on
close folders */
- if (camel_folder_get_mode (folder, ex) != FOLDER_CLOSE) {
+ if (camel_folder_is_open (folder, ex)) {
+ if (camel_exception_get_id (ex)) return;
camel_exception_set (ex,
CAMEL_EXCEPTION_FOLDER_INVALID,
"CamelFolder::set_name is valid only on closed folders");
@@ -497,14 +500,19 @@ _set_name (CamelFolder *folder,
}
separator = camel_store_get_separator (folder->parent_store, ex);
+ if (camel_exception_get_id (ex)) return;
+
camel_exception_clear (ex);
if (folder->parent_folder) {
parent_full_name = camel_folder_get_full_name (folder->parent_folder, ex);
if (camel_exception_get_id (ex)) return;
- full_name = g_strdup_printf ("%s%d%s", parent_full_name, separator, name);
- }
-
+ full_name = g_strdup_printf ("%s%c%s", parent_full_name, separator, name);
+ } else {
+ full_name = g_strdup_printf ("%c%s", separator, name);
+ }
+
+ CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder full name set to %s\n", full_name);
folder->name = g_strdup (name);
folder->full_name = full_name;
@@ -759,6 +767,29 @@ _is_open (CamelFolder *folder, CamelException *ex)
}
+/**
+ * _is_open: test if the folder is open
+ * @folder: The folder object
+ *
+ * Tests if a folder is open. If not open it can be opened
+ * CamelFolder::open
+ *
+ * Return value: true if the folder exists, false otherwise
+ **/
+gboolean
+camel_folder_is_open (CamelFolder *folder, CamelException *ex)
+{
+ if (!folder) {
+ camel_exception_set (ex,
+ CAMEL_EXCEPTION_FOLDER_NULL,
+ "folder object is NULL");
+ return FALSE;
+ }
+
+ return (CF_CLASS(folder)->is_open (folder, ex));
+}
+
+
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 36cdc50f29..d9715c4d54 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -249,6 +249,7 @@ const gchar *camel_folder_get_full_name (CamelFolder *folder, CamelException *ex
gboolean camel_folder_exists (CamelFolder *folder, CamelException *ex);
const GList *camel_folder_list_permanent_flags (CamelFolder *folder, CamelException *ex);
CamelFolderOpenMode camel_folder_get_mode (CamelFolder *folder, CamelException *ex);
+gboolean camel_folder_is_open (CamelFolder *folder, CamelException *ex);
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index e3638e23d4..1a01462fd6 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -175,6 +175,7 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException
parent_class->init_with_store (folder, parent_store, ex);
if (camel_exception_get_id (ex)) return;
+ printf ("%d\n", folder->open_mode);
/* we assume that the parent init_with_store
method checks for the existance of @folder */