[evolution-kolab/ek-wip-porting] CamelIMAPXExtdStore: subclassing of interfaces
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] CamelIMAPXExtdStore: subclassing of interfaces
- Date: Mon, 9 Jan 2012 19:05:16 +0000 (UTC)
commit 02ec130c331bd88f50cbf5039120f252dc68eecd
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Jan 9 20:01:11 2012 +0100
CamelIMAPXExtdStore: subclassing of interfaces
* initial implementation of the parent class'
interfaces (GInitable, CamelNetworkService, CamelSubscribable)
src/camel/providers/imapx/camel-imapx-extd-store.c | 165 +++++++++++++++++---
1 files changed, 144 insertions(+), 21 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-extd-store.c b/src/camel/providers/imapx/camel-imapx-extd-store.c
index 2157dcb..b478781 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-store.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-store.c
@@ -36,24 +36,30 @@
/*----------------------------------------------------------------------------*/
-/* Forward Declarations */
+static GInitableIface *parent_initable_iface = NULL;
+static CamelNetworkServiceInterface *parent_service_iface = NULL;
+static CamelSubscribableInterface *parent_subscribable_iface = NULL;
+
+/*----------------------------------------------------------------------------*/
+
+/* forward declarations */
static void camel_imapx_extd_store_initable_init (GInitableIface *interface);
static void camel_imapx_extd_store_network_service_init (CamelNetworkServiceInterface *interface);
static void camel_imapx_extd_store_subscribable_init (CamelSubscribableInterface *interface);
G_DEFINE_TYPE_WITH_CODE (
- CamelIMAPXExtdStore,
- camel_imapx_extd_store,
- CAMEL_TYPE_IMAPX_STORE,
- G_IMPLEMENT_INTERFACE (
- G_TYPE_INITABLE,
- camel_imapx_extd_store_initable_init)
- G_IMPLEMENT_INTERFACE (
- CAMEL_TYPE_NETWORK_SERVICE,
- camel_imapx_extd_store_network_service_init)
- G_IMPLEMENT_INTERFACE (
- CAMEL_TYPE_SUBSCRIBABLE,
- camel_imapx_extd_store_subscribable_init))
+ CamelIMAPXExtdStore,
+ camel_imapx_extd_store,
+ CAMEL_TYPE_IMAPX_STORE,
+ G_IMPLEMENT_INTERFACE (
+ G_TYPE_INITABLE,
+ camel_imapx_extd_store_initable_init)
+ G_IMPLEMENT_INTERFACE (
+ CAMEL_TYPE_NETWORK_SERVICE,
+ camel_imapx_extd_store_network_service_init)
+ G_IMPLEMENT_INTERFACE (
+ CAMEL_TYPE_SUBSCRIBABLE,
+ camel_imapx_extd_store_subscribable_init))
/*----------------------------------------------------------------------------*/
/* object/class init */
@@ -83,13 +89,124 @@ camel_imapx_extd_store_finalize (GObject *object)
G_OBJECT_CLASS (camel_imapx_extd_store_parent_class)->finalize (object);
}
+/*----------------------------------------------------------------------------*/
+/* class functions */
+
+
+/*----------------------------------------------------------------------------*/
+/* interface functions */
+
+static gboolean
+camel_imapx_extd_store_initable_initialize (GInitable *initable,
+ GCancellable *cancellable,
+ GError **err)
+{
+ gboolean ok = FALSE;
+
+ g_assert (G_IS_INITABLE (initable));
+ /* cancellable may be NULL */
+ g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+ /* chain up to parent interface's init() method. */
+ ok = parent_initable_iface->init (initable,
+ cancellable,
+ err);
+ return ok;
+}
+
+static const gchar*
+camel_imapx_extd_store_get_service_name (CamelNetworkService *service,
+ CamelNetworkSecurityMethod method)
+{
+ const gchar *sn = NULL;
+
+ g_assert (CAMEL_IS_NETWORK_SERVICE (service));
+
+ /* use parent function for now */
+ sn = parent_service_iface->get_service_name (service,
+ method);
+
+ return sn;
+}
+
+static guint16
+camel_imapx_extd_store_get_default_port (CamelNetworkService *service,
+ CamelNetworkSecurityMethod method)
+{
+ guint16 port = 0;
+
+ g_assert (CAMEL_IS_NETWORK_SERVICE (service));
+
+ /* use parent function for now */
+ port = parent_service_iface->get_default_port (service,
+ method);
+
+ return port;
+}
+
+static gboolean
+camel_imapx_extd_store_folder_is_subscribed (CamelSubscribable *subscribable,
+ const gchar *foldername)
+{
+ gboolean subscribed = FALSE;
+
+ g_assert (CAMEL_IS_SUBSCRIBABLE (subscribable));
+ g_assert (foldername != NULL);
+
+ /* use parent function for now */
+ subscribed = parent_subscribable_iface->folder_is_subscribed (subscribable,
+ foldername);
+
+ return subscribed;
+}
+
+static gboolean
+camel_imapx_extd_store_subscribe_folder_sync (CamelSubscribable *subscribable,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err)
+{
+ gboolean ok = FALSE;
+
+ g_assert (CAMEL_IS_SUBSCRIBABLE (subscribable));
+ g_assert (foldername != NULL);
+ /* cancellable may be NULL */
+ g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+ /* use parent function for now */
+ ok = parent_subscribable_iface->subscribe_folder_sync (subscribable,
+ foldername,
+ cancellable,
+ err);
+ return ok;
+}
+
+static gboolean
+camel_imapx_extd_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err)
+{
+ gboolean ok = FALSE;
+
+ g_assert (CAMEL_IS_SUBSCRIBABLE (subscribable));
+ g_assert (foldername != NULL);
+ /* cancellable may be NULL */
+ g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+ /* use parent function for now */
+ ok = parent_subscribable_iface->unsubscribe_folder_sync (subscribable,
+ foldername,
+ cancellable,
+ err);
+ return ok;
+}
+
static void
camel_imapx_extd_store_initable_init (GInitableIface *interface)
{
- g_assert (interface != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
+ parent_initable_iface = g_type_interface_peek_parent (interface);
+ interface->init = camel_imapx_extd_store_initable_initialize;
}
static void
@@ -97,8 +214,9 @@ camel_imapx_extd_store_network_service_init (CamelNetworkServiceInterface *inter
{
g_assert (CAMEL_IS_NETWORK_SERVICE_INTERFACE (interface));
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
+ parent_service_iface = g_type_interface_peek_parent (interface);
+ interface->get_service_name = camel_imapx_extd_store_get_service_name;
+ interface->get_default_port = camel_imapx_extd_store_get_default_port;
}
static void
@@ -106,10 +224,15 @@ camel_imapx_extd_store_subscribable_init (CamelSubscribableInterface *interface)
{
g_assert (CAMEL_IS_SUBSCRIBABLE_INTERFACE (interface));
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
+ parent_subscribable_iface = g_type_interface_peek_parent (interface);
+ interface->folder_is_subscribed = camel_imapx_extd_store_folder_is_subscribed;
+ interface->subscribe_folder_sync = camel_imapx_extd_store_subscribe_folder_sync;
+ interface->unsubscribe_folder_sync = camel_imapx_extd_store_unsubscribe_folder_sync;
}
+/*----------------------------------------------------------------------------*/
+/* class initialization */
+
static void
camel_imapx_extd_store_class_init (CamelIMAPXExtdStoreClass *klass)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]