diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-04 03:34:02 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:06 +0800 |
commit | f381a35cb09ded4308cf483e99e253426ccdaabe (patch) | |
tree | 64a6234640f1750979b992452fbe014c5956b151 | |
parent | c8b60e1f2a8df8c20809fefad00fb9c2570fdf88 (diff) | |
download | gsoc2013-evolution-f381a35cb09ded4308cf483e99e253426ccdaabe.tar gsoc2013-evolution-f381a35cb09ded4308cf483e99e253426ccdaabe.tar.gz gsoc2013-evolution-f381a35cb09ded4308cf483e99e253426ccdaabe.tar.bz2 gsoc2013-evolution-f381a35cb09ded4308cf483e99e253426ccdaabe.tar.lz gsoc2013-evolution-f381a35cb09ded4308cf483e99e253426ccdaabe.tar.xz gsoc2013-evolution-f381a35cb09ded4308cf483e99e253426ccdaabe.tar.zst gsoc2013-evolution-f381a35cb09ded4308cf483e99e253426ccdaabe.zip |
EMFolderSelectionButton: Avoid e_get_account_by_source_url().
Use e_get_account_by_uid() instead.
-rw-r--r-- | mail/em-folder-selection-button.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c index d5268d31e3..44da01f912 100644 --- a/mail/em-folder-selection-button.c +++ b/mail/em-folder-selection-button.c @@ -29,6 +29,7 @@ #include <e-util/e-util.h> #include <e-util/e-account-utils.h> +#include "e-mail-folder-utils.h" #include "em-folder-tree.h" #include "em-folder-selector.h" #include "em-utils.h" @@ -81,33 +82,41 @@ folder_selection_button_unselected (EMFolderSelectionButton *button) static void folder_selection_button_set_contents (EMFolderSelectionButton *button) { + CamelSession *session; + CamelStore *store = NULL; EAccount *account; GtkLabel *label; - const gchar *uri; - gchar *folder_name; + const gchar *uid; + gchar *folder_name = NULL; - uri = button->priv->uri; label = GTK_LABEL (button->priv->label); - folder_name = em_utils_folder_name_from_uri (uri); + session = CAMEL_SESSION (button->priv->session); + + if (button->priv->uri != NULL) + e_mail_folder_uri_parse ( + session, button->priv->uri, + &store, &folder_name, NULL); - if (folder_name == NULL) { + if (store == NULL || folder_name == NULL) { folder_selection_button_unselected (button); return; } - account = e_get_account_by_source_url (uri); + uid = camel_service_get_uid (CAMEL_SERVICE (store)); + account = e_get_account_by_uid (uid); if (account != NULL) { - gchar *tmp = folder_name; + gchar *text; - folder_name = g_strdup_printf ( + text = g_strdup_printf ( "%s/%s", e_account_get_string ( account, E_ACCOUNT_NAME), _(folder_name)); - gtk_label_set_text (label, folder_name); - g_free (tmp); + gtk_label_set_text (label, text); + g_free (text); } else gtk_label_set_text (label, _(folder_name)); + g_object_unref (store); g_free (folder_name); } |