[dconf/patch/engine-check: 3/4] common: factor out dconf_gvdb_utils_table_from_changeset



commit 671623fdafbf81636a983852a0efd74f6b0a9e2f
Author: Daniel Playfair Cal <daniel playfair cal gmail com>
Date:   Mon Jan 6 12:41:23 2020 +1100

    common: factor out dconf_gvdb_utils_table_from_changeset

 common/dconf-gvdb-utils.c | 13 +++++++++++--
 common/dconf-gvdb-utils.h |  1 +
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/common/dconf-gvdb-utils.c b/common/dconf-gvdb-utils.c
index 738ff22..cad38fa 100644
--- a/common/dconf-gvdb-utils.c
+++ b/common/dconf-gvdb-utils.c
@@ -190,6 +190,16 @@ dconf_gvdb_utils_add_key (const gchar *path,
   return TRUE;
 }
 
+GHashTable *
+dconf_gvdb_utils_table_from_changeset (DConfChangeset *database)
+{
+  GHashTable *table;
+
+  table = gvdb_hash_table_new (NULL, NULL);
+  dconf_changeset_all (database, dconf_gvdb_utils_add_key, table);
+  return table;
+}
+
 gboolean
 dconf_gvdb_utils_write_file (const gchar     *filename,
                              DConfChangeset  *database,
@@ -198,8 +208,7 @@ dconf_gvdb_utils_write_file (const gchar     *filename,
   GHashTable *gvdb;
   gboolean success;
 
-  gvdb = gvdb_hash_table_new (NULL, NULL);
-  dconf_changeset_all (database, dconf_gvdb_utils_add_key, gvdb);
+  gvdb = dconf_gvdb_utils_table_from_changeset (database);
   success = gvdb_table_write_contents (gvdb, filename, FALSE, error);
 
   if (!success)
diff --git a/common/dconf-gvdb-utils.h b/common/dconf-gvdb-utils.h
index 31daa43..c86dde5 100644
--- a/common/dconf-gvdb-utils.h
+++ b/common/dconf-gvdb-utils.h
@@ -27,6 +27,7 @@ DConfChangeset *                dconf_changeset_new_from_gvdb_table     (GvdbTab
 DConfChangeset *                dconf_gvdb_utils_read_and_back_up_file  (const gchar     *filename,
                                                                          gboolean        *file_missing,
                                                                          GError         **error);
+GHashTable *                    dconf_gvdb_utils_table_from_changeset   (DConfChangeset  *database);
 gboolean                        dconf_gvdb_utils_write_file             (const gchar     *filename,
                                                                          DConfChangeset  *database,
                                                                          GError         **error);


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