From ba9b1480dd6bcfebf517ee5bd5689dce88bc5917 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Thu, 16 Aug 2001 17:47:15 +0000 Subject: (fe_node_to_shell_path): Use node->name and node->full_name to generate 2001-08-16 Peter Williams (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 --- mail/subscribe-dialog.c | 50 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to 'mail/subscribe-dialog.c') 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); } -- cgit v1.2.3