[evolution-data-server/openismus-work-master] e_book_backend_sqlitedb_new_full(): Simplified to take the extension directly.



commit 0ceb391a6bb350a9f4841bb196225b309535c8d1
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Tue Nov 20 16:42:27 2012 +0900

    e_book_backend_sqlitedb_new_full(): Simplified to take the extension directly.

 .../libedata-book/e-book-backend-sqlitedb.c        |   31 ++++++++++++++-----
 .../libedata-book/e-book-backend-sqlitedb.h        |    6 +---
 2 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 111004e..c82ecbf 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -948,24 +948,33 @@ e_book_backend_sqlitedb_new_full (const gchar *path,
 				  const gchar *folderid,
 				  const gchar *folder_name,
 				  gboolean store_vcard,
-				  EContactField *fields,
-				  gint n_fields,
-				  EContactField *indexed_fields,
-				  EBookIndexType *index_types,
-				  gint n_indexed_fields,
+				  ESourceBackendSummarySetup *setup,
 				  GError **error)
 {
 	EBookBackendSqliteDB *ebsdb = NULL;
+	EContactField *fields;
+	EContactField *indexed_fields;
+	EBookIndexType *index_types;
 	gboolean have_attr_list = FALSE;
 	gboolean have_attr_list_prefix = FALSE;
 	gboolean have_attr_list_suffix = FALSE;
 	gboolean had_error = FALSE;
 	GArray *summary_fields;
-	gint i;
+	gint n_fields, n_indexed_fields, i;
+
+	fields         = e_source_backend_summary_setup_get_summary_fields (setup, &n_fields);
+	indexed_fields = e_source_backend_summary_setup_get_indexed_fields (setup, &index_types, &n_indexed_fields);
 
 	/* No specified summary fields indicates the default summary configuration should be used */
-	if (n_fields <= 0)
-		return e_book_backend_sqlitedb_new (path, emailid, folderid, folder_name, store_vcard, error);
+	if (n_fields <= 0) {
+
+		ebsdb = e_book_backend_sqlitedb_new (path, emailid, folderid, folder_name, store_vcard, error);
+		g_free (fields);
+		g_free (index_types);
+		g_free (indexed_fields);
+		
+		return ebsdb;
+	}
 
 	summary_fields = g_array_new (FALSE, FALSE, sizeof (SummaryField));
 
@@ -982,6 +991,9 @@ e_book_backend_sqlitedb_new_full (const gchar *path,
 
 	if (had_error) {
 		g_array_free (summary_fields, TRUE);
+		g_free (fields);
+		g_free (index_types);
+		g_free (indexed_fields);
 		return NULL;
 	}
 
@@ -998,6 +1010,9 @@ e_book_backend_sqlitedb_new_full (const gchar *path,
 						      have_attr_list_suffix,
 						      error);
 
+	g_free (fields);
+	g_free (index_types);
+	g_free (indexed_fields);
 	g_array_free (summary_fields, FALSE);
 
 	return ebsdb;
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.h b/addressbook/libedata-book/e-book-backend-sqlitedb.h
index 8de7f05..897753e 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.h
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.h
@@ -99,11 +99,7 @@ EBookBackendSqliteDB *
 						 const gchar *folderid,
 						 const gchar *folder_name,
 						 gboolean store_vcard,
-						 EContactField *fields,
-						 gint n_fields,
-						 EContactField *indexed_fields,
-						 EBookIndexType *index_types,
-						 gint n_indexed_fields,
+						 ESourceBackendSummarySetup *setup,
 						 GError **error);
 gboolean	e_book_backend_sqlitedb_lock_updates
 						(EBookBackendSqliteDB *ebsdb,



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