[evolution-data-server] Store QUOTAROOT information in CamelIMAPXMailbox.



commit 2eeeaedd41f6212abb5e6019f0f056c2d3d78133
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Sep 2 08:55:22 2013 -0400

    Store QUOTAROOT information in CamelIMAPXMailbox.
    
    Keep QUOTAROOT information in the named CamelIMAPXMailbox instead of
    CamelIMAPXFolder.  Also remove CamelIMAPXFolder's "quota-root-names"
    property, since it's no longer used.
    
    Removed functions:
    
      camel_imapx_folder_dup_quota_root_names()
      camel_imapx_folder_set_quota_root_names()

 camel/camel-imapx-folder.c              |   63 +------------------------------
 camel/camel-imapx-folder.h              |    5 --
 camel/camel-imapx-server.c              |   40 ++++---------------
 docs/reference/camel/camel-sections.txt |    2 -
 4 files changed, 10 insertions(+), 100 deletions(-)
---
diff --git a/camel/camel-imapx-folder.c b/camel/camel-imapx-folder.c
index b680856..7952bf5 100644
--- a/camel/camel-imapx-folder.c
+++ b/camel/camel-imapx-folder.c
@@ -46,7 +46,6 @@
 struct _CamelIMAPXFolderPrivate {
        GMutex property_lock;
        GWeakRef mailbox;
-       gchar **quota_root_names;
 
        GMutex move_to_hash_table_lock;
        GHashTable *move_to_real_junk_uids;
@@ -58,7 +57,6 @@ struct _CamelIMAPXFolderPrivate {
 enum {
        PROP_0,
        PROP_MAILBOX,
-       PROP_QUOTA_ROOT_NAMES,
        PROP_APPLY_FILTERS = 0x2501
 };
 
@@ -146,12 +144,6 @@ imapx_folder_set_property (GObject *object,
                                CAMEL_IMAPX_FOLDER (object),
                                g_value_get_object (value));
                        return;
-
-               case PROP_QUOTA_ROOT_NAMES:
-                       camel_imapx_folder_set_quota_root_names (
-                               CAMEL_IMAPX_FOLDER (object),
-                               g_value_get_boxed (value));
-                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -177,13 +169,6 @@ imapx_folder_get_property (GObject *object,
                                camel_imapx_folder_ref_mailbox (
                                CAMEL_IMAPX_FOLDER (object)));
                        return;
-
-               case PROP_QUOTA_ROOT_NAMES:
-                       g_value_take_boxed (
-                               value,
-                               camel_imapx_folder_dup_quota_root_names (
-                               CAMEL_IMAPX_FOLDER (object)));
-                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -227,7 +212,6 @@ imapx_folder_finalize (GObject *object)
        g_mutex_clear (&folder->stream_lock);
 
        g_mutex_clear (&folder->priv->property_lock);
-       g_strfreev (folder->priv->quota_root_names);
 
        g_mutex_clear (&folder->priv->move_to_hash_table_lock);
        g_hash_table_destroy (folder->priv->move_to_real_junk_uids);
@@ -695,8 +679,7 @@ imapx_get_quota_info_sync (CamelFolder *folder,
        if (!success)
                goto exit;
 
-       quota_roots = camel_imapx_folder_dup_quota_root_names (
-               CAMEL_IMAPX_FOLDER (folder));
+       quota_roots = camel_imapx_mailbox_dup_quota_roots (mailbox);
 
        /* XXX Just return info for the first quota root, I guess. */
        if (quota_roots != NULL && quota_roots[0] != NULL) {
@@ -1188,17 +1171,6 @@ camel_imapx_folder_class_init (CamelIMAPXFolderClass *class)
                        CAMEL_TYPE_IMAPX_MAILBOX,
                        G_PARAM_READWRITE |
                        G_PARAM_STATIC_STRINGS));
-
-       g_object_class_install_property (
-               object_class,
-               PROP_QUOTA_ROOT_NAMES,
-               g_param_spec_boxed (
-                       "quota-root-names",
-                       "Quota Root Names",
-                       "Quota root names for this folder",
-                       G_TYPE_STRV,
-                       G_PARAM_READWRITE |
-                       G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -1502,39 +1474,6 @@ exit:
        return mailbox;
 }
 
-gchar **
-camel_imapx_folder_dup_quota_root_names (CamelIMAPXFolder *folder)
-{
-       gchar **duplicate;
-
-       g_return_val_if_fail (CAMEL_IS_IMAPX_FOLDER (folder), NULL);
-
-       g_mutex_lock (&folder->priv->property_lock);
-
-       duplicate = g_strdupv (folder->priv->quota_root_names);
-
-       g_mutex_unlock (&folder->priv->property_lock);
-
-       return duplicate;
-}
-
-void
-camel_imapx_folder_set_quota_root_names (CamelIMAPXFolder *folder,
-                                         const gchar **quota_root_names)
-{
-       g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
-
-       g_mutex_lock (&folder->priv->property_lock);
-
-       g_strfreev (folder->priv->quota_root_names);
-       folder->priv->quota_root_names =
-               g_strdupv ((gchar **) quota_root_names);
-
-       g_mutex_unlock (&folder->priv->property_lock);
-
-       g_object_notify (G_OBJECT (folder), "quota-root-names");
-}
-
 /**
  * camel_imapx_folder_copy_message_map:
  * @folder: a #CamelIMAPXFolder
diff --git a/camel/camel-imapx-folder.h b/camel/camel-imapx-folder.h
index 7ff4901..a7efacf 100644
--- a/camel/camel-imapx-folder.h
+++ b/camel/camel-imapx-folder.h
@@ -97,11 +97,6 @@ CamelIMAPXMailbox *
                camel_imapx_folder_list_mailbox (CamelIMAPXFolder *folder,
                                                 GCancellable *cancellable,
                                                 GError **error);
-gchar **       camel_imapx_folder_dup_quota_root_names
-                                               (CamelIMAPXFolder *folder);
-void           camel_imapx_folder_set_quota_root_names
-                                               (CamelIMAPXFolder *folder,
-                                                const gchar **quota_root_names);
 GSequence *    camel_imapx_folder_copy_message_map
                                                (CamelIMAPXFolder *folder);
 void           camel_imapx_folder_add_move_to_real_junk
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index e3cf49f..bd44514 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -2539,13 +2539,10 @@ imapx_untagged_quotaroot (CamelIMAPXServer *is,
                           GCancellable *cancellable,
                           GError **error)
 {
-       CamelIMAPXStore *store;
-       CamelIMAPXStoreNamespace *ns;
-       CamelFolder *folder = NULL;
+       CamelIMAPXMailbox *mailbox;
        gchar *mailbox_name = NULL;
        gchar **quota_roots = NULL;
        gboolean success;
-       GError *local_error = NULL;
 
        success = camel_imapx_parse_quotaroot (
                stream, cancellable, &mailbox_name, &quota_roots, error);
@@ -2558,35 +2555,16 @@ imapx_untagged_quotaroot (CamelIMAPXServer *is,
        if (!success)
                return FALSE;
 
-       store = camel_imapx_server_ref_store (is);
-
-       ns = camel_imapx_store_summary_namespace_find_by_mailbox (
-               store->summary, mailbox_name);
-       if (ns != NULL) {
-               gchar *folder_path;
-
-               folder_path = camel_imapx_mailbox_to_folder_path (
-                       mailbox_name, ns->sep);
-               if (folder_path != NULL) {
-                       folder = camel_store_get_folder_sync (
-                               CAMEL_STORE (store), folder_path, 0,
-                               cancellable, &local_error);
-                       g_free (folder_path);
-               }
-       }
-
-       if (folder != NULL) {
-               camel_imapx_folder_set_quota_root_names (
-                       CAMEL_IMAPX_FOLDER (folder),
-                       (const gchar **) quota_roots);
-               g_object_unref (folder);
-       }
+       mailbox = camel_imapx_server_ref_mailbox (is, mailbox_name);
 
-       if (local_error != NULL) {
+       if (mailbox != NULL) {
+               camel_imapx_mailbox_set_quota_roots (
+                       mailbox, (const gchar **) quota_roots);
+               g_object_unref (mailbox);
+       } else {
                g_warning (
-                       "%s: Failed to get folder '%s': %s",
-                       G_STRFUNC, mailbox_name, local_error->message);
-               g_error_free (local_error);
+                       "%s: Unknown mailbox '%s'",
+                       G_STRFUNC, mailbox_name);
        }
 
        g_free (mailbox_name);
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 7cced08..d0cac1c 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -785,8 +785,6 @@ camel_imapx_folder_new
 camel_imapx_folder_ref_mailbox
 camel_imapx_folder_set_mailbox
 camel_imapx_folder_list_mailbox
-camel_imapx_folder_dup_quota_root_names
-camel_imapx_folder_set_quota_root_names
 camel_imapx_folder_copy_message_map
 camel_imapx_folder_add_move_to_real_junk
 camel_imapx_folder_add_move_to_real_trash


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