[evolution-data-server] Remove camel_settings_save_to_url().



commit d4a230bf00ad67543de3854f84b524cfaa34f58b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Jun 3 20:40:29 2012 -0400

    Remove camel_settings_save_to_url().
    
    Camel settings are no longer stored as a URL string in Evolution.
    This function was always meant to be temporary.  Its time has come.

 camel/camel-settings.c                  |  147 -------------------------------
 camel/camel-settings.h                  |    4 -
 docs/reference/camel/camel-sections.txt |    1 -
 3 files changed, 0 insertions(+), 152 deletions(-)
---
diff --git a/camel/camel-settings.c b/camel/camel-settings.c
index 8628249..8b17cf0 100644
--- a/camel/camel-settings.c
+++ b/camel/camel-settings.c
@@ -223,150 +223,3 @@ camel_settings_equal (CamelSettings *settings_a,
 	return class->equal (settings_a, settings_b);
 }
 
-/**
- * camel_settings_save_to_url:
- * @settings: a #CamelSettings
- * @url: a #CamelURL
- *
- * Writes the values of all properties of @settings to @url as parameter
- * strings.  The parameter name in @url matches the corresponding property
- * in @settings.
- *
- * This function is highly Evolution-centric and is only temporary.
- * Expect this function to be removed as early as version 3.4.
- *
- * Since: 3.2
- **/
-void
-camel_settings_save_to_url (CamelSettings *settings,
-                            CamelURL *url)
-{
-	CamelSettingsClass *class;
-	GParamSpec **properties;
-	GValue pvalue = G_VALUE_INIT;
-	GValue svalue = G_VALUE_INIT;
-	guint ii, n_properties;
-
-	g_return_if_fail (CAMEL_IS_SETTINGS (settings));
-	g_return_if_fail (url != NULL);
-
-	g_value_init (&svalue, G_TYPE_STRING);
-
-	class = CAMEL_SETTINGS_GET_CLASS (settings);
-	properties = camel_settings_class_list_settings (class, &n_properties);
-
-	for (ii = 0; ii < n_properties; ii++) {
-		GParamSpec *pspec = properties[ii];
-		gchar *string = NULL;
-
-		g_value_init (&pvalue, pspec->value_type);
-
-		g_object_get_property (
-			G_OBJECT (settings),
-			pspec->name, &pvalue);
-
-		/* Some CamelNetworkSettings properties are put directly
-		 * in the CamelURL struct instead of in parameters. */
-
-		if (g_strcmp0 (pspec->name, "auth-mechanism") == 0) {
-			const gchar *auth = g_value_get_string (&pvalue);
-			camel_url_set_authmech (url, auth);
-			g_value_unset (&pvalue);
-			continue;
-		}
-
-		if (g_strcmp0 (pspec->name, "host") == 0) {
-			const gchar *host = g_value_get_string (&pvalue);
-			camel_url_set_host (url, host);
-			g_value_unset (&pvalue);
-			continue;
-		}
-
-		if (g_strcmp0 (pspec->name, "port") == 0) {
-			guint port = g_value_get_uint (&pvalue);
-			camel_url_set_port (url, port);
-			g_value_unset (&pvalue);
-			continue;
-		}
-
-		if (g_strcmp0 (pspec->name, "user") == 0) {
-			const gchar *user = g_value_get_string (&pvalue);
-			camel_url_set_user (url, user);
-			g_value_unset (&pvalue);
-			continue;
-		}
-
-		/* Some CamelLocalSettings properties are put directly
-		 * in the CamelURL struct instead of in parameters. */
-
-		if (g_strcmp0 (pspec->name, "path") == 0) {
-			const gchar *path = g_value_get_string (&pvalue);
-			camel_url_set_path (url, path);
-			g_value_unset (&pvalue);
-			continue;
-		}
-
-		/* If the property value matches the default value,
-		 * remove the corresponding URL parameter so we keep
-		 * the URL string to a minimum. */
-		if (g_param_value_defaults (pspec, &pvalue)) {
-			g_datalist_remove_data (&url->params, pspec->name);
-			g_value_unset (&pvalue);
-			continue;
-		}
-
-		/* For the most part we can just transform any supported
-		 * property type to a string, with a couple exceptions. */
-
-		/* Transforming a boolean GValue to a string results
-		 * in "TRUE" or "FALSE" (all uppercase).  Instead use
-		 * all lowercase since GKeyFile will require it. */
-		if (G_VALUE_HOLDS_BOOLEAN (&pvalue)) {
-			gboolean v_boolean = g_value_get_boolean (&pvalue);
-			string = g_strdup (v_boolean ? "true" : "false");
-
-		/* Transforming an enum GValue to a string results in
-		 * the GEnumValue name.  We want the shorter nickname. */
-		} else if (G_VALUE_HOLDS_ENUM (&pvalue)) {
-			GParamSpecEnum *enum_pspec;
-			GEnumClass *enum_class;
-			GEnumValue *enum_value;
-			gint value;
-
-			enum_pspec = G_PARAM_SPEC_ENUM (pspec);
-			enum_class = enum_pspec->enum_class;
-
-			value = g_value_get_enum (&pvalue);
-			enum_value = g_enum_get_value (enum_class, value);
-
-			if (enum_value != NULL)
-				string = g_strdup (enum_value->value_nick);
-
-		} else if (G_VALUE_HOLDS (&pvalue, G_TYPE_STRV)) {
-			gchar **strv = g_value_get_boxed (&pvalue);
-
-			if (strv != NULL)
-				string = g_strjoinv (",", strv);
-
-		} else if (g_value_transform (&pvalue, &svalue)) {
-			string = g_value_dup_string (&svalue);
-
-		} else
-			g_warning (
-				"No handler to save property %s:%s (type %s)",
-				G_OBJECT_TYPE_NAME (settings),
-				pspec->name, g_type_name (pspec->value_type));
-
-		/* CamelURL takes ownership of the string. */
-		if (string != NULL)
-			g_datalist_set_data_full (
-				&url->params, pspec->name, string,
-				(GDestroyNotify) g_free);
-
-		g_value_unset (&pvalue);
-	}
-
-	g_free (properties);
-
-	g_value_unset (&svalue);
-}
diff --git a/camel/camel-settings.h b/camel/camel-settings.h
index b43ca1c..0313369 100644
--- a/camel/camel-settings.h
+++ b/camel/camel-settings.h
@@ -83,10 +83,6 @@ CamelSettings *	camel_settings_clone		(CamelSettings *settings);
 gboolean	camel_settings_equal		(CamelSettings *settings_a,
 						 CamelSettings *settings_b);
 
-/* XXX These functions are temporary.  Fair warning. */
-void		camel_settings_save_to_url	(CamelSettings *settings,
-						 CamelURL *url);
-
 G_END_DECLS
 
 #endif /* CAMEL_SETTINGS_H */
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index ac1cd96..187948f 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -2347,7 +2347,6 @@ CamelSettings
 camel_settings_class_list_settings
 camel_settings_clone
 camel_settings_equal
-camel_settings_save_to_url
 <SUBSECTION Standard>
 CAMEL_SETTINGS
 CAMEL_IS_SETTINGS



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