[evolution-data-server] CamelIMAPXStore: Configure folder flags on folder creation.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] CamelIMAPXStore: Configure folder flags on folder creation.
- Date: Tue, 22 Jan 2013 16:24:43 +0000 (UTC)
commit d17a67a7b2f198e7d251024138a2c0d9266d3ed8
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jan 22 11:02:52 2013 -0500
CamelIMAPXStore: Configure folder flags on folder creation.
Immediately after CamelFolder creation, check whether the store is
configured to use real Junk/Trash folders and set CamelFolderFlags
appropriately.
This solves the problem of Evolution not displaying junk messages in a
real Junk folder. This does NOT solve the restart problem, as noted in
the comment.
camel/camel-imapx-store.c | 71 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index 9181331..0c7650b 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -1258,7 +1258,76 @@ imapx_store_get_folder_sync (CamelStore *store,
GCancellable *cancellable,
GError **error)
{
- return get_folder_offline (store, folder_name, flags, error);
+ CamelFolder *folder;
+ CamelSettings *settings;
+ gboolean use_real_junk_path = FALSE;
+ gboolean use_real_trash_path = FALSE;
+
+ folder = get_folder_offline (store, folder_name, flags, error);
+
+ /* Configure the folder flags according to IMAPX settings.
+ *
+ * XXX Since this is only done when the folder is first created,
+ * a restart is required to pick up changes to real Junk/Trash
+ * folder settings. Need to think of a better way.
+ *
+ * Perhaps have CamelStoreSettings grow junk and trash path
+ * string properties, and eliminate the CAMEL_FOLDER_IS_JUNK
+ * and CAMEL_FOLDER_IS_TRASH flags. Then add functions like
+ * camel_folder_is_junk() and camel_folder_is_trash(), which
+ * compare their own full name against CamelStoreSettings.
+ *
+ * Something to think about...
+ */
+
+ settings = camel_service_ref_settings (CAMEL_SERVICE (store));
+
+ if (folder != NULL) {
+ use_real_junk_path =
+ camel_imapx_settings_get_use_real_junk_path (
+ CAMEL_IMAPX_SETTINGS (settings));
+ use_real_trash_path =
+ camel_imapx_settings_get_use_real_trash_path (
+ CAMEL_IMAPX_SETTINGS (settings));
+ }
+
+ if (use_real_junk_path) {
+ gchar *real_junk_path;
+
+ real_junk_path =
+ camel_imapx_settings_dup_real_junk_path (
+ CAMEL_IMAPX_SETTINGS (settings));
+
+ /* So we can safely compare strings. */
+ if (real_junk_path == NULL)
+ real_junk_path = g_strdup ("");
+
+ if (g_ascii_strcasecmp (real_junk_path, folder_name) == 0)
+ folder->folder_flags |= CAMEL_FOLDER_IS_JUNK;
+
+ g_free (real_junk_path);
+ }
+
+ if (use_real_trash_path) {
+ gchar *real_trash_path;
+
+ real_trash_path =
+ camel_imapx_settings_dup_real_trash_path (
+ CAMEL_IMAPX_SETTINGS (settings));
+
+ /* So we can safely compare strings. */
+ if (real_trash_path == NULL)
+ real_trash_path = g_strdup ("");
+
+ if (g_ascii_strcasecmp (real_trash_path, folder_name) == 0)
+ folder->folder_flags |= CAMEL_FOLDER_IS_TRASH;
+
+ g_free (real_trash_path);
+ }
+
+ g_object_unref (settings);
+
+ return folder;
}
static CamelFolderInfo *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]