aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-store.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-21 05:28:10 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-21 05:28:10 +0800
commitd728e1e79c7a6e3d7797775de7d9ef0320937422 (patch)
tree69b216975fc8d8e5e3865a4af26201596ee277dc /camel/camel-store.c
parent5052619689e904d905c8e6a27735ecc8d69638bd (diff)
downloadgsoc2013-evolution-d728e1e79c7a6e3d7797775de7d9ef0320937422.tar.gz
gsoc2013-evolution-d728e1e79c7a6e3d7797775de7d9ef0320937422.tar.zst
gsoc2013-evolution-d728e1e79c7a6e3d7797775de7d9ef0320937422.zip
And finally here.
2001-09-20 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-spool-folder.c (camel_spool_folder_construct): And finally here. * providers/local/camel-local-folder.c (camel_local_folder_construct): And here. * camel-vee-store.c (vee_get_folder): ANd here too. (vee_get_folder_info): And here. * providers/imap/camel-imap-store.c (create_folder): Use camel_folder_info_build() and do better error checking. (subscribe_folder): Set the path on the folder info. * camel-store.c (camel_folder_info_build): Set the folder-info path if it hasn't already been set by the caller. (camel_folder_info_free): Free the path. * camel-store.h: Added a path member to the FolderInfo type. svn path=/trunk/; revision=13019
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r--camel/camel-store.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 7f8dab06b3..adef02a0b3 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -666,6 +666,7 @@ camel_folder_info_free (CamelFolderInfo *fi)
camel_folder_info_free (fi->child);
g_free (fi->name);
g_free (fi->full_name);
+ g_free (fi->path);
g_free (fi->url);
g_free (fi);
}
@@ -673,6 +674,27 @@ camel_folder_info_free (CamelFolderInfo *fi)
/**
+ * camel_folder_info_build_path:
+ * @fi: folder info
+ * @separator: directory separator
+ *
+ * Sets the folder info path based on the folder's full name and
+ * directory separator.
+ **/
+void
+camel_folder_info_build_path (CamelFolderInfo *fi, char separator)
+{
+ fi->path = g_strdup (fi->full_name);
+ if (separator != '/') {
+ char *p;
+
+ p = fi->path;
+ while ((p = strchr (p, separator)))
+ *p = '/';
+ }
+}
+
+/**
* camel_folder_info_build:
* @folders: an array of CamelFolderInfo
* @namespace: an ignorable prefix on the folder names
@@ -725,6 +747,11 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace,
name = fi->full_name;
if (*name == separator)
name++;
+
+ /* set the path if it isn't already set */
+ if (!fi->path)
+ camel_folder_info_build_path (fi, separator);
+
p = strrchr (name, separator);
if (p) {
pname = g_strndup (name, p - name);
@@ -752,6 +779,8 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace,
*sep = '\0';
else
g_warning ("huh, no \"%c\" in \"%s\"?", separator, fi->url);
+
+ /* FIXME: wtf is this? This is WRONG. Parent folders can be selectable */
camel_url_set_param (url, "noselect", "yes");
pfi->url = camel_url_to_string (url, 0);
camel_url_free (url);
@@ -776,7 +805,7 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace,
fi->sibling = top;
top = fi;
}
-
+
return top;
}