[evolution-kolab/ek-wip-porting-imapx] IMAPX: initial subclassing of CamelIMAPXFolder and CamelIMAPXServer
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting-imapx] IMAPX: initial subclassing of CamelIMAPXFolder and CamelIMAPXServer
- Date: Fri, 2 Dec 2011 18:36:03 +0000 (UTC)
commit 0625a1151410eb94b4a33c0e0828bc6fcf4c153f
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri Dec 2 16:04:21 2011 +0100
IMAPX: initial subclassing of CamelIMAPXFolder and CamelIMAPXServer
* added CamelIMAPXExtdFolder and CamelIMAPXExtdServer
GObject classes (deriving from CamelIMAPXFolder and
CamelIMAPXServer, respectively)
* currently used for metadata extensions
* to be extended later on with IMAP ACL functionality
.../providers/imapx/camel-imapx-extd-folder.c | 56 +++++++++-
.../providers/imapx/camel-imapx-extd-folder.h | 51 ++++++++-
.../providers/imapx/camel-imapx-extd-server.c | 113 +++++++++++++++++---
.../providers/imapx/camel-imapx-extd-server.h | 59 +++++++++-
4 files changed, 248 insertions(+), 31 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-extd-folder.c b/src/camel/providers/imapx/camel-imapx-extd-folder.c
index 32cb15b..de959e6 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-folder.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-folder.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/***************************************************************************
-* camel-imapx-folder-extn.c
+* camel-imapx-extd-folder.c
*
* 2011-11-25, 21:02:28
* Copyright 2011, Christian Hilberg
@@ -25,18 +25,66 @@
/*----------------------------------------------------------------------------*/
-#include "camel-imapx-folder-extn.h"
+#include "camel-imapx-extd-folder.h"
/*----------------------------------------------------------------------------*/
+G_DEFINE_TYPE (CamelIMAPXExtdFolder, camel_imapx_extd_folder, CAMEL_TYPE_IMAPX_FOLDER)
+
+/*----------------------------------------------------------------------------*/
+/* object/class init */
+
+static void
+camel_imapx_extd_folder_init (CamelIMAPXExtdFolder *object)
+{
+ g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (object));
+}
+
+static void
+camel_imapx_extd_folder_dispose (GObject *object)
+{
+ g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (object));
+
+ G_OBJECT_CLASS (camel_imapx_extd_folder_parent_class)->dispose (object);
+}
+
+static void
+camel_imapx_extd_folder_finalize (GObject *object)
+{
+ g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (object));
+
+ G_OBJECT_CLASS (camel_imapx_extd_folder_parent_class)->finalize (object);
+}
+
+static void
+camel_imapx_extd_folder_class_init (CamelIMAPXExtdFolderClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ /* g_type_class_add_private (klass, sizeof (CamelIMAPXExtdFolderPrivate)); */
+
+ object_class->dispose = camel_imapx_extd_folder_dispose;
+ object_class->finalize = camel_imapx_extd_folder_finalize;
+}
+
/*----------------------------------------------------------------------------*/
+/* API functions */
guint64
-camel_imapx_folder_extn_get_uidvalidity (CamelFolder *folder,
+camel_imapx_extd_folder_get_uidvalidity (CamelIMAPXExtdFolder *folder,
GError **err)
{
+ guint64 uidvalidity = 0;
+
+ g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+ g_return_val_if_fail (err == NULL || *err == NULL, 0);
+
/* FIXME implement me */
g_assert_not_reached ();
+
+ /* TODO read the uidvalidity value from parent object */
+
+ return uidvalidity;
}
-/*----------------------------------------------------------------------------*/
\ No newline at end of file
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-folder.h b/src/camel/providers/imapx/camel-imapx-extd-folder.h
index bce6f53..e5376bd 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-folder.h
+++ b/src/camel/providers/imapx/camel-imapx-extd-folder.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/***************************************************************************
-* camel-imapx-folder-extn.h
+* camel-imapx-extd-folder.h
*
* 2011-11-25, 21:02:18
* Copyright 2011, Christian Hilberg
@@ -25,8 +25,8 @@
/*----------------------------------------------------------------------------*/
-#ifndef CAMEL_IMAPX_FOLDER_EXTN_H_
-#define CAMEL_IMAPX_FOLDER_EXTN_H_
+#ifndef _CAMEL_IMAPX_EXTD_FOLDER_H_
+#define _CAMEL_IMAPX_EXTD_FOLDER_H_
/*----------------------------------------------------------------------------*/
@@ -34,11 +34,50 @@
#include "camel-imapx-folder.h"
/*----------------------------------------------------------------------------*/
+/* Standard GObject macros */
-guint64 camel_imapx_folder_extn_get_uidvalidity (CamelFolder *folder, GError **err);
+#define CAMEL_TYPE_IMAPX_EXTD_FOLDER \
+ (camel_imapx_extd_folder_get_type ())
+#define CAMEL_IMAPX_EXTD_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_IMAPX_EXTD_FOLDER, CamelIMAPXExtdFolder))
+#define CAMEL_IMAPX_EXTD_FOLDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((klass), CAMEL_TYPE_IMAPX_EXTD_FOLDER, CamelIMAPXExtdFolderClass))
+#define CAMEL_IS_IMAPX_EXTD_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_IMAPX_EXTD_FOLDER))
+#define CAMEL_IS_IMAPX_EXTD_FOLDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((klass), CAMEL_TYPE_IMAPX_EXTD_FOLDER))
+#define CAMEL_IMAPX_EXTD_FOLDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_IMAPX_EXTD_FOLDER, CamelIMAPXExtdFolderClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelIMAPXExtdFolder CamelIMAPXExtdFolder;
+typedef struct _CamelIMAPXExtdFolderClass CamelIMAPXExtdFolderClass;
+
+struct _CamelIMAPXExtdFolder {
+ CamelIMAPXFolder parent;
+};
+
+struct _CamelIMAPXExtdFolderClass {
+ CamelIMAPXFolderClass parent_class;
+};
+
+GType
+camel_imapx_extd_folder_get_type (void);
+
+guint64
+camel_imapx_extd_folder_get_uidvalidity (CamelIMAPXExtdFolder *folder,
+ GError **err);
+
+G_END_DECLS
/*----------------------------------------------------------------------------*/
-#endif /* CAMEL_IMAPX_FOLDER_EXTN_H_ */
+#endif /* _CAMEL_IMAPX_EXTD_FOLDER_H_ */
-/*----------------------------------------------------------------------------*/
\ No newline at end of file
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-server.c b/src/camel/providers/imapx/camel-imapx-extd-server.c
index 220b754..3efcbb3 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-server.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-server.c
@@ -25,46 +25,129 @@
/*----------------------------------------------------------------------------*/
-#include "camel-imapx-server-extn.h"
+#include "camel-imapx-extd-server.h"
/*----------------------------------------------------------------------------*/
+typedef struct _CamelIMAPXExtdServerPrivate CamelIMAPXExtdServerPrivate;
+struct _CamelIMAPXExtdServerPrivate {
+ CamelImapxMetadata *metadata;
+};
+
+#define CAMEL_IMAPX_EXTD_SERVER_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CAMEL_TYPE_IMAPX_EXTD_SERVER, CamelIMAPXExtdServerPrivate))
+
+G_DEFINE_TYPE (CamelIMAPXExtdServer, camel_imapx_extd_server, CAMEL_TYPE_IMAPX_SERVER)
+
/*----------------------------------------------------------------------------*/
+/* object/class init */
+
+static void
+camel_imapx_extd_server_init (CamelIMAPXExtdServer *object)
+{
+ CamelIMAPXExtdServer *self = NULL;
+ CamelIMAPXExtdServerPrivate *priv = NULL;
+
+ g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (object));
+
+ self = object;
+ priv = CAMEL_IMAPX_EXTD_SERVER_PRIVATE (self);
+
+ priv->metadata = NULL;
+}
+
+static void
+camel_imapx_extd_server_dispose (GObject *object)
+{
+ g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (object));
+
+ G_OBJECT_CLASS (camel_imapx_extd_server_parent_class)->dispose (object);
+}
+
+static void
+camel_imapx_extd_server_finalize (GObject *object)
+{
+ CamelIMAPXExtdServer *self = NULL;
+ CamelIMAPXExtdServerPrivate *priv = NULL;
+
+ g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (object));
+
+ self = object;
+ priv = CAMEL_IMAPX_EXTD_SERVER_PRIVATE (self);
+
+ camel_imapx_metadata_free (priv->metadata);
+
+ G_OBJECT_CLASS (camel_imapx_extd_server_parent_class)->finalize (object);
+}
+
+static void
+camel_imapx_extd_server_class_init (CamelIMAPXExtdServerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (CamelIMAPXExtdServerPrivate));
+
+ object_class->dispose = camel_imapx_extd_server_dispose;
+ object_class->finalize = camel_imapx_extd_server_finalize;
+}
+
+/*----------------------------------------------------------------------------*/
+/* API functions */
camel_imapx_metadata_proto_t
-camel_imapx_server_metadata_get_proto (CamelIMAPXServer *is)
+camel_imapx_extd_server_metadata_get_proto (CamelIMAPXExtdServer *server)
{
- g_assert (CAMEL_IS_IMAPX_SERVER (is));
- return camel_imapx_metadata_get_proto (is->metadata);
+ CamelIMAPXExtdServer *self = NULL;
+ CamelIMAPXExtdServerPrivate *priv = NULL;
+
+ g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (server));
+
+ self = server;
+ priv = CAMEL_IMAPX_EXTD_SERVER_PRIVATE (self);
+
+ return camel_imapx_metadata_get_proto (priv->metadata);
}
CamelImapxMetadata*
-camel_imapx_server_get_metadata (CamelIMAPXServer *is,
- CamelImapxMetadataSpec *spec,
- gboolean do_resect,
- GError **err)
+camel_imapx_extd_server_get_metadata (CamelIMAPXExtdServer *server,
+ CamelImapxMetadataSpec *spec,
+ gboolean do_resect,
+ GError **err)
{
- g_assert (CAMEL_IS_IMAPX_SERVER (is));
+ CamelIMAPXExtdServer *self = NULL;
+ CamelIMAPXExtdServerPrivate *priv = NULL;
+
+ g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (server));
+ (void)do_resect; /* FIXME */
g_assert (spec != NULL);
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+ self = server;
+ priv = CAMEL_IMAPX_EXTD_SERVER_PRIVATE (self);
+
+ /* FIXME */
g_error ("%s: FIXME: implement me", __func__);
return NULL;
}
gboolean
-camel_imapx_server_set_metadata (CamelIMAPXServer *is,
- CamelImapxMetadata *md,
- GError **err)
+camel_imapx_extd_server_set_metadata (CamelIMAPXExtdServer *server,
+ CamelImapxMetadata *md,
+ GError **err)
{
- g_assert (CAMEL_IS_IMAPX_SERVER (is));
- g_assert (md != NULL);
+ CamelIMAPXExtdServer *self = NULL;
+ CamelIMAPXExtdServerPrivate *priv = NULL;
+
+ g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (server));
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+ self = server;
+ priv = CAMEL_IMAPX_EXTD_SERVER_PRIVATE (self);
+
+ /* FIXME */
g_error ("%s: FIXME: implement me", __func__);
- return FALSE;
+ return FALSE;
}
/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-server.h b/src/camel/providers/imapx/camel-imapx-extd-server.h
index ed39434..5657ad2 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-server.h
+++ b/src/camel/providers/imapx/camel-imapx-extd-server.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/***************************************************************************
-* camel-imapx-server-extn.h
+* camel-imapx-extd-server.h
*
* 2011-11-28, 20:16:38
* Copyright 2011, Christian Hilberg
@@ -25,8 +25,8 @@
/*----------------------------------------------------------------------------*/
-#ifndef CAMEL_IMAPX_SERVER_EXTN_H_
-#define CAMEL_IMAPX_SERVER_EXTN_H_
+#ifndef _CAMEL_IMAPX_EXTD_SERVER_H_
+#define _CAMEL_IMAPX_EXTD_SERVER_H_
/*----------------------------------------------------------------------------*/
@@ -36,11 +36,58 @@
/*----------------------------------------------------------------------------*/
-camel_imapx_metadata_proto_t camel_imapx_server_metadata_get_proto (CamelIMAPXServer *is);
+/*----------------------------------------------------------------------------*/
+/* Standard GObject macros */
+
+#define CAMEL_TYPE_IMAPX_EXTD_SERVER \
+ (camel_imapx_extd_server_get_type ())
+#define CAMEL_IMAPX_EXTD_SERVER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_IMAPX_EXTD_SERVER, CamelIMAPXExtdServer))
+#define CAMEL_IMAPX_EXTD_SERVER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((klass), CAMEL_TYPE_IMAPX_EXTD_SERVER, CamelIMAPXExtdServerClass))
+#define CAMEL_IS_IMAPX_EXTD_SERVER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_IMAPX_EXTD_SERVER))
+#define CAMEL_IS_IMAPX_EXTD_SERVER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((klass), CAMEL_TYPE_IMAPX_EXTD_SERVER))
+#define CAMEL_IMAPX_EXTD_SERVER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_IMAPX_EXTD_SERVER, CamelIMAPXExtdServerClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelIMAPXExtdServer CamelIMAPXExtdServer;
+typedef struct _CamelIMAPXExtdServerClass CamelIMAPXExtdServerClass;
+
+struct _CamelIMAPXExtdServer {
+ CamelIMAPXServer parent;
+};
+
+struct _CamelIMAPXExtdServerClass {
+ CamelIMAPXServerClass parent_class;
+};
+
+GType
+camel_imapx_extd_server_get_type (void);
+
+camel_imapx_metadata_proto_t
+camel_imapx_extd_server_metadata_get_proto (CamelIMAPXExtdServer *server);
+
+CamelImapxMetadata*
+camel_imapx_extd_server_get_metadata (CamelIMAPXExtdServer *server,
+ CamelImapxMetadataSpec *spec,
+ gboolean do_resect,
+ GError **err);
-CamelImapxMetadata *camel_imapx_server_get_metadata (CamelIMAPXServer *is, CamelImapxMetadataSpec *spec, gboolean do_resect, GError **err);
+gboolean
+camel_imapx_extd_server_set_metadata (CamelIMAPXExtdServer *server,
+ CamelImapxMetadata *md,
+ GError **err);
-gboolean camel_imapx_server_set_metadata (CamelIMAPXServer *is, CamelImapxMetadata *md, GError **err);
+G_END_DECLS
/*----------------------------------------------------------------------------*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]