diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-06 04:48:37 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-06 04:48:37 +0800 |
commit | b700aaf9aa14a2634f926f2385b1bc8d663bfd31 (patch) | |
tree | cec8c0473eab36739760936e965602d6939b9327 | |
parent | 467bc6e244c574d872bc17faac7af00509626edf (diff) | |
download | gsoc2013-evolution-b700aaf9aa14a2634f926f2385b1bc8d663bfd31.tar gsoc2013-evolution-b700aaf9aa14a2634f926f2385b1bc8d663bfd31.tar.gz gsoc2013-evolution-b700aaf9aa14a2634f926f2385b1bc8d663bfd31.tar.bz2 gsoc2013-evolution-b700aaf9aa14a2634f926f2385b1bc8d663bfd31.tar.lz gsoc2013-evolution-b700aaf9aa14a2634f926f2385b1bc8d663bfd31.tar.xz gsoc2013-evolution-b700aaf9aa14a2634f926f2385b1bc8d663bfd31.tar.zst gsoc2013-evolution-b700aaf9aa14a2634f926f2385b1bc8d663bfd31.zip |
Simplify vfolder_adduri_desc().
-rw-r--r-- | mail/mail-vfolder.c | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 6958e82f62..9295f8b718 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -203,46 +203,39 @@ struct _adduri_msg { static gchar * vfolder_adduri_desc (struct _adduri_msg *m) { - gchar *euri, *desc = NULL; - - /* Yuck yuck. Lookup the account name and use that to describe the path */ - /* We really need to normalise this across all of camel and evolution :-/ */ - euri = em_uri_from_camel (m->uri); - if (euri) { - CamelURL *url = camel_url_new (euri, NULL); - - if (url) { - const gchar *loc = NULL; - - if (url->host && !strcmp(url->host, "local") - && url->user && !strcmp(url->user, "local")) { - loc = _("On This Computer"); - } else { - gchar *uid; - const EAccount *account; - - if (url->user == NULL) - uid = g_strdup (url->host); - else - uid = g_strdup_printf("%s@%s", url->user, url->host); - - account = e_get_account_by_uid (uid); - g_free (uid); - if (account != NULL) - loc = account->name; - } + EAccount *account; + CamelStore *store; + CamelSession *session; + const gchar *store_name; + const gchar *uid; + gchar *folder_name; + gchar *description; + gboolean success; - if (loc && url->path) - desc = g_strdup_printf(_("Updating Search Folders for '%s:%s'"), loc, url->path); - camel_url_free (url); - } - g_free (euri); - } + session = CAMEL_SESSION (m->session); + + success = e_mail_folder_uri_parse ( + session, m->uri, &store, &folder_name, NULL); + + if (!success) + return NULL; + + uid = camel_service_get_uid (CAMEL_SERVICE (store)); + account = e_get_account_by_uid (uid); + + if (account != NULL) + store_name = account->name; + else + store_name = _("On This Computer"); + + description = g_strdup_printf ( + _("Updating Search Folders for '%s' : %s"), + store_name, folder_name); - if (desc == NULL) - desc = g_strdup_printf(_("Updating Search Folders for '%s'"), m->uri); + g_object_unref (store); + g_free (folder_name); - return desc; + return description; } static void |