[evolution-ews/evolution-ews-3-12] Bug 731585 - evolution-ews Camel part pretends offline state



commit a327b3ffad09d66823e9bc7da20494da6e84b786
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 12 21:45:45 2014 +0200

    Bug 731585 - evolution-ews Camel part pretends offline state
    
    Keep in sync the "host" setting with "host-url", thus the test
    for its reachability is accurate.

 src/camel/camel-ews-store.c     |    3 +--
 src/server/camel-ews-settings.c |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index 2c80411..4f4d123 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -3689,8 +3689,7 @@ camel_ews_subscribable_init (CamelSubscribableInterface *iface)
 static void
 camel_ews_store_init (CamelEwsStore *ews_store)
 {
-       ews_store->priv =
-               CAMEL_EWS_STORE_GET_PRIVATE (ews_store);
+       ews_store->priv = CAMEL_EWS_STORE_GET_PRIVATE (ews_store);
 
        ews_store->priv->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
        ews_store->priv->updates_cancellable = NULL;
diff --git a/src/server/camel-ews-settings.c b/src/server/camel-ews-settings.c
index bd6fa9b..714fca8 100644
--- a/src/server/camel-ews-settings.c
+++ b/src/server/camel-ews-settings.c
@@ -76,6 +76,35 @@ G_DEFINE_TYPE_WITH_CODE (
        G_IMPLEMENT_INTERFACE (
                CAMEL_TYPE_NETWORK_SETTINGS, NULL))
 
+static gboolean
+ews_settings_transform_host_url_to_host_cb (GBinding *binding,
+                                           const GValue *host_url_value,
+                                           GValue *host_value,
+                                           gpointer user_data)
+{
+       const gchar *host_url;
+
+       host_url = g_value_get_string (host_url_value);
+       if (host_url && *host_url) {
+               SoupURI *uri;
+
+               uri = soup_uri_new (host_url);
+               if (uri) {
+                       const gchar *host;
+
+                       host = soup_uri_get_host (uri);
+                       if (!host || !*host)
+                               host = "";
+
+                       g_value_set_string (host_value, host);
+
+                       soup_uri_free (uri);
+               }
+       }
+
+       return TRUE;
+}
+
 static void
 ews_settings_set_property (GObject *object,
                             guint property_id,
@@ -581,6 +610,14 @@ camel_ews_settings_init (CamelEwsSettings *settings)
 {
        settings->priv = CAMEL_EWS_SETTINGS_GET_PRIVATE (settings);
        g_mutex_init (&settings->priv->property_lock);
+
+       g_object_bind_property_full (settings, "hosturl",
+                                    settings, "host",
+                                    G_BINDING_DEFAULT,
+                                    ews_settings_transform_host_url_to_host_cb,
+                                    NULL,
+                                    NULL,
+                                    NULL);
 }
 
 /**


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