diff options
author | Milan Crha <mcrha@redhat.com> | 2012-02-07 19:57:29 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-02-07 19:57:29 +0800 |
commit | 5483b65b5e2212383b4ecf9a8fe9ef958ef582ad (patch) | |
tree | bf9a1f91a6964e6258656f19cd518b30103402b0 | |
parent | 22281b32d33694e763ea6c793e2bb2007709fb63 (diff) | |
download | gsoc2013-evolution-5483b65b5e2212383b4ecf9a8fe9ef958ef582ad.tar.gz gsoc2013-evolution-5483b65b5e2212383b4ecf9a8fe9ef958ef582ad.tar.zst gsoc2013-evolution-5483b65b5e2212383b4ecf9a8fe9ef958ef582ad.zip |
Bug #309945 - Ability to filter folders other than INBOX too
-rw-r--r-- | mail/em-account-editor.c | 45 | ||||
-rw-r--r-- | mail/em-folder-properties.c | 20 |
2 files changed, 43 insertions, 22 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 6b54c2ae1b..b2759f3ad9 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -3136,6 +3136,26 @@ emae_receive_page (EConfig *ec, return w; } +static void +emae_set_option_dependency (EMAccountEditorService *service, + CamelProviderConfEntry *conf, + GtkWidget *widget) +{ + if (conf->depname != NULL) { + const gchar *depname = conf->depname; + + if (*depname == '!') + depname++; + + g_object_bind_property ( + service->settings, depname, + widget, "sensitive", + G_BINDING_SYNC_CREATE | + (depname == conf->depname ? 0 : G_BINDING_INVERT_BOOLEAN)); + gtk_widget_set_margin_left (widget, INDENT_MARGIN); + } +} + static GtkWidget * emae_option_toggle (EMAccountEditorService *service, CamelProviderConfEntry *conf) @@ -3150,13 +3170,7 @@ emae_option_toggle (EMAccountEditorService *service, G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - if (conf->depname != NULL) { - g_object_bind_property ( - service->settings, conf->depname, - widget, "sensitive", - G_BINDING_SYNC_CREATE); - gtk_widget_set_margin_left (widget, INDENT_MARGIN); - } + emae_set_option_dependency (service, conf, widget); return widget; } @@ -3177,14 +3191,7 @@ emae_option_entry (EMAccountEditorService *service, G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - if (conf->depname != NULL) { - g_object_bind_property ( - service->settings, conf->depname, - widget, "sensitive", - G_BINDING_SYNC_CREATE); - gtk_widget_set_margin_left ( - GTK_WIDGET (label_for_mnemonic), INDENT_MARGIN); - } + emae_set_option_dependency (service, conf, widget); g_object_bind_property ( widget, "sensitive", @@ -3353,13 +3360,7 @@ emae_option_checkspin (EMAccountEditorService *service, gtk_widget_show (label); } - if (conf->depname != NULL) { - g_object_bind_property ( - service->settings, conf->depname, - hbox, "sensitive", - G_BINDING_SYNC_CREATE); - gtk_widget_set_margin_left (hbox, INDENT_MARGIN); - } + emae_set_option_dependency (service, conf, hbox); return hbox; } diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index 2abb1f366d..5bd75cf61e 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -126,6 +126,7 @@ emfp_get_folder_item (EConfig *ec, AsyncContext *context = data; guint ii, n_properties; gint row = 0; + gboolean can_apply_filters = FALSE; if (old) return old; @@ -188,6 +189,21 @@ emfp_get_folder_item (EConfig *ec, } } + if (context->folder) { + CamelStore *store; + CamelSession *session; + CamelFolderInfoFlags fi_flags = 0; + MailFolderCache *folder_cache; + + store = camel_folder_get_parent_store (context->folder); + session = camel_service_get_session (CAMEL_SERVICE (store)); + folder_cache = e_mail_session_get_folder_cache (E_MAIL_SESSION (session)); + + can_apply_filters = !CAMEL_IS_VEE_FOLDER (context->folder) && + mail_folder_cache_get_folder_info_flags (folder_cache, context->folder, &fi_flags) && + (fi_flags & CAMEL_FOLDER_TYPE_MASK) != CAMEL_FOLDER_TYPE_INBOX; + } + class = G_OBJECT_GET_CLASS (context->folder); properties = g_object_class_list_properties (class, &n_properties); @@ -197,6 +213,10 @@ emfp_get_folder_item (EConfig *ec, if ((properties[ii]->flags & CAMEL_PARAM_PERSISTENT) == 0) continue; + if (!can_apply_filters && + g_strcmp0 (properties[ii]->name, "apply-filters") == 0) + continue; + blurb = g_param_spec_get_blurb (properties[ii]); switch (properties[ii]->value_type) { |