diff options
author | Dan Winship <danw@src.gnome.org> | 2000-10-25 23:29:55 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-10-25 23:29:55 +0800 |
commit | 9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85 (patch) | |
tree | 110327fb1d754abd5d3fefb2d8b6a8a8a756033b /mail | |
parent | 82185d7faa88274eccd75e495d2de2a3f8f4237c (diff) | |
download | gsoc2013-evolution-9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85.tar gsoc2013-evolution-9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85.tar.gz gsoc2013-evolution-9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85.tar.bz2 gsoc2013-evolution-9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85.tar.lz gsoc2013-evolution-9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85.tar.xz gsoc2013-evolution-9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85.tar.zst gsoc2013-evolution-9dcf5fdde9ce7a8ab46a82be8416a83c104b5e85.zip |
Don't prepend "/" to the folder's full_name. Deal with hierarchy in the
* subscribe-dialog.c (folder_info_subscribed,
subscribe_folder_info, unsubscribe_folder_info): Don't prepend "/"
to the folder's full_name. Deal with hierarchy in the
EvolutionStorage tree better.
(storage_tree_path): Helper function to build a storage path from
a CamelFolderInfo.
svn path=/trunk/; revision=6168
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 9 | ||||
-rw-r--r-- | mail/subscribe-dialog.c | 72 |
2 files changed, 52 insertions, 29 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4e6c4a339e..01344af4ff 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2000-10-24 Dan Winship <danw@helixcode.com> + + * subscribe-dialog.c (folder_info_subscribed, + subscribe_folder_info, unsubscribe_folder_info): Don't prepend "/" + to the folder's full_name. Deal with hierarchy in the + EvolutionStorage tree better. + (storage_tree_path): Helper function to build a storage path from + a CamelFolderInfo. + 2000-10-23 Dan Winship <danw@helixcode.com> * *: Add some missing _()s and N_()s. diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c index d486df97df..e6bfed93c2 100644 --- a/mail/subscribe-dialog.c +++ b/mail/subscribe-dialog.c @@ -128,66 +128,80 @@ make_folder_search_widget (GtkSignalFunc start_search_func, static gboolean folder_info_subscribed (SubscribeDialog *sc, CamelFolderInfo *info) { - char *path; - gboolean retval; - - path = g_strdup_printf ("/%s", info->full_name); + return camel_store_folder_subscribed (sc->store, info->full_name); +} - retval = camel_store_folder_subscribed (sc->store, path); - - g_free (path); +/* Given a CamelFolderInfo, construct the corresponding + * EvolutionStorage path to it. + */ +static char * +storage_tree_path (CamelFolderInfo *info) +{ + int len; + CamelFolderInfo *i; + char *path, *p; + + for (len = 0, i = info; i; i = i->parent) + len += strlen (i->name) + 1; + + /* We do this backwards because that's the way the pointers point. */ + path = g_malloc (len + 1); + p = path + len; + *p = '\0'; + for (i = info; i; i = i->parent) { + len = strlen (i->name); + p -= len; + memcpy (p, i->name, len); + *--p = '/'; + } - return retval; + return path; } static void subscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info) { char *path; - CamelException *ex; + CamelException ex; /* folders without urls cannot be subscribed to */ if (info->url == NULL) return; - ex = camel_exception_new (); - path = g_strdup_printf ("/%s", info->full_name); + camel_exception_init (&ex); + camel_store_subscribe_folder (sc->store, info->full_name, &ex); - camel_store_subscribe_folder (sc->store, path, ex); - - if (!camel_exception_is_set (ex)) { + if (!camel_exception_is_set (&ex)) { + path = storage_tree_path (info); evolution_storage_new_folder (sc->storage, path, info->name, "mail", info->url, _("(No description)") /* XXX */); - } - - camel_exception_free (ex); - g_free (path); + g_free (path); + } else + camel_exception_clear (&ex); } static void unsubscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info) { char *path; - CamelException *ex; + CamelException ex; /* folders without urls cannot be subscribed to */ if (info->url == NULL) return; - ex = camel_exception_new (); - path = g_strdup_printf ("/%s", info->full_name); - - camel_store_unsubscribe_folder (sc->store, path, ex); + camel_exception_init (&ex); + camel_store_unsubscribe_folder (sc->store, info->full_name, &ex); - if (!camel_exception_is_set (ex)) { + if (!camel_exception_is_set (&ex)) { + path = storage_tree_path (info); evolution_storage_removed_folder (sc->storage, path); - } - - camel_exception_free (ex); - g_free (path); + g_free (path); + } else + camel_exception_clear (&ex); } static void @@ -401,7 +415,7 @@ folder_etree_value_at (ETreeModel *etree, ETreePath *path, int col, void *model_ else if (!folder_info_subscribed(dialog, info)) return 0; /* XXX unchecked */ else - return 1; /* checked */ + return GUINT_TO_POINTER (1); /* checked */ } } |