[evolution-mapi] Adapt to CamelStoreSummary API changes.



commit 45d291b835fd8fa452bd9e0c45abdcd0111be477
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Aug 16 15:07:42 2013 -0400

    Adapt to CamelStoreSummary API changes.

 src/camel/camel-mapi-folder.c                      |    4 +-
 src/camel/camel-mapi-store-summary.c               |   25 ++------
 src/camel/camel-mapi-store.c                       |   64 ++++++++++----------
 .../e-mapi-subscribe-foreign-folder.c              |    4 +-
 4 files changed, 42 insertions(+), 55 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index abef87b..d480ce3 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -1237,7 +1237,7 @@ mapi_folder_append_message_sync (CamelFolder *folder,
        si = camel_store_summary_path (mapi_store->summary, full_name);
        if (si) {
                folder_flags = si->flags;
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
        }
 
        if (((folder_flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_TRASH) ||
@@ -2169,7 +2169,7 @@ camel_mapi_folder_new (CamelStore *store,
                        folder->folder_flags |= CAMEL_FOLDER_IS_TRASH;
                else if ((si->flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_JUNK)
                        folder->folder_flags |= CAMEL_FOLDER_IS_JUNK;
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
        } else {
                g_warning ("%s: cannot find '%s' in known folders", G_STRFUNC, folder_name);
        }
diff --git a/src/camel/camel-mapi-store-summary.c b/src/camel/camel-mapi-store-summary.c
index 060f734..79375cf 100644
--- a/src/camel/camel-mapi-store-summary.c
+++ b/src/camel/camel-mapi-store-summary.c
@@ -48,7 +48,6 @@ static CamelStoreInfo *store_info_load (CamelStoreSummary *s, FILE *in);
 static gint store_info_save (CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi);
 static void store_info_free (CamelStoreSummary *s, CamelStoreInfo *mi);
 static void store_info_set_string (CamelStoreSummary *s, CamelStoreInfo *mi, gint type, const gchar *str);
-static const gchar *store_info_string (CamelStoreSummary *s, const CamelStoreInfo *mi, gint type);
 
 G_DEFINE_TYPE (CamelMapiStoreSummary, camel_mapi_store_summary, CAMEL_TYPE_STORE_SUMMARY)
 
@@ -63,7 +62,6 @@ camel_mapi_store_summary_class_init (CamelMapiStoreSummaryClass *class)
        store_summary_class->store_info_load = store_info_load;
        store_summary_class->store_info_save = store_info_save;
        store_summary_class->store_info_free = store_info_free;
-       store_summary_class->store_info_string = store_info_string;
        store_summary_class->store_info_set_string = store_info_set_string;
 }
 
@@ -140,7 +138,7 @@ store_info_load (CamelStoreSummary *s, FILE *in)
                    || camel_file_util_decode_string (in, &msi->foreign_username) == -1
                    || !e_mapi_util_mapi_id_from_string (folder_id_str, &msi->folder_id)
                    || !e_mapi_util_mapi_id_from_string (parent_id_str, &msi->parent_id)) {
-                       camel_store_summary_info_free (s, si);
+                       camel_store_summary_info_unref (s, si);
                        si = NULL;
                } else {
                        if (msi->foreign_username && !*msi->foreign_username) {
@@ -201,17 +199,6 @@ store_info_free (CamelStoreSummary *s, CamelStoreInfo *si)
        CAMEL_STORE_SUMMARY_CLASS (camel_mapi_store_summary_parent_class)->store_info_free (s, si);
 }
 
-static const gchar *
-store_info_string (CamelStoreSummary *s, const CamelStoreInfo *si, gint type)
-{
-       CamelMapiStoreInfo *msi = (CamelMapiStoreInfo *) si;
-
-       if (type == CAMEL_MAPI_STORE_INFO_FOREIGN_USERNAME)
-               return msi->foreign_username;
-
-       return CAMEL_STORE_SUMMARY_CLASS (camel_mapi_store_summary_parent_class)->store_info_string (s, si, 
type);
-}
-
 static void
 store_info_set_string (CamelStoreSummary *s, CamelStoreInfo *si, gint type, const gchar *str)
 {
@@ -245,7 +232,7 @@ camel_mapi_store_summary_add_from_full (CamelStoreSummary *s,
 
        si = camel_store_summary_path (s, path);
        if (si) {
-               camel_store_summary_info_free (s, si);
+               camel_store_summary_info_unref (s, si);
                return si;
        }
 
@@ -268,7 +255,7 @@ camel_mapi_store_summary_add_from_full (CamelStoreSummary *s,
        return si;
 }
 
-/* free the returned pointer with camel_store_summary_info_free(), if not NULL */
+/* free the returned pointer with camel_store_summary_info_unref(), if not NULL */
 CamelStoreInfo *
 camel_mapi_store_summary_get_folder_id (CamelStoreSummary *s, mapi_id_t folder_id)
 {
@@ -290,17 +277,17 @@ camel_mapi_store_summary_get_folder_id (CamelStoreSummary *s, mapi_id_t folder_i
                        */
                        if ((msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC_REAL) == 0) {
                                if (adept)
-                                       camel_store_summary_info_free (s, adept);
+                                       camel_store_summary_info_unref (s, adept);
                                return si;
                        } else {
                                if (adept)
-                                       camel_store_summary_info_free (s, adept);
+                                       camel_store_summary_info_unref (s, adept);
                                adept = si;
                                camel_store_summary_info_ref (s, adept);
                        }
                }
 
-               camel_store_summary_info_free (s, si);
+               camel_store_summary_info_unref (s, si);
        }
 
        return adept;
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 900a48f..15d7a8a 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -451,7 +451,7 @@ remove_path_from_store_summary (const gchar *path, gpointer value, CamelMapiStor
                camel_store_folder_deleted (CAMEL_STORE (mstore), fi);
                camel_folder_info_free (fi);
 
-               camel_store_summary_info_free (mstore->summary, si);
+               camel_store_summary_info_unref (mstore->summary, si);
        }
 
        camel_store_summary_remove_path (mstore->summary, path);
@@ -523,9 +523,9 @@ mapi_folders_sync (CamelMapiStore *store, guint32 flags, GCancellable *cancellab
                    (msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_FOREIGN) == 0) ||
                    ((msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC_REAL) != 0 &&
                    (msi->mapi_folder_flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) == 0))
-                       g_hash_table_insert (old_cache_folders, g_strdup (camel_store_info_path 
(store->summary, msi)), GINT_TO_POINTER (1));
+                       g_hash_table_insert (old_cache_folders, g_strdup (camel_store_info_path 
(store->summary, (CamelStoreInfo *) msi)), GINT_TO_POINTER (1));
 
-               camel_store_summary_info_free (store->summary, (CamelStoreInfo *) msi);
+               camel_store_summary_info_unref (store->summary, (CamelStoreInfo *) msi);
        }
 
        subscription_list = (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST);
@@ -623,7 +623,7 @@ mapi_folders_sync (CamelMapiStore *store, guint32 flags, GCancellable *cancellab
                        msi->info.unread = info->unread;
                        msi->mapi_folder_flags |= CAMEL_MAPI_STORE_FOLDER_FLAG_MAIL;
 
-                       camel_store_summary_info_free (store->summary, (CamelStoreInfo *) msi);
+                       camel_store_summary_info_unref (store->summary, (CamelStoreInfo *) msi);
                        camel_folder_info_free (info);
                } else if (folder->category == E_MAPI_FOLDER_CATEGORY_PUBLIC) {
                        info = mapi_convert_to_folder_info (store, folder, NULL);
@@ -647,7 +647,7 @@ mapi_folders_sync (CamelMapiStore *store, guint32 flags, GCancellable *cancellab
 
                        msi->info.flags = info->flags;
 
-                       camel_store_summary_info_free (store->summary, (CamelStoreInfo *) msi);
+                       camel_store_summary_info_unref (store->summary, (CamelStoreInfo *) msi);
                        camel_folder_info_free (info);
                }
        }
@@ -792,7 +792,7 @@ mapi_get_folder_info_offline (CamelStore *store,
                    ((msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC) == 0 ||
                    (msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC_REAL) == 0 ||
                    (msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_FOREIGN) != 0)) {
-                       camel_store_summary_info_free (mapi_store->summary, si);
+                       camel_store_summary_info_unref (mapi_store->summary, si);
                        continue;
                }
 
@@ -801,7 +801,7 @@ mapi_get_folder_info_offline (CamelStore *store,
                    (((si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) == 0 &&
                     (msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_PERSONAL) == 0) ||
                    (!subscription_list && (msi->mapi_folder_flags & 
CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC_REAL) != 0))) {
-                       camel_store_summary_info_free (mapi_store->summary, si);
+                       camel_store_summary_info_unref (mapi_store->summary, si);
                        continue;
                }
 
@@ -810,7 +810,7 @@ mapi_get_folder_info_offline (CamelStore *store,
                    (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) != 0 &&
                    ((msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC) != 0 ||
                     (msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_FOREIGN) != 0)) {
-                       camel_store_summary_info_free (mapi_store->summary, si);
+                       camel_store_summary_info_unref (mapi_store->summary, si);
                        continue;
                }
 
@@ -835,7 +835,7 @@ mapi_get_folder_info_offline (CamelStore *store,
                                        if (si != si2)
                                                fi->flags = si2->flags;
 
-                                       camel_store_summary_info_free (mapi_store->summary, si2);
+                                       camel_store_summary_info_unref (mapi_store->summary, si2);
                                }
 
                                folder_type = mapi_folders_hash_table_type_lookup (mapi_store, 
camel_store_info_path (mapi_store->summary, si));
@@ -847,7 +847,7 @@ mapi_get_folder_info_offline (CamelStore *store,
 
                        g_ptr_array_add (folders, fi);
                }
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
        }
 
        if (!subscription_list && !*top) {
@@ -975,7 +975,7 @@ mapi_rename_folder_infos (CamelMapiStore *mapi_store, const gchar *old_name, con
                                g_free (fid_str);
                        }
                }
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
        }
 
        camel_store_summary_unlock (mapi_store->summary, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
@@ -1181,7 +1181,7 @@ mapi_store_get_folder_sync (CamelStore *store,
        }
 
        if (si)
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
 
        service = CAMEL_SERVICE (store);
        user_cache_dir = camel_service_get_user_cache_dir (service);
@@ -1369,7 +1369,7 @@ mapi_store_create_folder_sync (CamelStore *store,
                        is_foreign ? parent_msi->foreign_username : NULL);
 
                if (parent_msi)
-                       camel_store_summary_info_free (mapi_store->summary, (CamelStoreInfo *) parent_msi);
+                       camel_store_summary_info_unref (mapi_store->summary, (CamelStoreInfo *) parent_msi);
 
                camel_store_summary_save (mapi_store->summary);
 
@@ -1676,7 +1676,7 @@ mapi_store_rename_folder_sync (CamelStore *store,
                                        camel_store_summary_remove (mapi_store->summary, si);
                                        si = NULL;
                                }
-                               camel_store_summary_info_free (mapi_store->summary, new_si);
+                               camel_store_summary_info_unref (mapi_store->summary, new_si);
                        }
                } else {
                        gboolean status = FALSE;
@@ -1746,7 +1746,7 @@ mapi_store_rename_folder_sync (CamelStore *store,
                camel_store_info_set_string (mapi_store->summary, si, CAMEL_STORE_INFO_PATH, new_name);
                if (new_parent_fid_str && e_mapi_util_mapi_id_from_string (new_parent_fid_str, 
&new_parent_fid))
                        ((CamelMapiStoreInfo *) si)->parent_id = new_parent_fid;
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
                camel_store_summary_touch (mapi_store->summary);
        }
 
@@ -1788,7 +1788,7 @@ mapi_store_folder_is_subscribed (CamelSubscribable *subscribable,
 
        if ((si = camel_store_summary_path (mapi_store->summary, folder_name))) {
                truth = (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) != 0;
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
        }
 
        return truth;
@@ -1838,7 +1838,7 @@ mapi_store_subscribe_folder_sync (CamelSubscribable *subscribable,
                   only on public folders, thus report success
                */
 
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
 
                return TRUE;
        }
@@ -1847,12 +1847,12 @@ mapi_store_subscribe_folder_sync (CamelSubscribable *subscribable,
        si2 = camel_store_summary_path (mapi_store->summary, path);
        if (si2 && ((CamelMapiStoreInfo *) si2)->folder_id == msi->folder_id && (si2->flags & 
CAMEL_FOLDER_SUBSCRIBED) != 0) {
                /* already subscribed */
-               camel_store_summary_info_free (mapi_store->summary, si);
-               camel_store_summary_info_free (mapi_store->summary, si2);
+               camel_store_summary_info_unref (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si2);
 
                return TRUE;
        } else if (si2) {
-               camel_store_summary_info_free (mapi_store->summary, si2);
+               camel_store_summary_info_unref (mapi_store->summary, si2);
                si2 = NULL;
        }
 
@@ -1913,7 +1913,7 @@ mapi_store_subscribe_folder_sync (CamelSubscribable *subscribable,
                        (gint) msi->folder_id,
                        cancellable,
                        error)) {
-                       camel_store_summary_info_free (mapi_store->summary, si);
+                       camel_store_summary_info_unref (mapi_store->summary, si);
                        g_free (profile);
                        g_free (path);
 
@@ -1922,7 +1922,7 @@ mapi_store_subscribe_folder_sync (CamelSubscribable *subscribable,
 
                g_free (profile);
        }
-       camel_store_summary_info_free (mapi_store->summary, si);
+       camel_store_summary_info_unref (mapi_store->summary, si);
        camel_store_summary_save (mapi_store->summary);
 
        g_free (path);
@@ -1972,7 +1972,7 @@ mapi_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
                                camel_store_summary_remove (mapi_store->summary, si2);
                                camel_store_summary_touch (mapi_store->summary);
                        } else {
-                               camel_store_summary_info_free (mapi_store->summary, si2);
+                               camel_store_summary_info_unref (mapi_store->summary, si2);
                        }
                } else {
                        g_debug ("%s: Failed to find subscribed by folder ID", G_STRFUNC);
@@ -1999,7 +1999,7 @@ mapi_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
                camel_store_summary_remove (mapi_store->summary, si);
                camel_store_summary_touch (mapi_store->summary);
        } else {
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
        }
 
        camel_store_summary_save (mapi_store->summary);
@@ -2428,11 +2428,11 @@ schedule_folder_update (CamelMapiStore *mapi_store, mapi_id_t fid)
 
        msi = (CamelMapiStoreInfo *) si;
        if ((msi->mapi_folder_flags & CAMEL_MAPI_STORE_FOLDER_FLAG_MAIL) == 0) {
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
                return;
        }
 
-       camel_store_summary_info_free (mapi_store->summary, si);
+       camel_store_summary_info_unref (mapi_store->summary, si);
 
        fidstr = e_mapi_util_mapi_id_to_string (fid);
        if (!fidstr)
@@ -2862,9 +2862,9 @@ mapi_folders_update_hash_tables_from_cache (CamelMapiStore *store)
                fid = e_mapi_util_mapi_id_to_string (msi->folder_id);
                pid = e_mapi_util_mapi_id_to_string (msi->parent_id);
 
-               mapi_update_folder_hash_tables (store, camel_store_info_path (summary, msi), fid, pid);
+               mapi_update_folder_hash_tables (store, camel_store_info_path (summary, (CamelStoreInfo *) 
msi), fid, pid);
 
-               camel_store_summary_info_free (summary, (CamelStoreInfo *) msi);
+               camel_store_summary_info_unref (summary, (CamelStoreInfo *) msi);
                g_free (fid);
                g_free (pid);
        }
@@ -2990,7 +2990,7 @@ camel_mapi_store_ensure_unique_path (CamelMapiStore *mapi_store,
 
                si = camel_store_summary_path (mapi_store->summary, *ppath);
                if (si) {
-                       camel_store_summary_info_free (mapi_store->summary, si);
+                       camel_store_summary_info_unref (mapi_store->summary, si);
 
                        done = FALSE;
                        counter++;
@@ -3029,7 +3029,7 @@ camel_mapi_store_announce_subscribed_folder (CamelMapiStore *mapi_store,
        si = camel_store_summary_path (mapi_store->summary, path);
        g_return_if_fail (si != NULL);
 
-       camel_store_summary_info_free (mapi_store->summary, si);
+       camel_store_summary_info_unref (mapi_store->summary, si);
 
        parts = g_strsplit (path, "/", -1);
        g_return_if_fail (parts != NULL);
@@ -3045,7 +3045,7 @@ camel_mapi_store_announce_subscribed_folder (CamelMapiStore *mapi_store,
                si = camel_store_summary_path (mapi_store->summary, partial_path->str);
                if (si) {
                        /* it's a known path, no need to announce it */
-                       camel_store_summary_info_free (mapi_store->summary, si);
+                       camel_store_summary_info_unref (mapi_store->summary, si);
                } else {
                        /* it's an unknown path, not a real path, thus announce it too,
                           to ensure the folder path for this new path will exist
@@ -3080,7 +3080,7 @@ camel_mapi_store_announce_subscribed_folder (CamelMapiStore *mapi_store,
        camel_subscribable_folder_subscribed (CAMEL_SUBSCRIBABLE (mapi_store), fi);
 
        camel_folder_info_free (fi);
-       camel_store_summary_info_free (mapi_store->summary, si);
+       camel_store_summary_info_unref (mapi_store->summary, si);
        g_free (folder_id_str);
        g_free (parent_id_str);
 }
diff --git a/src/configuration/e-mapi-subscribe-foreign-folder.c 
b/src/configuration/e-mapi-subscribe-foreign-folder.c
index 2c6f6d4..57674c3 100644
--- a/src/configuration/e-mapi-subscribe-foreign-folder.c
+++ b/src/configuration/e-mapi-subscribe-foreign-folder.c
@@ -99,7 +99,7 @@ add_foreign_folder_to_camel (CamelMapiStore *mapi_store,
                        }
                }
 
-               camel_store_summary_info_free (mapi_store->summary, si);
+               camel_store_summary_info_unref (mapi_store->summary, si);
        }
 
        if (res) {
@@ -147,7 +147,7 @@ add_foreign_folder_to_camel (CamelMapiStore *mapi_store,
        }
 
        if (parent_si)
-               camel_store_summary_info_free (mapi_store->summary, parent_si);
+               camel_store_summary_info_unref (mapi_store->summary, parent_si);
        g_free (parent_path);
 
        return res;


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