[evolution-data-server/openismus-work] For openismus-work branch, make test-client-custom-summary not use function from glib 2.34



commit 0007cc0f80de18855a64b15a96d6d6820a0edd48
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Dec 7 17:31:42 2012 +0900

    For openismus-work branch, make test-client-custom-summary not use function from glib 2.34

 tests/libebook/client/test-client-custom-summary.c |   22 ++++++++++++++++++-
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/tests/libebook/client/test-client-custom-summary.c b/tests/libebook/client/test-client-custom-summary.c
index 21ac71e..1f27fe7 100644
--- a/tests/libebook/client/test-client-custom-summary.c
+++ b/tests/libebook/client/test-client-custom-summary.c
@@ -134,6 +134,7 @@ new_custom_temp_client (gchar **uri)
 }
 
 typedef struct {
+	GTestDataFunc func;
 	EBookClient *client;
 	EBookQuery *query;
 	gint num_contacts;
@@ -144,7 +145,9 @@ client_test_data_free (gpointer p)
 {
 	ClientTestData *const data = p;
 	g_object_unref (data->client);
-	e_book_query_unref (data->query);
+
+	if (data->query)
+		e_book_query_unref (data->query);
 	g_slice_free (ClientTestData, data);
 }
 
@@ -203,6 +206,20 @@ remove_test (gconstpointer p)
 	}
 }
 
+/* Temporary hack not in master, we need to support
+ * earlier versions of GLib (< 2.34) without g_test_add_data_func_full()
+ *
+ *
+ */
+static void
+test_and_free (gconstpointer p)
+{
+	ClientTestData *data = (ClientTestData *)p;
+
+	data->func (p);
+	client_test_data_free (data);
+}
+
 static void
 add_client_test (const gchar *path,
                  GTestDataFunc func,
@@ -212,11 +229,12 @@ add_client_test (const gchar *path,
 {
 	ClientTestData *data = g_slice_new (ClientTestData);
 
+	data->func = func;
 	data->client = g_object_ref (client);
 	data->query = query;
 	data->num_contacts = num_contacts;
 
-	g_test_add_data_func_full (path, data, func, client_test_data_free);
+	g_test_add_data_func (path, data, test_and_free);
 }
 
 gint



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