[evolution-kolab/ek-wip-porting] CamelKolabIMAPXStore: initial implementation of class functions
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] CamelKolabIMAPXStore: initial implementation of class functions
- Date: Tue, 10 Jan 2012 17:01:30 +0000 (UTC)
commit b7d3b93f1b7dd7d997dd0c1b56992b505294017b
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Tue Jan 10 17:58:58 2012 +0100
CamelKolabIMAPXStore: initial implementation of class functions
* added implementation for service class virtual functions
* added implementation for store class virtual functions
* these use the parent implementations only at present,
for Kolab specifics we'll need to extend some of them
src/camel/camel-kolab-imapx-store.c | 207 ++++++++++++++++++++++-------------
1 files changed, 129 insertions(+), 78 deletions(-)
---
diff --git a/src/camel/camel-kolab-imapx-store.c b/src/camel/camel-kolab-imapx-store.c
index ff01d2f..438a3dc 100644
--- a/src/camel/camel-kolab-imapx-store.c
+++ b/src/camel/camel-kolab-imapx-store.c
@@ -49,6 +49,9 @@ static GInitableIface *parent_initable_iface = NULL;
static CamelNetworkServiceInterface *parent_service_iface = NULL;
static CamelSubscribableInterface *parent_subscribable_iface = NULL;
+static CamelServiceClass *parent_service_class = NULL;
+static CamelStoreClass *parent_store_class = NULL;
+
/*----------------------------------------------------------------------------*/
/* forward declarations */
@@ -195,8 +198,6 @@ camel_kolab_imapx_store_get_name (CamelService *service,
const gchar *user = NULL;
gchar *name = NULL;
- /* TODO type-check that we get CamelKolab* instances here */
-
g_assert (CAMEL_IS_SERVICE (service));
settings = camel_service_get_settings (service);
@@ -218,16 +219,16 @@ camel_kolab_imapx_store_connect_sync (CamelService *service,
GCancellable *cancellable,
GError **err)
{
- /* TODO type-check that we get CamelKolab* instances here */
+ gboolean ok = FALSE;
g_assert (CAMEL_IS_SERVICE (service));
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return FALSE;
+ ok = parent_service_class->connect_sync (service,
+ cancellable,
+ err);
+ return ok;
}
static gboolean
@@ -236,17 +237,17 @@ camel_kolab_imapx_store_disconnect_sync (CamelService *service,
GCancellable *cancellable,
GError **err)
{
- /* TODO type-check that we get CamelKolab* instances here */
+ gboolean ok = FALSE;
g_assert (CAMEL_IS_SERVICE (service));
- (void)clean; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return FALSE;
+ ok = parent_service_class->disconnect_sync (service,
+ clean,
+ cancellable,
+ err);
+ return ok;
}
static CamelAuthenticationResult
@@ -255,17 +256,17 @@ camel_kolab_imapx_store_authenticate_sync (CamelService *service,
GCancellable *cancellable,
GError **err)
{
- /* TODO type-check that we get CamelKolab* instances here */
+ CamelAuthenticationResult result = CAMEL_AUTHENTICATION_ERROR;
g_assert (CAMEL_IS_SERVICE (service));
- (void)mechanism; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, CAMEL_AUTHENTICATION_ERROR);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return CAMEL_AUTHENTICATION_ERROR;
+ result = parent_service_class->authenticate_sync (service,
+ mechanism,
+ cancellable,
+ err);
+ return result;
}
static GList*
@@ -273,16 +274,16 @@ camel_kolab_imapx_store_query_auth_types_sync (CamelService *service,
GCancellable *cancellable,
GError **err)
{
- /* TODO type-check that we get CamelKolab* instances here */
+ GList *auth_types = NULL;
g_assert (CAMEL_IS_SERVICE (service));
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return NULL;
+ auth_types = parent_service_class->query_auth_types_sync (service,
+ cancellable,
+ err);
+ return auth_types;
}
static guint
@@ -312,14 +313,16 @@ camel_kolab_imapx_store_can_refresh_folder (CamelStore *self,
CamelFolderInfo *finfo,
GError **err)
{
+ gboolean can = FALSE;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
g_assert (finfo != NULL);
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return FALSE;
+ can = parent_store_class->can_refresh_folder (self,
+ finfo,
+ err);
+ return can;
}
static CamelFolder*
@@ -329,16 +332,26 @@ camel_kolab_imapx_store_get_folder_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ CamelFolder *folder = NULL;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- (void)foldername; /* FIXME */
- (void)flags; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
+ g_assert (foldername != NULL);
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
+ folder = parent_store_class->get_folder_sync (self,
+ foldername,
+ flags,
+ cancellable,
+ err);
+ if (folder != NULL) {
+ /* FIXME need to get a CamelKolabImapxFolder here?
+ * how?
+ */
+ g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+ }
- return NULL;
+ return folder;
}
static CamelFolderInfo*
@@ -348,16 +361,19 @@ camel_kolab_imapx_store_get_folder_info_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ CamelFolderInfo *finfo = NULL;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- (void)top; /* FIXME */ /* top may be NULL */
- (void)flags; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* top may be NULL */
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return NULL;
+ finfo = parent_store_class->get_folder_info_sync (self,
+ top,
+ flags,
+ cancellable,
+ err);
+ return finfo;
}
static CamelFolder*
@@ -365,14 +381,23 @@ camel_kolab_imapx_store_get_junk_folder_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ CamelFolder *folder = NULL;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
+ 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));
+ }
- return NULL;
+ return folder;
}
static CamelFolder*
@@ -380,14 +405,23 @@ camel_kolab_imapx_store_get_trash_folder_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ CamelFolder *folder = NULL;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
+ 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));
+ }
- return NULL;
+ return folder;
}
static CamelFolderInfo*
@@ -397,16 +431,20 @@ camel_kolab_imapx_store_create_folder_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ CamelFolderInfo *finfo = NULL;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- (void)parentname; /* FIXME */
- (void)foldername; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* parentname may be NULL */ /* correct? */
+ g_assert (foldername != NULL);
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return NULL;
+ finfo = parent_store_class->create_folder_sync (self,
+ parentname,
+ foldername,
+ cancellable,
+ err);
+ return finfo;
}
static gboolean
@@ -415,15 +453,19 @@ camel_kolab_imapx_store_delete_folder_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ gboolean ok = FALSE;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- (void)foldername; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* parentname may be NULL */ /* correct? */
+ g_assert (foldername != NULL);
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return FALSE;
+ ok = parent_store_class->delete_folder_sync (self,
+ foldername,
+ cancellable,
+ err);
+ return ok;
}
static gboolean
@@ -433,16 +475,20 @@ camel_kolab_imapx_store_rename_folder_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ gboolean ok = FALSE;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- (void)foldername_old; /* FIXME */
- (void)foldername_new; /* FIXME */
- g_assert (G_IS_CANCELLABLE (cancellable));
+ g_assert (foldername_old != NULL);
+ g_assert (foldername_new != NULL);
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return FALSE;
+ ok = parent_store_class->rename_folder_sync (self,
+ foldername_old,
+ foldername_new,
+ cancellable,
+ err);
+ return ok;
}
static gboolean
@@ -450,14 +496,16 @@ camel_kolab_imapx_store_noop_sync (CamelStore *self,
GCancellable *cancellable,
GError **err)
{
+ gboolean ok = FALSE;
+
g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (self));
- g_assert (G_IS_CANCELLABLE (cancellable));
+ /* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
- /* FIXME implement me */
- g_error ("%s: FIXME implement me", __func__);
-
- return FALSE;
+ ok = parent_store_class->noop_sync (self,
+ cancellable,
+ err);
+ return ok;
}
/*----------------------------------------------------------------------------*/
@@ -607,6 +655,9 @@ camel_kolab_imapx_store_class_init (CamelKolabIMAPXStoreClass *klass)
CamelServiceClass *service_class;
CamelStoreClass *store_class;
+ 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->dispose = camel_kolab_imapx_store_dispose;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]