[evolution-data-server] Bug 691465 - [IMAPx] Mark individual folder for automatic update
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 691465 - [IMAPx] Mark individual folder for automatic update
- Date: Mon, 22 Dec 2014 15:53:31 +0000 (UTC)
commit 2b2045449d77860ef8b19a2676335df1ada0d5d5
Author: Milan Crha <mcrha redhat com>
Date: Mon Dec 22 16:53:01 2014 +0100
Bug 691465 - [IMAPx] Mark individual folder for automatic update
camel/providers/imapx/camel-imapx-folder.c | 52 +++++++++++++++++++++++++++-
camel/providers/imapx/camel-imapx-folder.h | 5 +++
camel/providers/imapx/camel-imapx-store.c | 10 +++++
3 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c
index 3fa6e17..2635ec3 100644
--- a/camel/providers/imapx/camel-imapx-folder.c
+++ b/camel/providers/imapx/camel-imapx-folder.c
@@ -49,6 +49,8 @@ struct _CamelIMAPXFolderPrivate {
GMutex move_to_hash_table_lock;
GHashTable *move_to_real_junk_uids;
GHashTable *move_to_real_trash_uids;
+
+ gboolean check_folder;
};
/* The custom property ID is a CamelArg artifact.
@@ -56,7 +58,8 @@ struct _CamelIMAPXFolderPrivate {
enum {
PROP_0,
PROP_MAILBOX,
- PROP_APPLY_FILTERS = 0x2501
+ PROP_APPLY_FILTERS = 0x2501,
+ PROP_CHECK_FOLDER = 0x2502
};
G_DEFINE_TYPE (CamelIMAPXFolder, camel_imapx_folder, CAMEL_TYPE_OFFLINE_FOLDER)
@@ -138,6 +141,12 @@ imapx_folder_set_property (GObject *object,
g_value_get_boolean (value));
return;
+ case PROP_CHECK_FOLDER:
+ camel_imapx_folder_set_check_folder (
+ CAMEL_IMAPX_FOLDER (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_MAILBOX:
camel_imapx_folder_set_mailbox (
CAMEL_IMAPX_FOLDER (object),
@@ -162,6 +171,13 @@ imapx_folder_get_property (GObject *object,
CAMEL_IMAPX_FOLDER (object)));
return;
+ case PROP_CHECK_FOLDER:
+ g_value_set_boolean (
+ value,
+ camel_imapx_folder_get_check_folder (
+ CAMEL_IMAPX_FOLDER (object)));
+ return;
+
case PROP_MAILBOX:
g_value_take_object (
value,
@@ -1378,6 +1394,17 @@ camel_imapx_folder_class_init (CamelIMAPXFolderClass *class)
g_object_class_install_property (
object_class,
+ PROP_CHECK_FOLDER,
+ g_param_spec_boolean (
+ "check-folder",
+ "Check Folder",
+ _("Always check for _new mail in this folder"),
+ FALSE,
+ G_PARAM_READWRITE |
+ CAMEL_PARAM_PERSISTENT));
+
+ g_object_class_install_property (
+ object_class,
PROP_MAILBOX,
g_param_spec_object (
"mailbox",
@@ -1867,3 +1894,26 @@ camel_imapx_folder_invalidate_local_cache (CamelIMAPXFolder *folder,
camel_folder_summary_free_array (array);
}
+gboolean
+camel_imapx_folder_get_check_folder (CamelIMAPXFolder *folder)
+{
+ g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_val_if_fail (CAMEL_IS_IMAPX_FOLDER (folder), FALSE);
+
+ return folder->priv->check_folder;
+}
+
+void
+camel_imapx_folder_set_check_folder (CamelIMAPXFolder *folder,
+ gboolean check_folder)
+{
+ g_return_if_fail (folder != NULL);
+ g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
+
+ if (folder->priv->check_folder == check_folder)
+ return;
+
+ folder->priv->check_folder = check_folder;
+
+ g_object_notify (G_OBJECT (folder), "check-folder");
+}
diff --git a/camel/providers/imapx/camel-imapx-folder.h b/camel/providers/imapx/camel-imapx-folder.h
index ea5645b..a894ced 100644
--- a/camel/providers/imapx/camel-imapx-folder.h
+++ b/camel/providers/imapx/camel-imapx-folder.h
@@ -91,6 +91,11 @@ void camel_imapx_folder_add_move_to_real_trash
void camel_imapx_folder_invalidate_local_cache
(CamelIMAPXFolder *folder,
guint64 new_uidvalidity);
+gboolean camel_imapx_folder_get_check_folder
+ (CamelIMAPXFolder *folder);
+void camel_imapx_folder_set_check_folder
+ (CamelIMAPXFolder *folder,
+ gboolean check_folder);
G_END_DECLS
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 86ee2d4..5f18a2d 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -1645,6 +1645,16 @@ imapx_can_refresh_folder (CamelStore *store,
res = store_class->can_refresh_folder (store, info, &local_error) ||
check_all || (check_subscribed && subscribed);
+ if (!res && !local_error) {
+ CamelFolder *folder;
+
+ folder = camel_store_get_folder_sync (store, info->full_name, 0, NULL, &local_error);
+ if (folder && CAMEL_IS_IMAPX_FOLDER (folder))
+ res = camel_imapx_folder_get_check_folder (CAMEL_IMAPX_FOLDER (folder));
+
+ g_clear_object (&folder);
+ }
+
if (local_error != NULL)
g_propagate_error (error, local_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]