aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-01-20 05:36:57 +0800
committerDan Winship <danw@src.gnome.org>2001-01-20 05:36:57 +0800
commit5ca4a5eb37cc9347e1d01028d31edc46ef1cb90b (patch)
tree965f49d00b8e17acc50bccdb654d50a8bb026f42
parente0ca9fc3346b8f27aefc63a9cc458ff437f2ff63 (diff)
downloadgsoc2013-evolution-5ca4a5eb37cc9347e1d01028d31edc46ef1cb90b.tar.gz
gsoc2013-evolution-5ca4a5eb37cc9347e1d01028d31edc46ef1cb90b.tar.zst
gsoc2013-evolution-5ca4a5eb37cc9347e1d01028d31edc46ef1cb90b.zip
New function to add a folder and any parents of it that don't yet exist.
* subscribe-dialog.c (recursive_add_folder): New function to add a folder and any parents of it that don't yet exist. Fixes bugzilla #1028. svn path=/trunk/; revision=7658
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/subscribe-dialog.c34
2 files changed, 34 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6bb1be5091..bb1a8623dc 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2001-01-19 Dan Winship <danw@ximian.com>
+
+ * subscribe-dialog.c (recursive_add_folder): New function to add a
+ folder and any parents of it that don't yet exist. Fixes bugzilla
+ #1028.
+
2001-01-19 Not Zed <NotZed@Ximian.com>
* mail-send-recv.c: New swanky send/recieve thingy, well it so far
diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c
index a7538d766a..bdbdf347bf 100644
--- a/mail/subscribe-dialog.c
+++ b/mail/subscribe-dialog.c
@@ -332,6 +332,31 @@ do_subscribe_folder (gpointer in_data, gpointer op_data, CamelException *ex)
}
static void
+recursive_add_folder (EvolutionStorage *storage, const char *path,
+ const char *name, const char *url)
+{
+ char *parent, *pname, *p;
+
+ p = strrchr (path, '/');
+ if (p && p != path) {
+ parent = g_strndup (path, p - path);
+ if (!evolution_storage_folder_exists (storage, parent)) {
+ p = strrchr (parent, '/');
+ if (p)
+ pname = g_strdup (p + 1);
+ else
+ pname = g_strdup ("");
+ recursive_add_folder (storage, parent, pname, "");
+ g_free (pname);
+ }
+ g_free (parent);
+ }
+
+ evolution_storage_new_folder (storage, path, name, "mail", url,
+ _("(No description)"), FALSE);
+}
+
+static void
cleanup_subscribe_folder (gpointer in_data, gpointer op_data,
CamelException *ex)
{
@@ -340,12 +365,9 @@ cleanup_subscribe_folder (gpointer in_data, gpointer op_data,
if (!camel_exception_is_set (ex)) {
if (input->subscribe)
- evolution_storage_new_folder (input->sc->storage,
- data->path,
- data->name, "mail",
- data->url,
- _("(No description)") /* XXX */,
- FALSE);
+ recursive_add_folder (input->sc->storage,
+ data->path, data->name,
+ data->url);
else
evolution_storage_removed_folder (input->sc->storage, data->path);
}