[PATCH] Notify observers about existing folders when they're attached.
- From: Rob Taylor <rob taylor codethink co uk>
- Subject: [PATCH] Notify observers about existing folders when they're attached.
- Date: Wed, 11 Jun 2008 17:26:11 +0100
---
ChangeLog | 5 +++++
libtinymail-camel/tny-camel-folder.c | 14 ++++++++++++++
libtinymail-camel/tny-camel-store-account.c | 17 +++++++++++++++--
3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ccf8788..f035979 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
2008-06-12 Rob Taylor <rob taylor codethink co uk>
+ * libtinymail-camel/tny-camel-folder.c:
+ * libtinymail-camel/tny-camel-store-account.c:
+ Notify observers about existing folders when they're attached.
+
+2008-06-12 Rob Taylor <rob taylor codethink co uk>
* libtinymail-camel/tny-camel-folder-priv.h:
* libtinymail-camel/tny-camel-folder.c:
diff --git a/libtinymail-camel/tny-camel-folder.c b/libtinymail-camel/tny-camel-folder.c
index 051c787..20a7df8 100644
--- a/libtinymail-camel/tny-camel-folder.c
+++ b/libtinymail-camel/tny-camel-folder.c
@@ -6122,10 +6122,20 @@ notify_store_observer_del (gpointer user_data, GObject *observer)
g_static_rec_mutex_unlock (priv->obs_lock);
}
+static void build_appeared_change (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ TnyFolder *folder = key;
+ TnyFolderStoreChange *change = user_data;
+ tny_folder_store_change_add_appeared_folder (change, folder);
+}
+
static void
tny_camel_folder_store_add_observer_default (TnyFolderStore *self, TnyFolderStoreObserver *observer)
{
TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self);
+ TnyFolderStoreChange *change = tny_folder_store_change_new (self);
g_assert (TNY_IS_FOLDER_STORE_OBSERVER (observer));
@@ -6136,6 +6146,10 @@ tny_camel_folder_store_add_observer_default (TnyFolderStore *self, TnyFolderStor
}
g_static_rec_mutex_unlock (priv->obs_lock);
+ g_hash_table_foreach (priv->known_folders, build_appeared_change, change);
+ notify_folder_store_observers_about_in_idle (self, change, TNY_FOLDER_PRIV_GET_SESSION (priv));
+ g_object_unref (change);
+
return;
}
diff --git a/libtinymail-camel/tny-camel-store-account.c b/libtinymail-camel/tny-camel-store-account.c
index b1bbd98..9880732 100644
--- a/libtinymail-camel/tny-camel-store-account.c
+++ b/libtinymail-camel/tny-camel-store-account.c
@@ -1872,10 +1872,21 @@ tny_camel_store_account_add_observer (TnyFolderStore *self, TnyFolderStoreObserv
TNY_CAMEL_STORE_ACCOUNT_GET_CLASS (self)->add_observer(self, observer);
}
+static void build_appeared_change (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ TnyFolder *folder = key;
+ TnyFolderStoreChange *change = user_data;
+ tny_folder_store_change_add_appeared_folder (change, folder);
+}
+
+
static void
tny_camel_store_account_add_observer_default (TnyFolderStore *self, TnyFolderStoreObserver *observer)
{
TnyCamelStoreAccountPriv *priv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self);
+ TnyFolderStoreChange *change = tny_folder_store_change_new (self);
g_assert (TNY_IS_FOLDER_STORE_OBSERVER (observer));
@@ -1886,11 +1897,13 @@ tny_camel_store_account_add_observer_default (TnyFolderStore *self, TnyFolderSto
}
g_static_rec_mutex_unlock (priv->obs_lock);
+ g_hash_table_foreach (priv->known_folders, build_appeared_change, change);
+ notify_folder_store_observers_about_in_idle (self, change);
+ g_object_unref (change);
+
return;
}
-
-
static void
tny_camel_store_account_remove_observer (TnyFolderStore *self, TnyFolderStoreObserver *observer)
{
--
1.5.4.3
--------------040209010609030806090308
Content-Type: text/x-diff;
name="0005-Change-all-usage-of-tny_folder_store_get_folders-ove.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0005-Change-all-usage-of-tny_folder_store_get_folders-ove.pa";
filename*1="tch"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]