[evolution-kolab/ek-wip-porting] CamelKolabIMAPXStore: use virtual functions for extensions
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] CamelKolabIMAPXStore: use virtual functions for extensions
- Date: Fri, 13 Jan 2012 19:03:01 +0000 (UTC)
commit f67791a1a62c47822030e6d973fc6ade16c844dc
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri Jan 13 19:58:23 2012 +0100
CamelKolabIMAPXStore: use virtual functions for extensions
* implement the virtual function / accessor API function
scheme for Kolab extension functions
* renaming of internal static functions
src/camel/camel-kolab-imapx-store.c | 403 ++++++++++++++++++++---------------
src/camel/camel-kolab-imapx-store.h | 29 ++-
2 files changed, 245 insertions(+), 187 deletions(-)
---
diff --git a/src/camel/camel-kolab-imapx-store.c b/src/camel/camel-kolab-imapx-store.c
index 90fb6a8..6631179 100644
--- a/src/camel/camel-kolab-imapx-store.c
+++ b/src/camel/camel-kolab-imapx-store.c
@@ -56,9 +56,9 @@ static CamelStoreClass *parent_store_class = NULL;
/*----------------------------------------------------------------------------*/
/* forward declarations */
-static void camel_kolab_imapx_store_initable_init (GInitableIface *interface);
-static void camel_kolab_imapx_store_network_service_init (CamelNetworkServiceInterface *interface);
-static void camel_kolab_imapx_store_subscribable_init (CamelSubscribableInterface *interface);
+static void kolab_imapx_store_initable_init (GInitableIface *interface);
+static void kolab_imapx_store_network_service_init (CamelNetworkServiceInterface *interface);
+static void kolab_imapx_store_subscribable_init (CamelSubscribableInterface *interface);
typedef struct _CamelKolabIMAPXStorePrivate CamelKolabIMAPXStorePrivate;
struct _CamelKolabIMAPXStorePrivate {
@@ -81,15 +81,12 @@ struct _CamelKolabIMAPXStorePrivate {
G_DEFINE_TYPE_WITH_CODE (CamelKolabIMAPXStore,
camel_kolab_imapx_store,
CAMEL_TYPE_IMAPX_EXTD_STORE,
- G_IMPLEMENT_INTERFACE (
- G_TYPE_INITABLE,
- camel_kolab_imapx_store_initable_init)
- G_IMPLEMENT_INTERFACE (
- CAMEL_TYPE_NETWORK_SERVICE,
- camel_kolab_imapx_store_network_service_init)
- G_IMPLEMENT_INTERFACE (
- CAMEL_TYPE_SUBSCRIBABLE,
- camel_kolab_imapx_store_subscribable_init))
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+ kolab_imapx_store_initable_init)
+ G_IMPLEMENT_INTERFACE (CAMEL_TYPE_NETWORK_SERVICE,
+ kolab_imapx_store_network_service_init)
+ G_IMPLEMENT_INTERFACE (CAMEL_TYPE_SUBSCRIBABLE,
+ kolab_imapx_store_subscribable_init))
/*----------------------------------------------------------------------------*/
/* object/class init */
@@ -151,16 +148,25 @@ static void
camel_kolab_imapx_store_dispose (GObject *object)
{
CamelKolabIMAPXStore *self = NULL;
- CamelKolabIMAPXStorePrivate *priv = NULL;
+ CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (self);
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (object));
self = CAMEL_KOLAB_IMAPX_STORE (object);
- priv = CAMEL_KOLAB_IMAPX_STORE_PRIVATE (self);
+ istore = CAMEL_IMAPX_STORE (self);
- if (priv->server != NULL) {
- g_object_unref (priv->server);
- priv->server = NULL;
+ /* disconnect service and unref the connection manager.
+ * see imapx_store_dispose() in camel-imapx-store.c
+ */
+ if (istore->con_man != NULL) {
+ camel_service_disconnect_sync (CAMEL_SERVICE (self),
+ TRUE,
+ NULL);
+ g_object_unref (istore->con_man);
+ istore->con_man = NULL;
+ /* this part will now be skipped
+ * in the parent's dispose() function
+ */
}
/* Chain up to parent's dispose() method. */
@@ -201,8 +207,8 @@ camel_kolab_imapx_store_finalize (GObject *object)
/* class functions */
static gchar*
-camel_kolab_imapx_store_get_name (CamelService *service,
- gboolean brief)
+kolab_imapx_store_get_name (CamelService *service,
+ gboolean brief)
{
CamelNetworkSettings *network_settings = NULL;
CamelSettings *settings = NULL;
@@ -227,9 +233,9 @@ camel_kolab_imapx_store_get_name (CamelService *service,
}
static gboolean
-camel_kolab_imapx_store_connect_sync (CamelService *service,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_connect_sync (CamelService *service,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -244,10 +250,10 @@ camel_kolab_imapx_store_connect_sync (CamelService *service,
}
static gboolean
-camel_kolab_imapx_store_disconnect_sync (CamelService *service,
- gboolean clean,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_disconnect_sync (CamelService *service,
+ gboolean clean,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -263,14 +269,15 @@ camel_kolab_imapx_store_disconnect_sync (CamelService *service,
}
static CamelAuthenticationResult
-camel_kolab_imapx_store_authenticate_sync (CamelService *service,
- const gchar *mechanism,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_authenticate_sync (CamelService *service,
+ const gchar *mechanism,
+ GCancellable *cancellable,
+ GError **err)
{
CamelAuthenticationResult result = CAMEL_AUTHENTICATION_ERROR;
g_assert (CAMEL_IS_SERVICE (service));
+ g_assert (mechanism != NULL); /* FIXME correct? */
/* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, CAMEL_AUTHENTICATION_ERROR);
@@ -282,9 +289,9 @@ camel_kolab_imapx_store_authenticate_sync (CamelService *service,
}
static GList*
-camel_kolab_imapx_store_query_auth_types_sync (CamelService *service,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_query_auth_types_sync (CamelService *service,
+ GCancellable *cancellable,
+ GError **err)
{
GList *auth_types = NULL;
@@ -299,7 +306,7 @@ camel_kolab_imapx_store_query_auth_types_sync (CamelService *service,
}
static guint
-camel_kolab_imapx_store_name_hash (gconstpointer key)
+kolab_imapx_store_name_hash (gconstpointer key)
{
if (g_ascii_strcasecmp (key, "INBOX") == 0)
return g_str_hash ("INBOX");
@@ -308,8 +315,8 @@ camel_kolab_imapx_store_name_hash (gconstpointer key)
}
static gint
-camel_kolab_imapx_store_name_equal (gconstpointer a,
- gconstpointer b)
+kolab_imapx_store_name_equal (gconstpointer a,
+ gconstpointer b)
{
gconstpointer aname = a, bname = b;
@@ -321,9 +328,9 @@ camel_kolab_imapx_store_name_equal (gconstpointer a,
}
static gboolean
-camel_kolab_imapx_store_can_refresh_folder (CamelStore *self,
- CamelFolderInfo *finfo,
- GError **err)
+kolab_imapx_store_can_refresh_folder (CamelStore *self,
+ CamelFolderInfo *finfo,
+ GError **err)
{
gboolean can = FALSE;
@@ -338,11 +345,11 @@ camel_kolab_imapx_store_can_refresh_folder (CamelStore *self,
}
static CamelFolder*
-camel_kolab_imapx_store_get_folder_sync (CamelStore *self,
- const gchar *foldername,
- CamelStoreGetFolderFlags flags,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_get_folder_sync (CamelStore *self,
+ const gchar *foldername,
+ CamelStoreGetFolderFlags flags,
+ GCancellable *cancellable,
+ GError **err)
{
CamelFolder *folder = NULL;
@@ -367,16 +374,16 @@ camel_kolab_imapx_store_get_folder_sync (CamelStore *self,
}
static CamelFolderInfo*
-camel_kolab_imapx_store_get_folder_info_sync (CamelStore *self,
- const gchar *top,
- CamelStoreGetFolderInfoFlags flags,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_get_folder_info_sync (CamelStore *self,
+ const gchar *top,
+ CamelStoreGetFolderInfoFlags flags,
+ GCancellable *cancellable,
+ GError **err)
{
CamelFolderInfo *finfo = NULL;
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- /* top may be NULL */
+ /* top may be NULL */ /* FIXME correct? */
/* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
@@ -389,9 +396,9 @@ camel_kolab_imapx_store_get_folder_info_sync (CamelStore *self,
}
static CamelFolder*
-camel_kolab_imapx_store_get_junk_folder_sync (CamelStore *self,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_get_junk_folder_sync (CamelStore *self,
+ GCancellable *cancellable,
+ GError **err)
{
CamelFolder *folder = NULL;
@@ -402,20 +409,16 @@ camel_kolab_imapx_store_get_junk_folder_sync (CamelStore *self,
folder = parent_store_class->get_junk_folder_sync (self,
cancellable,
err);
- if (folder != NULL) {
- /* FIXME need to get a CamelKolabImapxFolder here?
- * how?
- */
- g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
- }
+ if (folder != NULL)
+ g_assert (CAMEL_IS_KOLAB_IMAPX_FOLDER (folder));
return folder;
}
static CamelFolder*
-camel_kolab_imapx_store_get_trash_folder_sync (CamelStore *self,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_get_trash_folder_sync (CamelStore *self,
+ GCancellable *cancellable,
+ GError **err)
{
CamelFolder *folder = NULL;
@@ -426,27 +429,23 @@ camel_kolab_imapx_store_get_trash_folder_sync (CamelStore *self,
folder = parent_store_class->get_trash_folder_sync (self,
cancellable,
err);
- if (folder != NULL) {
- /* FIXME need to get a CamelKolabImapxFolder here?
- * how?
- */
- g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
- }
+ if (folder != NULL)
+ g_assert (CAMEL_IS_KOLAB_IMAPX_FOLDER (folder));
return folder;
}
static CamelFolderInfo*
-camel_kolab_imapx_store_create_folder_sync (CamelStore *self,
- const gchar *parentname,
- const gchar *foldername,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_create_folder_sync (CamelStore *self,
+ const gchar *parentname,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err)
{
CamelFolderInfo *finfo = NULL;
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- /* parentname may be NULL */ /* correct? */
+ /* parentname may be NULL */ /* FIXME correct? */
g_assert (foldername != NULL);
/* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
@@ -460,10 +459,10 @@ camel_kolab_imapx_store_create_folder_sync (CamelStore *self,
}
static gboolean
-camel_kolab_imapx_store_delete_folder_sync (CamelStore *self,
- const gchar *foldername,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_delete_folder_sync (CamelStore *self,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -481,11 +480,11 @@ camel_kolab_imapx_store_delete_folder_sync (CamelStore *self,
}
static gboolean
-camel_kolab_imapx_store_rename_folder_sync (CamelStore *self,
- const gchar *foldername_old,
- const gchar *foldername_new,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_rename_folder_sync (CamelStore *self,
+ const gchar *foldername_old,
+ const gchar *foldername_new,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -504,9 +503,9 @@ camel_kolab_imapx_store_rename_folder_sync (CamelStore *self,
}
static gboolean
-camel_kolab_imapx_store_noop_sync (CamelStore *self,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_noop_sync (CamelStore *self,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -520,13 +519,69 @@ camel_kolab_imapx_store_noop_sync (CamelStore *self,
return ok;
}
+static gboolean
+kolab_imapx_store_set_folder_creation_type (CamelKolabIMAPXStore *self,
+ KolabFolderTypeID type_id)
+{
+ g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
+ g_assert ((type_id > KOLAB_FOLDER_TYPE_UNKNOWN) &&
+ (type_id < KOLAB_FOLDER_LAST_TYPE));
+
+ /* FIXME implement me */
+ g_error ("%s: FIXME implement me", __func__);
+
+ return FALSE;
+}
+
+static gboolean
+kolab_imapx_store_set_folder_context (CamelKolabIMAPXStore *self,
+ KolabFolderContextID context)
+{
+ g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
+ g_assert ((context > KOLAB_FOLDER_CONTEXT_INVAL) &&
+ (context < KOLAB_FOLDER_LAST_CONTEXT));
+
+ /* FIXME implement me */
+ g_error ("%s: FIXME implement me", __func__);
+
+ return FALSE;
+}
+
+static KolabFolderTypeID
+kolab_imapx_store_get_folder_type (CamelKolabIMAPXStore *self,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err)
+{
+ g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
+ (void)foldername; /* FIXME */
+ (void)cancellable; /* FIXME */ /* cancellable may be NULL */
+ g_return_val_if_fail (err == NULL || *err == NULL, KOLAB_FOLDER_TYPE_INVAL);
+
+ /* FIXME implement me */
+ g_error ("%s: FIXME implement me", __func__);
+
+ return KOLAB_FOLDER_TYPE_INVAL;
+}
+
+static GList*
+kolab_imapx_store_resect_folder_list (CamelKolabIMAPXStore *self)
+{
+ g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
+
+ /* FIXME remove me */
+ g_error ("%s: FIXME implement me", __func__);
+
+ return NULL;
+}
+
/*----------------------------------------------------------------------------*/
/* interface functions */
static gboolean
-camel_kolab_imapx_store_initable_initialize (GInitable *initable,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_initable_initialize (GInitable *initable,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -542,8 +597,8 @@ camel_kolab_imapx_store_initable_initialize (GInitable *initable,
}
static const gchar*
-camel_kolab_imapx_store_get_service_name (CamelNetworkService *service,
- CamelNetworkSecurityMethod method)
+kolab_imapx_store_get_service_name (CamelNetworkService *service,
+ CamelNetworkSecurityMethod method)
{
const gchar *sn = NULL;
@@ -557,8 +612,8 @@ camel_kolab_imapx_store_get_service_name (CamelNetworkService *service,
}
static guint16
-camel_kolab_imapx_store_get_default_port (CamelNetworkService *service,
- CamelNetworkSecurityMethod method)
+kolab_imapx_store_get_default_port (CamelNetworkService *service,
+ CamelNetworkSecurityMethod method)
{
guint16 port = 0;
@@ -572,8 +627,8 @@ camel_kolab_imapx_store_get_default_port (CamelNetworkService *service,
}
static gboolean
-camel_kolab_imapx_store_folder_is_subscribed (CamelSubscribable *subscribable,
- const gchar *foldername)
+kolab_imapx_store_folder_is_subscribed (CamelSubscribable *subscribable,
+ const gchar *foldername)
{
gboolean subscribed = FALSE;
@@ -588,10 +643,10 @@ camel_kolab_imapx_store_folder_is_subscribed (CamelSubscribable *subscribable,
}
static gboolean
-camel_kolab_imapx_store_subscribe_folder_sync (CamelSubscribable *subscribable,
- const gchar *foldername,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_subscribe_folder_sync (CamelSubscribable *subscribable,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -609,10 +664,10 @@ camel_kolab_imapx_store_subscribe_folder_sync (CamelSubscribable *subscribable,
}
static gboolean
-camel_kolab_imapx_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
- const gchar *foldername,
- GCancellable *cancellable,
- GError **err)
+kolab_imapx_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err)
{
gboolean ok = FALSE;
@@ -630,31 +685,31 @@ camel_kolab_imapx_store_unsubscribe_folder_sync (CamelSubscribable *subscribable
}
static void
-camel_kolab_imapx_store_initable_init (GInitableIface *interface)
+kolab_imapx_store_initable_init (GInitableIface *interface)
{
parent_initable_iface = g_type_interface_peek_parent (interface);
- interface->init = camel_kolab_imapx_store_initable_initialize;
+ interface->init = kolab_imapx_store_initable_initialize;
}
static void
-camel_kolab_imapx_store_network_service_init (CamelNetworkServiceInterface *interface)
+kolab_imapx_store_network_service_init (CamelNetworkServiceInterface *interface)
{
g_assert (CAMEL_IS_NETWORK_SERVICE_INTERFACE (interface));
parent_service_iface = g_type_interface_peek_parent (interface);
- interface->get_service_name = camel_kolab_imapx_store_get_service_name;
- interface->get_default_port = camel_kolab_imapx_store_get_default_port;
+ interface->get_service_name = kolab_imapx_store_get_service_name;
+ interface->get_default_port = kolab_imapx_store_get_default_port;
}
static void
-camel_kolab_imapx_store_subscribable_init (CamelSubscribableInterface *interface)
+kolab_imapx_store_subscribable_init (CamelSubscribableInterface *interface)
{
g_assert (CAMEL_IS_SUBSCRIBABLE_INTERFACE (interface));
parent_subscribable_iface = g_type_interface_peek_parent (interface);
- interface->folder_is_subscribed = camel_kolab_imapx_store_folder_is_subscribed;
- interface->subscribe_folder_sync = camel_kolab_imapx_store_subscribe_folder_sync;
- interface->unsubscribe_folder_sync = camel_kolab_imapx_store_unsubscribe_folder_sync;
+ interface->folder_is_subscribed = kolab_imapx_store_folder_is_subscribed;
+ interface->subscribe_folder_sync = kolab_imapx_store_subscribe_folder_sync;
+ interface->unsubscribe_folder_sync = kolab_imapx_store_unsubscribe_folder_sync;
}
/*----------------------------------------------------------------------------*/
@@ -670,80 +725,71 @@ camel_kolab_imapx_store_class_init (CamelKolabIMAPXStoreClass *klass)
parent_service_class = CAMEL_SERVICE_CLASS (camel_kolab_imapx_store_parent_class);
parent_store_class = CAMEL_STORE_CLASS (camel_kolab_imapx_store_parent_class);
- object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (CamelKolabIMAPXStorePrivate));
+
+ object_class = G_OBJECT_CLASS (klass);
object_class->dispose = camel_kolab_imapx_store_dispose;
object_class->finalize = camel_kolab_imapx_store_finalize;
service_class = CAMEL_SERVICE_CLASS (klass);
service_class->settings_type = CAMEL_TYPE_KOLAB_IMAPX_SETTINGS;
- service_class->get_name = camel_kolab_imapx_store_get_name;
- service_class->connect_sync = camel_kolab_imapx_store_connect_sync;
- service_class->disconnect_sync = camel_kolab_imapx_store_disconnect_sync;
- service_class->authenticate_sync = camel_kolab_imapx_store_authenticate_sync;
- service_class->query_auth_types_sync = camel_kolab_imapx_store_query_auth_types_sync;
+ service_class->get_name = kolab_imapx_store_get_name;
+ service_class->connect_sync = kolab_imapx_store_connect_sync;
+ service_class->disconnect_sync = kolab_imapx_store_disconnect_sync;
+ service_class->authenticate_sync = kolab_imapx_store_authenticate_sync;
+ service_class->query_auth_types_sync = kolab_imapx_store_query_auth_types_sync;
store_class = CAMEL_STORE_CLASS (klass);
- store_class->hash_folder_name = camel_kolab_imapx_store_name_hash;
- store_class->compare_folder_name = camel_kolab_imapx_store_name_equal;
- store_class->can_refresh_folder = camel_kolab_imapx_store_can_refresh_folder;
+ store_class->hash_folder_name = kolab_imapx_store_name_hash;
+ store_class->compare_folder_name = kolab_imapx_store_name_equal;
+ store_class->can_refresh_folder = kolab_imapx_store_can_refresh_folder;
store_class->free_folder_info = camel_store_free_folder_info_full;
- store_class->get_folder_sync = camel_kolab_imapx_store_get_folder_sync;
- store_class->get_folder_info_sync = camel_kolab_imapx_store_get_folder_info_sync;
- store_class->get_junk_folder_sync = camel_kolab_imapx_store_get_junk_folder_sync;
- store_class->get_trash_folder_sync = camel_kolab_imapx_store_get_trash_folder_sync;
- store_class->create_folder_sync = camel_kolab_imapx_store_create_folder_sync;
- store_class->delete_folder_sync = camel_kolab_imapx_store_delete_folder_sync;
- store_class->rename_folder_sync = camel_kolab_imapx_store_rename_folder_sync;
- store_class->noop_sync = camel_kolab_imapx_store_noop_sync;
+ store_class->get_folder_sync = kolab_imapx_store_get_folder_sync;
+ store_class->get_folder_info_sync = kolab_imapx_store_get_folder_info_sync;
+ store_class->get_junk_folder_sync = kolab_imapx_store_get_junk_folder_sync;
+ store_class->get_trash_folder_sync = kolab_imapx_store_get_trash_folder_sync;
+ store_class->create_folder_sync = kolab_imapx_store_create_folder_sync;
+ store_class->delete_folder_sync = kolab_imapx_store_delete_folder_sync;
+ store_class->rename_folder_sync = kolab_imapx_store_rename_folder_sync;
+ store_class->noop_sync = kolab_imapx_store_noop_sync;
+
+ klass->set_folder_creation_type = kolab_imapx_store_set_folder_creation_type;
+ klass->set_folder_context = kolab_imapx_store_set_folder_context;
+ klass->get_folder_type = kolab_imapx_store_get_folder_type;
+ klass->resect_folder_list = kolab_imapx_store_resect_folder_list;
}
/*----------------------------------------------------------------------------*/
/* API functions */
-CamelKolabIMAPXServer*
-camel_kolab_imapx_store_get_server (CamelKolabIMAPXStore *self,
- const gchar *foldername,
- GCancellable *cancellable,
- GError **err)
-{
- g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- (void)foldername; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
- g_return_val_if_fail (err == NULL || *err == NULL, NULL);
-
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return NULL;
-}
-
gboolean
camel_kolab_imapx_store_set_folder_creation_type (CamelKolabIMAPXStore *self,
KolabFolderTypeID type_id)
{
- g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- g_assert ((type_id > KOLAB_FOLDER_TYPE_UNKNOWN) &&
- (type_id < KOLAB_FOLDER_LAST_TYPE));
+ CamelKolabIMAPXStoreClass *klass = NULL;
+ gboolean ok = FALSE;
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_STORE (self), FALSE);
- return FALSE;
+ klass = CAMEL_KOLAB_IMAPX_STORE_GET_CLASS (self);
+ ok = klass->set_folder_creation_type (self, type_id);
+
+ return ok;
}
gboolean
camel_kolab_imapx_store_set_folder_context (CamelKolabIMAPXStore *self,
KolabFolderContextID context)
{
- g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- g_assert ((context > KOLAB_FOLDER_CONTEXT_INVAL) &&
- (context < KOLAB_FOLDER_LAST_CONTEXT));
+ CamelKolabIMAPXStoreClass *klass = NULL;
+ gboolean ok = FALSE;
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_STORE (self), FALSE);
- return FALSE;
+ klass = CAMEL_KOLAB_IMAPX_STORE_GET_CLASS (self);
+ ok = klass->set_folder_context (self, context);
+
+ return ok;
}
KolabFolderTypeID
@@ -752,15 +798,31 @@ camel_kolab_imapx_store_get_folder_type (CamelKolabIMAPXStore *self,
GCancellable *cancellable,
GError **err)
{
- g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- (void)foldername; /* FIXME */
- (void)cancellable; /* FIXME */ /* cancellable may be NULL */
- g_return_val_if_fail (err == NULL || *err == NULL, KOLAB_FOLDER_TYPE_INVAL);
+ CamelKolabIMAPXStoreClass *klass = NULL;
+ KolabFolderTypeID foldertype = KOLAB_FOLDER_TYPE_INVAL;
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_STORE (self), KOLAB_FOLDER_TYPE_INVAL);
- return KOLAB_FOLDER_TYPE_INVAL;
+ klass = CAMEL_KOLAB_IMAPX_STORE_GET_CLASS (self);
+ foldertype = klass->get_folder_type (self,
+ foldername,
+ cancellable,
+ err);
+ return foldertype;
+}
+
+GList*
+camel_kolab_imapx_store_resect_folder_list (CamelKolabIMAPXStore *self)
+{
+ CamelKolabIMAPXStoreClass *klass = NULL;
+ GList *list = NULL;
+
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_STORE (self), NULL);
+
+ klass = CAMEL_KOLAB_IMAPX_STORE_GET_CLASS (self);
+ list = klass->resect_folder_list (self);
+
+ return list;
}
gboolean
@@ -780,17 +842,6 @@ camel_kolab_imapx_store_logout_sync (CamelKolabIMAPXStore *self,
return FALSE;
}
-GList*
-camel_kolab_imapx_store_resect_folder_list (CamelKolabIMAPXStore *self)
-{
- g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
-
- /* FIXME remove me */
- g_error ("%s: FIXME implement me", __func__);
-
- return NULL;
-}
-
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
diff --git a/src/camel/camel-kolab-imapx-store.h b/src/camel/camel-kolab-imapx-store.h
index e490569..9c74ebe 100644
--- a/src/camel/camel-kolab-imapx-store.h
+++ b/src/camel/camel-kolab-imapx-store.h
@@ -59,7 +59,7 @@
#define CAMEL_IS_KOLAB_IMAPX_STORE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), CAMEL_TYPE_KOLAB_IMAPX_STORE))
-#define CAMEL_KOLAB_IMAPX_GET_CLASS(obj) \
+#define CAMEL_KOLAB_IMAPX_STORE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), CAMEL_TYPE_KOLAB_IMAPX_STORE, CamelKolabIMAPXStoreClass))
@@ -77,17 +77,23 @@ struct _CamelKolabIMAPXStore {
struct _CamelKolabIMAPXStoreClass {
CamelIMAPXStoreClass parent_class;
+
+ gboolean (*set_folder_creation_type) (CamelKolabIMAPXStore *self,
+ KolabFolderTypeID type_id);
+
+ gboolean (*set_folder_context) (CamelKolabIMAPXStore *self,
+ KolabFolderContextID context);
+
+ KolabFolderTypeID (*get_folder_type) (CamelKolabIMAPXStore *self,
+ const gchar *foldername,
+ GCancellable *cancellable,
+ GError **err);
+
+ GList* (*resect_folder_list) (CamelKolabIMAPXStore *self);
};
GType camel_kolab_imapx_store_get_type (void);
-/* CamelServer getter */
-CamelKolabIMAPXServer*
-camel_kolab_imapx_store_get_server (CamelKolabIMAPXStore *self,
- const gchar *foldername,
- GCancellable *cancellable,
- GError **err);
-
/* Kolab extension: set type for newly created folders */
gboolean
camel_kolab_imapx_store_set_folder_creation_type (CamelKolabIMAPXStore *self,
@@ -105,15 +111,16 @@ camel_kolab_imapx_store_get_folder_type (CamelKolabIMAPXStore *self,
GCancellable *cancellable,
GError **err);
+/* Kolab extension */
+GList*
+camel_kolab_imapx_store_resect_folder_list (CamelKolabIMAPXStore *self);
+
/* send a LOGOUT to the server (still neeed??) */
gboolean
camel_kolab_imapx_store_logout_sync (CamelKolabIMAPXStore *self,
GCancellable *cancellable,
GError **err);
-GList*
-camel_kolab_imapx_store_resect_folder_list (CamelKolabIMAPXStore *self);
-
G_END_DECLS
/*----------------------------------------------------------------------------*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]