[evolution-kolab/EDS_IMAPX_nobuild] updated IMAPX files as of EDS commit fa5668b3193c55220c192c620a7d2c227664a146
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/EDS_IMAPX_nobuild] updated IMAPX files as of EDS commit fa5668b3193c55220c192c620a7d2c227664a146
- Date: Tue, 7 Feb 2012 19:00:47 +0000 (UTC)
commit 5cdf364ba9034a587a0ce50d0392eee59542ebd9
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Tue Feb 7 16:32:34 2012 +0100
updated IMAPX files as of EDS commit fa5668b3193c55220c192c620a7d2c227664a146
* updated the local IMAPX code from upstream
* now at EDS commit
fa5668b3193c55220c192c620a7d2c227664a146
src/camel/providers/imapx/camel-imapx-folder.c | 91 +++++++++++++++++++++-
src/camel/providers/imapx/camel-imapx-folder.h | 2 +
src/camel/providers/imapx/camel-imapx-provider.c | 4 +-
src/camel/providers/imapx/camel-imapx-settings.c | 65 +++++++++++++++
src/camel/providers/imapx/camel-imapx-settings.h | 5 +
5 files changed, 164 insertions(+), 3 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-folder.c b/src/camel/providers/imapx/camel-imapx-folder.c
index 81a4a66..24deaf5 100644
--- a/src/camel/providers/imapx/camel-imapx-folder.c
+++ b/src/camel/providers/imapx/camel-imapx-folder.c
@@ -38,8 +38,17 @@
#define d(...) camel_imapx_debug(debug, '?', __VA_ARGS__)
+/* The custom property ID is a CamelArg artifact.
+ * It still identifies the property in state files. */
+enum {
+ PROP_0,
+ PROP_APPLY_FILTERS = 0x2501
+};
+
G_DEFINE_TYPE (CamelIMAPXFolder, camel_imapx_folder, CAMEL_TYPE_OFFLINE_FOLDER)
+static gboolean imapx_folder_get_apply_filters (CamelIMAPXFolder *folder);
+
CamelFolder *
camel_imapx_folder_new (CamelStore *store,
const gchar *folder_dir,
@@ -52,6 +61,7 @@ camel_imapx_folder_new (CamelStore *store,
CamelIMAPXFolder *ifolder;
const gchar *short_name;
gchar *state_file;
+ gboolean filter_all;
gboolean filter_inbox;
gboolean filter_junk;
gboolean filter_junk_inbox;
@@ -63,6 +73,7 @@ camel_imapx_folder_new (CamelStore *store,
g_object_get (
settings,
+ "filter-all", &filter_all,
"filter-inbox", &filter_inbox,
"filter-junk", &filter_junk,
"filter-junk-inbox", &filter_junk_inbox,
@@ -115,13 +126,18 @@ camel_imapx_folder_new (CamelStore *store,
ifolder->uidnext_on_server = 0;
if (!g_ascii_strcasecmp (folder_name, "INBOX")) {
- if (filter_inbox)
+ if (filter_inbox || filter_all)
folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
if (filter_junk)
folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
- } else if (filter_junk && !filter_junk_inbox)
+ } else {
+ if (filter_junk && !filter_junk_inbox)
folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
+ if (filter_all || imapx_folder_get_apply_filters (ifolder))
+ folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ }
+
camel_store_summary_connect_folder_summary (
(CamelStoreSummary *) ((CamelIMAPXStore *) store)->summary,
folder_name, folder->summary);
@@ -129,6 +145,64 @@ camel_imapx_folder_new (CamelStore *store,
return folder;
}
+static gboolean
+imapx_folder_get_apply_filters (CamelIMAPXFolder *folder)
+{
+ g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_val_if_fail (CAMEL_IS_IMAPX_FOLDER (folder), FALSE);
+
+ return folder->apply_filters;
+}
+
+static void
+imapx_folder_set_apply_filters (CamelIMAPXFolder *folder,
+ gboolean apply_filters)
+{
+ g_return_if_fail (folder != NULL);
+ g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
+
+ if ((folder->apply_filters ? 1 : 0) == (apply_filters ? 1 : 0))
+ return;
+
+ folder->apply_filters = apply_filters;
+
+ g_object_notify (G_OBJECT (folder), "apply-filters");
+}
+
+static void
+imapx_folder_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_APPLY_FILTERS:
+ imapx_folder_set_apply_filters (
+ CAMEL_IMAPX_FOLDER (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+imapx_folder_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_APPLY_FILTERS:
+ g_value_set_boolean (
+ value, imapx_folder_get_apply_filters (
+ CAMEL_IMAPX_FOLDER (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
static void
imapx_folder_dispose (GObject *object)
{
@@ -643,6 +717,8 @@ camel_imapx_folder_class_init (CamelIMAPXFolderClass *class)
CamelFolderClass *folder_class;
object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = imapx_folder_set_property;
+ object_class->get_property = imapx_folder_get_property;
object_class->dispose = imapx_folder_dispose;
object_class->finalize = imapx_folder_finalize;
@@ -661,6 +737,17 @@ camel_imapx_folder_class_init (CamelIMAPXFolderClass *class)
folder_class->synchronize_sync = imapx_synchronize_sync;
folder_class->synchronize_message_sync = imapx_synchronize_message_sync;
folder_class->transfer_messages_to_sync = imapx_transfer_messages_to_sync;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_APPLY_FILTERS,
+ g_param_spec_boolean (
+ "apply-filters",
+ "Apply Filters",
+ _("Apply message filters to this folder"),
+ FALSE,
+ G_PARAM_READWRITE |
+ CAMEL_PARAM_PERSISTENT));
}
static void
diff --git a/src/camel/providers/imapx/camel-imapx-folder.h b/src/camel/providers/imapx/camel-imapx-folder.h
index efe0af7..885640f 100644
--- a/src/camel/providers/imapx/camel-imapx-folder.h
+++ b/src/camel/providers/imapx/camel-imapx-folder.h
@@ -68,6 +68,8 @@ struct _CamelIMAPXFolder {
GMutex *search_lock;
GMutex *stream_lock;
+
+ gboolean apply_filters; /* persistent property */
};
struct _CamelIMAPXFolderClass {
diff --git a/src/camel/providers/imapx/camel-imapx-provider.c b/src/camel/providers/imapx/camel-imapx-provider.c
index 6179e84..05a93de 100644
--- a/src/camel/providers/imapx/camel-imapx-provider.c
+++ b/src/camel/providers/imapx/camel-imapx-provider.c
@@ -70,7 +70,9 @@ CamelProviderConfEntry imapx_conf_entries[] = {
#endif
{ CAMEL_PROVIDER_CONF_SECTION_END },
{ CAMEL_PROVIDER_CONF_SECTION_START, "general", NULL, N_("Options") },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-inbox", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-all", NULL,
+ N_("Apply _filters to new messages in all folders"), "0" },
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-inbox", "!filter-all",
N_("_Apply filters to new messages in Inbox on this server"), "1" },
{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk", NULL,
N_("Check new messages for Jun_k contents"), "0" },
diff --git a/src/camel/providers/imapx/camel-imapx-settings.c b/src/camel/providers/imapx/camel-imapx-settings.c
index 2b4c333..2f1c3a8 100644
--- a/src/camel/providers/imapx/camel-imapx-settings.c
+++ b/src/camel/providers/imapx/camel-imapx-settings.c
@@ -35,6 +35,7 @@ struct _CamelIMAPXSettingsPrivate {
gboolean check_all;
gboolean check_subscribed;
+ gboolean filter_all;
gboolean filter_junk;
gboolean filter_junk_inbox;
gboolean use_idle;
@@ -55,6 +56,7 @@ enum {
PROP_CHECK_SUBSCRIBED,
PROP_CONCURRENT_CONNECTIONS,
PROP_FETCH_ORDER,
+ PROP_FILTER_ALL,
PROP_FILTER_JUNK,
PROP_FILTER_JUNK_INBOX,
PROP_HOST,
@@ -121,6 +123,12 @@ imapx_settings_set_property (GObject *object,
g_value_get_enum (value));
return;
+ case PROP_FILTER_ALL:
+ camel_imapx_settings_set_filter_all (
+ CAMEL_IMAPX_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_FILTER_JUNK:
camel_imapx_settings_set_filter_junk (
CAMEL_IMAPX_SETTINGS (object),
@@ -258,6 +266,13 @@ imapx_settings_get_property (GObject *object,
CAMEL_IMAPX_SETTINGS (object)));
return;
+ case PROP_FILTER_ALL:
+ g_value_set_boolean (
+ value,
+ camel_imapx_settings_get_filter_all (
+ CAMEL_IMAPX_SETTINGS (object)));
+ return;
+
case PROP_FILTER_JUNK:
g_value_set_boolean (
value,
@@ -461,6 +476,18 @@ camel_imapx_settings_class_init (CamelIMAPXSettingsClass *class)
g_object_class_install_property (
object_class,
+ PROP_FILTER_ALL,
+ g_param_spec_boolean (
+ "filter-all",
+ "Filter All",
+ "Whether to apply filters in all folders",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_FILTER_JUNK,
g_param_spec_boolean (
"filter-junk",
@@ -824,6 +851,44 @@ camel_imapx_settings_set_fetch_order (CamelIMAPXSettings *settings,
}
/**
+ * camel_imapx_settings_get_filter_all:
+ * @settings: a #CamelIMAPXSettings
+ *
+ * Returns whether apply filters in all folders.
+ *
+ * Returns: whether to apply filters in all folders
+ *
+ * Since: 3.4
+ **/
+gboolean
+camel_imapx_settings_get_filter_all (CamelIMAPXSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_IMAPX_SETTINGS (settings), FALSE);
+
+ return settings->priv->filter_all;
+}
+
+/**
+ * camel_imapx_settings_set_filter_all:
+ * @settings: a #CamelIMAPXSettings
+ * @filter_all: whether to apply filters in all folders
+ *
+ * Sets whether to apply filters in all folders.
+ *
+ * Since: 3.4
+ **/
+void
+camel_imapx_settings_set_filter_all (CamelIMAPXSettings *settings,
+ gboolean filter_all)
+{
+ g_return_if_fail (CAMEL_IS_IMAPX_SETTINGS (settings));
+
+ settings->priv->filter_all = filter_all;
+
+ g_object_notify (G_OBJECT (settings), "filter-all");
+}
+
+/**
* camel_imapx_settings_get_filter_junk:
* @settings: a #CamelIMAPXSettings
*
diff --git a/src/camel/providers/imapx/camel-imapx-settings.h b/src/camel/providers/imapx/camel-imapx-settings.h
index bffa560..fbd1084 100644
--- a/src/camel/providers/imapx/camel-imapx-settings.h
+++ b/src/camel/providers/imapx/camel-imapx-settings.h
@@ -81,6 +81,11 @@ CamelSortType camel_imapx_settings_get_fetch_order
void camel_imapx_settings_set_fetch_order
(CamelIMAPXSettings *settings,
CamelSortType fetch_order);
+gboolean camel_imapx_settings_get_filter_all
+ (CamelIMAPXSettings *settings);
+void camel_imapx_settings_set_filter_all
+ (CamelIMAPXSettings *settings,
+ gboolean filter_all);
gboolean camel_imapx_settings_get_filter_junk
(CamelIMAPXSettings *settings);
void camel_imapx_settings_set_filter_junk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]