[evolution-data-server] Deprecate CAMEL_STORE_FOLDER_EXCL.



commit 48504b934fe11e51328f8997b876cce050221047
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Mar 3 10:22:45 2014 -0500

    Deprecate CAMEL_STORE_FOLDER_EXCL.
    
    Fortunately Evolution doesn't use this flag, so we can simply remove
    code branches that check for it.  I'll remove the flag after 3.12.0.

 camel/camel-store.c                         |  196 +++++++++++++--------------
 camel/camel-store.h                         |    2 +-
 camel/providers/local/camel-maildir-store.c |    5 -
 camel/providers/local/camel-mbox-store.c    |    7 -
 camel/providers/local/camel-mh-store.c      |    7 -
 5 files changed, 92 insertions(+), 125 deletions(-)
---
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 1c8ecd7..7c446a0 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -1182,127 +1182,113 @@ camel_store_get_folder_sync (CamelStore *store,
 {
        CamelStoreClass *class;
        CamelFolder *folder = NULL;
+       CamelVeeFolder *vjunk = NULL;
+       CamelVeeFolder *vtrash = NULL;
+       gboolean folder_name_is_vjunk;
+       gboolean folder_name_is_vtrash;
+       gboolean store_uses_vjunk;
+       gboolean store_uses_vtrash;
+
 
        g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
        g_return_val_if_fail (folder_name != NULL, NULL);
 
        class = CAMEL_STORE_GET_CLASS (store);
 
-       /* O_EXCL doesn't make sense if we aren't requesting
-        * to also create the folder if it doesn't exist. */
-       if (!(flags & CAMEL_STORE_FOLDER_CREATE))
-               flags &= ~CAMEL_STORE_FOLDER_EXCL;
-
        /* Try cache first. */
        folder = camel_object_bag_reserve (store->folders, folder_name);
-       if (folder != NULL && (flags & CAMEL_STORE_FOLDER_EXCL)) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot create folder '%s': folder exists"),
-                       folder_name);
-               camel_object_bag_abort (store->folders, folder_name);
-               g_object_unref (folder);
-               return NULL;
-       }
+       if (folder != NULL)
+               return folder;
 
-       if (folder == NULL) {
-               CamelVeeFolder *vjunk = NULL;
-               CamelVeeFolder *vtrash = NULL;
-               gboolean folder_name_is_vjunk;
-               gboolean folder_name_is_vtrash;
-               gboolean store_uses_vjunk;
-               gboolean store_uses_vtrash;
-
-               store_uses_vjunk =
-                       ((store->flags & CAMEL_STORE_VJUNK) != 0);
-               store_uses_vtrash =
-                       ((store->flags & CAMEL_STORE_VTRASH) != 0);
-               folder_name_is_vjunk =
-                       store_uses_vjunk &&
-                       (strcmp (folder_name, CAMEL_VJUNK_NAME) == 0);
-               folder_name_is_vtrash =
-                       store_uses_vtrash &&
-                       (strcmp (folder_name, CAMEL_VTRASH_NAME) == 0);
-
-               if (flags & CAMEL_STORE_IS_MIGRATING) {
-                       if (folder_name_is_vtrash) {
-                               if (store->folders != NULL)
-                                       camel_object_bag_abort (
-                                               store->folders, folder_name);
-                               return NULL;
-                       }
+       store_uses_vjunk =
+               ((store->flags & CAMEL_STORE_VJUNK) != 0);
+       store_uses_vtrash =
+               ((store->flags & CAMEL_STORE_VTRASH) != 0);
+       folder_name_is_vjunk =
+               store_uses_vjunk &&
+               (strcmp (folder_name, CAMEL_VJUNK_NAME) == 0);
+       folder_name_is_vtrash =
+               store_uses_vtrash &&
+               (strcmp (folder_name, CAMEL_VTRASH_NAME) == 0);
+
+       if (flags & CAMEL_STORE_IS_MIGRATING) {
+               if (folder_name_is_vtrash) {
+                       if (store->folders != NULL)
+                               camel_object_bag_abort (
+                                       store->folders, folder_name);
+                       return NULL;
+               }
 
-                       if (folder_name_is_vjunk) {
-                               if (store->folders != NULL)
-                                       camel_object_bag_abort (
-                                               store->folders, folder_name);
-                               return NULL;
-                       }
+               if (folder_name_is_vjunk) {
+                       if (store->folders != NULL)
+                               camel_object_bag_abort (
+                                       store->folders, folder_name);
+                       return NULL;
                }
+       }
 
-               camel_operation_push_message (
-                       cancellable, _("Opening folder '%s'"), folder_name);
+       camel_operation_push_message (
+               cancellable, _("Opening folder '%s'"), folder_name);
 
-               if (folder_name_is_vtrash) {
-                       folder = class->get_trash_folder_sync (
-                               store, cancellable, error);
-                       CAMEL_CHECK_GERROR (
-                               store, get_trash_folder_sync,
-                               folder != NULL, error);
-               } else if (folder_name_is_vjunk) {
-                       folder = class->get_junk_folder_sync (
-                               store, cancellable, error);
-                       CAMEL_CHECK_GERROR (
-                               store, get_junk_folder_sync,
-                               folder != NULL, error);
-               } else {
-                       folder = class->get_folder_sync (
-                               store, folder_name, flags,
-                               cancellable, error);
-                       CAMEL_CHECK_GERROR (
-                               store, get_folder_sync,
-                               folder != NULL, error);
+       if (folder_name_is_vtrash) {
+               folder = class->get_trash_folder_sync (
+                       store, cancellable, error);
+               CAMEL_CHECK_GERROR (
+                       store, get_trash_folder_sync,
+                       folder != NULL, error);
+       } else if (folder_name_is_vjunk) {
+               folder = class->get_junk_folder_sync (
+                       store, cancellable, error);
+               CAMEL_CHECK_GERROR (
+                       store, get_junk_folder_sync,
+                       folder != NULL, error);
+       } else {
+               folder = class->get_folder_sync (
+                       store, folder_name, flags,
+                       cancellable, error);
+               CAMEL_CHECK_GERROR (
+                       store, get_folder_sync,
+                       folder != NULL, error);
 
-                       if (folder != NULL && store_uses_vjunk)
-                               vjunk = camel_object_bag_get (
-                                       store->folders, CAMEL_VJUNK_NAME);
+               if (folder != NULL && store_uses_vjunk)
+                       vjunk = camel_object_bag_get (
+                               store->folders, CAMEL_VJUNK_NAME);
 
-                       if (folder != NULL && store_uses_vtrash)
-                               vtrash = camel_object_bag_get (
-                                       store->folders, CAMEL_VTRASH_NAME);
-               }
+               if (folder != NULL && store_uses_vtrash)
+                       vtrash = camel_object_bag_get (
+                               store->folders, CAMEL_VTRASH_NAME);
+       }
 
-               /* Release the folder name reservation before adding the
-                * folder to the virtual Junk and Trash folders, just to
-                * reduce the chance of deadlock. */
-               if (folder != NULL)
-                       camel_object_bag_add (
-                               store->folders, folder_name, folder);
-               else
-                       camel_object_bag_abort (
-                               store->folders, folder_name);
-
-               /* If this is a normal folder and the store uses a
-                * virtual Junk folder, let the virtual Junk folder
-                * track this folder. */
-               if (vjunk != NULL) {
-                       camel_vee_folder_add_folder (vjunk, folder, NULL);
-                       g_object_unref (vjunk);
-               }
+       /* Release the folder name reservation before adding the
+        * folder to the virtual Junk and Trash folders, just to
+        * reduce the chance of deadlock. */
+       if (folder != NULL)
+               camel_object_bag_add (
+                       store->folders, folder_name, folder);
+       else
+               camel_object_bag_abort (
+                       store->folders, folder_name);
+
+       /* If this is a normal folder and the store uses a
+        * virtual Junk folder, let the virtual Junk folder
+        * track this folder. */
+       if (vjunk != NULL) {
+               camel_vee_folder_add_folder (vjunk, folder, NULL);
+               g_object_unref (vjunk);
+       }
 
-               /* If this is a normal folder and the store uses a
-                * virtual Trash folder, let the virtual Trash folder
-                * track this folder. */
-               if (vtrash != NULL) {
-                       camel_vee_folder_add_folder (vtrash, folder, NULL);
-                       g_object_unref (vtrash);
-               }
+       /* If this is a normal folder and the store uses a
+        * virtual Trash folder, let the virtual Trash folder
+        * track this folder. */
+       if (vtrash != NULL) {
+               camel_vee_folder_add_folder (vtrash, folder, NULL);
+               g_object_unref (vtrash);
+       }
 
-               camel_operation_pop_message (cancellable);
+       camel_operation_pop_message (cancellable);
 
-               if (folder != NULL)
-                       camel_store_folder_opened (store, folder);
-       }
+       if (folder != NULL)
+               camel_store_folder_opened (store, folder);
 
        return folder;
 }
diff --git a/camel/camel-store.h b/camel/camel-store.h
index 5f5c24d..c0040b2 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -97,7 +97,7 @@ typedef struct _CamelStorePrivate CamelStorePrivate;
 /* open mode for folder */
 typedef enum {
        CAMEL_STORE_FOLDER_CREATE = 1 << 0,
-       CAMEL_STORE_FOLDER_EXCL = 1 << 1,
+       CAMEL_STORE_FOLDER_EXCL = 1 << 1,       /* deprecated, not honored */
        CAMEL_STORE_FOLDER_BODY_INDEX = 1 << 2,
        CAMEL_STORE_FOLDER_PRIVATE    = 1 << 3  /* a private folder that
                                                    should not show up in
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index d74d083..4dfe921 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -282,11 +282,6 @@ maildir_store_get_folder_sync (CamelStore *store,
                        error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
                        _("Cannot get folder '%s': not a maildir directory."),
                        name);
-       } else if (flags & CAMEL_STORE_FOLDER_EXCL) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot create folder '%s': folder exists."),
-                       folder_name);
        } else {
                folder = camel_maildir_folder_new (store, folder_name, flags, cancellable, error);
        }
diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c
index 95f8704..cbd2f20 100644
--- a/camel/providers/local/camel-mbox-store.c
+++ b/camel/providers/local/camel-mbox-store.c
@@ -434,13 +434,6 @@ mbox_store_get_folder_sync (CamelStore *store,
                        folder_name);
                g_free (name);
                return NULL;
-       } else if (flags & CAMEL_STORE_FOLDER_EXCL) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot create folder '%s': folder exists."),
-                       folder_name);
-               g_free (name);
-               return NULL;
        } else
                g_free (name);
 
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c
index a6b3935..54cbb59 100644
--- a/camel/providers/local/camel-mh-store.c
+++ b/camel/providers/local/camel-mh-store.c
@@ -558,13 +558,6 @@ mh_store_get_folder_sync (CamelStore *store,
                        _("Cannot get folder '%s': not a directory."),
                        folder_name);
                goto exit;
-
-       } else if (flags & CAMEL_STORE_FOLDER_EXCL) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot create folder '%s': folder exists."),
-                       folder_name);
-               goto exit;
        }
 
        folder = camel_mh_folder_new (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]