[gnome-terminal] profile: Use non-deprecated way to get list of keys in the settings schema
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] profile: Use non-deprecated way to get list of keys in the settings schema
- Date: Sat, 14 Sep 2019 21:57:02 +0000 (UTC)
commit dc4d9257e228db728de585acf361196a6b2033b1
Author: Christian Persch <chpe src gnome org>
Date: Sat Sep 14 23:56:58 2019 +0200
profile: Use non-deprecated way to get list of keys in the settings schema
https://gitlab.gnome.org/GNOME/gnome-terminal/issues/161
src/terminal-libgsystem.h | 10 ++++++++++
src/terminal-settings-list.c | 15 +++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/terminal-libgsystem.h b/src/terminal-libgsystem.h
index e2e5080a..906a127d 100644
--- a/src/terminal-libgsystem.h
+++ b/src/terminal-libgsystem.h
@@ -224,6 +224,16 @@ static inline void gs_local_gstring_free (void *v) \
*/
#define gs_unref_settings_schema __attribute__ ((cleanup(gs_local_settings_schema_unref)))
+/**
+ * gs_unref_settings_schema_source:
+ *
+ * Call g_settings_schema_source_unref() on a variable location when it goes out of
+ * scope. Note that unlike g_settings_schema_source_unref(), the variable may be
+ * %NULL.
+
+ */
+#define gs_unref_settings_schema_source __attribute__ ((cleanup(gs_local_settings_schema_source_unref)))
+
/**
* gs_unref_settings_schema_key:
*
diff --git a/src/terminal-settings-list.c b/src/terminal-settings-list.c
index e5949b2a..5e52ca1d 100644
--- a/src/terminal-settings-list.c
+++ b/src/terminal-settings-list.c
@@ -293,7 +293,6 @@ clone_child (TerminalSettingsList *list,
char *new_uuid;
gs_free char *path;
gs_free char *new_path;
- char **keys;
guint i;
gs_unref_object DConfClient *client;
DConfChangeset *changeset;
@@ -309,11 +308,15 @@ clone_child (TerminalSettingsList *list,
client = dconf_client_new ();
changeset = dconf_changeset_new ();
- /* FIXME: this is beyond ugly. Need API on GSettingsSchema to list all the keys! */
- {
- gs_unref_object GSettings *dummy = g_settings_new_with_path (list->child_schema_id, "/foo/");
- keys = g_settings_list_keys (dummy);
- }
+ GSettingsSchemaSource *source = g_settings_schema_source_get_default (); /* unowned */
+ gs_unref_settings_schema GSettingsSchema* schema = g_settings_schema_source_lookup (source,
+ list->child_schema_id,
+ TRUE);
+ /* shouldn't really happen ever */
+ if (schema == NULL)
+ return new_uuid;
+
+ gs_strfreev char **keys = g_settings_schema_list_keys (schema);
for (i = 0; keys[i]; i++) {
gs_free char *rkey;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]