[evolution/wip/gsettings] EMAccountEditor: Simplify real junk/trash folder selection.
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/gsettings] EMAccountEditor: Simplify real junk/trash folder selection.
- Date: Wed, 14 Sep 2011 12:24:24 +0000 (UTC)
commit 65c587a85f55ae9778bba01ccc86c4506eeada70
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Aug 9 23:50:51 2011 -0400
EMAccountEditor: Simplify real junk/trash folder selection.
Limit the folder choices to the current account so we don't have to
check after the fact if the chosen folder is from the current account.
mail/em-account-editor.c | 40 +++++++++++++++++++++-------------------
1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index c689ca6..f852441 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -3056,12 +3056,12 @@ emae_real_url_toggled (GtkToggleButton *check, EMAccountEditor *emae)
}
static void
-emae_real_url_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor *emae)
+emae_real_url_folder_changed (EMFolderSelectionButton *folder,
+ EMAccountEditor *emae)
{
CamelURL *url;
guint32 flag;
GtkWidget *check = NULL;
- gboolean changed = FALSE;
const gchar *param_key = NULL, *curi_selected;
g_return_if_fail (folder != NULL);
@@ -3083,34 +3083,34 @@ emae_real_url_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor *
curi_selected = em_folder_selection_button_get_folder_uri (folder);
if (!curi_selected || !*curi_selected) {
camel_url_set_param (url, param_key, NULL);
- changed = TRUE;
} else {
- gboolean passed;
gchar *selected_folder_name = NULL;
CamelStore *selected_store = NULL;
- CamelSession *session = CAMEL_SESSION (e_mail_backend_get_session (em_account_editor_get_backend (emae)));
+ EMailBackend *backend;
+ EMailSession *session;
+ gboolean valid;
- passed = e_mail_folder_uri_parse (session, curi_selected, &selected_store, &selected_folder_name, NULL);
- if (passed) {
- passed = selected_store && emae->priv->modified_account && emae->priv->modified_account->uid
- && g_strcmp0 (camel_service_get_uid (CAMEL_SERVICE (selected_store)), emae->priv->modified_account->uid) == 0;
- }
+ backend = em_account_editor_get_backend (emae);
+ session = e_mail_backend_get_session (backend);
- if (passed && selected_folder_name && *selected_folder_name) {
- camel_url_set_param (url, param_key, (*selected_folder_name) == '/' ? selected_folder_name + 1 : selected_folder_name);
- changed = TRUE;
- } else {
- e_notice (NULL, GTK_MESSAGE_ERROR, "%s", _("Please select a folder from the current account."));
- em_folder_selection_button_set_folder_uri (folder, "");
- }
+ valid = e_mail_folder_uri_parse (
+ CAMEL_SESSION (session), curi_selected,
+ &selected_store, &selected_folder_name, NULL);
+ g_return_if_fail (valid);
+
+ if (*selected_folder_name == '/')
+ camel_url_set_param (
+ url, param_key, selected_folder_name + 1);
+ else
+ camel_url_set_param (
+ url, param_key, selected_folder_name);
g_free (selected_folder_name);
if (selected_store)
g_object_unref (selected_store);
}
- if (changed)
- emae_uri_changed (&emae->priv->source, url);
+ emae_uri_changed (&emae->priv->source, url);
camel_url_free (url);
}
@@ -3233,6 +3233,7 @@ emae_defaults_page (EConfig *ec,
widget = e_builder_get_widget (builder, "trash_folder_butt");
button = EM_FOLDER_SELECTION_BUTTON (widget);
+ em_folder_selection_button_set_account (button, account);
em_folder_selection_button_set_backend (button, backend);
priv->trash_folder_button = GTK_BUTTON (button);
@@ -3246,6 +3247,7 @@ emae_defaults_page (EConfig *ec,
widget = e_builder_get_widget (builder, "junk_folder_butt");
button = EM_FOLDER_SELECTION_BUTTON (widget);
+ em_folder_selection_button_set_account (button, account);
em_folder_selection_button_set_backend (button, backend);
priv->junk_folder_button = GTK_BUTTON (button);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]