Remove camel_settings_save_to_url().
authorMatthew Barnes <mbarnes@redhat.com>
Mon, 4 Jun 2012 00:40:29 +0000 (20:40 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Mon, 4 Jun 2012 00:41:28 +0000 (20:41 -0400)
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
camel/camel-settings.h
docs/reference/camel/camel-sections.txt

index 8628249..8b17cf0 100644 (file)
@@ -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);
-}
index b43ca1c..0313369 100644 (file)
@@ -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 */
index ac1cd96..187948f 100644 (file)
@@ -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