[evolution-ews] Change return type of *_search apis to GSList as the EBookBackend api's have been changed accordingl



commit 80b2c844cc5308e626c5c2cbc7d2c4251a7283e6
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Mon Jun 13 14:08:20 2011 +0530

    Change return type of *_search apis to GSList as the EBookBackend api's have been changed accordingly

 src/addressbook/e-book-backend-ews.c           |    8 ++--
 src/addressbook/e-book-backend-sqlitedb-test.c |    2 +-
 src/addressbook/e-book-backend-sqlitedb.c      |   52 ++++++++++++------------
 src/addressbook/e-book-backend-sqlitedb.h      |    7 ++-
 4 files changed, 35 insertions(+), 34 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 1008a18..f70398a 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -992,17 +992,17 @@ e_book_backend_ews_start_book_view (EBookBackend  *backend,
 		ebews_start_refreshing (ebews);
 
 		if (e_book_backend_sqlitedb_get_is_populated (priv->ebsdb, priv->folder_id, NULL)) {
-			GList *contacts, *k;
+			GSList *contacts;
 			
 			contacts = e_book_backend_sqlitedb_search (priv->ebsdb, priv->folder_id, query, NULL, &error);
-			for (k = contacts; k != NULL; k = g_list_next (k)) {
-				EbSdbSearchData *s_data = (EbSdbSearchData *) k->data;
+			for (l = contacts; l != NULL; l = g_slist_next (l)) {
+				EbSdbSearchData *s_data = (EbSdbSearchData *) l->data;
 			
 				e_data_book_view_notify_update_prefiltered_vcard (book_view, s_data->uid, s_data->vcard);
 				e_book_backend_sqlitedb_search_data_free (s_data);
 			}
 
-			g_list_free (contacts);
+			g_slist_free (contacts);
 			e_data_book_view_notify_complete (book_view, error);
 			e_data_book_view_unref (book_view);
 			return;
diff --git a/src/addressbook/e-book-backend-sqlitedb-test.c b/src/addressbook/e-book-backend-sqlitedb-test.c
index d9b1741..bc67590 100644
--- a/src/addressbook/e-book-backend-sqlitedb-test.c
+++ b/src/addressbook/e-book-backend-sqlitedb-test.c
@@ -91,7 +91,7 @@ add_contacts (EBookBackendSqliteDB *ebsdb)
 static void
 search_db (EBookBackendSqliteDB *ebsdb, const gchar *type, const gchar *sexp)
 {
-	GList *vcards;
+	GSList *vcards;
 	EbSdbSearchData *s_data;
 	
 	g_print ("%s - query: %s \n", type, sexp);
diff --git a/src/addressbook/e-book-backend-sqlitedb.c b/src/addressbook/e-book-backend-sqlitedb.c
index a4125d4..5dc8c38 100644
--- a/src/addressbook/e-book-backend-sqlitedb.c
+++ b/src/addressbook/e-book-backend-sqlitedb.c
@@ -1080,7 +1080,7 @@ sexp_to_sql_query (const gchar *query)
 static gint
 addto_vcard_list_cb (gpointer ref, gint col, gchar **cols, gchar **name)
 {
-	GList **vcards = ref;
+	GSList **vcard_data = ref;
 	EbSdbSearchData *s_data = g_new0 (EbSdbSearchData, 1);
 
 	if (cols [0])
@@ -1092,7 +1092,7 @@ addto_vcard_list_cb (gpointer ref, gint col, gchar **cols, gchar **name)
 	if (cols [2])
 		s_data->bdata = g_strdup (cols [1]);
 
-	*vcards = g_list_prepend (*vcards, s_data);
+	*vcard_data = g_slist_prepend (*vcard_data, s_data);
 
 	return 0;
 }
@@ -1111,7 +1111,7 @@ addto_slist_cb (gpointer ref, gint col, gchar **cols, gchar **name)
 static int
 store_data_to_vcard (gpointer ref, gint ncol, gchar **cols, gchar **name)
 {
-	GSList **vcards = ref;
+	GSList **vcard_data = ref;
 	EbSdbSearchData *search_data = g_new0 (EbSdbSearchData, 1);
 	EContact *contact = e_contact_new ();
 	gchar *vcard;
@@ -1160,53 +1160,53 @@ store_data_to_vcard (gpointer ref, gint ncol, gchar **cols, gchar **name)
 
 	vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
 	search_data->vcard = vcard;
-	*vcards = g_slist_prepend (*vcards, search_data);
+	*vcard_data = g_slist_prepend (*vcard_data, search_data);
 
 	g_object_unref (contact);
 	return 0;
 }
 
-static GList *
+static GSList *
 book_backend_sqlitedb_search_query	(EBookBackendSqliteDB *ebsdb, 
 			 		 const gchar *sql, 
 					 const gchar *folderid, 
-					 GSList *requested_fields, 
+					 GSList *fields_of_interest, 
 					 GError **error)
 {
 	GError *err = NULL;
-	GList *vcards = NULL;
+	GSList *vcard_data = NULL;
 	gchar *stmt;
 
 	READER_LOCK (ebsdb);
 
 	/* TODO enable return just the requested fields. */
-	if (!ebsdb->priv->store_vcard || requested_fields) {
+	if (!ebsdb->priv->store_vcard || fields_of_interest) {
 		stmt = sqlite3_mprintf ("SELECT uid, nickname, full_name, given_name, family_name, file_as, email_1, email_2, " 
 					"email_3, is_list, list_show_addresses, wants_html FROM %Q WHERE %s", folderid, sql);
-		book_backend_sql_exec (ebsdb->priv->db, stmt, store_data_to_vcard, &vcards, &err);
+		book_backend_sql_exec (ebsdb->priv->db, stmt, store_data_to_vcard, &vcard_data, &err);
 		sqlite3_free (stmt);
 	} else {
 		stmt = sqlite3_mprintf ("SELECT uid vcard bdata FROM %Q WHERE %s", folderid, sql);
-		book_backend_sql_exec (ebsdb->priv->db, stmt, addto_vcard_list_cb , &vcards, &err);
+		book_backend_sql_exec (ebsdb->priv->db, stmt, addto_vcard_list_cb , &vcard_data, &err);
 		sqlite3_free (stmt);
 	}
 
 	READER_UNLOCK (ebsdb);
 
-	if (vcards)
-		vcards = g_list_reverse (vcards);
+	if (vcard_data)
+		vcard_data = g_slist_reverse (vcard_data);
 
 	if (err)
 		g_propagate_error (error, err);
 
-	return vcards;
+	return vcard_data;
 }
 
-static GList *
+static GSList *
 book_backend_sqlitedb_search_full (EBookBackendSqliteDB *ebsdb, const gchar *sexp, const gchar *folderid, gboolean return_uids, GError **error)
 {
 	GError *err = NULL;
-	GList *r_list = NULL, *all = NULL, *l;
+	GSList *r_list = NULL, *all = NULL, *l;
 	EBookBackendSExp *bsexp = NULL;
 	gchar *stmt;
 
@@ -1221,14 +1221,14 @@ book_backend_sqlitedb_search_full (EBookBackendSqliteDB *ebsdb, const gchar *sex
 	if (!err) {
 		bsexp = e_book_backend_sexp_new (sexp);
 
-		for (l = all; l != NULL; l = g_list_next (l)) {
+		for (l = all; l != NULL; l = g_slist_next (l)) {
 			EbSdbSearchData *s_data = (EbSdbSearchData *) l->data;
 			
 			if (e_book_backend_sexp_match_vcard (bsexp, s_data->vcard)) {
 				if (!return_uids)
-					r_list = g_list_prepend (r_list, s_data);
+					r_list = g_slist_prepend (r_list, s_data);
 				else {
-					r_list = g_list_prepend (r_list, g_strdup (s_data->uid));
+					r_list = g_slist_prepend (r_list, g_strdup (s_data->uid));
 					e_book_backend_sqlitedb_search_data_free (s_data);
 				}
 			} else
@@ -1238,7 +1238,7 @@ book_backend_sqlitedb_search_full (EBookBackendSqliteDB *ebsdb, const gchar *sex
 		g_object_unref (bsexp);
 	}
 
-	g_list_free (all);
+	g_slist_free (all);
 
 	return r_list;
 }
@@ -1248,7 +1248,7 @@ book_backend_sqlitedb_search_full (EBookBackendSqliteDB *ebsdb, const gchar *sex
  * @ebsdb: 
  * @folderid: 
  * @sexp: search expression.
- * &requested_fields: a #GList containing the names of fields to return, or NULL for all. 
+ * &fields_of_interest: a #GList containing the names of fields to return, or NULL for all. 
  *  At the moment if this is non-null, the vcard will be populated with summary fields, else it would return the 
  *  whole vcard if its stored in the db. [not implemented fully]
  * @error: 
@@ -1260,20 +1260,20 @@ book_backend_sqlitedb_search_full (EBookBackendSqliteDB *ebsdb, const gchar *sex
  *
  * Returns: List of EbSdbSearchData.
  **/
-GList *
+GSList *
 e_book_backend_sqlitedb_search	(EBookBackendSqliteDB *ebsdb,
 				 const gchar *folderid,
 				 const gchar *sexp,
-				 GSList *requested_fields,
+				 GSList *fields_of_interest,
 				 GError **error)
 {
-	GList *search_contacts = NULL;
+	GSList *search_contacts = NULL;
 
 	if (book_backend_sqlitedb_is_summary_query (sexp)) {
 		gchar *sql_query;
 
 		sql_query = sexp_to_sql_query (sexp);
-		search_contacts = book_backend_sqlitedb_search_query (ebsdb, sql_query, folderid, requested_fields, error);
+		search_contacts = book_backend_sqlitedb_search_query (ebsdb, sql_query, folderid, fields_of_interest, error);
 		g_free (sql_query);
 	} else if (ebsdb->priv->store_vcard)
 		search_contacts = book_backend_sqlitedb_search_full (ebsdb, sexp, folderid, FALSE, error);
@@ -1285,13 +1285,13 @@ e_book_backend_sqlitedb_search	(EBookBackendSqliteDB *ebsdb,
 	return search_contacts;
 }
 
-GList *		
+GSList *		
 e_book_backend_sqlitedb_search_uids	(EBookBackendSqliteDB *ebsdb,
 					 const gchar *folderid,
 					 const gchar *sexp,
 					 GError **error)
 {
-	GList *uids = NULL;
+	GSList *uids = NULL;
 	
 	if (book_backend_sqlitedb_is_summary_query (sexp)) {
 		gchar *stmt;
diff --git a/src/addressbook/e-book-backend-sqlitedb.h b/src/addressbook/e-book-backend-sqlitedb.h
index d5a40bb..49099b7 100644
--- a/src/addressbook/e-book-backend-sqlitedb.h
+++ b/src/addressbook/e-book-backend-sqlitedb.h
@@ -110,12 +110,13 @@ gchar *		e_book_backend_sqlitedb_get_vcard_string
 							 const gchar *folderid,
 							 const gchar *uid,
 							 GError **error);
-GList *		e_book_backend_sqlitedb_search		(EBookBackendSqliteDB *ebsdb,
+GSList *		e_book_backend_sqlitedb_search	(EBookBackendSqliteDB *ebsdb,
 							 const gchar *folderid,
 							 const gchar *sexp,
-							 GSList *requested_fields,
+							 GSList *fields_of_interest,
 							 GError **error);
-GList *		e_book_backend_sqlitedb_search_uids	(EBookBackendSqliteDB *ebsdb,
+GSList *		e_book_backend_sqlitedb_search_uids	
+							(EBookBackendSqliteDB *ebsdb,
 							 const gchar *folderid,
 							 const gchar *sexp,
 							 GError **error);



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