[glib] drop the now-trivial g_settings_schema_new
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] drop the now-trivial g_settings_schema_new
- Date: Thu, 17 Nov 2011 14:05:25 +0000 (UTC)
commit 3bcf1137f4f9a9c84814f3a2102d06d90858daa2
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Nov 15 08:03:38 2011 +0000
drop the now-trivial g_settings_schema_new
Combine it into g_settings_constructed()
gio/gsettings.c | 12 +++++++++++-
gio/gsettingsschema-internal.h | 2 --
gio/gsettingsschema.c | 19 -------------------
3 files changed, 11 insertions(+), 22 deletions(-)
---
diff --git a/gio/gsettings.c b/gio/gsettings.c
index a7c86ad..c75194b 100644
--- a/gio/gsettings.c
+++ b/gio/gsettings.c
@@ -492,9 +492,19 @@ static void
g_settings_constructed (GObject *object)
{
GSettings *settings = G_SETTINGS (object);
+ GSettingsSchemaSource *default_source;
const gchar *schema_path;
- settings->priv->schema = g_settings_schema_new (settings->priv->schema_name);
+ default_source = g_settings_schema_source_get_default ();
+
+ if (default_source == NULL)
+ g_error ("No GSettings schemas are installed on the system");
+
+ settings->priv->schema = g_settings_schema_source_lookup (default_source, settings->priv->schema_name, TRUE);
+
+ if (settings->priv->schema == NULL)
+ g_error ("Settings schema '%s' is not installed\n", settings->priv->schema_name);
+
schema_path = g_settings_schema_get_path (settings->priv->schema);
if (settings->priv->path && schema_path && strcmp (settings->priv->path, schema_path) != 0)
diff --git a/gio/gsettingsschema-internal.h b/gio/gsettingsschema-internal.h
index 5eb5190..f9d79eb 100644
--- a/gio/gsettingsschema-internal.h
+++ b/gio/gsettingsschema-internal.h
@@ -42,8 +42,6 @@ typedef struct
} GSettingsSchemaKey;
G_GNUC_INTERNAL
-GSettingsSchema * g_settings_schema_new (const gchar *name);
-G_GNUC_INTERNAL
const gchar * g_settings_schema_get_gettext_domain (GSettingsSchema *schema);
G_GNUC_INTERNAL
GVariantIter * g_settings_schema_get_value (GSettingsSchema *schema,
diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
index a130839..00055e3 100644
--- a/gio/gsettingsschema.c
+++ b/gio/gsettingsschema.c
@@ -350,25 +350,6 @@ g_settings_schema_get_string (GSettingsSchema *schema,
return result;
}
-GSettingsSchema *
-g_settings_schema_new (const gchar *name)
-{
- GSettingsSchemaSource *source;
- GSettingsSchema *schema;
-
- source = g_settings_schema_source_get_default ();
-
- if (source == NULL)
- g_error ("No GSettings schemas are installed on the system");
-
- schema = g_settings_schema_source_lookup (source, name, TRUE);
-
- if (schema == NULL)
- g_error ("Settings schema '%s' is not installed\n", name);
-
- return schema;
-}
-
GVariantIter *
g_settings_schema_get_value (GSettingsSchema *schema,
const gchar *key)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]