[evolution-data-server/imap-notify: 9/23] CamelIMAPXStore: Rough in handlers for CamelIMAPXServer signals.



commit e423549f14bae335a4ddb64eb0b7cd1e26aede31
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Aug 28 13:12:30 2013 -0400

    CamelIMAPXStore: Rough in handlers for CamelIMAPXServer signals.

 camel/camel-imapx-store.c |  108 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 108 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index 5b5d778..944838a 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -59,6 +59,9 @@
 struct _CamelIMAPXStorePrivate {
        CamelIMAPXServer *connected_server;
        CamelIMAPXServer *connecting_server;
+       gulong mailbox_created_handler_id;
+       gulong mailbox_renamed_handler_id;
+       gulong mailbox_updated_handler_id;
        GMutex server_lock;
 
        GHashTable *quota_info;
@@ -316,6 +319,28 @@ imapx_store_rename_storage_path (CamelIMAPXStore *imapx_store,
 }
 
 static void
+imapx_store_mailbox_created_cb (CamelIMAPXServer *server,
+                                CamelIMAPXMailbox *mailbox,
+                                CamelIMAPXStore *store)
+{
+}
+
+static void
+imapx_store_mailbox_renamed_cb (CamelIMAPXServer *server,
+                                CamelIMAPXMailbox *mailbox,
+                                const gchar *oldname,
+                                CamelIMAPXStore *store)
+{
+}
+
+static void
+imapx_store_mailbox_updated_cb (CamelIMAPXServer *server,
+                                CamelIMAPXMailbox *mailbox,
+                                CamelIMAPXStore *store)
+{
+}
+
+static void
 imapx_store_connect_to_settings (CamelStore *store)
 {
        CamelIMAPXStorePrivate *priv;
@@ -404,6 +429,27 @@ imapx_store_dispose (GObject *object)
 {
        CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (object);
 
+       if (imapx_store->priv->mailbox_created_handler_id > 0) {
+               g_signal_handler_disconnect (
+                       imapx_store->priv->connected_server,
+                       imapx_store->priv->mailbox_created_handler_id);
+               imapx_store->priv->mailbox_created_handler_id = 0;
+       }
+
+       if (imapx_store->priv->mailbox_renamed_handler_id > 0) {
+               g_signal_handler_disconnect (
+                       imapx_store->priv->connected_server,
+                       imapx_store->priv->mailbox_renamed_handler_id);
+               imapx_store->priv->mailbox_renamed_handler_id = 0;
+       }
+
+       if (imapx_store->priv->mailbox_updated_handler_id > 0) {
+               g_signal_handler_disconnect (
+                       imapx_store->priv->connected_server,
+                       imapx_store->priv->mailbox_updated_handler_id);
+               imapx_store->priv->mailbox_updated_handler_id = 0;
+       }
+
        if (imapx_store->priv->settings_notify_handler_id > 0) {
                g_signal_handler_disconnect (
                        imapx_store->priv->settings,
@@ -522,8 +568,49 @@ imapx_connect_sync (CamelService *service,
        g_clear_object (&priv->connecting_server);
 
        if (success) {
+               gulong handler_id;
+
+               if (priv->mailbox_created_handler_id > 0) {
+                       g_signal_handler_disconnect (
+                               priv->connected_server,
+                               priv->mailbox_created_handler_id);
+                       priv->mailbox_created_handler_id = 0;
+               }
+
+               if (priv->mailbox_renamed_handler_id > 0) {
+                       g_signal_handler_disconnect (
+                               priv->connected_server,
+                               priv->mailbox_renamed_handler_id);
+                       priv->mailbox_renamed_handler_id = 0;
+               }
+
+               if (priv->mailbox_updated_handler_id > 0) {
+                       g_signal_handler_disconnect (
+                               priv->connected_server,
+                               priv->mailbox_updated_handler_id);
+                       priv->mailbox_updated_handler_id = 0;
+               }
+
                g_clear_object (&priv->connected_server);
                priv->connected_server = g_object_ref (imapx_server);
+
+               handler_id = g_signal_connect (
+                       priv->connected_server, "mailbox-created",
+                       G_CALLBACK (imapx_store_mailbox_created_cb),
+                       service);
+               priv->mailbox_created_handler_id = handler_id;
+
+               handler_id = g_signal_connect (
+                       priv->connected_server, "mailbox-renamed",
+                       G_CALLBACK (imapx_store_mailbox_renamed_cb),
+                       service);
+               priv->mailbox_renamed_handler_id = handler_id;
+
+               handler_id = g_signal_connect (
+                       priv->connected_server, "mailbox-updated",
+                       G_CALLBACK (imapx_store_mailbox_updated_cb),
+                       service);
+               priv->mailbox_updated_handler_id = handler_id;
        }
 
        g_mutex_unlock (&priv->server_lock);
@@ -545,6 +632,27 @@ imapx_disconnect_sync (CamelService *service,
 
        g_mutex_lock (&priv->server_lock);
 
+       if (priv->mailbox_created_handler_id > 0) {
+               g_signal_handler_disconnect (
+                       priv->connected_server,
+                       priv->mailbox_created_handler_id);
+               priv->mailbox_created_handler_id = 0;
+       }
+
+       if (priv->mailbox_renamed_handler_id > 0) {
+               g_signal_handler_disconnect (
+                       priv->connected_server,
+                       priv->mailbox_renamed_handler_id);
+               priv->mailbox_renamed_handler_id = 0;
+       }
+
+       if (priv->mailbox_updated_handler_id > 0) {
+               g_signal_handler_disconnect (
+                       priv->connected_server,
+                       priv->mailbox_updated_handler_id);
+               priv->mailbox_updated_handler_id = 0;
+       }
+
        g_clear_object (&priv->connected_server);
        g_clear_object (&priv->connecting_server);
 


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