[evolution-data-server] CamelIMAPXStoreSummary cleanups.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] CamelIMAPXStoreSummary cleanups.
- Date: Sun, 27 Oct 2013 14:56:29 +0000 (UTC)
commit c2aef3bd588b2739bc9890dc0527d2a6b1b46f27
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Sep 12 11:58:39 2013 -0400
CamelIMAPXStoreSummary cleanups.
CamelIMAPXStoreSummary has no public or private members, so no reason
to cast pointers to that type. Stick with plain (CamelStoreSummary *).
Removed functions:
camel_imapx_store_summary_new()
camel/camel-imapx-folder.c | 17 ++---
camel/camel-imapx-server.c | 8 +-
camel/camel-imapx-store-summary.c | 100 +++++++++++++------------------
camel/camel-imapx-store-summary.h | 26 ++++-----
camel/camel-imapx-store.c | 93 +++++++++++-----------------
camel/camel-imapx-store.h | 3 +-
camel/camel-imapx-utils.c | 8 +--
docs/reference/camel/camel-sections.txt | 1 -
8 files changed, 103 insertions(+), 153 deletions(-)
---
diff --git a/camel/camel-imapx-folder.c b/camel/camel-imapx-folder.c
index 54fafc3..f142b9f 100644
--- a/camel/camel-imapx-folder.c
+++ b/camel/camel-imapx-folder.c
@@ -193,7 +193,7 @@ imapx_folder_dispose (GObject *object)
store = camel_folder_get_parent_store (CAMEL_FOLDER (folder));
if (store != NULL) {
camel_store_summary_disconnect_folder_summary (
- (CamelStoreSummary *) ((CamelIMAPXStore *) store)->summary,
+ CAMEL_IMAPX_STORE (store)->summary,
CAMEL_FOLDER (folder)->summary);
}
@@ -1104,8 +1104,7 @@ imapx_rename (CamelFolder *folder,
imapx_store = CAMEL_IMAPX_STORE (store);
camel_store_summary_disconnect_folder_summary (
- CAMEL_STORE_SUMMARY (imapx_store->summary),
- folder->summary);
+ imapx_store->summary, folder->summary);
/* Chain up to parent's rename() method. */
CAMEL_FOLDER_CLASS (camel_imapx_folder_parent_class)->
@@ -1114,8 +1113,7 @@ imapx_rename (CamelFolder *folder,
folder_name = camel_folder_get_full_name (folder);
camel_store_summary_connect_folder_summary (
- CAMEL_STORE_SUMMARY (imapx_store->summary),
- folder_name, folder->summary);
+ imapx_store->summary, folder_name, folder->summary);
}
static void
@@ -1303,7 +1301,7 @@ camel_imapx_folder_new (CamelStore *store,
}
camel_store_summary_connect_folder_summary (
- (CamelStoreSummary *) ((CamelIMAPXStore *) store)->summary,
+ CAMEL_IMAPX_STORE (store)->summary,
folder_name, folder->summary);
return folder;
@@ -1386,7 +1384,6 @@ camel_imapx_folder_list_mailbox (CamelIMAPXFolder *folder,
CamelIMAPXServer *server = NULL;
CamelIMAPXMailbox *mailbox;
CamelStore *parent_store;
- CamelStoreSummary *store_summary;
CamelStoreInfo *store_info;
CamelIMAPXStoreInfo *imapx_store_info;
gchar *folder_path = NULL;
@@ -1408,9 +1405,9 @@ camel_imapx_folder_list_mailbox (CamelIMAPXFolder *folder,
parent_store = camel_folder_get_parent_store (CAMEL_FOLDER (folder));
imapx_store = CAMEL_IMAPX_STORE (parent_store);
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
- store_info = camel_store_summary_path (store_summary, folder_path);
+ store_info = camel_store_summary_path (
+ imapx_store->summary, folder_path);
/* This should never fail. We needed the CamelStoreInfo
* to instantiate the CamelIMAPXFolder in the first place. */
@@ -1419,7 +1416,7 @@ camel_imapx_folder_list_mailbox (CamelIMAPXFolder *folder,
imapx_store_info = (CamelIMAPXStoreInfo *) store_info;
mailbox_name = g_strdup (imapx_store_info->mailbox_name);
- camel_store_summary_info_unref (store_summary, store_info);
+ camel_store_summary_info_unref (imapx_store->summary, store_info);
/* See if the CamelIMAPXServer already has the mailbox. */
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 77db9e4..2e8e2ea 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -7130,7 +7130,7 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is,
CamelStoreInfo *si;
/* ... and store's summary when folder's summary is dirty */
- si = camel_store_summary_path ((CamelStoreSummary *)((CamelIMAPXStore *)
parent_store)->summary, full_name);
+ si = camel_store_summary_path (CAMEL_IMAPX_STORE (parent_store)->summary, full_name);
if (si) {
if (si->total != camel_folder_summary_get_saved_count (folder->summary) ||
si->unread != camel_folder_summary_get_unread_count (folder->summary)) {
@@ -7140,15 +7140,15 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is,
* have downloaded is little. */
if (!mobile_mode)
si->unread = camel_folder_summary_get_unread_count
(folder->summary);
- camel_store_summary_touch ((CamelStoreSummary *)((CamelIMAPXStore *)
parent_store)->summary);
+ camel_store_summary_touch (CAMEL_IMAPX_STORE (parent_store)->summary);
}
- camel_store_summary_info_unref ((CamelStoreSummary *)((CamelIMAPXStore *)
parent_store)->summary, si);
+ camel_store_summary_info_unref (CAMEL_IMAPX_STORE (parent_store)->summary,
si);
}
}
camel_folder_summary_save_to_db (folder->summary, NULL);
- camel_store_summary_save ((CamelStoreSummary *)((CamelIMAPXStore *) parent_store)->summary);
+ camel_store_summary_save (CAMEL_IMAPX_STORE (parent_store)->summary);
imapx_unregister_job (is, job);
}
diff --git a/camel/camel-imapx-store-summary.c b/camel/camel-imapx-store-summary.c
index 5ce7b58..0b4ea96 100644
--- a/camel/camel-imapx-store-summary.c
+++ b/camel/camel-imapx-store-summary.c
@@ -1,22 +1,19 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * Authors: Michael Zucchi <notzed ximian com>
+ * camel-imapx-store-summary.c
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -48,7 +45,6 @@ G_DEFINE_TYPE (
camel_imapx_store_summary,
CAMEL_TYPE_STORE_SUMMARY)
-
static gboolean
namespace_load (FILE *in)
{
@@ -95,7 +91,7 @@ exit:
}
static gint
-imapx_store_summary_summary_header_load (CamelStoreSummary *s,
+imapx_store_summary_summary_header_load (CamelStoreSummary *summary,
FILE *in)
{
CamelStoreSummaryClass *store_summary_class;
@@ -106,7 +102,7 @@ imapx_store_summary_summary_header_load (CamelStoreSummary *s,
camel_imapx_store_summary_parent_class);
/* Chain up to parent's summary_header_load() method. */
- if (store_summary_class->summary_header_load (s, in) == -1)
+ if (store_summary_class->summary_header_load (summary, in) == -1)
return -1;
if (camel_file_util_decode_fixed_int32 (in, &version) == -1)
@@ -132,7 +128,7 @@ imapx_store_summary_summary_header_load (CamelStoreSummary *s,
}
static gint
-imapx_store_summary_summary_header_save (CamelStoreSummary *s,
+imapx_store_summary_summary_header_save (CamelStoreSummary *summary,
FILE *out)
{
CamelStoreSummaryClass *store_summary_class;
@@ -142,11 +138,12 @@ imapx_store_summary_summary_header_save (CamelStoreSummary *s,
camel_imapx_store_summary_parent_class);
/* Chain up to parent's summary_header_save() method. */
- if (store_summary_class->summary_header_save (s, out) == -1)
+ if (store_summary_class->summary_header_save (summary, out) == -1)
return -1;
/* always write as latest version */
- if (camel_file_util_encode_fixed_int32 (out, CAMEL_IMAPX_STORE_SUMMARY_VERSION) == -1)
+ if (camel_file_util_encode_fixed_int32 (
+ out, CAMEL_IMAPX_STORE_SUMMARY_VERSION) == -1)
return -1;
if (camel_file_util_encode_fixed_int32 (out, 0) == -1)
@@ -169,7 +166,7 @@ imapx_store_summary_summary_header_save (CamelStoreSummary *s,
}
static CamelStoreInfo *
-imapx_store_summary_store_info_load (CamelStoreSummary *s,
+imapx_store_summary_store_info_load (CamelStoreSummary *summary,
FILE *in)
{
CamelStoreSummaryClass *store_summary_class;
@@ -182,17 +179,17 @@ imapx_store_summary_store_info_load (CamelStoreSummary *s,
camel_imapx_store_summary_parent_class);
/* Chain up to parent's store_info_load() method. */
- si = store_summary_class->store_info_load (s, in);
+ si = store_summary_class->store_info_load (summary, in);
if (si == NULL)
return NULL;
if (camel_file_util_decode_string (in, &separator) == -1) {
- camel_store_summary_info_unref (s, si);
+ camel_store_summary_info_unref (summary, si);
return NULL;
}
if (camel_file_util_decode_string (in, &mailbox_name) == -1) {
- camel_store_summary_info_unref (s, si);
+ camel_store_summary_info_unref (summary, si);
return NULL;
}
@@ -213,7 +210,7 @@ imapx_store_summary_store_info_load (CamelStoreSummary *s,
}
static gint
-imapx_store_summary_store_info_save (CamelStoreSummary *s,
+imapx_store_summary_store_info_save (CamelStoreSummary *summary,
FILE *out,
CamelStoreInfo *si)
{
@@ -229,7 +226,7 @@ imapx_store_summary_store_info_save (CamelStoreSummary *s,
separator[0] = ((CamelIMAPXStoreInfo *) si)->separator;
/* Chain up to parent's store_info_save() method. */
- if (store_summary_class->store_info_save (s, out, si) == -1)
+ if (store_summary_class->store_info_save (summary, out, si) == -1)
return -1;
if (camel_file_util_encode_string (out, separator) == -1)
@@ -242,7 +239,7 @@ imapx_store_summary_store_info_save (CamelStoreSummary *s,
}
static void
-imapx_store_summary_store_info_free (CamelStoreSummary *s,
+imapx_store_summary_store_info_free (CamelStoreSummary *summary,
CamelStoreInfo *si)
{
CamelStoreSummaryClass *store_summary_class;
@@ -254,7 +251,7 @@ imapx_store_summary_store_info_free (CamelStoreSummary *s,
g_free (((CamelIMAPXStoreInfo *) si)->mailbox_name);
/* Chain up to parent's store_info_free() method. */
- store_summary_class->store_info_free (s, si);
+ store_summary_class->store_info_free (summary, si);
}
static void
@@ -272,39 +269,25 @@ camel_imapx_store_summary_class_init (CamelIMAPXStoreSummaryClass *class)
}
static void
-camel_imapx_store_summary_init (CamelIMAPXStoreSummary *s)
+camel_imapx_store_summary_init (CamelIMAPXStoreSummary *summary)
{
}
/**
- * camel_imapx_store_summary_new:
- *
- * Create a new CamelIMAPXStoreSummary object.
- *
- * Returns: A new CamelIMAPXStoreSummary widget.
- **/
-CamelIMAPXStoreSummary *
-camel_imapx_store_summary_new (void)
-{
- return g_object_new (CAMEL_TYPE_IMAPX_STORE_SUMMARY, NULL);
-}
-
-/**
* camel_imapx_store_summary_mailbox:
- * @s:
- * @mailbox_name:
+ * @summary: a #CamelStoreSummary
+ * @mailbox_name: a mailbox name
*
* Retrieve a summary item by mailbox name.
*
- * A referenced to the summary item is returned, which may be
- * ref'd or free'd as appropriate.
+ * The returned #CamelIMAPXStoreInfo is referenced for thread-safety
+ * and should be unreferenced with camel_store_summary_info_unref()
+ * when finished with it.
*
- * Returns: The summary item, or NULL if the @mailbox_name
- * is not available.
- * It must be freed using camel_store_summary_info_unref().
+ * Returns: a #CamelIMAPXStoreInfo, or %NULL
**/
CamelIMAPXStoreInfo *
-camel_imapx_store_summary_mailbox (CamelIMAPXStoreSummary *s,
+camel_imapx_store_summary_mailbox (CamelStoreSummary *summary,
const gchar *mailbox_name)
{
CamelStoreInfo *match = NULL;
@@ -312,9 +295,12 @@ camel_imapx_store_summary_mailbox (CamelIMAPXStoreSummary *s,
gboolean find_inbox;
guint ii;
+ g_return_val_if_fail (CAMEL_IS_IMAPX_STORE_SUMMARY (summary), NULL);
+ g_return_val_if_fail (mailbox_name != NULL, NULL);
+
find_inbox = camel_imapx_mailbox_is_inbox (mailbox_name);
- array = camel_store_summary_array (CAMEL_STORE_SUMMARY (s));
+ array = camel_store_summary_array (summary);
for (ii = 0; ii < array->len; ii++) {
CamelIMAPXStoreInfo *info;
@@ -325,26 +311,24 @@ camel_imapx_store_summary_mailbox (CamelIMAPXStoreSummary *s,
if (find_inbox && is_inbox) {
match = camel_store_summary_info_ref (
- CAMEL_STORE_SUMMARY (s),
- (CamelStoreInfo *) info);
+ summary, (CamelStoreInfo *) info);
break;
}
if (g_str_equal (info->mailbox_name, mailbox_name)) {
match = camel_store_summary_info_ref (
- CAMEL_STORE_SUMMARY (s),
- (CamelStoreInfo *) info);
+ summary, (CamelStoreInfo *) info);
break;
}
}
- camel_store_summary_array_free (CAMEL_STORE_SUMMARY (s), array);
+ camel_store_summary_array_free (summary, array);
return (CamelIMAPXStoreInfo *) match;
}
CamelIMAPXStoreInfo *
-camel_imapx_store_summary_add_from_mailbox (CamelIMAPXStoreSummary *s,
+camel_imapx_store_summary_add_from_mailbox (CamelStoreSummary *summary,
CamelIMAPXMailbox *mailbox)
{
CamelIMAPXStoreInfo *info;
@@ -352,17 +336,16 @@ camel_imapx_store_summary_add_from_mailbox (CamelIMAPXStoreSummary *s,
gchar *folder_path;
gchar separator;
- g_return_val_if_fail (CAMEL_IS_IMAPX_STORE_SUMMARY (s), NULL);
+ g_return_val_if_fail (CAMEL_IS_IMAPX_STORE_SUMMARY (summary), NULL);
g_return_val_if_fail (CAMEL_IS_IMAPX_MAILBOX (mailbox), NULL);
mailbox_name = camel_imapx_mailbox_get_name (mailbox);
separator = camel_imapx_mailbox_get_separator (mailbox);
- info = camel_imapx_store_summary_mailbox (s, mailbox_name);
+ info = camel_imapx_store_summary_mailbox (summary, mailbox_name);
if (info != NULL) {
camel_store_summary_info_unref (
- CAMEL_STORE_SUMMARY (s),
- (CamelStoreInfo *) info);
+ summary, (CamelStoreInfo *) info);
return info;
}
@@ -370,8 +353,7 @@ camel_imapx_store_summary_add_from_mailbox (CamelIMAPXStoreSummary *s,
mailbox_name, separator);
info = (CamelIMAPXStoreInfo *)
- camel_store_summary_add_from_path (
- CAMEL_STORE_SUMMARY (s), folder_path);
+ camel_store_summary_add_from_path (summary, folder_path);
g_free (folder_path);
diff --git a/camel/camel-imapx-store-summary.h b/camel/camel-imapx-store-summary.h
index 8f26091..c0f4319 100644
--- a/camel/camel-imapx-store-summary.h
+++ b/camel/camel-imapx-store-summary.h
@@ -1,22 +1,19 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * Authors: Michael Zucchi <notzed ximian com>
+ * camel-imapx-store-summary.h
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
*/
#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
@@ -69,16 +66,15 @@ struct _CamelIMAPXStoreSummaryClass {
CamelStoreSummaryClass parent_class;
};
-GType camel_imapx_store_summary_get_type (void);
-CamelIMAPXStoreSummary *
- camel_imapx_store_summary_new (void);
+GType camel_imapx_store_summary_get_type
+ (void) G_GNUC_CONST;
CamelIMAPXStoreInfo *
camel_imapx_store_summary_mailbox
- (CamelIMAPXStoreSummary *s,
+ (CamelStoreSummary *summary,
const gchar *mailbox_name);
CamelIMAPXStoreInfo *
camel_imapx_store_summary_add_from_mailbox
- (CamelIMAPXStoreSummary *s,
+ (CamelStoreSummary *summary,
CamelIMAPXMailbox *mailbox);
G_END_DECLS
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index 53a2357..9372db5 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -241,14 +241,11 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store,
const gchar *old_folder_path,
const gchar *new_folder_path)
{
- CamelStoreSummary *store_summary;
GPtrArray *array;
gint olen = strlen (old_folder_path);
guint ii;
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
-
- array = camel_store_summary_array (store_summary);
+ array = camel_store_summary_array (imapx_store->summary);
for (ii = 0; ii < array->len; ii++) {
CamelStoreInfo *si;
@@ -258,7 +255,7 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store,
gchar *new_mailbox_name;
si = g_ptr_array_index (array, ii);
- path = camel_store_info_path (store_summary, si);
+ path = camel_store_info_path (imapx_store->summary, si);
/* We need to adjust not only the entry for the renamed
* folder, but also the entries for all the descendants
@@ -274,7 +271,7 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store,
new_path = g_strdup (new_folder_path);
camel_store_info_set_string (
- store_summary, si,
+ imapx_store->summary, si,
CAMEL_STORE_INFO_PATH, new_path);
imapx_si = (CamelIMAPXStoreInfo *) si;
@@ -288,12 +285,12 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store,
g_free (imapx_si->mailbox_name);
imapx_si->mailbox_name = new_mailbox_name;
- camel_store_summary_touch (store_summary);
+ camel_store_summary_touch (imapx_store->summary);
g_free (new_path);
}
- camel_store_summary_array_free (store_summary, array);
+ camel_store_summary_array_free (imapx_store->summary, array);
}
static void
@@ -397,7 +394,6 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
CamelFolderInfo *fi;
CamelIMAPXStoreInfo *si;
CamelStoreInfoFlags flags;
- CamelStoreSummary *summary;
CamelSettings *settings;
gboolean use_subscriptions;
gboolean mailbox_is_subscribed;
@@ -411,8 +407,6 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
const gchar *mailbox_name;
gchar separator;
- summary = CAMEL_STORE_SUMMARY (store->summary);
-
settings = camel_service_ref_settings (CAMEL_SERVICE (store));
use_subscriptions = camel_imapx_settings_get_use_subscriptions (
CAMEL_IMAPX_SETTINGS (settings));
@@ -456,10 +450,11 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
if ((flags ^ si->info.flags) & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) {
si->info.flags &= ~CAMEL_FOLDER_SUBSCRIBED;
si->info.flags |= flags & CAMEL_FOLDER_SUBSCRIBED;
- camel_store_summary_touch (summary);
+ camel_store_summary_touch (store->summary);
}
- folder_path = camel_store_info_path (summary, (CamelStoreInfo *) si);
+ folder_path = camel_store_info_path (
+ store->summary, (CamelStoreInfo *) si);
fi = imapx_store_build_folder_info (store, folder_path, flags);
/* Figure out which signals to emit, if any. */
@@ -1104,14 +1099,12 @@ get_folder_offline (CamelStore *store,
CamelFolder *new_folder = NULL;
CamelStoreInfo *si;
CamelService *service;
- CamelStoreSummary *store_summary;
const gchar *user_cache_dir;
service = CAMEL_SERVICE (store);
user_cache_dir = camel_service_get_user_cache_dir (service);
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
- si = camel_store_summary_path (store_summary, folder_name);
+ si = camel_store_summary_path (imapx_store->summary, folder_name);
if (si != NULL) {
gchar *base_dir;
@@ -1124,7 +1117,7 @@ get_folder_offline (CamelStore *store,
g_free (folder_dir);
g_free (base_dir);
- camel_store_summary_info_unref (store_summary, si);
+ camel_store_summary_info_unref (imapx_store->summary, si);
} else {
g_set_error (
error, CAMEL_STORE_ERROR,
@@ -1187,19 +1180,16 @@ imapx_unmark_folder_subscribed (CamelIMAPXStore *imapx_store,
const gchar *folder_path,
gboolean emit_signal)
{
- CamelStoreSummary *store_summary;
CamelStoreInfo *si;
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
-
- si = camel_store_summary_path (store_summary, folder_path);
+ si = camel_store_summary_path (imapx_store->summary, folder_path);
if (si != NULL) {
if (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) {
si->flags &= ~CAMEL_STORE_INFO_FOLDER_SUBSCRIBED;
- camel_store_summary_touch (store_summary);
- camel_store_summary_save (store_summary);
+ camel_store_summary_touch (imapx_store->summary);
+ camel_store_summary_save (imapx_store->summary);
}
- camel_store_summary_info_unref (store_summary, si);
+ camel_store_summary_info_unref (imapx_store->summary, si);
}
if (emit_signal) {
@@ -1251,9 +1241,8 @@ imapx_delete_folder_from_cache (CamelIMAPXStore *imapx_store,
g_free (folder_dir);
event:
- camel_store_summary_remove_path (
- (CamelStoreSummary *) imapx_store->summary, folder_path);
- camel_store_summary_save ((CamelStoreSummary *) imapx_store->summary);
+ camel_store_summary_remove_path (imapx_store->summary, folder_path);
+ camel_store_summary_save (imapx_store->summary);
fi = imapx_store_build_folder_info (imapx_store, folder_path, 0);
camel_store_folder_deleted (CAMEL_STORE (imapx_store), fi);
@@ -1269,7 +1258,6 @@ get_folder_info_offline (CamelStore *store,
CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (store);
CamelService *service;
CamelSettings *settings;
- CamelStoreSummary *store_summary;
gboolean include_inbox = FALSE;
CamelFolderInfo *fi;
GPtrArray *folders;
@@ -1300,9 +1288,7 @@ get_folder_info_offline (CamelStore *store,
* the moment. So let it do the right thing by bailing out if it's
* not a folder we're explicitly interested in. */
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
-
- array = camel_store_summary_array (store_summary);
+ array = camel_store_summary_array (imapx_store->summary);
for (ii = 0; ii < array->len; ii++) {
CamelStoreInfo *si;
@@ -1311,7 +1297,7 @@ get_folder_info_offline (CamelStore *store,
gboolean si_is_match;
si = g_ptr_array_index (array, ii);
- folder_path = camel_store_info_path (store_summary, si);
+ folder_path = camel_store_info_path (imapx_store->summary, si);
si_is_inbox = (g_ascii_strcasecmp (folder_path, "INBOX") == 0);
/* Filter by folder path. */
@@ -1371,7 +1357,7 @@ get_folder_info_offline (CamelStore *store,
g_ptr_array_add (folders, fi);
}
- camel_store_summary_array_free (store_summary, array);
+ camel_store_summary_array_free (imapx_store->summary, array);
fi = camel_folder_info_build (folders, top, '/', TRUE);
@@ -1385,14 +1371,11 @@ collect_folder_info_for_list (CamelIMAPXStore *imapx_store,
CamelIMAPXMailbox *mailbox,
GHashTable *folder_info_results)
{
- CamelStoreSummary *store_summary;
CamelIMAPXStoreInfo *si;
CamelFolderInfo *fi;
const gchar *folder_path;
const gchar *mailbox_name;
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
-
mailbox_name = camel_imapx_mailbox_get_name (mailbox);
si = camel_imapx_store_summary_mailbox (
@@ -1400,7 +1383,7 @@ collect_folder_info_for_list (CamelIMAPXStore *imapx_store,
g_return_if_fail (si != NULL);
folder_path = camel_store_info_path (
- store_summary, (CamelStoreInfo *) si);
+ imapx_store->summary, (CamelStoreInfo *) si);
fi = imapx_store_build_folder_info (imapx_store, folder_path, 0);
/* Takes ownership of the CamelFolderInfo. */
@@ -1585,7 +1568,6 @@ sync_folders (CamelIMAPXStore *imapx_store,
GError **error)
{
CamelIMAPXServer *server;
- CamelStoreSummary *store_summary;
GHashTable *folder_info_results;
GPtrArray *array;
guint ii;
@@ -1595,8 +1577,6 @@ sync_folders (CamelIMAPXStore *imapx_store,
if (server == NULL)
return FALSE;
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
-
/* mailbox name -> CamelFolderInfo */
folder_info_results = g_hash_table_new_full (
(GHashFunc) imapx_name_hash,
@@ -1638,7 +1618,7 @@ sync_folders (CamelIMAPXStore *imapx_store,
if (!success)
goto exit;
- array = camel_store_summary_array (store_summary);
+ array = camel_store_summary_array (imapx_store->summary);
for (ii = 0; ii < array->len; ii++) {
CamelStoreInfo *si;
@@ -1648,7 +1628,7 @@ sync_folders (CamelIMAPXStore *imapx_store,
gboolean pattern_match;
si = g_ptr_array_index (array, ii);
- si_path = camel_store_info_path (store_summary, si);
+ si_path = camel_store_info_path (imapx_store->summary, si);
mailbox_name = ((CamelIMAPXStoreInfo *) si)->mailbox_name;
if (mailbox_name == NULL || *mailbox_name == '\0')
@@ -1673,12 +1653,13 @@ sync_folders (CamelIMAPXStore *imapx_store,
imapx_store, dup_folder_path);
g_free (dup_folder_path);
} else {
- camel_store_summary_remove (store_summary, si);
+ camel_store_summary_remove (
+ imapx_store->summary, si);
}
}
}
- camel_store_summary_array_free (store_summary, array);
+ camel_store_summary_array_free (imapx_store->summary, array);
exit:
g_hash_table_destroy (folder_info_results);
@@ -1713,7 +1694,7 @@ imapx_refresh_finfo (CamelSession *session,
sync_folders (store, NULL, 0, cancellable, error);
- camel_store_summary_save (CAMEL_STORE_SUMMARY (store->summary));
+ camel_store_summary_save (store->summary);
exit:
camel_operation_pop_message (cancellable);
@@ -1881,13 +1862,11 @@ imapx_store_get_folder_info_sync (CamelStore *store,
CamelFolderInfo *fi = NULL;
CamelService *service;
CamelSettings *settings;
- CamelStoreSummary *store_summary;
gboolean initial_setup = FALSE;
gboolean use_subscriptions;
service = CAMEL_SERVICE (store);
imapx_store = CAMEL_IMAPX_STORE (store);
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
settings = camel_service_ref_settings (service);
@@ -1944,7 +1923,7 @@ imapx_store_get_folder_info_sync (CamelStore *store,
if (!sync_folders (imapx_store, top, flags, cancellable, error))
goto exit;
- camel_store_summary_save (store_summary);
+ camel_store_summary_save (imapx_store->summary);
/* ensure the INBOX is subscribed if lsub was preferred*/
if (initial_setup && use_subscriptions)
@@ -2346,11 +2325,12 @@ imapx_store_initable_init (GInitable *initable,
service = CAMEL_SERVICE (initable);
user_cache_dir = camel_service_get_user_cache_dir (service);
- imapx_store->summary = camel_imapx_store_summary_new ();
+ imapx_store->summary =
+ g_object_new (CAMEL_TYPE_IMAPX_STORE_SUMMARY, NULL);
summary = g_build_filename (user_cache_dir, ".ev-store-summary", NULL);
- camel_store_summary_set_filename ((CamelStoreSummary *) imapx_store->summary, summary);
- camel_store_summary_load ((CamelStoreSummary *) imapx_store->summary);
+ camel_store_summary_set_filename (imapx_store->summary, summary);
+ camel_store_summary_load (imapx_store->summary);
g_free (summary);
@@ -2408,12 +2388,11 @@ imapx_store_folder_is_subscribed (CamelSubscribable *subscribable,
if (folder_name && *folder_name == '/')
folder_name++;
- si = camel_store_summary_path (
- (CamelStoreSummary *) imapx_store->summary, folder_name);
- if (si) {
- is_subscribed = (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) != 0;
- camel_store_summary_info_unref (
- (CamelStoreSummary *) imapx_store->summary, si);
+ si = camel_store_summary_path (imapx_store->summary, folder_name);
+ if (si != NULL) {
+ if (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED)
+ is_subscribed = TRUE;
+ camel_store_summary_info_unref (imapx_store->summary, si);
}
return is_subscribed;
diff --git a/camel/camel-imapx-store.h b/camel/camel-imapx-store.h
index 909a33c..6d75c4f 100644
--- a/camel/camel-imapx-store.h
+++ b/camel/camel-imapx-store.h
@@ -31,7 +31,6 @@
#include <camel/camel.h>
#include "camel-imapx-server.h"
-#include "camel-imapx-store-summary.h"
/* Standard GObject macros */
#define CAMEL_TYPE_IMAPX_STORE \
@@ -62,7 +61,7 @@ struct _CamelIMAPXStore {
CamelOfflineStore parent;
CamelIMAPXStorePrivate *priv;
- CamelIMAPXStoreSummary *summary; /* in-memory list of folders */
+ CamelStoreSummary *summary; /* in-memory list of folders */
};
struct _CamelIMAPXStoreClass {
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index 8ba8cb9..18032ec 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -339,7 +339,6 @@ imapx_update_store_summary (CamelFolder *folder)
{
CamelStoreInfo *si;
CamelStore *parent_store;
- CamelStoreSummary *store_summary;
CamelIMAPXStore *imapx_store;
const gchar *full_name;
guint32 total;
@@ -351,9 +350,8 @@ imapx_update_store_summary (CamelFolder *folder)
parent_store = camel_folder_get_parent_store (folder);
imapx_store = CAMEL_IMAPX_STORE (parent_store);
- store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
- si = camel_store_summary_path (store_summary, full_name);
+ si = camel_store_summary_path (imapx_store->summary, full_name);
if (si == NULL)
return;
@@ -364,8 +362,8 @@ imapx_update_store_summary (CamelFolder *folder)
si->unread = unread;
si->total = total;
- camel_store_summary_touch (store_summary);
- camel_store_summary_save (store_summary);
+ camel_store_summary_touch (imapx_store->summary);
+ camel_store_summary_save (imapx_store->summary);
}
}
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index f05d79d..999ad54 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -1143,7 +1143,6 @@ CamelIMAPXStorePrivate
<TITLE>CamelIMAPXStoreSummary</TITLE>
CamelIMAPXStoreInfo
CamelIMAPXStoreSummary
-camel_imapx_store_summary_new
camel_imapx_store_summary_mailbox
camel_imapx_store_summary_add_from_mailbox
<SUBSECTION Standard>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]