aboutsummaryrefslogtreecommitdiffstats
path: root/mail/subscribe-dialog.c
diff options
context:
space:
mode:
authorPeter Williams <peterw@ximian.com>2001-08-17 01:47:15 +0800
committerPeter Williams <peterw@src.gnome.org>2001-08-17 01:47:15 +0800
commitba9b1480dd6bcfebf517ee5bd5689dce88bc5917 (patch)
treedf875472047ac5cf5f0a3a2cb194f9d973c7835f /mail/subscribe-dialog.c
parent46c82f851c09879152213a2a56ce409556d80feb (diff)
downloadgsoc2013-evolution-ba9b1480dd6bcfebf517ee5bd5689dce88bc5917.tar
gsoc2013-evolution-ba9b1480dd6bcfebf517ee5bd5689dce88bc5917.tar.gz
gsoc2013-evolution-ba9b1480dd6bcfebf517ee5bd5689dce88bc5917.tar.bz2
gsoc2013-evolution-ba9b1480dd6bcfebf517ee5bd5689dce88bc5917.tar.lz
gsoc2013-evolution-ba9b1480dd6bcfebf517ee5bd5689dce88bc5917.tar.xz
gsoc2013-evolution-ba9b1480dd6bcfebf517ee5bd5689dce88bc5917.tar.zst
gsoc2013-evolution-ba9b1480dd6bcfebf517ee5bd5689dce88bc5917.zip
(fe_node_to_shell_path): Use node->name and node->full_name to generate
2001-08-16 Peter Williams <peterw@ximian.com> (fe_node_to_shell_path): Use node->name and node->full_name to generate the the shell path of this item. Don't need to escape the URL, and handle cases when dir_sep != '/' (fe_done_subscribing): Use fe_node_to_shell_path instead of the CamelURL. Third time's the charm... svn path=/trunk/; revision=12101
Diffstat (limited to 'mail/subscribe-dialog.c')
-rw-r--r--mail/subscribe-dialog.c50
1 files changed, 45 insertions, 5 deletions
diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c
index 1d50a207e5..9b157179a7 100644
--- a/mail/subscribe-dialog.c
+++ b/mail/subscribe-dialog.c
@@ -758,29 +758,69 @@ fe_get_first_child (ETreeModel *model, ETreePath path)
/* subscribing */
+static gchar *
+fe_node_to_shell_path (ftree_node *node)
+{
+ gchar *path = NULL;
+ int name_len, full_name_len;
+
+ name_len = strlen (ftree_node_get_name (node));
+ full_name_len = strlen (ftree_node_get_full_name (node));
+
+ if (name_len != full_name_len) {
+ char *full_name;
+ gchar *iter;
+ gchar sep;
+
+ /* so, we don't know the heirarchy separator. But
+ * full_name = blahXblahXname, where X = separator
+ * and name = .... name. So we can determine it.
+ * (imap_store->dir_sep isn't really private, I guess,
+ * so we could use that if we had the store. But also
+ * we don't "know" that it is an IMAP store anyway.)
+ */
+
+ full_name = ftree_node_get_full_name (node);
+ sep = full_name[full_name_len - (name_len + 1)];
+
+ if (sep != '/') {
+ path = g_new (gchar, full_name_len + 2);
+ path[0] = '/';
+ strcpy (path + 1, full_name);
+ while ((iter = strchr (path, sep)) != NULL)
+ *iter = '/';
+ }
+ }
+
+ if (!path)
+ path = g_strdup_printf ("/%s", ftree_node_get_full_name (node));
+
+ return path;
+}
+
static void
fe_done_subscribing (const char *full_name, const char *name, gboolean subscribe, gboolean success, gpointer user_data)
{
ftree_op_data *closure = (ftree_op_data *) user_data;
if (success) {
- CamelURL *url;
+ gchar *path;
- url = camel_url_new (ftree_node_get_uri (closure->data), NULL);
+ path = fe_node_to_shell_path (closure->data);
if (subscribe) {
closure->data->flags |= FTREE_NODE_SUBSCRIBED;
recursive_add_folder (closure->ftree->e_storage,
- url->path, name,
+ path, name,
ftree_node_get_uri (closure->data));
} else {
closure->data->flags &= ~FTREE_NODE_SUBSCRIBED;
/* FIXME: recursively remove folder as well? Possible? */
- evolution_storage_removed_folder (closure->ftree->e_storage, url->path);
+ evolution_storage_removed_folder (closure->ftree->e_storage, path);
}
- camel_url_free (url);
+ g_free (path);
e_tree_model_node_data_changed (E_TREE_MODEL (closure->ftree), closure->path);
}