GSettings: deprecate 'schema' property

This should have been called 'schema-name'.
This commit is contained in:
Ryan Lortie 2011-11-15 11:31:58 +00:00
parent 3bcf1137f4
commit 736a286dce

View File

@ -239,7 +239,7 @@ struct _GSettingsPrivate
enum enum
{ {
PROP_0, PROP_0,
PROP_SCHEMA, PROP_SCHEMA_NAME,
PROP_BACKEND, PROP_BACKEND,
PROP_PATH, PROP_PATH,
PROP_HAS_UNAPPLIED, PROP_HAS_UNAPPLIED,
@ -427,9 +427,16 @@ g_settings_set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_SCHEMA: case PROP_SCHEMA_NAME:
/* we receive a set_property() call for both "schema" and
* "schema-name", even if they are not set. Hopefully only one of
* them is non-NULL.
*/
if (g_value_get_string (value) != NULL)
{
g_assert (settings->priv->schema_name == NULL); g_assert (settings->priv->schema_name == NULL);
settings->priv->schema_name = g_value_dup_string (value); settings->priv->schema_name = g_value_dup_string (value);
}
break; break;
case PROP_PATH: case PROP_PATH:
@ -455,7 +462,7 @@ g_settings_get_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_SCHEMA: case PROP_SCHEMA_NAME:
g_value_set_string (value, settings->priv->schema_name); g_value_set_string (value, settings->priv->schema_name);
break; break;
@ -695,9 +702,25 @@ g_settings_class_init (GSettingsClass *class)
* *
* The name of the schema that describes the types of keys * The name of the schema that describes the types of keys
* for this #GSettings object. * for this #GSettings object.
*
* Deprecated:2.32:Use the 'schema-name' property instead.
*/ */
g_object_class_install_property (object_class, PROP_SCHEMA, g_object_class_install_property (object_class, PROP_SCHEMA_NAME,
g_param_spec_string ("schema", g_param_spec_string ("schema",
P_("Schema name"),
P_("The name of the schema for this settings object"),
NULL,
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_DEPRECATED | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GSettings:schema-name:
*
* The name of the schema that describes the types of keys
* for this #GSettings object.
*/
g_object_class_install_property (object_class, PROP_SCHEMA_NAME,
g_param_spec_string ("schema-name",
P_("Schema name"), P_("Schema name"),
P_("The name of the schema for this settings object"), P_("The name of the schema for this settings object"),
NULL, NULL,
@ -767,7 +790,7 @@ g_settings_new (const gchar *schema)
g_return_val_if_fail (schema != NULL, NULL); g_return_val_if_fail (schema != NULL, NULL);
return g_object_new (G_TYPE_SETTINGS, return g_object_new (G_TYPE_SETTINGS,
"schema", schema, "schema-name", schema,
NULL); NULL);
} }
@ -796,7 +819,7 @@ g_settings_new_with_path (const gchar *schema,
g_return_val_if_fail (path != NULL, NULL); g_return_val_if_fail (path != NULL, NULL);
return g_object_new (G_TYPE_SETTINGS, return g_object_new (G_TYPE_SETTINGS,
"schema", schema, "schema-name", schema,
"path", path, "path", path,
NULL); NULL);
} }
@ -825,7 +848,7 @@ g_settings_new_with_backend (const gchar *schema,
g_return_val_if_fail (G_IS_SETTINGS_BACKEND (backend), NULL); g_return_val_if_fail (G_IS_SETTINGS_BACKEND (backend), NULL);
return g_object_new (G_TYPE_SETTINGS, return g_object_new (G_TYPE_SETTINGS,
"schema", schema, "schema-name", schema,
"backend", backend, "backend", backend,
NULL); NULL);
} }
@ -855,7 +878,7 @@ g_settings_new_with_backend_and_path (const gchar *schema,
g_return_val_if_fail (path != NULL, NULL); g_return_val_if_fail (path != NULL, NULL);
return g_object_new (G_TYPE_SETTINGS, return g_object_new (G_TYPE_SETTINGS,
"schema", schema, "schema-name", schema,
"backend", backend, "backend", backend,
"path", path, "path", path,
NULL); NULL);
@ -1909,7 +1932,7 @@ g_settings_get_child (GSettings *settings,
child_path = g_strconcat (settings->priv->path, child_name, NULL); child_path = g_strconcat (settings->priv->path, child_name, NULL);
child = g_object_new (G_TYPE_SETTINGS, child = g_object_new (G_TYPE_SETTINGS,
"schema", child_schema, "schema-name", child_schema,
"path", child_path, "path", child_path,
NULL); NULL);
g_free (child_path); g_free (child_path);