[glib/new-gsettings] Add a schema parameter to g_settings_new with_path



commit 9c64ed313ec45d90bbbd5efc33284208b8953a26
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Apr 14 12:27:09 2010 -0400

    Add a schema parameter to g_settings_new with_path

 docs/reference/gio/gio-sections.txt |    2 +-
 gio/gsettings.c                     |   25 +++++++++++++++++++++++--
 gio/gsettings.h                     |    3 ++-
 3 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index 0deb175..247663c 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -2102,7 +2102,7 @@ GSettingsBackendPrivate
 <TITLE>GSettings</TITLE>
 GSettings
 g_settings_new
-g_settings_new_from_path
+g_settings_new_with_path
 g_settings_get_value
 g_settings_set_value
 g_settings_get
diff --git a/gio/gsettings.c b/gio/gsettings.c
index 1b05e87..23e3de2 100644
--- a/gio/gsettings.c
+++ b/gio/gsettings.c
@@ -425,10 +425,24 @@ g_settings_new (const gchar *schema)
   return g_object_new (G_TYPE_SETTINGS, "schema-name", schema, NULL);
 }
 
+/**
+ * g_settings_new_with_path:
+ * @schema: the name of the schema
+ * @path: the path to use
+ * @returns: a new #GSettings object
+ *
+ * Creates a new #GSettings object with a given schema and path.
+ *
+ * It is a programmer error to call this function for a schema that
+ * has an explicitly specified path.
+ *
+ * Since: 2.26
+ */
 GSettings *
-g_settings_new_from_path (const gchar *path)
+g_settings_new_with_path (const gchar *schema,
+                          const gchar *path)
 {
-  return g_object_new (G_TYPE_SETTINGS, "base-path", path, NULL);
+  return g_object_new (G_TYPE_SETTINGS, "schema-name", schema, "base-path", path, NULL);
 }
 
 #if 0
@@ -531,6 +545,13 @@ g_settings_class_init (GSettingsClass *class)
                   g_cclosure_marshal_VOID__STRING,
                   G_TYPE_NONE, 1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
 
+  /**
+   * GSettings::destroyed:
+   * @settings: the object on which this signal was emitted
+   *
+   * The "destroyed" signal is emitted when the root of the settings
+   * is removed from the backend storage.
+   */
   g_settings_signals[SIGNAL_DESTROYED] =
     g_signal_new ("destroyed", G_TYPE_SETTINGS,
                   G_SIGNAL_RUN_LAST,
diff --git a/gio/gsettings.h b/gio/gsettings.h
index 79553b4..69ed86a 100644
--- a/gio/gsettings.h
+++ b/gio/gsettings.h
@@ -69,7 +69,8 @@ gboolean                g_settings_get_has_unapplied                    (GSettin
 void                    g_settings_set_delay_apply                      (GSettings          *settings,
                                                                          gboolean            delay);
 GSettings *             g_settings_new                                  (const gchar        *schema);
-GSettings *             g_settings_new_from_path                        (const gchar        *path);
+GSettings *             g_settings_new_with_path                        (const gchar        *schema,
+                                                                         const gchar        *path);
 
 void                    g_settings_set_value                            (GSettings          *settings,
                                                                          const gchar        *key,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]