[evolution-kolab/ek-wip-porting] CamelKolabIMAPXStore: GType fixups



commit 96a9a6da123e5a9988d9e752526b28fdd0aba298
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Mon Jan 23 22:32:47 2012 +0100

    CamelKolabIMAPXStore: GType fixups
    
    * correctly subclass from CamelIMAPXExtdStore (had been
      CamelIMAPXStore by error before)
      (Thanks to Matthew Barnes for pointing that out)
    * in most functions, check "self" param type more
      precisely
    * in kolab_imapx_store_get_folder_sync(), do not check
      the type of the folder returned as yet (needs more
      work with the Kolab object type injection into
      upstream objects)

 src/camel/camel-kolab-imapx-store.c |   26 ++++++++++++++++++--------
 src/camel/camel-kolab-imapx-store.h |    2 +-
 2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/src/camel/camel-kolab-imapx-store.c b/src/camel/camel-kolab-imapx-store.c
index 26aba70..dd626d2 100644
--- a/src/camel/camel-kolab-imapx-store.c
+++ b/src/camel/camel-kolab-imapx-store.c
@@ -150,8 +150,6 @@ camel_kolab_imapx_store_dispose (GObject *object)
 	CamelKolabIMAPXStore *self = NULL;
 	CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (self);
 
-	g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (object));
-
 	self = CAMEL_KOLAB_IMAPX_STORE (object);
 	istore = CAMEL_IMAPX_STORE (self);
 
@@ -227,6 +225,9 @@ imapx_store_get_folder_offline (CamelStore *self,
 	CamelStoreInfo *si = NULL;
 	const gchar *user_cache_dir = NULL;
 
+	g_assert (folder_name != NULL);
+	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
+
 	user_cache_dir = camel_service_get_user_cache_dir (service);
 
 	si = camel_store_summary_path (CAMEL_STORE_SUMMARY (imapx_store->summary), folder_name);
@@ -281,6 +282,8 @@ kolab_imapx_store_get_name (CamelService *service,
 	gchar *user;
 	gchar *name;
 
+	g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (service));
+
 	settings = camel_service_get_settings (service);
 
 	network_settings = CAMEL_NETWORK_SETTINGS (settings);
@@ -307,7 +310,7 @@ kolab_imapx_store_connect_sync (CamelService *service,
 {
 	gboolean ok = FALSE;
 
-	g_assert (CAMEL_IS_SERVICE (service));
+	g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (service));
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
@@ -325,7 +328,7 @@ kolab_imapx_store_disconnect_sync (CamelService *service,
 {
 	gboolean ok = FALSE;
 
-	g_assert (CAMEL_IS_SERVICE (service));
+	g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (service));
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
@@ -344,10 +347,10 @@ kolab_imapx_store_authenticate_sync (CamelService *service,
 {
 	CamelAuthenticationResult result = CAMEL_AUTHENTICATION_ERROR;
 
-	g_assert (CAMEL_IS_SERVICE (service));
+	g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (service));
 	/* mechanism may be NULL */
 	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, CAMEL_AUTHENTICATION_ERROR);
+	g_return_val_if_fail (err == NULL || *err == NULL, CAMEL_AUTHENTICATION_REJECTED);
 
 	result = parent_service_class->authenticate_sync (service,
 	                                                  mechanism,
@@ -363,7 +366,7 @@ kolab_imapx_store_query_auth_types_sync (CamelService *service,
 {
 	GList *auth_types = NULL;
 
-	g_assert (CAMEL_IS_SERVICE (service));
+	g_assert (CAMEL_IS_KOLAB_IMAPX_STORE (service));
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
 
@@ -423,13 +426,20 @@ kolab_imapx_store_get_folder_sync (CamelStore *self,
 
 	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
 	g_assert (foldername != NULL);
-	(void)cancellable;
+	(void)cancellable; /* FIXME */
 	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
 
 	folder = imapx_store_get_folder_offline (self,
 	                                         foldername,
 	                                         flags,
 	                                         err);
+	/* FIXME */
+	g_warning ("%s: FIXME getting CamelIMAPXFolder, expected CamelKolabIMAPXFolder",
+	           __func__);
+#if 0
+	if (folder != NULL)
+		g_assert (CAMEL_IS_KOLAB_IMAPX_FOLDER (folder));
+#endif
 	return folder;
 }
 
diff --git a/src/camel/camel-kolab-imapx-store.h b/src/camel/camel-kolab-imapx-store.h
index 4709384..db7fde6 100644
--- a/src/camel/camel-kolab-imapx-store.h
+++ b/src/camel/camel-kolab-imapx-store.h
@@ -77,7 +77,7 @@ struct _CamelKolabIMAPXStore {
 };
 
 struct _CamelKolabIMAPXStoreClass {
-	CamelIMAPXStoreClass parent_class;
+	CamelIMAPXExtdStoreClass parent_class;
 
 	gboolean (*set_folder_creation_type) (CamelKolabIMAPXStore *self,
 	                                      KolabFolderTypeID type_id);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]