X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgsettingsschema.c;h=85cad60cb4dd0c50bd9ec2b3b3fcf7682ad357e4;hb=356a3987cee7ceddcb3fe623edf0bd2881895add;hp=10a8c2be39c8455d0b411722d0fb8d98a8641eb8;hpb=b227528f3291c8c4cfdfea057917edec63597ff8;p=platform%2Fupstream%2Fglib.git
diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
index 10a8c2b..85cad60 100644
--- a/gio/gsettingsschema.c
+++ b/gio/gsettingsschema.c
@@ -13,9 +13,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see .
*/
#include "config.h"
@@ -32,8 +30,9 @@
/**
* SECTION:gsettingsschema
- * @short_description: Introspecting and controlling the loading of
- * GSettings schemas
+ * @short_description: Introspecting and controlling the loading
+ * of GSettings schemas
+ * @include: gio/gio.h
*
* The #GSettingsSchemaSource and #GSettingsSchema APIs provide a
* mechanism for advanced control over the loading of schemas and a
@@ -53,7 +52,7 @@
*
* Consider the following example:
*
- * |[
+ * |[
* typedef struct
* {
* ...
@@ -110,7 +109,7 @@
* ships a gschemas.compiled file as part of itself, and then simply do
* the following:
*
- * |[
+ * |[
* {
* GSettings *settings;
* gint some_value;
@@ -251,16 +250,14 @@ g_settings_schema_source_unref (GSettingsSchemaSource *source)
* This function is not required for normal uses of #GSettings but it
* may be useful to authors of plugin management systems.
*
- * The directory should contain a file called
- * gschemas.compiled as produced by
- * glib-compile-schemas.
+ * The directory should contain a file called `gschemas.compiled` as
+ * produced by the [glib-compile-schemas][glib-compile-schemas] tool.
*
- * If @trusted is %TRUE then gschemas.compiled is
- * trusted not to be corrupted. This assumption has a performance
- * advantage, but can result in crashes or inconsistent behaviour in the
- * case of a corrupted file. Generally, you should set @trusted to
- * %TRUE for files installed by the system and to %FALSE for files in
- * the home directory.
+ * If @trusted is %TRUE then `gschemas.compiled` is trusted not to be
+ * corrupted. This assumption has a performance advantage, but can result
+ * in crashes or inconsistent behaviour in the case of a corrupted file.
+ * Generally, you should set @trusted to %TRUE for files installed by the
+ * system and to %FALSE for files in the home directory.
*
* If @parent is non-%NULL then there are two effects.
*
@@ -269,8 +266,8 @@ g_settings_schema_source_unref (GSettingsSchemaSource *source)
* source, the lookup will recurse to the parent.
*
* Second, any references to other schemas specified within this
- * source (ie: child or extends)
- * references may be resolved from the @parent.
+ * source (ie: `child` or `extends`) references may be resolved
+ * from the @parent.
*
* For this second reason, except in very unusual situations, the
* @parent should probably be given as the default schema source, as
@@ -364,9 +361,8 @@ initialise_schema_sources (void)
*
* The returned source may actually consist of multiple schema sources
* from different directories, depending on which directories were given
- * in XDG_DATA_DIRS and
- * GSETTINGS_SCHEMA_DIR. For this reason, all lookups
- * performed against the default source should probably be done
+ * in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
+ * lookups performed against the default source should probably be done
* recursively.
*
* Returns: (transfer none): the default schema source
@@ -398,7 +394,7 @@ g_settings_schema_source_get_default (void)
*
* If the schema isn't found, %NULL is returned.
*
- * Returns: (transfer full): a new #GSettingsSchema
+ * Returns: (nullable) (transfer full): a new #GSettingsSchema
*
* Since: 2.32
**/
@@ -677,8 +673,9 @@ parse_into_text_tables (const gchar *directory,
GMarkupParseContext *context;
context = g_markup_parse_context_new (&parser, G_MARKUP_TREAT_CDATA_AS_TEXT, &info, NULL);
+ /* Ignore errors here, this is best effort only. */
if (g_markup_parse_context_parse (context, contents, size, NULL))
- g_markup_parse_context_end_parse (context, NULL);
+ (void) g_markup_parse_context_end_parse (context, NULL);
g_markup_parse_context_free (context);
/* Clean up dangling stuff in case there was an error. */
@@ -701,6 +698,8 @@ parse_into_text_tables (const gchar *directory,
g_free (filename);
}
+
+ g_dir_close (dir);
}
static GHashTable **
@@ -727,9 +726,10 @@ g_settings_schema_source_get_text_tables (GSettingsSchemaSource *source)
* g_settings_schema_source_list_schemas:
* @source: a #GSettingsSchemaSource
* @recursive: if we should recurse
- * @non_relocatable: (out) (transfer full): the list of non-relocatable
- * schemas
- * @relocatable: (out) (transfer full): the list of relocatable schemas
+ * @non_relocatable: (out) (transfer full) (array zero-terminated=1): the
+ * list of non-relocatable schemas
+ * @relocatable: (out) (transfer full) (array zero-terminated=1): the list
+ * of relocatable schemas
*
* Lists the schemas in a given source.
*
@@ -842,7 +842,10 @@ ensure_schema_lists (void)
*
* Since: 2.26
*
- * Deprecated:2.40: Use g_settings_schema_source_list_schemas() instead
+ * Deprecated:2.40: Use g_settings_schema_source_list_schemas() instead.
+ * If you used g_settings_list_schemas() to check for the presence of
+ * a particular schema, use g_settings_schema_source_lookup() instead
+ * of your whole loop.
**/
const gchar * const *
g_settings_list_schemas (void)
@@ -1289,7 +1292,7 @@ g_settings_schema_key_get_translated_default (GSettingsSchemaKey *key)
if (value == NULL)
{
g_warning ("Failed to parse translated string '%s' for "
- "key '%s' in schema '%s': %s", key->unparsed, key->name,
+ "key '%s' in schema '%s': %s", translated, key->name,
g_settings_schema_get_id (key->schema), error->message);
g_warning ("Using untranslated default instead.");
g_error_free (error);
@@ -1592,31 +1595,28 @@ g_settings_schema_key_get_default_value (GSettingsSchemaKey *key)
* This function will return a #GVariant that fully describes the range
* of values that are valid for @key.
*
- * The type of #GVariant returned is (sv). The
- * string describes the type of range restriction in effect. The type
- * and meaning of the value contained in the variant depends on the
- * string.
+ * The type of #GVariant returned is `(sv)`. The string describes
+ * the type of range restriction in effect. The type and meaning of
+ * the value contained in the variant depends on the string.
*
- * If the string is 'type' then the variant contains
- * an empty array. The element type of that empty array is the expected
- * type of value and all values of that type are valid.
+ * If the string is `'type'` then the variant contains an empty array.
+ * The element type of that empty array is the expected type of value
+ * and all values of that type are valid.
*
- * If the string is 'enum' then the variant contains
- * an array enumerating the possible values. Each item in the array is
+ * If the string is `'enum'` then the variant contains an array
+ * enumerating the possible values. Each item in the array is
* a possible valid value and no other values are valid.
*
- * If the string is 'flags' then the variant contains
- * an array. Each item in the array is a value that may appear zero or
- * one times in an array to be used as the value for this key. For
- * example, if the variant contained the array ['x',
- * 'y'] then the valid values for the key would be
- * [], ['x'],
- * ['y'], ['x', 'y'] and
- * ['y', 'x'].
- *
- * Finally, if the string is 'range' then the variant
- * contains a pair of like-typed values -- the minimum and maximum
- * permissible values for this key.
+ * If the string is `'flags'` then the variant contains an array. Each
+ * item in the array is a value that may appear zero or one times in an
+ * array to be used as the value for this key. For example, if the
+ * variant contained the array `['x', 'y']` then the valid values for
+ * the key would be `[]`, `['x']`, `['y']`, `['x', 'y']` and
+ * `['y', 'x']`.
+ *
+ * Finally, if the string is `'range'` then the variant contains a pair
+ * of like-typed values -- the minimum and maximum permissible values
+ * for this key.
*
* This information should not be used by normal programs. It is
* considered to be a hint for introspection purposes. Normal programs