aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-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);
}