[evolution-data-server/openismus-work-master] Rename of ESourceAddressBookConfig to ESourceBackendSummarySetup



commit 48f74911c1e9c7762439948606bb7d6f58f8177f
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Tue Nov 20 16:35:34 2012 +0900

    Rename of ESourceAddressBookConfig to ESourceBackendSummarySetup

 addressbook/libebook/Makefile.am                   |    4 +-
 .../libebook/e-source-address-book-config.h        |  109 --------
 ...k-config.c => e-source-backend-summary-setup.c} |  269 ++++++++++----------
 .../libebook/e-source-backend-summary-setup.h      |  108 ++++++++
 addressbook/libebook/libebook.h                    |    2 +-
 5 files changed, 248 insertions(+), 244 deletions(-)
---
diff --git a/addressbook/libebook/Makefile.am b/addressbook/libebook/Makefile.am
index 419711c..12d4cec 100644
--- a/addressbook/libebook/Makefile.am
+++ b/addressbook/libebook/Makefile.am
@@ -49,7 +49,7 @@ libebook_1_2_la_SOURCES =				\
 	e-destination.c					\
 	e-name-western.c				\
 	e-name-western-tables.h                         \
-	e-source-address-book-config.c			\
+	e-source-backend-summary-setup.c			\
 	e-vcard.c					\
 	e-error.h
 
@@ -80,7 +80,7 @@ libebookinclude_HEADERS =				\
 	e-contact.h					\
 	e-destination.h					\
 	e-name-western.h				\
-	e-source-address-book-config.h			\
+	e-source-backend-summary-setup.h		\
 	e-vcard.h
 
 %-$(API_VERSION).pc: %.pc
diff --git a/addressbook/libebook/e-source-address-book-config.c b/addressbook/libebook/e-source-backend-summary-setup.c
similarity index 57%
rename from addressbook/libebook/e-source-address-book-config.c
rename to addressbook/libebook/e-source-backend-summary-setup.c
index 81288d6..a3159ae 100644
--- a/addressbook/libebook/e-source-address-book-config.c
+++ b/addressbook/libebook/e-source-backend-summary-setup.c
@@ -1,55 +1,60 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
-/* e-source-address-book-config.c - Address Book Configuration.
+/* e-source-backend-summary-setup.c - Backend Summary Data Configuration.
  *
  * Copyright (C) 2012 Openismus GmbH
  *
  * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
  *
  * Authors: Tristan Van Berkom <tristanvb openismus com>
  */
 
 /**
- * SECTION: e-source-address-book-config
- * @include: libebook/libebook.h
- * @short_description: #ESource extension for an address book configuration
+ * SECTION: e-source-backend-summary-setup
+ * @include: libedataserver/libedataserver.h
+ * @short_description: #ESource extension to configure summary fields
  *
- * The #ESourceAddressBookConfig extension adds configuration data to
- * an #ESource which is already defined as an #ESourceAddressBook.
+ * The #ESourceBackendSummarySetup extension configures which #EContactFields
+ * should be in the summary and which of those fields should be optimized for
+ * quicker search results.
  *
  * Access the extension as follows:
  *
  * |[
- *   #include <libebook/libebook.h>
+ *   #include <libedataserver/libedataserver.h>
  *
- *   ESourceAddressBookConfig *extension;
+ *   ESourceBackendSummarySetup *extension;
  *
- *   extension = e_source_get_extension (source, E_SOURCE_EXTENSION_ADDRESS_BOOK_CONFIG);
+ *   extension = e_source_get_extension (source, E_SOURCE_EXTENSION_BACKEND_SUMMARY_SETUP);
  * ]|
+ *
+ * <note><para>The summary configuration is expected to be setup in only one way for
+ * a given #ESource at creation time. Any configurations made after creation of the
+ * book in question will be ignored.</para></note>
+ *
  **/
 
-#include "e-source-address-book-config.h"
+#include "e-source-backend-summary-setup.h"
 #include "e-book-enumtypes.h"
 
-#define E_SOURCE_ABC_GET_PRIVATE(obj)			\
+#define E_SOURCE_BACKEND_SUMMARY_GET_PRIVATE(obj)	\
 	(G_TYPE_INSTANCE_GET_PRIVATE			\
-	 ((obj), E_TYPE_SOURCE_ADDRESS_BOOK_CONFIG,	\
-	  ESourceAddressBookConfigPrivate))
+	 ((obj), E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP,	\
+	  ESourceBackendSummarySetupPrivate))
 
-struct _ESourceAddressBookConfigPrivate {
-	GMutex *property_lock;
+struct _ESourceBackendSummarySetupPrivate {
+	GMutex  property_lock;
 	gchar  *summary_fields;
 	gchar  *indexed_fields;
 };
@@ -61,32 +66,32 @@ enum {
 };
 
 G_DEFINE_TYPE (
-	ESourceAddressBookConfig,
-	e_source_address_book_config,
+	ESourceBackendSummarySetup,
+	e_source_backend_summary_setup,
 	E_TYPE_SOURCE_EXTENSION)
 
 
 static void
-source_address_book_config_finalize (GObject *object)
+source_backend_summary_setup_finalize (GObject *object)
 {
-	ESourceAddressBookConfigPrivate *priv;
+	ESourceBackendSummarySetupPrivate *priv;
 
-	priv = E_SOURCE_ABC_GET_PRIVATE (object);
+	priv = E_SOURCE_BACKEND_SUMMARY_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 	g_free (priv->summary_fields);
 	g_free (priv->indexed_fields);
 
-	G_OBJECT_CLASS (e_source_address_book_config_parent_class)->finalize (object);
+	G_OBJECT_CLASS (e_source_backend_summary_setup_parent_class)->finalize (object);
 }
 
 static gchar *
-source_address_book_config_dup_litteral_fields (ESourceAddressBookConfig *extension,
+source_backend_summary_setup_dup_literal_fields (ESourceBackendSummarySetup *extension,
 						gint                      which)
 {
 	gchar *duplicate = NULL;
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	switch (which) {
 	case PROP_SUMMARY_FIELDS:
@@ -100,14 +105,14 @@ source_address_book_config_dup_litteral_fields (ESourceAddressBookConfig *extens
 		break;
 	}
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
 
 static void
-source_address_book_config_set_litteral_fields (ESourceAddressBookConfig *extension,
-						const gchar              *litteral_fields,
+source_backend_summary_setup_set_literal_fields (ESourceBackendSummarySetup *extension,
+						const gchar              *literal_fields,
 						gint                      which)
 {
 	const gchar *property_name;
@@ -127,23 +132,23 @@ source_address_book_config_set_litteral_fields (ESourceAddressBookConfig *extens
 		break;
 	}
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
-	if (g_strcmp0 (*target, litteral_fields) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+	if (g_strcmp0 (*target, literal_fields) == 0) {
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (*target);
-	*target = e_util_strdup_strip (litteral_fields);
+	*target = e_util_strdup_strip (literal_fields);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), property_name);
 }
 
 static void
-source_address_book_config_set_property (GObject *object,
+source_backend_summary_setup_set_property (GObject *object,
 					 guint property_id,
 					 const GValue *value,
 					 GParamSpec *pspec)
@@ -151,8 +156,8 @@ source_address_book_config_set_property (GObject *object,
 	switch (property_id) {
 	case PROP_SUMMARY_FIELDS:
 	case PROP_INDEXED_FIELDS:
-		source_address_book_config_set_litteral_fields
-			(E_SOURCE_ADDRESS_BOOK_CONFIG (object), g_value_get_string (value), property_id);
+		source_backend_summary_setup_set_literal_fields
+			(E_SOURCE_BACKEND_SUMMARY_SETUP (object), g_value_get_string (value), property_id);
 			return;
 	}
 
@@ -160,7 +165,7 @@ source_address_book_config_set_property (GObject *object,
 }
 
 static void
-source_address_book_config_get_property (GObject *object,
+source_backend_summary_setup_get_property (GObject *object,
 					 guint property_id,
 					 GValue *value,
 					 GParamSpec *pspec)
@@ -169,8 +174,8 @@ source_address_book_config_get_property (GObject *object,
 	case PROP_SUMMARY_FIELDS:
 	case PROP_INDEXED_FIELDS:
 		g_value_take_string (value,
-				     source_address_book_config_dup_litteral_fields
-				     (E_SOURCE_ADDRESS_BOOK_CONFIG (object), property_id));
+				     source_backend_summary_setup_dup_literal_fields
+				     (E_SOURCE_BACKEND_SUMMARY_SETUP (object), property_id));
 			return;
 	}
 
@@ -178,18 +183,18 @@ source_address_book_config_get_property (GObject *object,
 }
 
 static void
-e_source_address_book_config_class_init (ESourceAddressBookConfigClass *class)
+e_source_backend_summary_setup_class_init (ESourceBackendSummarySetupClass *class)
 {
 	GObjectClass          *object_class;
 	ESourceExtensionClass *extension_class;
 
 	extension_class       = E_SOURCE_EXTENSION_CLASS (class);
-	extension_class->name = E_SOURCE_EXTENSION_ADDRESS_BOOK_CONFIG;
+	extension_class->name = E_SOURCE_EXTENSION_BACKEND_SUMMARY_SETUP;
 
 	object_class               = G_OBJECT_CLASS (class);
-	object_class->finalize     = source_address_book_config_finalize;
-	object_class->get_property = source_address_book_config_get_property;
-	object_class->set_property = source_address_book_config_set_property;
+	object_class->finalize     = source_backend_summary_setup_finalize;
+	object_class->get_property = source_backend_summary_setup_get_property;
+	object_class->set_property = source_backend_summary_setup_set_property;
 
 	g_object_class_install_property (
 		object_class,
@@ -197,7 +202,7 @@ e_source_address_book_config_class_init (ESourceAddressBookConfigClass *class)
 		g_param_spec_string (
 			"summary-fields",
 			"Summary Fields",
-			"The list of quick reference summary fields for this address book",
+			"The list of quick reference summary fields",
 			NULL,
 			G_PARAM_READWRITE |
 			G_PARAM_CONSTRUCT |
@@ -217,31 +222,31 @@ e_source_address_book_config_class_init (ESourceAddressBookConfigClass *class)
 			G_PARAM_STATIC_STRINGS |
 			E_SOURCE_PARAM_SETTING));
 
-	g_type_class_add_private (class, sizeof (ESourceAddressBookConfigPrivate));
+	g_type_class_add_private (class, sizeof (ESourceBackendSummarySetupPrivate));
 }
 
 static void
-e_source_address_book_config_init (ESourceAddressBookConfig *extension)
+e_source_backend_summary_setup_init (ESourceBackendSummarySetup *extension)
 {
-	extension->priv = E_SOURCE_ABC_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	extension->priv = E_SOURCE_BACKEND_SUMMARY_GET_PRIVATE (extension);
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 static EContactField *
-source_address_book_config_get_fields_array (ESourceAddressBookConfig  *extension,
-					     gint                      *n_fields,
-					     gint                       which)
+source_backend_summary_setup_get_fields_array (ESourceBackendSummarySetup  *extension,
+					       gint                        *n_fields,
+					       gint                         which)
 {
 	EContactField field;
 	EContactField *fields = NULL;
-	gchar *litteral_fields;
+	gchar *literal_fields;
 	gchar **split = NULL;
 	gint n_ret_fields = 0, i;
 
-	litteral_fields = source_address_book_config_dup_litteral_fields (extension, which);
+	literal_fields = source_backend_summary_setup_dup_literal_fields (extension, which);
 
-	if (litteral_fields)
-		split = g_strsplit (litteral_fields, ":", 0);
+	if (literal_fields)
+		split = g_strsplit (literal_fields, ":", 0);
 
 	if (split) {
 		n_ret_fields = g_strv_length (split);
@@ -251,7 +256,7 @@ source_address_book_config_get_fields_array (ESourceAddressBookConfig  *extensio
 			field = e_contact_field_id (split[i]);
 
 			if (field == 0)
-				g_warning ("Unrecognized field '%s' in ESourceAddressBookConfig fields", split[i]);
+				g_warning ("Unrecognized field '%s' in ESourceBackendSummarySetup fields", split[i]);
 
 			fields[i] = field;
 		}
@@ -259,7 +264,7 @@ source_address_book_config_get_fields_array (ESourceAddressBookConfig  *extensio
 		g_strfreev (split);
 	}
 
-	g_free (litteral_fields);
+	g_free (literal_fields);
 
 	*n_fields = n_ret_fields;
 
@@ -267,10 +272,10 @@ source_address_book_config_get_fields_array (ESourceAddressBookConfig  *extensio
 }
 
 static void
-e_source_address_book_config_set_fields_array (ESourceAddressBookConfig *extension,
-					       EContactField            *fields,
-					       gint                      n_fields,
-					       gint                      which)
+e_source_backend_summary_setup_set_fields_array (ESourceBackendSummarySetup *extension,
+						 EContactField              *fields,
+						 gint                        n_fields,
+						 gint                        which)
 {
 	gint i;
 	GString *string;
@@ -282,7 +287,7 @@ e_source_address_book_config_set_fields_array (ESourceAddressBookConfig *extensi
 		const gchar *field_name = e_contact_field_name (fields[i]);
 
 		if (field_name == NULL) {
-			g_warning ("Invalid EContactField given to ESourceAddressBookConfig");
+			g_warning ("Invalid EContactField given to ESourceBackendSummarySetup");
 			malformed = TRUE;
 			break;
 		}
@@ -294,15 +299,15 @@ e_source_address_book_config_set_fields_array (ESourceAddressBookConfig *extensi
 	}
 
 	if (malformed == FALSE)
-		source_address_book_config_set_litteral_fields (extension, string->str, which);
+		source_backend_summary_setup_set_literal_fields (extension, string->str, which);
 
 	g_string_free (string, TRUE);
 }
 
 static void
-e_source_address_book_config_set_fields_va_list (ESourceAddressBookConfig *extension,
-						 va_list                   var_args,
-						 gint                      which)
+e_source_backend_summary_setup_set_fields_va_list (ESourceBackendSummarySetup *extension,
+						   va_list                     var_args,
+						   gint                        which)
 {
 	GString *string;
 	gboolean malformed = FALSE, first_field = TRUE;
@@ -315,7 +320,7 @@ e_source_address_book_config_set_fields_va_list (ESourceAddressBookConfig *exten
 		const gchar *field_name = e_contact_field_name (field);
 
 		if (field_name == NULL) {
-			g_warning ("Invalid EContactField given to ESourceAddressBookConfig");
+			g_warning ("Invalid EContactField given to ESourceBackendSummarySetup");
 			malformed = TRUE;
 			break;
 		}
@@ -331,14 +336,14 @@ e_source_address_book_config_set_fields_va_list (ESourceAddressBookConfig *exten
 	}
 
 	if (malformed == FALSE)
-		source_address_book_config_set_litteral_fields (extension, string->str, which);
+		source_backend_summary_setup_set_literal_fields (extension, string->str, which);
 
 	g_string_free (string, TRUE);
 }
 
 /**
- * e_source_address_book_config_get_summary_fields:
- * @extension: An #ESourceAddressBookConfig
+ * e_source_backend_summary_setup_get_summary_fields:
+ * @extension: An #ESourceBackendSummarySetup
  * @n_fields: (out): A return location for the number of #EContactFields in the returned array.
  *
  * Fetches the #EContactFields which are configured to be a part of the summary.
@@ -350,18 +355,18 @@ e_source_address_book_config_set_fields_va_list (ESourceAddressBookConfig *exten
  * Since: 3.8
  */
 EContactField *
-e_source_address_book_config_get_summary_fields (ESourceAddressBookConfig  *extension,
-						 gint                      *n_fields)
+e_source_backend_summary_setup_get_summary_fields (ESourceBackendSummarySetup  *extension,
+						   gint                        *n_fields)
 {
-	g_return_val_if_fail (E_IS_SOURCE_ADDRESS_BOOK_CONFIG (extension), NULL);
+	g_return_val_if_fail (E_IS_SOURCE_BACKEND_SUMMARY_SETUP (extension), NULL);
 	g_return_val_if_fail (n_fields != NULL, NULL);
 
-	return source_address_book_config_get_fields_array (extension, n_fields, PROP_SUMMARY_FIELDS);
+	return source_backend_summary_setup_get_fields_array (extension, n_fields, PROP_SUMMARY_FIELDS);
 }
 
 /**
- * e_source_address_book_config_set_summary_fieldsv:
- * @extension: An #ESourceAddressBookConfig
+ * e_source_backend_summary_setup_set_summary_fieldsv:
+ * @extension: An #ESourceBackendSummarySetup
  * @fields: The array of #EContactFields to set as summary fields
  * @n_fields: The number of #EContactFields in @fields
  *
@@ -379,22 +384,22 @@ e_source_address_book_config_get_summary_fields (ESourceAddressBookConfig  *exte
  * Since: 3.8
  */
 void
-e_source_address_book_config_set_summary_fieldsv (ESourceAddressBookConfig *extension,
-						  EContactField            *fields,
-						  gint                      n_fields)
+e_source_backend_summary_setup_set_summary_fieldsv (ESourceBackendSummarySetup *extension,
+						    EContactField              *fields,
+						    gint                        n_fields)
 {
-	g_return_if_fail (E_IS_SOURCE_ADDRESS_BOOK_CONFIG (extension));
+	g_return_if_fail (E_IS_SOURCE_BACKEND_SUMMARY_SETUP (extension));
 	g_return_if_fail (n_fields >= 0);
 
-	e_source_address_book_config_set_fields_array (extension, fields, n_fields, PROP_SUMMARY_FIELDS);
+	e_source_backend_summary_setup_set_fields_array (extension, fields, n_fields, PROP_SUMMARY_FIELDS);
 }
 
 /**
- * e_source_address_book_config_set_summary_fields:
- * @extension: An #ESourceAddressBookConfig
+ * e_source_backend_summary_setup_set_summary_fields:
+ * @extension: An #ESourceBackendSummarySetup
  * @...: A 0 terminated list of #EContactFields to set as summary fields
  *
- * Like e_source_address_book_config_set_summary_fieldsv(), but takes a litteral
+ * Like e_source_backend_summary_setup_set_summary_fieldsv(), but takes a literal
  * list of #EContactFields for convenience.
  *
  * To configure the address book summary fields with main phone nubmer fields:
@@ -402,31 +407,31 @@ e_source_address_book_config_set_summary_fieldsv (ESourceAddressBookConfig *exte
  * |[
  *   #include <libebook/libebook.h>
  *
- *   ESourceAddressBookConfig *extension;
+ *   ESourceBackendSummarySetup *extension;
  *
- *   extension = e_source_get_extension (source, E_SOURCE_EXTENSION_ADDRESS_BOOK_CONFIG);
+ *   extension = e_source_get_extension (source, E_SOURCE_EXTENSION_BACKEND_SUMMARY_SETUP);
  *
- *   e_source_address_book_config_set_summary_fields (extension, E_CONTACT_PHONE_HOME, E_CONTACT_PHONE_MOBILE, 0);
+ *   e_source_backend_summary_setup_set_summary_fields (extension, E_CONTACT_FULL_NAME, E_CONTACT_EMAIL, 0);
  * ]|
  *
  * Since: 3.8
  */
 void
-e_source_address_book_config_set_summary_fields (ESourceAddressBookConfig *extension,
-						 ...)
+e_source_backend_summary_setup_set_summary_fields (ESourceBackendSummarySetup *extension,
+						   ...)
 {
 	va_list var_args;
 
-	g_return_if_fail (E_IS_SOURCE_ADDRESS_BOOK_CONFIG (extension));
+	g_return_if_fail (E_IS_SOURCE_BACKEND_SUMMARY_SETUP (extension));
 
 	va_start (var_args, extension);
-	e_source_address_book_config_set_fields_va_list (extension, var_args, PROP_SUMMARY_FIELDS);
+	e_source_backend_summary_setup_set_fields_va_list (extension, var_args, PROP_SUMMARY_FIELDS);
 	va_end (var_args);
 }
 
 /**
- * e_source_address_book_config_get_indexed_fields:
- * @extension: An #ESourceAddressBookConfig
+ * e_source_backend_summary_setup_get_indexed_fields:
+ * @extension: An #ESourceBackendSummarySetup
  * @types: (out) (transfer full): A return location for the set of #EBookIndexTypes corresponding
  *                                to each returned field,  should be freed with g_free() when no longer needed.
  * @n_fields: (out): The number of elements in the returned arrays.
@@ -436,30 +441,30 @@ e_source_address_book_config_set_summary_fields (ESourceAddressBookConfig *exten
  * Returns: (transfer full): The array of indexed #EContactFields.
  */
 EContactField  *
-e_source_address_book_config_get_indexed_fields (ESourceAddressBookConfig  *extension,
-						 EBookIndexType           **types,
-						 gint                      *n_fields)
+e_source_backend_summary_setup_get_indexed_fields (ESourceBackendSummarySetup  *extension,
+						   EBookIndexType             **types,
+						   gint                        *n_fields)
 {
 	EContactField *ret_fields;
 	EBookIndexType *ret_types;
 	gboolean malformed = FALSE;
 	gchar **split, **index_split;
-	gchar *litteral_indexes;
+	gchar *literal_indexes;
 	gint ret_n_fields;
 	gint i;
 
-	g_return_val_if_fail (E_IS_SOURCE_ADDRESS_BOOK_CONFIG (extension), NULL);
+	g_return_val_if_fail (E_IS_SOURCE_BACKEND_SUMMARY_SETUP (extension), NULL);
 	g_return_val_if_fail (types != NULL, NULL);
 	g_return_val_if_fail (n_fields != NULL, NULL);
 
-	litteral_indexes = source_address_book_config_dup_litteral_fields (extension, PROP_INDEXED_FIELDS);
-	if (!litteral_indexes) {
+	literal_indexes = source_backend_summary_setup_dup_literal_fields (extension, PROP_INDEXED_FIELDS);
+	if (!literal_indexes) {
 		*types = NULL;
 		*n_fields = 0;
 		return NULL;
 	}
 
-	split = g_strsplit (litteral_indexes, ":", 0);
+	split = g_strsplit (literal_indexes, ":", 0);
 	ret_n_fields = g_strv_length (split);
 
 	ret_fields = g_new0 (EContactField, ret_n_fields);
@@ -504,7 +509,7 @@ e_source_address_book_config_get_indexed_fields (ESourceAddressBookConfig  *exte
 	}
 
 	g_strfreev (split);
-	g_free (litteral_indexes);
+	g_free (literal_indexes);
 
 	*n_fields = ret_n_fields;
 	*types = ret_types;
@@ -513,8 +518,8 @@ e_source_address_book_config_get_indexed_fields (ESourceAddressBookConfig  *exte
 }
 
 /**
- * e_source_address_book_config_set_indexed_fieldsv:
- * @extension: An #ESourceAddressBookConfig
+ * e_source_backend_summary_setup_set_indexed_fieldsv:
+ * @extension: An #ESourceBackendSummarySetup
  * @fields: The array of #EContactFields to set indexes for
  * @types: The array of #EBookIndexTypes defining what types of indexes to create
  * @n_fields: The number elements in the passed @fields, @rule_types and @rules arrays.
@@ -529,21 +534,21 @@ e_source_address_book_config_get_indexed_fields (ESourceAddressBookConfig  *exte
  * Since: 3.8
  */
 void
-e_source_address_book_config_set_indexed_fieldsv (ESourceAddressBookConfig  *extension,
-						  EContactField             *fields,
-						  EBookIndexType            *types,
-						  gint                       n_fields)
+e_source_backend_summary_setup_set_indexed_fieldsv (ESourceBackendSummarySetup  *extension,
+						    EContactField               *fields,
+						    EBookIndexType              *types,
+						    gint                         n_fields)
 {
 	GString *string;
 	gboolean malformed = FALSE;
 	gint i;
 
-	g_return_if_fail (E_IS_SOURCE_ADDRESS_BOOK_CONFIG (extension));
+	g_return_if_fail (E_IS_SOURCE_BACKEND_SUMMARY_SETUP (extension));
 	g_return_if_fail (types != NULL || n_fields <= 0);
 	g_return_if_fail (fields != NULL || n_fields <= 0);
 
 	if (n_fields <= 0) {
-		source_address_book_config_set_litteral_fields (extension, NULL, PROP_INDEXED_FIELDS);
+		source_backend_summary_setup_set_literal_fields (extension, NULL, PROP_INDEXED_FIELDS);
 		return;
 	}
 
@@ -570,17 +575,17 @@ e_source_address_book_config_set_indexed_fieldsv (ESourceAddressBookConfig  *ext
 	}
 
 	if (!malformed)
-		source_address_book_config_set_litteral_fields (extension, string->str, PROP_INDEXED_FIELDS);
+		source_backend_summary_setup_set_literal_fields (extension, string->str, PROP_INDEXED_FIELDS);
 
 	g_string_free (string, TRUE);
 }
 
 /**
- * e_source_address_book_config_set_indexed_fields:
- * @extension: An #ESourceAddressBookConfig
+ * e_source_backend_summary_setup_set_indexed_fields:
+ * @extension: An #ESourceBackendSummarySetup
  * @...: A list of #EContactFields, #EBookIndexType pairs terminated by 0.
  *
- * Like e_source_address_book_config_set_indexed_fieldsv(), but takes a litteral list of
+ * Like e_source_backend_summary_setup_set_indexed_fieldsv(), but takes a literal list of
  * of indexes.
  *
  * To give the 'fullname' field an index for prefix and suffix searches:
@@ -588,21 +593,21 @@ e_source_address_book_config_set_indexed_fieldsv (ESourceAddressBookConfig  *ext
  * |[
  *   #include <libebook/libebook.h>
  *
- *   ESourceAddressBookConfig *extension;
+ *   ESourceBackendSummarySetup *extension;
  *
- *   extension = e_source_get_extension (source, E_SOURCE_EXTENSION_ADDRESS_BOOK_CONFIG);
+ *   extension = e_source_get_extension (source, E_SOURCE_EXTENSION_BACKEND_SUMMARY_SETUP);
  *
- *   e_source_address_book_config_set_indexed_fields (extension,
- *                                                    E_CONTACT_FULL_NAME, E_BOOK_INDEX_PREFIX,
- *                                                    E_CONTACT_FULL_NAME, E_BOOK_INDEX_SUFFIX,
- *                                                    0);
+ *   e_source_backend_summary_setup_set_indexed_fields (extension,
+ *                                                      E_CONTACT_FULL_NAME, E_BOOK_INDEX_PREFIX,
+ *                                                      E_CONTACT_FULL_NAME, E_BOOK_INDEX_SUFFIX,
+ *                                                      0);
  * ]|
  *
  * Since: 3.8
  */
 void
-e_source_address_book_config_set_indexed_fields (ESourceAddressBookConfig  *extension,
-						  ...)
+e_source_backend_summary_setup_set_indexed_fields (ESourceBackendSummarySetup  *extension,
+						   ...)
 {
 	GString *string;
 	gboolean malformed = FALSE, first = TRUE;
@@ -610,7 +615,7 @@ e_source_address_book_config_set_indexed_fields (ESourceAddressBookConfig  *exte
 	EContactField field_in;
 	EBookIndexType type_in;
 
-	g_return_if_fail (E_IS_SOURCE_ADDRESS_BOOK_CONFIG (extension));
+	g_return_if_fail (E_IS_SOURCE_BACKEND_SUMMARY_SETUP (extension));
 
 	string = g_string_new (NULL);
 
@@ -624,7 +629,7 @@ e_source_address_book_config_set_indexed_fields (ESourceAddressBookConfig  *exte
 		field = e_contact_field_name (field_in);
 		if (field == NULL) {
 			g_warning ("Invalid contact field specified in "
-				   "e_source_address_book_config_set_indexed_fields()");
+				   "e_source_backend_summary_setup_set_indexed_fields()");
 			malformed = TRUE;
 			break;
 		}
@@ -633,7 +638,7 @@ e_source_address_book_config_set_indexed_fields (ESourceAddressBookConfig  *exte
 		type = e_enum_to_string (E_TYPE_BOOK_INDEX_TYPE, type_in);
 		if (type == NULL) {
 			g_warning ("Invalid index type "
-				   "e_source_address_book_config_set_indexed_fields()");
+				   "e_source_backend_summary_setup_set_indexed_fields()");
 			malformed = TRUE;
 			break;
 		}
@@ -651,7 +656,7 @@ e_source_address_book_config_set_indexed_fields (ESourceAddressBookConfig  *exte
 	va_end (var_args);
 
 	if (!malformed)
-		source_address_book_config_set_litteral_fields (extension, string->str, PROP_INDEXED_FIELDS);
+		source_backend_summary_setup_set_literal_fields (extension, string->str, PROP_INDEXED_FIELDS);
 
 	g_string_free (string, TRUE);
 }
diff --git a/addressbook/libebook/e-source-backend-summary-setup.h b/addressbook/libebook/e-source-backend-summary-setup.h
new file mode 100644
index 0000000..ae3fb8c
--- /dev/null
+++ b/addressbook/libebook/e-source-backend-summary-setup.h
@@ -0,0 +1,108 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/* e-source-backend-summary-setup.h - Backend Summary Data Configuration.
+ *
+ * Copyright (C) 2012 Openismus GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ * Authors: Tristan Van Berkom <tristanvb openismus com>
+ */
+
+#if !defined (__LIBEBOOK_H_INSIDE__) && !defined (LIBEBOOK_COMPILATION)
+#error "Only <libebook/libebook.h> should be included directly."
+#endif
+
+#ifndef E_SOURCE_BACKEND_SUMMARY_SETUP_H
+#define E_SOURCE_BACKEND_SUMMARY_SETUP_H
+
+#include <libedataserver/libedataserver.h>
+#include <libebook/e-contact.h>
+#include <libebook/e-book-types.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP \
+	(e_source_backend_summary_setup_get_type ())
+#define E_SOURCE_BACKEND_SUMMARY_SETUP(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP, ESourceBackendSummarySetup))
+#define E_SOURCE_BACKEND_SUMMARY_SETUP_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP, ESourceBackendSummarySetupClass))
+#define E_IS_SOURCE_BACKEND_SUMMARY_SETUP(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP))
+#define E_IS_SOURCE_BACKEND_SUMMARY_SETUP_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP))
+#define E_SOURCE_BACKEND_SUMMARY_SETUP_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP, ESourceBackendSummarySetupClass))
+
+/**
+ * E_SOURCE_EXTENSION_BACKEND_SUMMARY_SETUP:
+ *
+ * Pass this extension name to e_source_get_extension() to access
+ * #ESourceBackendSummarySetup.  This is also used as a group name in key files.
+ *
+ * Since: 3.8
+ **/
+#define E_SOURCE_EXTENSION_BACKEND_SUMMARY_SETUP "Backend Summary Setup"
+
+G_BEGIN_DECLS
+
+typedef struct _ESourceBackendSummarySetup ESourceBackendSummarySetup;
+typedef struct _ESourceBackendSummarySetupClass ESourceBackendSummarySetupClass;
+typedef struct _ESourceBackendSummarySetupPrivate ESourceBackendSummarySetupPrivate;
+
+/**
+ * ESourceBackendSummarySetup:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ *
+ * Since: 3.8
+ **/
+struct _ESourceBackendSummarySetup {
+	ESourceBackend parent;
+	ESourceBackendSummarySetupPrivate *priv;
+};
+
+struct _ESourceBackendSummarySetupClass {
+	ESourceBackendClass parent_class;
+};
+
+GType           e_source_backend_summary_setup_get_type            (void) G_GNUC_CONST;
+
+EContactField  *e_source_backend_summary_setup_get_summary_fields  (ESourceBackendSummarySetup *extension,
+								    gint                       *n_fields);
+void            e_source_backend_summary_setup_set_summary_fieldsv (ESourceBackendSummarySetup *extension,
+								    EContactField              *fields,
+								    gint                        n_fields);
+void            e_source_backend_summary_setup_set_summary_fields  (ESourceBackendSummarySetup *extension,
+								    ...);
+
+EContactField  *e_source_backend_summary_setup_get_indexed_fields  (ESourceBackendSummarySetup *extension,
+								    EBookIndexType            **types,
+								    gint                       *n_fields);
+void            e_source_backend_summary_setup_set_indexed_fieldsv (ESourceBackendSummarySetup *extension,
+								    EContactField              *fields,
+								    EBookIndexType             *types,
+								    gint                        n_fields);
+void            e_source_backend_summary_setup_set_indexed_fields  (ESourceBackendSummarySetup *extension,
+								    ...);
+
+G_END_DECLS
+
+#endif /* E_SOURCE_BACKEND_SUMMARY_SETUP_H */
diff --git a/addressbook/libebook/libebook.h b/addressbook/libebook/libebook.h
index fec9f57..b1ddffc 100644
--- a/addressbook/libebook/libebook.h
+++ b/addressbook/libebook/libebook.h
@@ -34,7 +34,7 @@
 #include <libebook/e-contact.h>
 #include <libebook/e-destination.h>
 #include <libebook/e-name-western.h>
-#include <libebook/e-source-address-book-config.h>
+#include <libebook/e-source-backend-summary-setup.h>
 #include <libebook/e-vcard.h>
 
 #undef __LIBEBOOK_H_INSIDE__



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