mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
gsettings: add g_settings_schema_list_children
https://bugzilla.gnome.org/show_bug.cgi?id=743517
This commit is contained in:
parent
d95bb1f08b
commit
6d55189d8c
@ -2439,6 +2439,7 @@ g_settings_schema_has_key
|
|||||||
g_settings_schema_get_key
|
g_settings_schema_get_key
|
||||||
g_settings_schema_key_ref
|
g_settings_schema_key_ref
|
||||||
g_settings_schema_key_unref
|
g_settings_schema_key_unref
|
||||||
|
g_settings_schema_list_children
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
g_settings_schema_key_get_value_type
|
g_settings_schema_key_get_value_type
|
||||||
|
@ -2325,29 +2325,7 @@ g_settings_list_keys (GSettings *settings)
|
|||||||
gchar **
|
gchar **
|
||||||
g_settings_list_children (GSettings *settings)
|
g_settings_list_children (GSettings *settings)
|
||||||
{
|
{
|
||||||
const GQuark *keys;
|
return g_settings_schema_list_children (settings->priv->schema);
|
||||||
gchar **strv;
|
|
||||||
gint n_keys;
|
|
||||||
gint i, j;
|
|
||||||
|
|
||||||
keys = g_settings_schema_list (settings->priv->schema, &n_keys);
|
|
||||||
strv = g_new (gchar *, n_keys + 1);
|
|
||||||
for (i = j = 0; i < n_keys; i++)
|
|
||||||
{
|
|
||||||
const gchar *key = g_quark_to_string (keys[i]);
|
|
||||||
|
|
||||||
if (g_str_has_suffix (key, "/"))
|
|
||||||
{
|
|
||||||
gint length = strlen (key);
|
|
||||||
|
|
||||||
strv[j] = g_memdup (key, length);
|
|
||||||
strv[j][length - 1] = '\0';
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strv[j] = NULL;
|
|
||||||
|
|
||||||
return strv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1004,6 +1004,47 @@ g_settings_schema_has_key (GSettingsSchema *schema,
|
|||||||
return gvdb_table_has_value (schema->table, key);
|
return gvdb_table_has_value (schema->table, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_settings_schema_list_children:
|
||||||
|
* @schema: a #GSettingsSchema
|
||||||
|
*
|
||||||
|
* Gets the list of children in @schema.
|
||||||
|
*
|
||||||
|
* You should free the return value with g_strfreev() when you are done
|
||||||
|
* with it.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full) (element-type utf8): a list of the children on @settings
|
||||||
|
*
|
||||||
|
* Since: 2.44
|
||||||
|
*/
|
||||||
|
gchar **
|
||||||
|
g_settings_schema_list_children (GSettingsSchema *schema)
|
||||||
|
{
|
||||||
|
const GQuark *keys;
|
||||||
|
gchar **strv;
|
||||||
|
gint n_keys;
|
||||||
|
gint i, j;
|
||||||
|
|
||||||
|
keys = g_settings_schema_list (schema, &n_keys);
|
||||||
|
strv = g_new (gchar *, n_keys + 1);
|
||||||
|
for (i = j = 0; i < n_keys; i++)
|
||||||
|
{
|
||||||
|
const gchar *key = g_quark_to_string (keys[i]);
|
||||||
|
|
||||||
|
if (g_str_has_suffix (key, "/"))
|
||||||
|
{
|
||||||
|
gint length = strlen (key);
|
||||||
|
|
||||||
|
strv[j] = g_memdup (key, length);
|
||||||
|
strv[j][length - 1] = '\0';
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strv[j] = NULL;
|
||||||
|
|
||||||
|
return strv;
|
||||||
|
}
|
||||||
|
|
||||||
const GQuark *
|
const GQuark *
|
||||||
g_settings_schema_list (GSettingsSchema *schema,
|
g_settings_schema_list (GSettingsSchema *schema,
|
||||||
gint *n_items)
|
gint *n_items)
|
||||||
|
@ -75,6 +75,9 @@ GLIB_AVAILABLE_IN_2_40
|
|||||||
gboolean g_settings_schema_has_key (GSettingsSchema *schema,
|
gboolean g_settings_schema_has_key (GSettingsSchema *schema,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
|
||||||
|
GLIB_AVAILABLE_IN_2_44
|
||||||
|
gchar ** g_settings_schema_list_children (GSettingsSchema *schema);
|
||||||
|
|
||||||
#define G_TYPE_SETTINGS_SCHEMA_KEY (g_settings_schema_key_get_type ())
|
#define G_TYPE_SETTINGS_SCHEMA_KEY (g_settings_schema_key_get_type ())
|
||||||
GLIB_AVAILABLE_IN_2_40
|
GLIB_AVAILABLE_IN_2_40
|
||||||
GType g_settings_schema_key_get_type (void) G_GNUC_CONST;
|
GType g_settings_schema_key_get_type (void) G_GNUC_CONST;
|
||||||
|
Loading…
Reference in New Issue
Block a user