diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-04 03:34:02 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-04 03:34:02 +0800 |
commit | d3fab3c3207a324d6a72e494959debbb7f7ce240 (patch) | |
tree | 3b9214c5c4c1d801e34e4712fe3c344d29df730a /mail | |
parent | 1ce5e2fee4ddc4dc5238870a9907340fce53055d (diff) | |
download | gsoc2013-evolution-d3fab3c3207a324d6a72e494959debbb7f7ce240.tar.gz gsoc2013-evolution-d3fab3c3207a324d6a72e494959debbb7f7ce240.tar.zst gsoc2013-evolution-d3fab3c3207a324d6a72e494959debbb7f7ce240.zip |
EMFolderSelectionButton: Avoid e_get_account_by_source_url().
Use e_get_account_by_uid() instead.
Diffstat (limited to 'mail')
-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); } |