CamelIMAPXStore: Override new CamelNetworkService properties.
authorMatthew Barnes <mbarnes@redhat.com>
Thu, 21 Feb 2013 19:14:30 +0000 (14:14 -0500)
committerMatthew Barnes <mbarnes@redhat.com>
Thu, 21 Feb 2013 20:17:37 +0000 (15:17 -0500)
camel/camel-imapx-store.c

index ae859a3..33ee30e 100644 (file)
@@ -61,6 +61,12 @@ struct _CamelIMAPXStorePrivate {
        GMutex quota_info_lock;
 };
 
+enum {
+       PROP_0,
+       PROP_CONNECTABLE,
+       PROP_HOST_REACHABLE
+};
+
 static GInitableIface *parent_initable_interface;
 
 /* Forward Declarations */
@@ -137,6 +143,48 @@ imapx_store_update_store_flags (CamelStore *store)
 }
 
 static void
+imapx_store_set_property (GObject *object,
+                          guint property_id,
+                          const GValue *value,
+                          GParamSpec *pspec)
+{
+       switch (property_id) {
+               case PROP_CONNECTABLE:
+                       camel_network_service_set_connectable (
+                               CAMEL_NETWORK_SERVICE (object),
+                               g_value_get_object (value));
+                       return;
+       }
+
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+imapx_store_get_property (GObject *object,
+                          guint property_id,
+                          GValue *value,
+                          GParamSpec *pspec)
+{
+       switch (property_id) {
+               case PROP_CONNECTABLE:
+                       g_value_take_object (
+                               value,
+                               camel_network_service_ref_connectable (
+                               CAMEL_NETWORK_SERVICE (object)));
+                       return;
+
+               case PROP_HOST_REACHABLE:
+                       g_value_set_boolean (
+                               value,
+                               camel_network_service_get_host_reachable (
+                               CAMEL_NETWORK_SERVICE (object)));
+                       return;
+       }
+
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
 imapx_store_dispose (GObject *object)
 {
        CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (object);
@@ -1888,6 +1936,8 @@ camel_imapx_store_class_init (CamelIMAPXStoreClass *class)
        g_type_class_add_private (class, sizeof (CamelIMAPXStorePrivate));
 
        object_class = G_OBJECT_CLASS (class);
+       object_class->set_property = imapx_store_set_property;
+       object_class->get_property = imapx_store_get_property;
        object_class->dispose = imapx_store_dispose;
        object_class->finalize = imapx_store_finalize;
 
@@ -1912,6 +1962,18 @@ camel_imapx_store_class_init (CamelIMAPXStoreClass *class)
        store_class->delete_folder_sync = imapx_store_delete_folder_sync;
        store_class->rename_folder_sync = imapx_store_rename_folder_sync;
        store_class->noop_sync = imapx_store_noop_sync;
+
+       /* Inherited from CamelNetworkService. */
+       g_object_class_override_property (
+               object_class,
+               PROP_CONNECTABLE,
+               "connectable");
+
+       /* Inherited from CamelNetworkService. */
+       g_object_class_override_property (
+               object_class,
+               PROP_HOST_REACHABLE,
+               "host-reachable");
 }
 
 static void