Remove camel_settings_load_from_url().
authorMatthew Barnes <mbarnes@redhat.com>
Mon, 4 Jun 2012 00:37:34 +0000 (20:37 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Mon, 4 Jun 2012 00:41:23 +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 e453456..8628249 100644 (file)
@@ -224,183 +224,6 @@ camel_settings_equal (CamelSettings *settings_a,
 }
 
 /**
- * camel_settings_load_from_url:
- * @settings: a #CamelSettings
- * @url: a #CamelURL
- *
- * Populates @settings with parameters from @url.  The @url parameter value
- * is converted according to the #GParamSpec for the corresponding property
- * name 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_load_from_url (CamelSettings *settings,
-                              CamelURL *url)
-{
-       CamelSettingsClass *class;
-       GParamSpec **properties;
-       GValue value = G_VALUE_INIT;
-       guint ii, n_properties;
-
-       g_return_if_fail (CAMEL_IS_SETTINGS (settings));
-       g_return_if_fail (url != NULL);
-
-       class = CAMEL_SETTINGS_GET_CLASS (settings);
-       properties = camel_settings_class_list_settings (class, &n_properties);
-
-       g_object_freeze_notify (G_OBJECT (settings));
-
-       /* Some CamelNetworkSettings properties are read directly
-        * from the CamelURL struct instead of from parameters. */
-
-       if (CAMEL_IS_NETWORK_SETTINGS (settings))
-               g_object_set (
-                       settings,
-                       "auth-mechanism", url->authmech,
-                       "host", url->host,
-                       "port", url->port,
-                       "user", url->user,
-                       NULL);
-
-       /* Some CamelLocalSettings properties are read directly
-        * from the CamelURL struct instead of from parameters. */
-
-       if (CAMEL_IS_LOCAL_SETTINGS (settings))
-               g_object_set (
-                       settings,
-                       "path", url->path,
-                       NULL);
-
-       for (ii = 0; ii < n_properties; ii++) {
-               GParamSpec *pspec = properties[ii];
-               const gchar *string;
-               gboolean value_is_set = FALSE;
-
-               string = g_datalist_get_data (&url->params, pspec->name);
-
-               /* If no corresponding URL parameter is found,
-                * leave the CamelSettings property unchanged. */
-               if (string == NULL)
-                       continue;
-
-               /* Handle more types as needed. */
-
-               if (G_IS_PARAM_SPEC_CHAR (pspec) ||
-                   G_IS_PARAM_SPEC_UCHAR (pspec) ||
-                   G_IS_PARAM_SPEC_INT (pspec) ||
-                   G_IS_PARAM_SPEC_UINT (pspec) ||
-                   G_IS_PARAM_SPEC_LONG (pspec) ||
-                   G_IS_PARAM_SPEC_ULONG (pspec)) {
-                       glong v_long;
-                       gchar *endptr;
-
-                       v_long = strtol (string, &endptr, 10);
-
-                       if (*string != '\0' && *endptr == '\0') {
-                               g_value_init (&value, G_TYPE_LONG);
-                               g_value_set_long (&value, v_long);
-                               value_is_set = TRUE;
-                       }
-
-               } else if (G_IS_PARAM_SPEC_BOOLEAN (pspec)) {
-                       gboolean v_boolean = FALSE;
-
-                       value_is_set = TRUE;
-
-                       /* If the value is empty, then the mere
-                        * presence of the parameter means TRUE. */
-                       if (*string == '\0')
-                               v_boolean = TRUE;
-
-                       else if (g_ascii_strcasecmp (string, "true") == 0)
-                               v_boolean = TRUE;
-
-                       else if (g_ascii_strcasecmp (string, "yes") == 0)
-                               v_boolean = TRUE;
-
-                       else if (g_ascii_strcasecmp (string, "1") == 0)
-                               v_boolean = TRUE;
-
-                       else if (g_ascii_strcasecmp (string, "false") == 0)
-                               v_boolean = FALSE;
-
-                       else if (g_ascii_strcasecmp (string, "no") == 0)
-                               v_boolean = FALSE;
-
-                       else if (g_ascii_strcasecmp (string, "0") == 0)
-                               v_boolean = FALSE;
-
-                       else
-                               value_is_set = FALSE;
-
-                       if (value_is_set) {
-                               g_value_init (&value, G_TYPE_BOOLEAN);
-                               g_value_set_boolean (&value, v_boolean);
-                       }
-
-               } else if (G_IS_PARAM_SPEC_ENUM (pspec)) {
-                       GParamSpecEnum *enum_pspec;
-                       GEnumValue *enum_value;
-
-                       enum_pspec = G_PARAM_SPEC_ENUM (pspec);
-                       enum_value = g_enum_get_value_by_nick (
-                               enum_pspec->enum_class, string);
-                       if (enum_value != NULL) {
-                               g_value_init (&value, pspec->value_type);
-                               g_value_set_enum (&value, enum_value->value);
-                               value_is_set = TRUE;
-                       }
-
-               } else if (G_IS_PARAM_SPEC_FLOAT (pspec) ||
-                          G_IS_PARAM_SPEC_DOUBLE (pspec)) {
-                       gdouble v_double;
-                       gchar *endptr;
-
-                       v_double = g_ascii_strtod (string, &endptr);
-
-                       if (*string != '\0' && *endptr == '\0') {
-                               g_value_init (&value, G_TYPE_DOUBLE);
-                               g_value_set_double (&value, v_double);
-                               value_is_set = TRUE;
-                       }
-
-               } else if (G_IS_PARAM_SPEC_STRING (pspec)) {
-                       g_value_init (&value, G_TYPE_STRING);
-                       g_value_set_string (&value, string);
-                       value_is_set = TRUE;
-
-               } else if (g_type_is_a (pspec->value_type, G_TYPE_STRV)) {
-                       gchar **strv;
-
-                       strv = g_strsplit (string, ",", -1);
-                       g_value_init (&value, G_TYPE_STRV);
-                       g_value_take_boxed (&value, strv);
-                       value_is_set = TRUE;
-
-               } else
-                       g_warning (
-                               "No handler to load property %s:%s (type %s)",
-                               G_OBJECT_TYPE_NAME (settings),
-                               pspec->name, g_type_name (pspec->value_type));
-
-               if (value_is_set) {
-                       g_object_set_property (
-                               G_OBJECT (settings),
-                               pspec->name, &value);
-                       g_value_unset (&value);
-               }
-       }
-
-       g_object_thaw_notify (G_OBJECT (settings));
-
-       g_free (properties);
-}
-
-/**
  * camel_settings_save_to_url:
  * @settings: a #CamelSettings
  * @url: a #CamelURL
index 14d1852..b43ca1c 100644 (file)
@@ -84,8 +84,6 @@ gboolean      camel_settings_equal            (CamelSettings *settings_a,
                                                 CamelSettings *settings_b);
 
 /* XXX These functions are temporary.  Fair warning. */
-void           camel_settings_load_from_url    (CamelSettings *settings,
-                                                CamelURL *url);
 void           camel_settings_save_to_url      (CamelSettings *settings,
                                                 CamelURL *url);
 
index e2c6dd0..ac1cd96 100644 (file)
@@ -2347,7 +2347,6 @@ CamelSettings
 camel_settings_class_list_settings
 camel_settings_clone
 camel_settings_equal
-camel_settings_load_from_url
 camel_settings_save_to_url
 <SUBSECTION Standard>
 CAMEL_SETTINGS