[evolution-data-server/imap-notify: 10/23] CamelIMAPXStore: Add imapx_store_add_mailbox_to_folder().



commit 462b9c6c0fe885420844615afe6dd753ba0f535b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Aug 29 09:45:37 2013 -0400

    CamelIMAPXStore: Add imapx_store_add_mailbox_to_folder().
    
    Called in response to CamelIMAPXServer::mailbox-created signals.

 camel/camel-imapx-store.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index 944838a..e0c277c 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -319,10 +319,38 @@ imapx_store_rename_storage_path (CamelIMAPXStore *imapx_store,
 }
 
 static void
+imapx_store_add_mailbox_to_folder (CamelIMAPXStore *store,
+                                   CamelIMAPXMailbox *mailbox)
+{
+       CamelIMAPXFolder *folder;
+       const gchar *name;
+       gchar *folder_path;
+       gchar separator;
+
+       /* Add the CamelIMAPXMailbox to a cached CamelIMAPXFolder. */
+
+       name = camel_imapx_mailbox_get_name (mailbox);
+       separator = camel_imapx_mailbox_get_separator (mailbox);
+
+       folder_path = camel_imapx_mailbox_to_folder_path (name, separator);
+
+       folder = camel_object_bag_get (
+               CAMEL_STORE (store)->folders, folder_path);
+
+       if (folder != NULL) {
+               camel_imapx_folder_set_mailbox (folder, mailbox);
+               g_object_unref (folder);
+       }
+
+       g_free (folder_path);
+}
+
+static void
 imapx_store_mailbox_created_cb (CamelIMAPXServer *server,
                                 CamelIMAPXMailbox *mailbox,
                                 CamelIMAPXStore *store)
 {
+       imapx_store_add_mailbox_to_folder (store, mailbox);
 }
 
 static void


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