From 48b99017de2057666d442167d9f329b0724cec02 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Tue, 15 Nov 2011 11:39:12 +0000 Subject: [PATCH] speak of 'schema id' rather than 'schema name' Schemas are identified by id='' in the xml file, so we should use the same language on the C and GObject property APIs. --- gio/gio.symbols | 2 +- gio/gsettings.c | 38 +++++++++++++++++++------------------- gio/gsettingsschema.c | 25 ++++++++++++------------- gio/gsettingsschema.h | 4 ++-- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/gio/gio.symbols b/gio/gio.symbols index 6ac32e5..39b2c20 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -1104,7 +1104,7 @@ g_settings_schema_source_ref g_settings_schema_source_unref g_settings_schema_ref g_settings_schema_unref -g_settings_schema_get_name +g_settings_schema_get_id g_settings_schema_get_path g_settings_list_schemas g_settings_list_relocatable_schemas diff --git a/gio/gsettings.c b/gio/gsettings.c index 7f52cc5..edbad04 100644 --- a/gio/gsettings.c +++ b/gio/gsettings.c @@ -239,7 +239,7 @@ struct _GSettingsPrivate enum { PROP_0, - PROP_SCHEMA_NAME, + PROP_SCHEMA_ID, PROP_BACKEND, PROP_PATH, PROP_HAS_UNAPPLIED, @@ -427,9 +427,9 @@ g_settings_set_property (GObject *object, switch (prop_id) { - case PROP_SCHEMA_NAME: + case PROP_SCHEMA_ID: /* we receive a set_property() call for both "schema" and - * "schema-name", even if they are not set. Hopefully only one of + * "schema-id", even if they are not set. Hopefully only one of * them is non-NULL. */ if (g_value_get_string (value) != NULL) @@ -462,7 +462,7 @@ g_settings_get_property (GObject *object, switch (prop_id) { - case PROP_SCHEMA_NAME: + case PROP_SCHEMA_ID: g_value_set_string (value, settings->priv->schema_name); break; @@ -703,9 +703,9 @@ g_settings_class_init (GSettingsClass *class) * The name of the schema that describes the types of keys * for this #GSettings object. * - * Deprecated:2.32:Use the 'schema-name' property instead. + * Deprecated:2.32:Use the 'schema-id' property instead. */ - g_object_class_install_property (object_class, PROP_SCHEMA_NAME, + g_object_class_install_property (object_class, PROP_SCHEMA_ID, g_param_spec_string ("schema", P_("Schema name"), P_("The name of the schema for this settings object"), @@ -714,13 +714,13 @@ g_settings_class_init (GSettingsClass *class) G_PARAM_DEPRECATED | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - * GSettings:schema-name: + * GSettings:schema-id: * * 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", + g_object_class_install_property (object_class, PROP_SCHEMA_ID, + g_param_spec_string ("schema-id", P_("Schema name"), P_("The name of the schema for this settings object"), NULL, @@ -790,7 +790,7 @@ g_settings_new (const gchar *schema) g_return_val_if_fail (schema != NULL, NULL); return g_object_new (G_TYPE_SETTINGS, - "schema-name", schema, + "schema-id", schema, NULL); } @@ -819,7 +819,7 @@ g_settings_new_with_path (const gchar *schema, g_return_val_if_fail (path != NULL, NULL); return g_object_new (G_TYPE_SETTINGS, - "schema-name", schema, + "schema-id", schema, "path", path, NULL); } @@ -848,7 +848,7 @@ g_settings_new_with_backend (const gchar *schema, g_return_val_if_fail (G_IS_SETTINGS_BACKEND (backend), NULL); return g_object_new (G_TYPE_SETTINGS, - "schema-name", schema, + "schema-id", schema, "backend", backend, NULL); } @@ -878,7 +878,7 @@ g_settings_new_with_backend_and_path (const gchar *schema, g_return_val_if_fail (path != NULL, NULL); return g_object_new (G_TYPE_SETTINGS, - "schema-name", schema, + "schema-id", schema, "backend", backend, "path", path, NULL); @@ -1061,7 +1061,7 @@ g_settings_set_enum (GSettings *settings, { g_critical ("g_settings_set_enum(): invalid enum value %d for key `%s' " "in schema `%s'. Doing nothing.", value, skey.name, - g_settings_schema_get_name (skey.schema)); + g_settings_schema_get_id (skey.schema)); g_settings_schema_key_clear (&skey); return FALSE; } @@ -1173,7 +1173,7 @@ g_settings_set_flags (GSettings *settings, { g_critical ("g_settings_set_flags(): invalid flags value 0x%08x " "for key `%s' in schema `%s'. Doing nothing.", - value, skey.name, g_settings_schema_get_name (skey.schema)); + value, skey.name, g_settings_schema_get_id (skey.schema)); g_settings_schema_key_clear (&skey); return FALSE; } @@ -1932,7 +1932,7 @@ g_settings_get_child (GSettings *settings, child_path = g_strconcat (settings->priv->path, child_name, NULL); child = g_object_new (G_TYPE_SETTINGS, - "schema-name", child_schema, + "schema-id", child_schema, "path", child_path, NULL); g_free (child_path); @@ -2248,7 +2248,7 @@ g_settings_binding_key_changed (GSettings *settings, g_warning ("Translated default `%s' for key `%s' in schema `%s' " "was rejected by the binding mapping function", binding->key.unparsed, binding->key.name, - g_settings_schema_get_name (binding->key.schema)); + g_settings_schema_get_id (binding->key.schema)); g_variant_unref (variant); variant = NULL; } @@ -2260,7 +2260,7 @@ g_settings_binding_key_changed (GSettings *settings, if (!binding->get_mapping (&value, variant, binding->user_data)) g_error ("The schema default value for key `%s' in schema `%s' " "was rejected by the binding mapping function.", - binding->key.name, g_settings_schema_get_name (binding->key.schema)); + binding->key.name, g_settings_schema_get_id (binding->key.schema)); } g_object_set_property (binding->object, binding->property->name, &value); @@ -2308,7 +2308,7 @@ g_settings_binding_property_changed (GObject *object, g_critical ("GObject property `%s' on a `%s' object is out of " "schema-specified range for key `%s' of `%s': %s", binding->property->name, g_type_name (binding->property->owner_type), - binding->key.name, g_settings_schema_get_name (binding->key.schema), + binding->key.name, g_settings_schema_get_id (binding->key.schema), g_variant_print (variant, TRUE)); return; } diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c index 00055e3..46a14d2 100644 --- a/gio/gsettingsschema.c +++ b/gio/gsettingsschema.c @@ -36,7 +36,7 @@ struct _GSettingsSchema GQuark *items; gint n_items; GvdbTable *table; - gchar *name; + gchar *id; gint ref_count; }; @@ -150,20 +150,20 @@ g_settings_schema_source_get_default (void) GSettingsSchema * g_settings_schema_source_lookup (GSettingsSchemaSource *source, - const gchar *schema_name, + const gchar *schema_id, gboolean recursive) { GSettingsSchema *schema; GvdbTable *table; g_return_val_if_fail (source != NULL, NULL); - g_return_val_if_fail (schema_name != NULL, NULL); + g_return_val_if_fail (schema_id != NULL, NULL); - table = gvdb_table_get_table (source->table, schema_name); + table = gvdb_table_get_table (source->table, schema_id); if (table == NULL && recursive) for (source = source->parent; source; source = source->parent) - if ((table = gvdb_table_get_table (source->table, schema_name))) + if ((table = gvdb_table_get_table (source->table, schema_id))) break; if (table == NULL) @@ -171,7 +171,7 @@ g_settings_schema_source_lookup (GSettingsSchemaSource *source, schema = g_slice_new0 (GSettingsSchema); schema->ref_count = 1; - schema->name = g_strdup (schema_name); + schema->id = g_strdup (schema_id); schema->table = table; schema->path = g_settings_schema_get_string (schema, ".path"); schema->gettext_domain = g_settings_schema_get_string (schema, ".gettext-domain"); @@ -328,7 +328,7 @@ g_settings_schema_unref (GSettingsSchema *schema) { gvdb_table_unref (schema->table); g_free (schema->items); - g_free (schema->name); + g_free (schema->id); g_slice_free (GSettingsSchema, schema); } @@ -360,8 +360,7 @@ g_settings_schema_get_value (GSettingsSchema *schema, value = gvdb_table_get_raw_value (schema->table, key); if G_UNLIKELY (value == NULL) - g_error ("Settings schema '%s' does not contain a key named '%s'", - schema->name, key); + g_error ("Settings schema '%s' does not contain a key named '%s'", schema->id, key); iter = g_variant_iter_new (value); g_variant_unref (value); @@ -418,9 +417,9 @@ g_settings_schema_list (GSettingsSchema *schema, } const gchar * -g_settings_schema_get_name (GSettingsSchema *schema) +g_settings_schema_get_id (GSettingsSchema *schema) { - return schema->name; + return schema->id; } static inline void @@ -628,7 +627,7 @@ g_settings_schema_key_get_translated_default (GSettingsSchemaKey *key) { g_warning ("Failed to parse translated string `%s' for " "key `%s' in schema `%s': %s", key->unparsed, key->name, - g_settings_schema_get_name (key->schema), error->message); + g_settings_schema_get_id (key->schema), error->message); g_warning ("Using untranslated default instead."); g_error_free (error); } @@ -637,7 +636,7 @@ g_settings_schema_key_get_translated_default (GSettingsSchemaKey *key) { g_warning ("Translated default `%s' for key `%s' in schema `%s' " "is outside of valid range", key->unparsed, key->name, - g_settings_schema_get_name (key->schema)); + g_settings_schema_get_id (key->schema)); g_variant_unref (value); value = NULL; } diff --git a/gio/gsettingsschema.h b/gio/gsettingsschema.h index 92665c8..8ac7958 100644 --- a/gio/gsettingsschema.h +++ b/gio/gsettingsschema.h @@ -31,13 +31,13 @@ GSettingsSchemaSource * g_settings_schema_source_ref (GSettin void g_settings_schema_source_unref (GSettingsSchemaSource *source); GSettingsSchema * g_settings_schema_source_lookup (GSettingsSchemaSource *source, - const gchar *schema_name, + const gchar *schema_id, gboolean recursive); GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema); void g_settings_schema_unref (GSettingsSchema *schema); -const gchar * g_settings_schema_get_name (GSettingsSchema *schema); +const gchar * g_settings_schema_get_id (GSettingsSchema *schema); const gchar * g_settings_schema_get_path (GSettingsSchema *schema); #endif /* __G_SETTINGS_SCHEMA_H__ */ -- 2.7.4