[evolution-data-server/wip/camel-more-gobject] Seal CamelFolderSummary properties + some API/function renames



commit 9cf51c6ce365f8f00ac5708f9f410e08ae83e375
Author: Milan Crha <mcrha redhat com>
Date:   Thu Nov 3 12:30:16 2016 +0100

    Seal CamelFolderSummary properties + some API/function renames

 src/camel/camel-db.c                              |    6 +-
 src/camel/camel-db.h                              |    2 +-
 src/camel/camel-folder-search.c                   |    6 +-
 src/camel/camel-folder-summary.c                  |  220 ++++++++++++++++-----
 src/camel/camel-folder-summary.h                  |   44 +++--
 src/camel/camel-folder.c                          |    4 +-
 src/camel/camel-store.c                           |    2 +-
 src/camel/camel-vee-summary.c                     |    2 +-
 src/camel/providers/imapx/camel-imapx-folder.c    |    2 +-
 src/camel/providers/imapx/camel-imapx-server.c    |   24 ++--
 src/camel/providers/imapx/camel-imapx-summary.c   |   30 ++--
 src/camel/providers/local/camel-local-summary.c   |   28 ++--
 src/camel/providers/local/camel-maildir-store.c   |    2 +-
 src/camel/providers/local/camel-maildir-summary.c |    6 +-
 src/camel/providers/local/camel-mbox-folder.c     |    4 +-
 src/camel/providers/local/camel-mbox-store.c      |    2 +-
 src/camel/providers/local/camel-mbox-summary.c    |   44 ++---
 src/camel/providers/local/camel-mh-store.c        |    6 +-
 src/camel/providers/local/camel-mh-summary.c      |    6 +-
 src/camel/providers/local/camel-spool-summary.c   |   13 +-
 src/camel/providers/nntp/camel-nntp-folder.c      |    8 +-
 src/camel/providers/nntp/camel-nntp-summary.c     |   24 ++--
 22 files changed, 297 insertions(+), 188 deletions(-)
---
diff --git a/src/camel/camel-db.c b/src/camel/camel-db.c
index 9411794..4e585ef 100644
--- a/src/camel/camel-db.c
+++ b/src/camel/camel-db.c
@@ -1953,12 +1953,12 @@ camel_db_write_folder_info_record (CamelDB *cdb,
 
        ins_query = sqlite3_mprintf (
                "INSERT INTO folders VALUES ("
-               "%Q, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %Q ) ",
+               "%Q, %d, %d, %d, %lld, %d, %d, %d, %d, %d, %d, %Q ) ",
                record->folder_name,
                record->version,
                record->flags,
                record->nextuid,
-               record->time,
+               record->timestamp,
                record->saved_count,
                record->unread_count,
                record->deleted_count,
@@ -2014,7 +2014,7 @@ read_fir_callback (gpointer ref,
                                rfd->record->nextuid = cols[i] ? strtoul (cols[i], NULL, 10) : 0;
                                break;
                        case CAMEL_DB_COLUMN_TIME:
-                               rfd->record->time = cols[i] ? strtoul (cols[i], NULL, 10) : 0;
+                               rfd->record->timestamp = cols[i] ? g_ascii_strtoll (cols[i], NULL, 10) : 0;
                                break;
                        case CAMEL_DB_COLUMN_SAVED_COUNT:
                                rfd->record->saved_count = cols[i] ? strtoul (cols[i], NULL, 10) : 0;
diff --git a/src/camel/camel-db.h b/src/camel/camel-db.h
index d88cab8..77a88b9 100644
--- a/src/camel/camel-db.h
+++ b/src/camel/camel-db.h
@@ -217,7 +217,7 @@ typedef struct _CamelFIRecord {
        guint32 version;
        guint32 flags;
        guint32 nextuid;
-       time_t time;
+       gint64 timestamp;
        guint32 saved_count;
        guint32 unread_count;
        guint32 deleted_count;
diff --git a/src/camel/camel-folder-search.c b/src/camel/camel-folder-search.c
index f83fc6d..289c59f 100644
--- a/src/camel/camel-folder-search.c
+++ b/src/camel/camel-folder-search.c
@@ -1943,7 +1943,7 @@ do_search_in_memory (CamelFolder *search_in_folder,
 
        if (search_in_folder &&
            camel_folder_get_folder_summary (search_in_folder) &&
-           (camel_folder_get_folder_summary (search_in_folder)->flags & CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY) 
!= 0)
+           (camel_folder_summary_get_flags (camel_folder_get_folder_summary (search_in_folder)) & 
CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY) != 0)
                return TRUE;
 
        if (!expr)
@@ -2084,7 +2084,7 @@ camel_folder_search_count (CamelFolderSearch *search,
                parent_store = camel_folder_get_parent_store (search->priv->folder);
 
                /* Sync the db, so that we search the db for changes */
-               camel_folder_summary_save_to_db (camel_folder_get_folder_summary (search->priv->folder), 
error);
+               camel_folder_summary_save (camel_folder_get_folder_summary (search->priv->folder), error);
 
                dd (printf ("sexp is : [%s]\n", expr));
                tmp1 = camel_db_sqlize_string (full_name);
@@ -2258,7 +2258,7 @@ camel_folder_search_search (CamelFolderSearch *search,
                parent_store = camel_folder_get_parent_store (search->priv->folder);
 
                /* Sync the db, so that we search the db for changes */
-               camel_folder_summary_save_to_db (camel_folder_get_folder_summary (search->priv->folder), 
error);
+               camel_folder_summary_save (camel_folder_get_folder_summary (search->priv->folder), error);
 
                dd (printf ("sexp is : [%s]\n", expr));
                tmp1 = camel_db_sqlize_string (full_name);
diff --git a/src/camel/camel-folder-summary.c b/src/camel/camel-folder-summary.c
index 9c3162b..c08d468 100644
--- a/src/camel/camel-folder-summary.c
+++ b/src/camel/camel-folder-summary.c
@@ -65,6 +65,11 @@
 #define dd(x) if (camel_debug("sync")) x
 
 struct _CamelFolderSummaryPrivate {
+       /* header info */
+       guint32 version;        /* version of file loaded/loading */
+       gint64 timestamp;       /* timestamp for this summary (for implementors to use) */
+       CamelFolderSummaryFlags flags;
+
        GHashTable *filter_charset;     /* CamelMimeFilterCharset's indexed by source charset */
 
        struct _CamelMimeFilter *filter_index;
@@ -323,7 +328,7 @@ is_in_memory_summary (CamelFolderSummary *summary)
 {
        g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), FALSE);
 
-       return (summary->flags & CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY) != 0;
+       return (summary->priv->flags & CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY) != 0;
 }
 
 #define UPDATE_COUNTS_ADD              (1)
@@ -419,31 +424,31 @@ folder_summary_update_counts_by_flags (CamelFolderSummary *summary,
 }
 
 static gboolean
-summary_header_from_db (CamelFolderSummary *summary,
-                        CamelFIRecord *record)
+summary_header_load (CamelFolderSummary *summary,
+                    CamelFIRecord *record)
 {
        io (printf ("Loading header from db \n"));
 
-       summary->version = record->version;
+       summary->priv->version = record->version;
 
        /* We may not worry, as we are setting a new standard here */
 #if 0
        /* Legacy version check, before version 12 we have no upgrade knowledge */
-       if ((summary->version > 0xff) && (summary->version & 0xff) < 12) {
+       if ((summary->priv->version > 0xff) && (summary->priv->version & 0xff) < 12) {
                io (printf ("Summary header version mismatch"));
                errno = EINVAL;
                return FALSE;
        }
 
-       if (!(summary->version < 0x100 && summary->version >= 13))
+       if (!(summary->priv->version < 0x100 && summary->priv->version >= 13))
                io (printf ("Loading legacy summary\n"));
        else
                io (printf ("loading new-format summary\n"));
 #endif
 
-       summary->flags = record->flags;
+       summary->priv->flags = record->flags;
        summary->priv->nextuid = record->nextuid;
-       summary->time = record->time;
+       summary->priv->timestamp = record->timestamp;
        summary->priv->saved_count = record->saved_count;
 
        summary->priv->unread_count = record->unread_count;
@@ -456,8 +461,8 @@ summary_header_from_db (CamelFolderSummary *summary,
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *summary,
-                      GError **error)
+summary_header_save (CamelFolderSummary *summary,
+                    GError **error)
 {
        CamelFIRecord *record = g_new0 (CamelFIRecord, 1);
        CamelStore *parent_store;
@@ -476,9 +481,9 @@ summary_header_to_db (CamelFolderSummary *summary,
 
        /* we always write out the current version */
        record->version = CAMEL_FOLDER_SUMMARY_VERSION;
-       record->flags = summary->flags;
+       record->flags = summary->priv->flags;
        record->nextuid = summary->priv->nextuid;
-       record->time = summary->time;
+       record->timestamp = summary->priv->timestamp;
 
        if (cdb && !is_in_memory_summary (summary)) {
                /* FIXME: Ever heard of Constructors and initializing ? */
@@ -606,8 +611,8 @@ camel_folder_summary_class_init (CamelFolderSummaryClass *class)
 
        class->message_info_type = CAMEL_TYPE_MESSAGE_INFO_BASE;
 
-       class->summary_header_from_db = summary_header_from_db;
-       class->summary_header_to_db = summary_header_to_db;
+       class->summary_header_load = summary_header_load;
+       class->summary_header_save = summary_header_save;
 
        class->message_info_new_from_header = message_info_new_from_header;
        class->message_info_new_from_parser = message_info_new_from_parser;
@@ -728,9 +733,9 @@ camel_folder_summary_init (CamelFolderSummary *summary)
 {
        summary->priv = CAMEL_FOLDER_SUMMARY_GET_PRIVATE (summary);
 
-       summary->version = CAMEL_FOLDER_SUMMARY_VERSION;
-       summary->flags = 0;
-       summary->time = 0;
+       summary->priv->version = CAMEL_FOLDER_SUMMARY_VERSION;
+       summary->priv->flags = 0;
+       summary->priv->timestamp = 0;
 
        summary->priv->filter_charset = g_hash_table_new (
                camel_strcase_hash, camel_strcase_equal);
@@ -777,6 +782,109 @@ camel_folder_summary_get_folder (CamelFolderSummary *summary)
 }
 
 /**
+ * camel_folder_summary_get_flags:
+ * @summary: a #CamelFolderSummary
+ *
+ * Returns: flags of the @summary, a bit-or of #CamelFolderSummaryFlags
+ *
+ * Since: 3.24
+ **/
+guint32
+camel_folder_summary_get_flags (CamelFolderSummary *summary)
+{
+       g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), 0);
+
+       return summary->priv->flags;
+}
+
+/**
+ * camel_folder_summary_set_flags:
+ * @summary: a #CamelFolderSummary
+ * @flags: flags to set
+ *
+ * Sets flags of the @summary, a bit-or of #CamelFolderSummaryFlags.
+ *
+ * Since: 3.24
+ **/
+void
+camel_folder_summary_set_flags (CamelFolderSummary *summary,
+                               guint32 flags)
+{
+       g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
+
+       summary->priv->flags = flags;
+}
+
+/**
+ * camel_folder_summary_get_timestamp:
+ * @summary: a #CamelFolderSummary
+ *
+ * Returns: timestamp of the @summary, as set by the descendants
+ *
+ * Since: 3.24
+ **/
+gint64
+camel_folder_summary_get_timestamp (CamelFolderSummary *summary)
+{
+       g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), 0);
+
+       return summary->priv->timestamp;
+}
+
+/**
+ * camel_folder_summary_set_timestamp:
+ * @summary: a #CamelFolderSummary
+ * @timestamp: a timestamp to set
+ *
+ * Sets timestamp of the @summary, provided by the descendants. This doesn't
+ * change the 'dirty' flag of the @summary.
+ *
+ * Since: 3.24
+ **/
+void
+camel_folder_summary_set_timestamp (CamelFolderSummary *summary,
+                                   gint64 timestamp)
+{
+       g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
+
+       summary->priv->timestamp = timestamp;
+}
+
+/**
+ * camel_folder_summary_get_version:
+ * @summary: a #CamelFolderSummary
+ *
+ * Returns: version of the @summary
+ *
+ * Since: 3.24
+ **/
+guint32
+camel_folder_summary_get_version (CamelFolderSummary *summary)
+{
+       g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), 0);
+
+       return summary->priv->version;
+}
+
+/**
+ * camel_folder_summary_get_version:
+ * @summary: a #CamelFolderSummary
+ * @version: version to set
+ *
+ * Sets version of the @summary.
+ *
+ * Since: 3.24
+ **/
+void
+camel_folder_summary_set_version (CamelFolderSummary *summary,
+                                 guint32 version)
+{
+       g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
+
+       summary->priv->version = version;
+}
+
+/**
  * camel_folder_summary_get_saved_count:
  * @summary: a #CamelFolderSummary object
  *
@@ -1620,14 +1728,15 @@ camel_folder_summary_prepare_fetch_all (CamelFolderSummary *summary,
 }
 
 /**
- * camel_folder_summary_load_from_db:
+ * camel_folder_summary_load:
  *
- * Since: 2.24
+ * Since: 3.24
  **/
 gboolean
-camel_folder_summary_load_from_db (CamelFolderSummary *summary,
-                                   GError **error)
+camel_folder_summary_load (CamelFolderSummary *summary,
+                          GError **error)
 {
+       CamelFolderSummaryClass *klass;
        CamelDB *cdb;
        CamelStore *parent_store;
        const gchar *full_name;
@@ -1636,18 +1745,21 @@ camel_folder_summary_load_from_db (CamelFolderSummary *summary,
 
        g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), FALSE);
 
+       klass = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary);
+       g_return_val_if_fail (klass != NULL, FALSE);
+
        if (is_in_memory_summary (summary))
                return TRUE;
 
        camel_folder_summary_lock (summary);
-       camel_folder_summary_save_to_db (summary, NULL);
+       camel_folder_summary_save (summary, NULL);
 
        /* struct _db_pass_data data; */
-       d (printf ("\ncamel_folder_summary_load_from_db called \n"));
+       d (printf ("\ncamel_folder_summary_load called \n"));
 
        full_name = camel_folder_get_full_name (summary->priv->folder);
        parent_store = camel_folder_get_parent_store (summary->priv->folder);
-       if (!camel_folder_summary_header_load_from_db (summary, parent_store, full_name, error)) {
+       if (!camel_folder_summary_header_load (summary, parent_store, full_name, error)) {
                camel_folder_summary_unlock (summary);
                return FALSE;
        }
@@ -1660,7 +1772,7 @@ camel_folder_summary_load_from_db (CamelFolderSummary *summary,
        cdb = camel_store_get_db (parent_store);
 
        ret = camel_db_get_folder_uids (
-               cdb, full_name, summary->sort_by, summary->collate,
+               cdb, full_name, klass->sort_by, klass->collate,
                summary->priv->uids, &local_error);
 
        if (local_error != NULL && local_error->message != NULL &&
@@ -1916,13 +2028,13 @@ save_message_infos_to_db (CamelFolderSummary *summary,
 }
 
 /**
- * camel_folder_summary_save_to_db:
+ * camel_folder_summary_save:
  *
- * Since: 2.24
+ * Since: 3.24
  **/
 gboolean
-camel_folder_summary_save_to_db (CamelFolderSummary *summary,
-                                 GError **error)
+camel_folder_summary_save (CamelFolderSummary *summary,
+                          GError **error)
 {
        CamelStore *parent_store;
        CamelDB *cdb;
@@ -1931,7 +2043,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
 
        g_return_val_if_fail (summary != NULL, FALSE);
 
-       if (!(summary->flags & CAMEL_FOLDER_SUMMARY_DIRTY) ||
+       if (!(summary->priv->flags & CAMEL_FOLDER_SUMMARY_DIRTY) ||
            is_in_memory_summary (summary))
                return TRUE;
 
@@ -1943,13 +2055,13 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
 
        camel_folder_summary_lock (summary);
 
-       d (printf ("\ncamel_folder_summary_save_to_db called \n"));
+       d (printf ("\ncamel_folder_summary_save called \n"));
 
-       summary->flags &= ~CAMEL_FOLDER_SUMMARY_DIRTY;
+       summary->priv->flags &= ~CAMEL_FOLDER_SUMMARY_DIRTY;
 
        count = cfs_count_dirty (summary);
        if (!count) {
-               gboolean res = camel_folder_summary_header_save_to_db (summary, error);
+               gboolean res = camel_folder_summary_header_save (summary, error);
                camel_folder_summary_unlock (summary);
                return res;
        }
@@ -1957,7 +2069,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
        ret = save_message_infos_to_db (summary, error);
        if (ret != 0) {
                /* Failed, so lets reset the flag */
-               summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
+               summary->priv->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
                camel_folder_summary_unlock (summary);
                return FALSE;
        }
@@ -1979,15 +2091,15 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
 
                ret = save_message_infos_to_db (summary, error);
                if (ret != 0) {
-                       summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
+                       summary->priv->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
                        camel_folder_summary_unlock (summary);
                        return FALSE;
                }
        }
 
-       record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_to_db (summary, error);
+       record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_save (summary, error);
        if (!record) {
-               summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
+               summary->priv->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
                camel_folder_summary_unlock (summary);
                return FALSE;
        }
@@ -2000,7 +2112,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
 
        if (ret != 0) {
                camel_db_abort_transaction (cdb, NULL);
-               summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
+               summary->priv->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
                camel_folder_summary_unlock (summary);
                return FALSE;
        }
@@ -2012,13 +2124,13 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
 }
 
 /**
- * camel_folder_summary_header_save_to_db:
+ * camel_folder_summary_header_save:
  *
- * Since: 2.24
+ * Since: 3.24
  **/
 gboolean
-camel_folder_summary_header_save_to_db (CamelFolderSummary *summary,
-                                        GError **error)
+camel_folder_summary_header_save (CamelFolderSummary *summary,
+                                 GError **error)
 {
        CamelStore *parent_store;
        CamelFIRecord *record;
@@ -2035,9 +2147,9 @@ camel_folder_summary_header_save_to_db (CamelFolderSummary *summary,
        cdb = camel_store_get_db (parent_store);
        camel_folder_summary_lock (summary);
 
-       d (printf ("\ncamel_folder_summary_header_save_to_db called \n"));
+       d (printf ("\ncamel_folder_summary_header_save called \n"));
 
-       record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_to_db (summary, error);
+       record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_save (summary, error);
        if (!record) {
                camel_folder_summary_unlock (summary);
                return FALSE;
@@ -2062,34 +2174,34 @@ camel_folder_summary_header_save_to_db (CamelFolderSummary *summary,
 }
 
 /**
- * camel_folder_summary_header_load_from_db:
+ * camel_folder_summary_header_load:
  *
- * Since: 2.24
+ * Since: 3.24
  **/
 gboolean
-camel_folder_summary_header_load_from_db (CamelFolderSummary *summary,
-                                          CamelStore *store,
-                                          const gchar *folder_name,
-                                          GError **error)
+camel_folder_summary_header_load (CamelFolderSummary *summary,
+                                 CamelStore *store,
+                                 const gchar *folder_name,
+                                 GError **error)
 {
        CamelDB *cdb;
        CamelFIRecord *record;
        gboolean ret = FALSE;
 
-       d (printf ("\ncamel_folder_summary_header_load_from_db called \n"));
+       d (printf ("\ncamel_folder_summary_header_load called \n"));
 
        if (is_in_memory_summary (summary))
                return TRUE;
 
        camel_folder_summary_lock (summary);
-       camel_folder_summary_save_to_db (summary, NULL);
+       camel_folder_summary_save (summary, NULL);
 
        cdb = camel_store_get_db (store);
 
        record = g_new0 (CamelFIRecord, 1);
        camel_db_read_folder_info_record (cdb, folder_name, record, error);
 
-       ret = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_from_db (summary, record);
+       ret = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_load (summary, record);
 
        camel_folder_summary_unlock (summary);
 
@@ -2375,7 +2487,7 @@ void
 camel_folder_summary_touch (CamelFolderSummary *summary)
 {
        camel_folder_summary_lock (summary);
-       summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
+       summary->priv->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
        camel_folder_summary_unlock (summary);
 }
 
diff --git a/src/camel/camel-folder-summary.h b/src/camel/camel-folder-summary.h
index 6bf2dde..ca4c198 100644
--- a/src/camel/camel-folder-summary.h
+++ b/src/camel/camel-folder-summary.h
@@ -76,17 +76,6 @@ typedef enum {
 struct _CamelFolderSummary {
        GObject parent;
        CamelFolderSummaryPrivate *priv;
-
-       /* header info */
-       guint32 version;        /* version of file loaded/loading */
-       time_t time;            /* timestamp for this summary (for implementors to use) */
-       CamelFolderSummaryFlags flags;
-
-       const gchar *collate;
-       const gchar *sort_by;
-
-       /* Future ABI expansion */
-       gpointer later[4];
 };
 
 struct _CamelMIRecord;
@@ -96,13 +85,15 @@ struct _CamelFolderSummaryClass {
        GObjectClass parent_class;
 
        GType message_info_type;
+       const gchar *collate;
+       const gchar *sort_by;
 
-       /* Load/Save folder summary from DB*/
-       gboolean        (*summary_header_from_db)
+       /* Load/Save folder summary*/
+       gboolean        (*summary_header_load)
                                        (CamelFolderSummary *summary,
                                         struct _CamelFIRecord *fir);
        struct _CamelFIRecord *
-                       (*summary_header_to_db)
+                       (*summary_header_save)
                                        (CamelFolderSummary *summary,
                                         GError **error);
 
@@ -139,7 +130,19 @@ CamelFolderSummary *
 
 struct _CamelFolder *
                camel_folder_summary_get_folder (CamelFolderSummary *summary);
-
+guint32                camel_folder_summary_get_flags  (CamelFolderSummary *summary);
+void           camel_folder_summary_set_flags  (CamelFolderSummary *summary,
+                                                guint32 flags);
+gint64         camel_folder_summary_get_timestamp
+                                               (CamelFolderSummary *summary);
+void           camel_folder_summary_set_timestamp
+                                               (CamelFolderSummary *summary,
+                                                gint64 timestamp);
+guint32                camel_folder_summary_get_version
+                                               (CamelFolderSummary *summary);
+void           camel_folder_summary_set_version
+                                               (CamelFolderSummary *summary,
+                                                guint32 version);
 guint32                camel_folder_summary_get_saved_count
                                                (CamelFolderSummary *summary);
 guint32                camel_folder_summary_get_unread_count
@@ -165,20 +168,19 @@ guint32           camel_folder_summary_get_next_uid
 gchar *                camel_folder_summary_next_uid_string
                                                (CamelFolderSummary *summary);
 
-/* load/save the full summary from/to the db */
-gboolean       camel_folder_summary_save_to_db (CamelFolderSummary *summary,
+/* load/save the full summary */
+gboolean       camel_folder_summary_save       (CamelFolderSummary *summary,
                                                 GError **error);
-gboolean       camel_folder_summary_load_from_db
-                                               (CamelFolderSummary *summary,
+gboolean       camel_folder_summary_load       (CamelFolderSummary *summary,
                                                 GError **error);
 
 /* only load the header */
-gboolean       camel_folder_summary_header_load_from_db
+gboolean       camel_folder_summary_header_load
                                                (CamelFolderSummary *summary,
                                                 struct _CamelStore *store,
                                                 const gchar *folder_name,
                                                 GError **error);
-gboolean       camel_folder_summary_header_save_to_db
+gboolean       camel_folder_summary_header_save
                                                (CamelFolderSummary *summary,
                                                 GError **error);
 
diff --git a/src/camel/camel-folder.c b/src/camel/camel-folder.c
index a32bd4d..3fa60fc 100644
--- a/src/camel/camel-folder.c
+++ b/src/camel/camel-folder.c
@@ -250,7 +250,7 @@ folder_filter_data_free_thread (gpointer user_data)
                camel_folder_free_deep (data->folder, data->notjunk);
 
        /* XXX Too late to pass a GError here. */
-       camel_folder_summary_save_to_db (camel_folder_get_folder_summary (data->folder), NULL);
+       camel_folder_summary_save (camel_folder_get_folder_summary (data->folder), NULL);
 
        camel_folder_thaw (data->folder);
        g_object_unref (data->folder);
@@ -983,7 +983,7 @@ folder_thaw (CamelFolder *folder)
                camel_folder_change_info_free (info);
 
                if (folder->priv->summary)
-                       camel_folder_summary_save_to_db (folder->priv->summary, NULL);
+                       camel_folder_summary_save (folder->priv->summary, NULL);
        }
 }
 
diff --git a/src/camel/camel-store.c b/src/camel/camel-store.c
index 82d2017..98e470a 100644
--- a/src/camel/camel-store.c
+++ b/src/camel/camel-store.c
@@ -452,7 +452,7 @@ store_synchronize_sync (CamelStore *store,
                CamelFolder *folder = folders->pdata[ii];
 
                if (camel_folder_get_folder_summary (folder))
-                       camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
+                       camel_folder_summary_save (camel_folder_get_folder_summary (folder), NULL);
 
                if (!CAMEL_IS_VEE_FOLDER (folder) && local_error == NULL) {
                        camel_folder_synchronize_sync (
diff --git a/src/camel/camel-vee-summary.c b/src/camel/camel-vee-summary.c
index 721c784..11e6a4e 100644
--- a/src/camel/camel-vee-summary.c
+++ b/src/camel/camel-vee-summary.c
@@ -145,7 +145,7 @@ camel_vee_summary_new (CamelFolder *parent)
        const gchar *full_name;
 
        summary = g_object_new (CAMEL_TYPE_VEE_SUMMARY, "folder", parent, NULL);
-       summary->flags |= CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY;
+       camel_folder_summary_set_flags (summary, camel_folder_summary_get_flags (summary) | 
CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY);
 
        /* not using DB for vee folder summaries, drop the table */
        full_name = camel_folder_get_full_name (parent);
diff --git a/src/camel/providers/imapx/camel-imapx-folder.c b/src/camel/providers/imapx/camel-imapx-folder.c
index e171c86..2d1080e 100644
--- a/src/camel/providers/imapx/camel-imapx-folder.c
+++ b/src/camel/providers/imapx/camel-imapx-folder.c
@@ -1460,7 +1460,7 @@ camel_imapx_folder_invalidate_local_cache (CamelIMAPXFolder *folder,
 
        CAMEL_IMAPX_SUMMARY (summary)->validity = new_uidvalidity;
        camel_folder_summary_touch (summary);
-       camel_folder_summary_save_to_db (summary, NULL);
+       camel_folder_summary_save (summary, NULL);
 
        camel_data_cache_clear (folder->cache, "cache");
        camel_data_cache_clear (folder->cache, "cur");
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 5d643fb..bdf51b3 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -775,7 +775,7 @@ imapx_expunge_uid_from_summary (CamelIMAPXServer *is,
 
                g_mutex_unlock (&is->priv->changes_lock);
 
-               camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
+               camel_folder_summary_save (camel_folder_get_folder_summary (folder), NULL);
                imapx_update_store_summary (folder);
                camel_folder_changed (folder, changes);
 
@@ -988,7 +988,7 @@ imapx_untagged_vanished (CamelIMAPXServer *is,
 
                        g_mutex_unlock (&is->priv->changes_lock);
 
-                       camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
+                       camel_folder_summary_save (camel_folder_get_folder_summary (folder), NULL);
                        imapx_update_store_summary (folder);
 
                        camel_folder_changed (folder, changes);
@@ -1272,7 +1272,7 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
                        g_free (uid);
 
                        if (changed && camel_imapx_server_is_in_idle (is)) {
-                               camel_folder_summary_save_to_db (camel_folder_get_folder_summary 
(select_folder), NULL);
+                               camel_folder_summary_save (camel_folder_get_folder_summary (select_folder), 
NULL);
                                imapx_update_store_summary (select_folder);
 
                                g_mutex_lock (&is->priv->changes_lock);
@@ -2330,7 +2330,7 @@ imapx_completion (CamelIMAPXServer *is,
                        folder = imapx_server_ref_folder (is, mailbox);
                        g_return_val_if_fail (folder != NULL, FALSE);
 
-                       camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
+                       camel_folder_summary_save (camel_folder_get_folder_summary (folder), NULL);
 
                        imapx_update_store_summary (folder);
                        camel_folder_changed (folder, changes);
@@ -4425,7 +4425,7 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
 
                                        if (camel_folder_change_info_changed (changes)) {
                                                camel_folder_summary_touch (camel_folder_get_folder_summary 
(destination_folder));
-                                               camel_folder_summary_save_to_db 
(camel_folder_get_folder_summary (destination_folder), NULL);
+                                               camel_folder_summary_save (camel_folder_get_folder_summary 
(destination_folder), NULL);
                                                camel_folder_changed (destination_folder, changes);
                                        }
 
@@ -4457,7 +4457,7 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
 
                                if (changes && camel_folder_change_info_changed (changes)) {
                                        camel_folder_summary_touch (camel_folder_get_folder_summary (folder));
-                                       camel_folder_summary_save_to_db (camel_folder_get_folder_summary 
(folder), NULL);
+                                       camel_folder_summary_save (camel_folder_get_folder_summary (folder), 
NULL);
                                        camel_folder_changed (folder, changes);
                                }
 
@@ -5134,7 +5134,7 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
                }
 
                if (camel_folder_change_info_changed (changes)) {
-                       camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
+                       camel_folder_summary_save (camel_folder_get_folder_summary (folder), NULL);
                        imapx_update_store_summary (folder);
                        camel_folder_changed (folder, changes);
                }
@@ -5202,7 +5202,7 @@ imapx_unset_folder_flagged_flag (CamelFolderSummary *summary,
 
        if (changed) {
                camel_folder_summary_touch (summary);
-               camel_folder_summary_save_to_db (summary, NULL);
+               camel_folder_summary_save (summary, NULL);
        }
 }
 
@@ -5626,7 +5626,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                unseen += unread_change;
                camel_imapx_mailbox_set_unseen (mailbox, unseen);
 
-               if ((folder_summary->flags & CAMEL_FOLDER_SUMMARY_DIRTY) != 0) {
+               if ((camel_folder_summary_get_flags (folder_summary) & CAMEL_FOLDER_SUMMARY_DIRTY) != 0) {
                        CamelStoreInfo *si;
 
                        /* ... and store's summary when folder's summary is dirty */
@@ -5643,7 +5643,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                        }
                }
 
-               camel_folder_summary_save_to_db (folder_summary, NULL);
+               camel_folder_summary_save (folder_summary, NULL);
                camel_store_summary_save (CAMEL_IMAPX_STORE (parent_store)->summary);
        }
 
@@ -5691,7 +5691,7 @@ camel_imapx_server_expunge_sync (CamelIMAPXServer *is,
 
                        camel_folder_summary_lock (folder_summary);
 
-                       camel_folder_summary_save_to_db (folder_summary, NULL);
+                       camel_folder_summary_save (folder_summary, NULL);
                        uids = camel_db_get_folder_deleted_uids (camel_store_get_db (parent_store), 
full_name, NULL);
 
                        if (uids && uids->len) {
@@ -5706,7 +5706,7 @@ camel_imapx_server_expunge_sync (CamelIMAPXServer *is,
                                }
 
                                camel_folder_summary_remove_uids (folder_summary, removed);
-                               camel_folder_summary_save_to_db (folder_summary, NULL);
+                               camel_folder_summary_save (folder_summary, NULL);
 
                                camel_folder_changed (folder, changes);
                                camel_folder_change_info_free (changes);
diff --git a/src/camel/providers/imapx/camel-imapx-summary.c b/src/camel/providers/imapx/camel-imapx-summary.c
index 28cdb20..6bb0757 100644
--- a/src/camel/providers/imapx/camel-imapx-summary.c
+++ b/src/camel/providers/imapx/camel-imapx-summary.c
@@ -39,15 +39,13 @@ G_DEFINE_TYPE (
        CAMEL_TYPE_FOLDER_SUMMARY)
 
 static gboolean
-imapx_summary_summary_header_from_db (CamelFolderSummary *s,
-                                      CamelFIRecord *mir)
+imapx_summary_summary_header_load (CamelFolderSummary *s,
+                                  CamelFIRecord *mir)
 {
        gboolean success;
 
-       /* Chain up to parent's summary_header_from_db() method. */
-       success = CAMEL_FOLDER_SUMMARY_CLASS (
-               camel_imapx_summary_parent_class)->
-               summary_header_from_db (s, mir);
+       /* Chain up to parent's summary_header_load() method. */
+       success = CAMEL_FOLDER_SUMMARY_CLASS (camel_imapx_summary_parent_class)->summary_header_load (s, mir);
 
        if (success) {
                CamelIMAPXSummary *ims;
@@ -74,15 +72,13 @@ imapx_summary_summary_header_from_db (CamelFolderSummary *s,
 }
 
 static CamelFIRecord *
-imapx_summary_summary_header_to_db (CamelFolderSummary *s,
-                                    GError **error)
+imapx_summary_summary_header_save (CamelFolderSummary *s,
+                                  GError **error)
 {
        struct _CamelFIRecord *fir;
 
-       /* Chain up to parent's summary_header_to_db() method. */
-       fir = CAMEL_FOLDER_SUMMARY_CLASS (
-               camel_imapx_summary_parent_class)->
-               summary_header_to_db (s, error);
+       /* Chain up to parent's summary_header_save() method. */
+       fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_imapx_summary_parent_class)->summary_header_save (s, error);
 
        if (fir != NULL) {
                CamelIMAPXSummary *ims;
@@ -110,8 +106,10 @@ camel_imapx_summary_class_init (CamelIMAPXSummaryClass *class)
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
        folder_summary_class->message_info_type = CAMEL_TYPE_IMAPX_MESSAGE_INFO;
-       folder_summary_class->summary_header_from_db = imapx_summary_summary_header_from_db;
-       folder_summary_class->summary_header_to_db = imapx_summary_summary_header_to_db;
+       folder_summary_class->sort_by = "uid";
+       folder_summary_class->collate = "imapx_uid_sort";
+       folder_summary_class->summary_header_load = imapx_summary_summary_header_load;
+       folder_summary_class->summary_header_save = imapx_summary_summary_header_save;
 }
 
 static void
@@ -170,11 +168,9 @@ camel_imapx_summary_new (CamelFolder *folder)
        /* Don't do DB sort. Its pretty slow to load */
        if (folder && 0) {
                camel_db_set_collate (camel_store_get_db (parent_store), "uid", "imapx_uid_sort", 
(CamelDBCollate) sort_uid_cmp);
-               summary->sort_by = "uid";
-               summary->collate = "imapx_uid_sort";
        }
 
-       if (!camel_folder_summary_load_from_db (summary, &local_error)) {
+       if (!camel_folder_summary_load (summary, &local_error)) {
                /* FIXME: Isn't this dangerous ? We clear the summary
                if it cannot be loaded, for some random reason.
                We need to pass the error and find out why it is not loaded etc. ? */
diff --git a/src/camel/providers/local/camel-local-summary.c b/src/camel/providers/local/camel-local-summary.c
index 8b86dfd..92c9016 100644
--- a/src/camel/providers/local/camel-local-summary.c
+++ b/src/camel/providers/local/camel-local-summary.c
@@ -38,9 +38,9 @@
 #define CAMEL_LOCAL_SUMMARY_VERSION (1)
 
 static CamelFIRecord *
-               summary_header_to_db            (CamelFolderSummary *,
+               summary_header_save             (CamelFolderSummary *,
                                                 GError **error);
-static gboolean        summary_header_from_db          (CamelFolderSummary *,
+static gboolean        summary_header_load             (CamelFolderSummary *,
                                                 CamelFIRecord *);
 
 static CamelMessageInfo *
@@ -117,8 +117,8 @@ camel_local_summary_class_init (CamelLocalSummaryClass *class)
        object_class->finalize = local_summary_finalize;
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->summary_header_from_db = summary_header_from_db;
-       folder_summary_class->summary_header_to_db = summary_header_to_db;
+       folder_summary_class->summary_header_load = summary_header_load;
+       folder_summary_class->summary_header_save = summary_header_save;
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
 
        class->load = local_summary_load;
@@ -138,7 +138,7 @@ camel_local_summary_init (CamelLocalSummary *local_summary)
        folder_summary = CAMEL_FOLDER_SUMMARY (local_summary);
 
        /* and a unique file version */
-       folder_summary->version += CAMEL_LOCAL_SUMMARY_VERSION;
+       camel_folder_summary_set_version (folder_summary, camel_folder_summary_get_version (folder_summary) + 
CAMEL_LOCAL_SUMMARY_VERSION);
 }
 
 void
@@ -158,7 +158,7 @@ local_summary_load (CamelLocalSummary *cls,
                     GError **error)
 {
        d (g_print ("\nlocal_summary_load called \n"));
-       return camel_folder_summary_load_from_db ((CamelFolderSummary *) cls, error);
+       return camel_folder_summary_load ((CamelFolderSummary *) cls, error);
 }
 
 /* load/check the summary */
@@ -483,7 +483,7 @@ local_summary_sync (CamelLocalSummary *cls,
 
        folder_summary = CAMEL_FOLDER_SUMMARY (cls);
 
-       if (!camel_folder_summary_save_to_db (folder_summary, error)) {
+       if (!camel_folder_summary_save (folder_summary, error)) {
                g_warning ("Could not save summary for local providers");
                return -1;
        }
@@ -694,15 +694,15 @@ local_summary_decode_x_evolution (CamelLocalSummary *cls,
 }
 
 static gboolean
-summary_header_from_db (CamelFolderSummary *s,
-                        CamelFIRecord *fir)
+summary_header_load (CamelFolderSummary *s,
+                    CamelFIRecord *fir)
 {
        CamelLocalSummary *cls = (CamelLocalSummary *) s;
        gchar *part, *tmp;
 
        /* We dont actually add our own headers, but version that we don't anyway */
 
-       if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_local_summary_parent_class)->summary_header_from_db (s, fir))
+       if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_local_summary_parent_class)->summary_header_load (s, fir))
                return FALSE;
 
        part = fir->bdata;
@@ -719,15 +719,15 @@ summary_header_from_db (CamelFolderSummary *s,
 }
 
 static struct _CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s,
-                      GError **error)
+summary_header_save (CamelFolderSummary *s,
+                    GError **error)
 {
        CamelFolderSummaryClass *folder_summary_class;
        struct _CamelFIRecord *fir;
 
-       /* Chain up to parent's summary_header_to_db() method. */
+       /* Chain up to parent's summary_header_save() method. */
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_local_summary_parent_class);
-       fir = folder_summary_class->summary_header_to_db (s, NULL);
+       fir = folder_summary_class->summary_header_save (s, NULL);
        if (fir)
                fir->bdata = g_strdup_printf ("%d", CAMEL_LOCAL_SUMMARY_VERSION);
 
diff --git a/src/camel/providers/local/camel-maildir-store.c b/src/camel/providers/local/camel-maildir-store.c
index 3912bfd..8b070fc 100644
--- a/src/camel/providers/local/camel-maildir-store.c
+++ b/src/camel/providers/local/camel-maildir-store.c
@@ -476,7 +476,7 @@ fill_fi (CamelStore *store,
                g_free (root);
 
                s = (CamelFolderSummary *) camel_maildir_summary_new (NULL, folderpath, NULL);
-               if (camel_folder_summary_header_load_from_db (s, store, fi->full_name, NULL)) {
+               if (camel_folder_summary_header_load (s, store, fi->full_name, NULL)) {
                        fi->unread = camel_folder_summary_get_unread_count (s);
                        fi->total = camel_folder_summary_get_saved_count (s);
                }
diff --git a/src/camel/providers/local/camel-maildir-summary.c 
b/src/camel/providers/local/camel-maildir-summary.c
index 7f79ae3..de646f6 100644
--- a/src/camel/providers/local/camel-maildir-summary.c
+++ b/src/camel/providers/local/camel-maildir-summary.c
@@ -125,6 +125,8 @@ camel_maildir_summary_class_init (CamelMaildirSummaryClass *class)
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
        folder_summary_class->message_info_type = CAMEL_TYPE_MAILDIR_MESSAGE_INFO;
+       folder_summary_class->sort_by = "dreceived";
+       folder_summary_class->collate = NULL;
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
        folder_summary_class->next_uid_string = maildir_summary_next_uid_string;
 
@@ -149,7 +151,7 @@ camel_maildir_summary_init (CamelMaildirSummary *maildir_summary)
                CAMEL_MAILDIR_SUMMARY_GET_PRIVATE (maildir_summary);
 
        /* set unique file version */
-       folder_summary->version += CAMEL_MAILDIR_SUMMARY_VERSION;
+       camel_folder_summary_set_version (folder_summary, camel_folder_summary_get_version (folder_summary) + 
CAMEL_MAILDIR_SUMMARY_VERSION);
 
        if (gethostname (hostname, 256) == 0) {
                maildir_summary->priv->hostname = g_strdup (hostname);
@@ -179,8 +181,6 @@ CamelMaildirSummary
 
                parent_store = camel_folder_get_parent_store (folder);
                camel_db_set_collate (camel_store_get_db (parent_store), "dreceived", NULL, NULL);
-               ((CamelFolderSummary *) o)->sort_by = "dreceived";
-               ((CamelFolderSummary *) o)->collate = NULL;
        }
        camel_local_summary_construct ((CamelLocalSummary *) o, maildirdir, index);
        return o;
diff --git a/src/camel/providers/local/camel-mbox-folder.c b/src/camel/providers/local/camel-mbox-folder.c
index 3425433..094772c 100644
--- a/src/camel/providers/local/camel-mbox-folder.c
+++ b/src/camel/providers/local/camel-mbox-folder.c
@@ -233,7 +233,7 @@ mbox_folder_append_message_sync (CamelFolder *folder,
        /* now we 'fudge' the summary  to tell it its uptodate, because its idea of uptodate has just changed 
*/
        /* the stat really shouldn't fail, we just wrote to it */
        if (g_stat (lf->folder_path, &st) == 0) {
-               ((CamelFolderSummary *) mbs)->time = st.st_mtime;
+               camel_folder_summary_set_timestamp (CAMEL_FOLDER_SUMMARY (mbs), st.st_mtime);
                mbs->folder_size = st.st_size;
        }
 
@@ -281,7 +281,7 @@ fail_write:
 
        /* and tell the summary it's up-to-date */
        if (g_stat (lf->folder_path, &st) == 0) {
-               ((CamelFolderSummary *) mbs)->time = st.st_mtime;
+               camel_folder_summary_set_timestamp (CAMEL_FOLDER_SUMMARY (mbs), st.st_mtime);
                mbs->folder_size = st.st_size;
        }
 
diff --git a/src/camel/providers/local/camel-mbox-store.c b/src/camel/providers/local/camel-mbox-store.c
index 3ec0448..01ec20d 100644
--- a/src/camel/providers/local/camel-mbox-store.c
+++ b/src/camel/providers/local/camel-mbox-store.c
@@ -134,7 +134,7 @@ fill_fi (CamelStore *store,
                mbs = (CamelMboxSummary *) camel_mbox_summary_new (
                        NULL, folderpath, NULL);
                /* FIXME[disk-summary] track exception */
-               if (camel_folder_summary_header_load_from_db ((CamelFolderSummary *) mbs, store, 
fi->full_name, NULL)) {
+               if (camel_folder_summary_header_load ((CamelFolderSummary *) mbs, store, fi->full_name, 
NULL)) {
                        fi->unread = camel_folder_summary_get_unread_count (
                                (CamelFolderSummary *) mbs);
                        fi->total = camel_folder_summary_get_saved_count (
diff --git a/src/camel/providers/local/camel-mbox-summary.c b/src/camel/providers/local/camel-mbox-summary.c
index ca31190..b9ac85d 100644
--- a/src/camel/providers/local/camel-mbox-summary.c
+++ b/src/camel/providers/local/camel-mbox-summary.c
@@ -55,9 +55,9 @@ struct _CamelMboxMessageContentInfo {
 };
 
 static CamelFIRecord *
-               summary_header_to_db            (CamelFolderSummary *,
+               summary_header_save             (CamelFolderSummary *,
                                                 GError **error);
-static gboolean        summary_header_from_db          (CamelFolderSummary *,
+static gboolean        summary_header_load             (CamelFolderSummary *,
                                                 CamelFIRecord *);
 static CamelMessageInfo *
                message_info_new_from_header    (CamelFolderSummary *,
@@ -116,8 +116,10 @@ camel_mbox_summary_class_init (CamelMboxSummaryClass *class)
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
        folder_summary_class->message_info_type = CAMEL_TYPE_MBOX_MESSAGE_INFO;
-       folder_summary_class->summary_header_from_db = summary_header_from_db;
-       folder_summary_class->summary_header_to_db = summary_header_to_db;
+       folder_summary_class->sort_by = "bdata";
+       folder_summary_class->collate = "mbox_frompos_sort";
+       folder_summary_class->summary_header_load = summary_header_load;
+       folder_summary_class->summary_header_save = summary_header_save;
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
        folder_summary_class->message_info_new_from_parser = message_info_new_from_parser;
 
@@ -139,7 +141,7 @@ camel_mbox_summary_init (CamelMboxSummary *mbox_summary)
        folder_summary = CAMEL_FOLDER_SUMMARY (mbox_summary);
 
        /* and a unique file version */
-       folder_summary->version += CAMEL_MBOX_SUMMARY_VERSION;
+       camel_folder_summary_set_version (folder_summary, camel_folder_summary_get_version (folder_summary) + 
CAMEL_MBOX_SUMMARY_VERSION);
 }
 
 /**
@@ -158,16 +160,12 @@ camel_mbox_summary_new (CamelFolder *folder,
 
        new = g_object_new (CAMEL_TYPE_MBOX_SUMMARY, "folder", folder, NULL);
        if (folder) {
-               CamelFolderSummary *summary = (CamelFolderSummary *) new;
                CamelStore *parent_store;
 
                parent_store = camel_folder_get_parent_store (folder);
 
                /* Set the functions for db sorting */
                camel_db_set_collate (camel_store_get_db (parent_store), "bdata", "mbox_frompos_sort", 
(CamelDBCollate) camel_local_frompos_sort);
-               summary->sort_by = "bdata";
-               summary->collate = "mbox_frompos_sort";
-
        }
        camel_local_summary_construct ((CamelLocalSummary *) new, mbox_name, index);
        return new;
@@ -200,13 +198,13 @@ mbox_summary_encode_x_evolution (CamelLocalSummary *cls,
 }
 
 static gboolean
-summary_header_from_db (CamelFolderSummary *s,
-                        struct _CamelFIRecord *fir)
+summary_header_load (CamelFolderSummary *s,
+                    struct _CamelFIRecord *fir)
 {
        CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY (s);
        gchar *part;
 
-       if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->summary_header_from_db (s, fir))
+       if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->summary_header_load (s, fir))
                return FALSE;
 
        part = fir->bdata;
@@ -219,17 +217,17 @@ summary_header_from_db (CamelFolderSummary *s,
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s,
-                      GError **error)
+summary_header_save (CamelFolderSummary *s,
+                    GError **error)
 {
        CamelFolderSummaryClass *folder_summary_class;
        CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY (s);
        struct _CamelFIRecord *fir;
        gchar *tmp;
 
-       /* Chain up to parent's summary_header_to_db() method. */
+       /* Chain up to parent's summary_header_save() method. */
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class);
-       fir = folder_summary_class->summary_header_to_db (s, error);
+       fir = folder_summary_class->summary_header_save (s, error);
        if (fir) {
                tmp = fir->bdata;
                fir->bdata = g_strdup_printf ("%s %d %d", tmp ? tmp : "", CAMEL_MBOX_SUMMARY_VERSION, (gint) 
mbs->folder_size);
@@ -472,7 +470,7 @@ summary_update (CamelLocalSummary *cls,
                if (g_stat (cls->folder_path, &st) == 0) {
                        camel_folder_summary_touch (s);
                        mbs->folder_size = st.st_size;
-                       s->time = st.st_mtime;
+                       camel_folder_summary_set_timestamp (s, st.st_mtime);
                }
        }
 
@@ -534,7 +532,7 @@ mbox_summary_check (CamelLocalSummary *cls,
                ret = 0;
        } else {
                /* is the summary uptodate? */
-               if (st.st_size != mbs->folder_size || st.st_mtime != s->time) {
+               if (st.st_size != mbs->folder_size || st.st_mtime != camel_folder_summary_get_timestamp (s)) {
                        if (mbs->folder_size < st.st_size) {
                                /* this will automatically rescan from 0 if there is a problem */
                                d (printf ("folder grew, attempting to rebuild from %d\n", mbs->folder_size));
@@ -551,9 +549,9 @@ mbox_summary_check (CamelLocalSummary *cls,
        /* FIXME: move upstream? */
 
        if (ret != -1) {
-               if (mbs->folder_size != st.st_size || s->time != st.st_mtime) {
+               if (mbs->folder_size != st.st_size || camel_folder_summary_get_timestamp (s) != st.st_mtime) {
                        mbs->folder_size = st.st_size;
-                       s->time = st.st_mtime;
+                       camel_folder_summary_set_timestamp (s, st.st_mtime);
                        camel_folder_summary_touch (s);
                }
        }
@@ -981,8 +979,8 @@ mbox_summary_sync (CamelLocalSummary *cls,
                return -1;
        }
 
-       if (mbs->folder_size != st.st_size || s->time != st.st_mtime) {
-               s->time = st.st_mtime;
+       if (mbs->folder_size != st.st_size || camel_folder_summary_get_timestamp (s) != st.st_mtime) {
+               camel_folder_summary_set_timestamp (s, st.st_mtime);
                mbs->folder_size = st.st_size;
                camel_folder_summary_touch (s);
        }
@@ -1211,7 +1209,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
        camel_folder_summary_free_array (known_uids);
 
        if (touched)
-               camel_folder_summary_header_save_to_db (s, NULL);
+               camel_folder_summary_header_save (s, NULL);
 
        camel_folder_summary_unlock (s);
 
diff --git a/src/camel/providers/local/camel-mh-store.c b/src/camel/providers/local/camel-mh-store.c
index e84d1cd..9dc7752 100644
--- a/src/camel/providers/local/camel-mh-store.c
+++ b/src/camel/providers/local/camel-mh-store.c
@@ -220,10 +220,8 @@ fill_fi (CamelStore *store,
                 * every file, i.e. very very slow */
 
                folderpath = g_strdup_printf ("%s/%s", path, fi->full_name);
-               s = (CamelFolderSummary *) camel_mh_summary_new (
-                       NULL, folderpath, NULL);
-               if (camel_folder_summary_header_load_from_db (
-                       s, store, fi->full_name, NULL)) {
+               s = (CamelFolderSummary *) camel_mh_summary_new (NULL, folderpath, NULL);
+               if (camel_folder_summary_header_load (s, store, fi->full_name, NULL)) {
                        fi->unread = camel_folder_summary_get_unread_count (s);
                        fi->total = camel_folder_summary_get_saved_count (s);
                }
diff --git a/src/camel/providers/local/camel-mh-summary.c b/src/camel/providers/local/camel-mh-summary.c
index 7e99d61..6c33a58 100644
--- a/src/camel/providers/local/camel-mh-summary.c
+++ b/src/camel/providers/local/camel-mh-summary.c
@@ -63,6 +63,8 @@ camel_mh_summary_class_init (CamelMhSummaryClass *class)
        g_type_class_add_private (class, sizeof (CamelMhSummaryPrivate));
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
+       folder_summary_class->sort_by = "uid";
+       folder_summary_class->collate = "mh_uid_sort";
        folder_summary_class->next_uid_string = mh_summary_next_uid_string;
 
        local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (class);
@@ -81,7 +83,7 @@ camel_mh_summary_init (CamelMhSummary *mh_summary)
        folder_summary = CAMEL_FOLDER_SUMMARY (mh_summary);
 
        /* set unique file version */
-       folder_summary->version += CAMEL_MH_SUMMARY_VERSION;
+       camel_folder_summary_set_version (folder_summary, camel_folder_summary_get_version (folder_summary) + 
CAMEL_MH_SUMMARY_VERSION);
 }
 
 /**
@@ -104,8 +106,6 @@ camel_mh_summary_new (CamelFolder *folder,
 
                parent_store = camel_folder_get_parent_store (folder);
                camel_db_set_collate (camel_store_get_db (parent_store), "uid", "mh_uid_sort", 
(CamelDBCollate) camel_local_frompos_sort);
-               ((CamelFolderSummary *) o)->sort_by = "uid";
-               ((CamelFolderSummary *) o)->collate = "mh_uid_sort";
        }
 
        camel_local_summary_construct ((CamelLocalSummary *) o, mhdir, index);
diff --git a/src/camel/providers/local/camel-spool-summary.c b/src/camel/providers/local/camel-spool-summary.c
index 3ee0cad..a0992d3 100644
--- a/src/camel/providers/local/camel-spool-summary.c
+++ b/src/camel/providers/local/camel-spool-summary.c
@@ -61,9 +61,14 @@ G_DEFINE_TYPE (CamelSpoolSummary, camel_spool_summary, CAMEL_TYPE_MBOX_SUMMARY)
 static void
 camel_spool_summary_class_init (CamelSpoolSummaryClass *class)
 {
+       CamelFolderSummaryClass *folder_summary_class;
        CamelLocalSummaryClass *local_summary_class;
        CamelMboxSummaryClass *mbox_summary_class;
 
+       folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
+       folder_summary_class->sort_by = "bdata";
+       folder_summary_class->collate = "spool_frompos_sort";
+
        local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (class);
        local_summary_class->load = spool_summary_load;
        local_summary_class->check = spool_summary_check;
@@ -83,7 +88,7 @@ camel_spool_summary_init (CamelSpoolSummary *spool_summary)
        /* message info size is from mbox parent */
 
        /* and a unique file version */
-       folder_summary->version += CAMEL_SPOOL_SUMMARY_VERSION;
+       camel_folder_summary_set_version (folder_summary, camel_folder_summary_get_version (folder_summary) + 
CAMEL_SPOOL_SUMMARY_VERSION);
 }
 
 CamelSpoolSummary *
@@ -98,11 +103,9 @@ camel_spool_summary_new (CamelFolder *folder,
 
                parent_store = camel_folder_get_parent_store (folder);
                camel_db_set_collate (camel_store_get_db (parent_store), "bdata", "spool_frompos_sort", 
(CamelDBCollate) camel_local_frompos_sort);
-               ((CamelFolderSummary *) new)->sort_by = "bdata";
-               ((CamelFolderSummary *) new)->collate = "spool_frompos_sort";
        }
        camel_local_summary_construct ((CamelLocalSummary *) new, mbox_name, NULL);
-       camel_folder_summary_load_from_db ((CamelFolderSummary *) new, NULL);
+       camel_folder_summary_load ((CamelFolderSummary *) new, NULL);
        return new;
 }
 
@@ -358,7 +361,7 @@ spool_summary_check (CamelLocalSummary *cls,
                }
 
                ((CamelMboxSummary *) cls)->folder_size = st.st_size;
-               ((CamelFolderSummary *) cls)->time = st.st_mtime;
+               camel_folder_summary_set_timestamp (CAMEL_FOLDER_SUMMARY (cls), st.st_mtime);
        }
 
        return 0;
diff --git a/src/camel/providers/nntp/camel-nntp-folder.c b/src/camel/providers/nntp/camel-nntp-folder.c
index 2ce8baa..44a03b5 100644
--- a/src/camel/providers/nntp/camel-nntp-folder.c
+++ b/src/camel/providers/nntp/camel-nntp-folder.c
@@ -114,7 +114,7 @@ nntp_folder_dispose (GObject *object)
        CamelStore *store;
 
        folder = CAMEL_FOLDER (object);
-       camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
+       camel_folder_summary_save (camel_folder_get_folder_summary (folder), NULL);
 
        store = camel_folder_get_parent_store (folder);
        if (store != NULL) {
@@ -546,7 +546,7 @@ nntp_folder_expunge_sync (CamelFolder *folder,
                g_clear_object (&info);
        }
 
-       camel_folder_summary_save_to_db (summary, NULL);
+       camel_folder_summary_save (summary, NULL);
        camel_folder_changed (folder, changes);
 
        camel_folder_change_info_free (changes);
@@ -701,7 +701,7 @@ nntp_folder_synchronize_sync (CamelFolder *folder,
                g_ptr_array_free (changed, TRUE);
        }
 
-       return camel_folder_summary_save_to_db (summary, error);
+       return camel_folder_summary_save (summary, error);
 }
 
 static gboolean
@@ -821,7 +821,7 @@ camel_nntp_folder_new (CamelStore *parent,
        if (filter_all || nntp_folder_get_apply_filters (nntp_folder))
                camel_folder_set_flags (folder, camel_folder_get_flags (folder) | CAMEL_FOLDER_FILTER_RECENT);
 
-       camel_folder_summary_load_from_db (camel_folder_get_folder_summary (folder), NULL);
+       camel_folder_summary_load (camel_folder_get_folder_summary (folder), NULL);
 
        nntp_store = CAMEL_NNTP_STORE (parent);
        nntp_store_summary = camel_nntp_store_ref_summary (nntp_store);
diff --git a/src/camel/providers/nntp/camel-nntp-summary.c b/src/camel/providers/nntp/camel-nntp-summary.c
index 8170be0..4ce0460 100644
--- a/src/camel/providers/nntp/camel-nntp-summary.c
+++ b/src/camel/providers/nntp/camel-nntp-summary.c
@@ -52,8 +52,8 @@ struct _CamelNNTPSummaryPrivate {
 };
 
 static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, CamelHeaderRaw *);
-static gboolean summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
+static gboolean summary_header_load (CamelFolderSummary *s, CamelFIRecord *mir);
+static CamelFIRecord * summary_header_save (CamelFolderSummary *s, GError **error);
 
 G_DEFINE_TYPE (CamelNNTPSummary, camel_nntp_summary, CAMEL_TYPE_FOLDER_SUMMARY)
 
@@ -66,8 +66,8 @@ camel_nntp_summary_class_init (CamelNNTPSummaryClass *class)
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
-       folder_summary_class->summary_header_from_db = summary_header_from_db;
-       folder_summary_class->summary_header_to_db = summary_header_to_db;
+       folder_summary_class->summary_header_load = summary_header_load;
+       folder_summary_class->summary_header_save = summary_header_save;
 }
 
 static void
@@ -78,7 +78,7 @@ camel_nntp_summary_init (CamelNNTPSummary *nntp_summary)
        nntp_summary->priv = CAMEL_NNTP_SUMMARY_GET_PRIVATE (nntp_summary);
 
        /* and a unique file version */
-       summary->version += CAMEL_NNTP_SUMMARY_VERSION;
+       camel_folder_summary_set_version (summary, camel_folder_summary_get_version (summary) + 
CAMEL_NNTP_SUMMARY_VERSION);
 }
 
 CamelNNTPSummary *
@@ -113,13 +113,13 @@ message_info_new_from_header (CamelFolderSummary *s,
 }
 
 static gboolean
-summary_header_from_db (CamelFolderSummary *s,
-                        CamelFIRecord *mir)
+summary_header_load (CamelFolderSummary *s,
+                    CamelFIRecord *mir)
 {
        CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY (s);
        gchar *part;
 
-       if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_nntp_summary_parent_class)->summary_header_from_db (s, mir))
+       if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_nntp_summary_parent_class)->summary_header_load (s, mir))
                return FALSE;
 
        part = mir->bdata;
@@ -132,13 +132,13 @@ summary_header_from_db (CamelFolderSummary *s,
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s,
-                      GError **error)
+summary_header_save (CamelFolderSummary *s,
+                    GError **error)
 {
        CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY (s);
        struct _CamelFIRecord *fir;
 
-       fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_nntp_summary_parent_class)->summary_header_to_db (s, error);
+       fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_nntp_summary_parent_class)->summary_header_save (s, error);
        if (!fir)
                return NULL;
        fir->bdata = g_strdup_printf ("%d %d %d", CAMEL_NNTP_SUMMARY_VERSION, cns->high, cns->low);
@@ -534,7 +534,7 @@ camel_nntp_summary_check (CamelNNTPSummary *cns,
 
        /* TODO: not from here */
        camel_folder_summary_touch (s);
-       camel_folder_summary_save_to_db (s, NULL);
+       camel_folder_summary_save (s, NULL);
 
 update:
        /* update store summary if we have it */


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