[evolution] EMFolderTreeModel: Listen for "folder-info-stale" signals.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EMFolderTreeModel: Listen for "folder-info-stale" signals.
- Date: Sat, 22 Jun 2013 14:06:55 +0000 (UTC)
commit 1f181f1e7ba371961b76ef20091dac86d99968a6
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Jun 22 10:05:21 2013 -0400
EMFolderTreeModel: Listen for "folder-info-stale" signals.
The signal indicates the folder tree for a particular store needs to be
reconstructed. We do this by calling em_folder_tree_model_add_store().
mail/em-folder-tree-model.c | 19 +++++++++++++++++++
mail/em-folder-tree-model.h | 1 +
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index f331313..eaa6b92 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -108,6 +108,11 @@ store_info_free (EMFolderTreeModelStoreInfo *si)
si->store,
si->folder_renamed_handler_id);
+ if (si->folder_info_stale_handler_id > 0)
+ g_signal_handler_disconnect (
+ si->store,
+ si->folder_info_stale_handler_id);
+
if (si->folder_subscribed_handler_id > 0)
g_signal_handler_disconnect (
si->store,
@@ -1066,6 +1071,15 @@ folder_tree_model_folder_renamed_cb (CamelStore *store,
em_folder_tree_model_set_folder_info (model, &iter, si, info, TRUE);
}
+static void
+folder_tree_model_folder_info_stale_cb (CamelStore *store,
+ EMFolderTreeModel *model)
+{
+ /* Re-add the store. The EMFolderTreeModelStoreInfo will
+ * be discarded and the folder tree will be reconstructed. */
+ em_folder_tree_model_add_store (model, store);
+}
+
void
em_folder_tree_model_add_store (EMFolderTreeModel *model,
CamelStore *store)
@@ -1168,6 +1182,11 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model,
G_CALLBACK (folder_tree_model_folder_renamed_cb), model);
si->folder_renamed_handler_id = handler_id;
+ handler_id = g_signal_connect (
+ store, "folder-info-stale",
+ G_CALLBACK (folder_tree_model_folder_info_stale_cb), model);
+ si->folder_info_stale_handler_id = handler_id;
+
if (CAMEL_IS_SUBSCRIBABLE (store)) {
handler_id = g_signal_connect (
store, "folder-subscribed",
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index b3d7b5f..af8acd7 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -84,6 +84,7 @@ struct _EMFolderTreeModelStoreInfo {
gulong folder_created_handler_id;
gulong folder_deleted_handler_id;
gulong folder_renamed_handler_id;
+ gulong folder_info_stale_handler_id;
gulong folder_subscribed_handler_id;
gulong folder_unsubscribed_handler_id;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]