[evolution-kolab/ek-wip-porting] CamelKolabIMAPXServer: use virtual functions for extensions
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] CamelKolabIMAPXServer: use virtual functions for extensions
- Date: Fri, 13 Jan 2012 19:02:56 +0000 (UTC)
commit 4c2e4029dc2c7ddc5713e11df158094aeb233de5
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri Jan 13 19:54:31 2012 +0100
CamelKolabIMAPXServer: use virtual functions for extensions
* implement the virtual function / accessor API function
scheme for Kolab extensions
* renamed kolab specific functions which had the same
name in the parent class implementation
src/camel/camel-kolab-imapx-server.c | 145 +++++++++++++++++++++++++++-------
src/camel/camel-kolab-imapx-server.h | 34 ++++++--
2 files changed, 142 insertions(+), 37 deletions(-)
---
diff --git a/src/camel/camel-kolab-imapx-server.c b/src/camel/camel-kolab-imapx-server.c
index 2337532..1c6698e 100644
--- a/src/camel/camel-kolab-imapx-server.c
+++ b/src/camel/camel-kolab-imapx-server.c
@@ -47,7 +47,7 @@ struct _CamelKolabIMAPXServerPrivate {
G_DEFINE_TYPE (CamelKolabIMAPXServer, camel_kolab_imapx_server, CAMEL_TYPE_IMAPX_EXTD_SERVER)
/*----------------------------------------------------------------------------*/
-/* object/class init */
+/* object init */
static void
camel_kolab_imapx_server_init (CamelKolabIMAPXServer *self)
@@ -84,22 +84,11 @@ camel_kolab_imapx_server_finalize (GObject *object)
G_OBJECT_CLASS (camel_kolab_imapx_server_parent_class)->finalize (object);
}
-static void
-camel_kolab_imapx_server_class_init (CamelKolabIMAPXServerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (CamelKolabIMAPXServerPrivate));
-
- object_class->dispose = camel_kolab_imapx_server_dispose;
- object_class->finalize = camel_kolab_imapx_server_finalize;
-}
-
/*----------------------------------------------------------------------------*/
-/* API functions */
+/* class functions */
-CamelKolabImapxMetadata*
-camel_kolab_imapx_server_get_metadata (CamelKolabIMAPXServer *self,
+static CamelKolabImapxMetadata*
+kolab_imapx_server_get_kolab_metadata (CamelKolabIMAPXServer *self,
gboolean do_resect,
GError **err)
{
@@ -117,8 +106,8 @@ camel_kolab_imapx_server_get_metadata (CamelKolabIMAPXServer *self,
return NULL;
}
-gboolean
-camel_kolab_imapx_server_set_metadata (CamelKolabIMAPXServer *self,
+static gboolean
+kolab_imapx_server_set_kolab_metadata (CamelKolabIMAPXServer *self,
CamelKolabImapxMetadata *kmd,
GError **err)
{
@@ -136,12 +125,12 @@ camel_kolab_imapx_server_set_metadata (CamelKolabIMAPXServer *self,
return FALSE;
}
-KolabFolderTypeID
-camel_kolab_imapx_server_get_foldertype (CamelKolabIMAPXServer *self,
- const gchar *foldername,
- gboolean do_updatedb,
- GCancellable *cancellable,
- GError **err)
+static KolabFolderTypeID
+kolab_imapx_server_get_foldertype (CamelKolabIMAPXServer *self,
+ const gchar *foldername,
+ gboolean do_updatedb,
+ GCancellable *cancellable,
+ GError **err)
{
/* TODO better error reporting */
CamelKolabIMAPXServerPrivate *priv = NULL;
@@ -248,12 +237,12 @@ camel_kolab_imapx_server_get_foldertype (CamelKolabIMAPXServer *self,
return kfmd->folder_type;
}
-gboolean
-camel_kolab_imapx_server_set_foldertype (CamelKolabIMAPXServer *self,
- const gchar *foldername,
- KolabFolderTypeID foldertype,
- GCancellable *cancellable,
- GError **err)
+static gboolean
+kolab_imapx_server_set_foldertype (CamelKolabIMAPXServer *self,
+ const gchar *foldername,
+ KolabFolderTypeID foldertype,
+ GCancellable *cancellable,
+ GError **err)
{
CamelKolabIMAPXServerPrivate *priv = NULL;
CamelIMAPXExtdServer *eserver = NULL;
@@ -339,6 +328,104 @@ camel_kolab_imapx_server_set_foldertype (CamelKolabIMAPXServer *self,
return TRUE;
}
+/*----------------------------------------------------------------------------*/
+/* class init */
+
+static void
+camel_kolab_imapx_server_class_init (CamelKolabIMAPXServerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (CamelKolabIMAPXServerPrivate));
+
+ object_class->dispose = camel_kolab_imapx_server_dispose;
+ object_class->finalize = camel_kolab_imapx_server_finalize;
+
+ klass->get_kolab_metadata = kolab_imapx_server_get_kolab_metadata;
+ klass->set_kolab_metadata = kolab_imapx_server_set_kolab_metadata;
+ klass->get_foldertype = kolab_imapx_server_get_foldertype;
+ klass->set_foldertype = kolab_imapx_server_set_foldertype;
+}
+
+/*----------------------------------------------------------------------------*/
+/* API functions */
+
+CamelKolabImapxMetadata*
+camel_kolab_imapx_server_get_kolab_metadata (CamelKolabIMAPXServer *self,
+ gboolean do_resect,
+ GError **err)
+{
+ CamelKolabIMAPXServerClass *klass = NULL;
+ CamelKolabImapxMetadata *kmd = NULL;
+
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_SERVER (self), NULL);
+
+ klass = CAMEL_KOLAB_IMAPX_SERVER_GET_CLASS (self);
+ kmd = klass->get_kolab_metadata (self,
+ do_resect,
+ err);
+ return kmd;
+}
+
+gboolean
+camel_kolab_imapx_server_set_kolab_metadata (CamelKolabIMAPXServer *self,
+ CamelKolabImapxMetadata *kmd,
+ GError **err)
+{
+ CamelKolabIMAPXServerClass *klass = NULL;
+ gboolean ok = FALSE;
+
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_SERVER (self), FALSE);
+
+ klass = CAMEL_KOLAB_IMAPX_SERVER_GET_CLASS (self);
+ ok = klass->set_kolab_metadata (self,
+ kmd,
+ err);
+ return ok;
+}
+
+KolabFolderTypeID
+camel_kolab_imapx_server_get_foldertype (CamelKolabIMAPXServer *self,
+ const gchar *foldername,
+ gboolean do_updatedb,
+ GCancellable *cancellable,
+ GError **err)
+{
+ CamelKolabIMAPXServerClass *klass = NULL;
+ KolabFolderTypeID foldertype = KOLAB_FOLDER_TYPE_INVAL;
+
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_SERVER (self), KOLAB_FOLDER_TYPE_INVAL);
+
+ klass = CAMEL_KOLAB_IMAPX_SERVER_GET_CLASS (self);
+ foldertype = klass->get_foldertype (self,
+ foldername,
+ do_updatedb,
+ cancellable,
+ err);
+ return foldertype;
+}
+
+gboolean
+camel_kolab_imapx_server_set_foldertype (CamelKolabIMAPXServer *self,
+ const gchar *foldername,
+ KolabFolderTypeID foldertype,
+ GCancellable *cancellable,
+ GError **err)
+{
+ CamelKolabIMAPXServerClass *klass = NULL;
+ gboolean ok = FALSE;
+
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_SERVER (self), FALSE);
+
+ klass = CAMEL_KOLAB_IMAPX_SERVER_GET_CLASS (self);
+ ok = klass->set_foldertype (self,
+ foldername,
+ foldertype,
+ cancellable,
+ err);
+ return ok;
+}
+
/* CAUTION -- TESTING purposes only! The server response may
* become too long to properly handle it!
*/
diff --git a/src/camel/camel-kolab-imapx-server.h b/src/camel/camel-kolab-imapx-server.h
index fc5a19b..05109a8 100644
--- a/src/camel/camel-kolab-imapx-server.h
+++ b/src/camel/camel-kolab-imapx-server.h
@@ -39,8 +39,6 @@
#include "camel-kolab-imapx-metadata.h"
/*----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------*/
/* Standard GObject macros */
#define CAMEL_TYPE_KOLAB_IMAPX_SERVER \
@@ -72,20 +70,40 @@ struct _CamelKolabIMAPXServer {
struct _CamelKolabIMAPXServerClass {
CamelIMAPXExtdServerClass parent_class;
+
+ CamelKolabImapxMetadata* (*get_kolab_metadata) (CamelKolabIMAPXServer *self,
+ gboolean do_resect,
+ GError **err);
+
+ gboolean (*set_kolab_metadata) (CamelKolabIMAPXServer *self,
+ CamelKolabImapxMetadata *kmd,
+ GError **err);
+
+ KolabFolderTypeID (*get_foldertype) (CamelKolabIMAPXServer *self,
+ const gchar *foldername,
+ gboolean do_updatedb,
+ GCancellable *cancellable,
+ GError **err);
+
+ gboolean (*set_foldertype) (CamelKolabIMAPXServer *self,
+ const gchar *foldername,
+ KolabFolderTypeID foldertype,
+ GCancellable *cancellable,
+ GError **err);
};
GType
camel_kolab_imapx_server_get_type (void);
CamelKolabImapxMetadata*
-camel_kolab_imapx_server_get_metadata (CamelKolabIMAPXServer *self,
- gboolean do_resect,
- GError **err);
+camel_kolab_imapx_server_get_kolab_metadata (CamelKolabIMAPXServer *self,
+ gboolean do_resect,
+ GError **err);
gboolean
-camel_kolab_imapx_server_set_metadata (CamelKolabIMAPXServer *self,
- CamelKolabImapxMetadata *kmd,
- GError **err);
+camel_kolab_imapx_server_set_kolab_metadata (CamelKolabIMAPXServer *self,
+ CamelKolabImapxMetadata *kmd,
+ GError **err);
KolabFolderTypeID
camel_kolab_imapx_server_get_foldertype (CamelKolabIMAPXServer *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]