[balsa] Move messages-loaded to LibBalsaMailboxLocal
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Move messages-loaded to LibBalsaMailboxLocal
- Date: Thu, 30 Jan 2020 19:32:24 +0000 (UTC)
commit 0b5d88db4684b0e0da9b1a5399cbb8808f218f87
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Jan 30 14:30:30 2020 -0500
Move messages-loaded to LibBalsaMailboxLocal
Move messages-loaded from LibBalsaMailbox to LibBalsaMailboxLocal
* libbalsa/mailbox.c (libbalsa_mailbox_close),
(libbalsa_mailbox_set_has_unread_messages): drop the getter and setter;
* libbalsa/mailbox.h: ditto;
* libbalsa/mailbox_local.c (libbalsa_mailbox_local_close_mailbox),
(lbml_load_messages_idle_cb), (libbalsa_mailbox_local_load_messages),
(lbml_set_threading_idle_cb), (libbalsa_mailbox_local_set_threading):
add and use LibBalsaMailboxLocalPrivate:messages_loaded.
ChangeLog | 15 +++++++++++++++
libbalsa/mailbox.c | 25 +------------------------
libbalsa/mailbox.h | 3 ---
libbalsa/mailbox_local.c | 11 +++++++----
4 files changed, 23 insertions(+), 31 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3f3a39112..731c794a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2020-01-30 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Move messages-loaded from LibBalsaMailbox to LibBalsaMailboxLocal
+
+ * libbalsa/mailbox.c (libbalsa_mailbox_close),
+ (libbalsa_mailbox_set_has_unread_messages): drop the getter and
+ setter;
+ * libbalsa/mailbox.h: ditto;
+ * libbalsa/mailbox_local.c (libbalsa_mailbox_local_close_mailbox),
+ (lbml_load_messages_idle_cb),
+ (libbalsa_mailbox_local_load_messages),
+ (lbml_set_threading_idle_cb),
+ (libbalsa_mailbox_local_set_threading): add and use
+ LibBalsaMailboxLocalPrivate:messages_loaded.
+
2020-01-30 Peter Bloomfield <pbloomfield bellsouth net>
mailbox-local: Improve threading
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index fac14fc0f..fa5cb8a73 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -164,8 +164,7 @@ struct _LibBalsaMailboxPrivate {
gboolean no_reassemble : 1;
/* Whether the tree has been changed since some event. */
gboolean msg_tree_changed : 1;
- /* Whether messages have been loaded and threaded. */
- gboolean messages_loaded : 1;
+ /* Whether messages have been threaded. */
gboolean messages_threaded : 1;
};
@@ -655,7 +654,6 @@ libbalsa_mailbox_close(LibBalsaMailbox * mailbox, gboolean expunge)
libbalsa_mailbox_free_mindex(mailbox);
priv->stamp++;
priv->state = LB_MAILBOX_STATE_CLOSED;
- priv->messages_loaded = FALSE;
priv->messages_threaded = FALSE;
if (priv->run_filters_idle_id != 0) {
@@ -4891,16 +4889,6 @@ libbalsa_mailbox_get_has_unread_messages(LibBalsaMailbox * mailbox)
return priv->has_unread_messages != 0;
}
-gboolean
-libbalsa_mailbox_get_messages_loaded(LibBalsaMailbox * mailbox)
-{
- LibBalsaMailboxPrivate *priv = libbalsa_mailbox_get_instance_private(mailbox);
-
- g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mailbox), FALSE);
-
- return priv->messages_loaded != 0;
-}
-
gboolean
libbalsa_mailbox_get_messages_threaded(LibBalsaMailbox * mailbox)
{
@@ -5031,17 +5019,6 @@ libbalsa_mailbox_set_has_unread_messages(LibBalsaMailbox * mailbox,
priv->has_unread_messages = !!has_unread_messages;
}
-void
-libbalsa_mailbox_set_messages_loaded(LibBalsaMailbox * mailbox,
- gboolean messages_loaded)
-{
- LibBalsaMailboxPrivate *priv = libbalsa_mailbox_get_instance_private(mailbox);
-
- g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
-
- priv->messages_loaded = !!messages_loaded;
-}
-
void
libbalsa_mailbox_set_messages_threaded(LibBalsaMailbox * mailbox,
gboolean messages_threaded)
diff --git a/libbalsa/mailbox.h b/libbalsa/mailbox.h
index bba8a7366..28bf7aa1e 100644
--- a/libbalsa/mailbox.h
+++ b/libbalsa/mailbox.h
@@ -619,7 +619,6 @@ guint libbalsa_mailbox_get_open_ref(LibBalsaMailbox * mailbox);
gboolean libbalsa_mailbox_get_readonly(LibBalsaMailbox * mailbox);
const gchar * libbalsa_mailbox_get_config_prefix(LibBalsaMailbox * mailbox);
gboolean libbalsa_mailbox_get_has_unread_messages(LibBalsaMailbox * mailbox);
-gboolean libbalsa_mailbox_get_messages_loaded(LibBalsaMailbox * mailbox);
gboolean libbalsa_mailbox_get_messages_threaded(LibBalsaMailbox * mailbox);
/*
@@ -638,8 +637,6 @@ void libbalsa_mailbox_set_name(LibBalsaMailbox * mailbox, const gchar * name);
void libbalsa_mailbox_set_view(LibBalsaMailbox * mailbox, LibBalsaMailboxView * view);
void libbalsa_mailbox_set_has_unread_messages(LibBalsaMailbox * mailbox,
gboolean has_unread_messages);
-void libbalsa_mailbox_set_messages_loaded(LibBalsaMailbox * mailbox,
- gboolean messages_loaded);
void libbalsa_mailbox_set_messages_threaded(LibBalsaMailbox * mailbox,
gboolean messages_threaded);
void libbalsa_mailbox_set_config_prefix(LibBalsaMailbox * mailbox,
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 680937889..a64a2fbe6 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -52,6 +52,7 @@ struct _LibBalsaMailboxLocalPrivate {
GPtrArray *threading_info;
LibBalsaMailboxLocalPool message_pool[LBML_POOL_SIZE];
guint pool_seqno;
+ gboolean messages_loaded;
};
static void libbalsa_mailbox_local_finalize(GObject * object);
@@ -789,6 +790,8 @@ libbalsa_mailbox_local_close_mailbox(LibBalsaMailbox * mailbox,
}
priv->pool_seqno = 0;
+ priv->messages_loaded = FALSE;
+
if (LIBBALSA_MAILBOX_CLASS(libbalsa_mailbox_local_parent_class)->close_mailbox)
LIBBALSA_MAILBOX_CLASS(libbalsa_mailbox_local_parent_class)->close_mailbox(mailbox,
expunge);
@@ -1092,7 +1095,7 @@ lbml_load_messages_idle_cb(LibBalsaMailbox * mailbox)
if (msg_info->message)
lbm_local_cache_message(local, msgno, msg_info->message);
}
- libbalsa_mailbox_set_messages_loaded(mailbox, TRUE);
+ priv->messages_loaded = TRUE;
if (new_messages > 0) {
libbalsa_mailbox_run_filters_on_reception(mailbox);
@@ -1116,7 +1119,7 @@ libbalsa_mailbox_local_load_messages(LibBalsaMailbox *mailbox,
g_return_if_fail(LIBBALSA_IS_MAILBOX_LOCAL(mailbox));
libbalsa_lock_mailbox(mailbox);
- libbalsa_mailbox_set_messages_loaded(mailbox, FALSE);
+ priv->messages_loaded = FALSE;
if (!priv->load_messages_id) {
priv->msgno = msgno;
priv->load_messages_id =
@@ -1172,7 +1175,7 @@ lbml_set_threading_idle_cb(LibBalsaMailboxLocal *local)
libbalsa_lock_mailbox(mailbox);
if (libbalsa_mailbox_get_msg_tree(mailbox) != NULL) {
- if (!libbalsa_mailbox_get_messages_loaded(mailbox)) {
+ if (!priv->messages_loaded) {
libbalsa_unlock_mailbox(mailbox);
return G_SOURCE_CONTINUE;
@@ -1209,7 +1212,7 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
libbalsa_mailbox_set_msg_tree(mailbox, g_node_new(NULL));
if (lbm_local_restore_tree(local, &total)) {
- libbalsa_mailbox_set_messages_loaded(mailbox, TRUE);
+ priv->messages_loaded = TRUE;
libbalsa_mailbox_set_messages_threaded(mailbox, TRUE);
} else {
/* Bad or no cache file: start over. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]