summaryrefslogtreecommitdiff
path: root/backends/markup-tree.c
diff options
context:
space:
mode:
authorMark McLoughlin <mark@skynet.ie>2006-01-03 17:05:28 +0000
committerMark McLoughlin <markmc@src.gnome.org>2006-01-03 17:05:28 +0000
commite242a570de9a3e584559895318eaf0ef11427e48 (patch)
treed029d5ffd9949ac1016f72e2ef218d52773b1778 /backends/markup-tree.c
parent11863a3d74d27bc5dc622a7814215280e1a5b431 (diff)
downloadgconf-e242a570de9a3e584559895318eaf0ef11427e48.tar.gz
Switch on "subtree merging" by default in the defaults database.
2006-01-03 Mark McLoughlin <mark@skynet.ie> Switch on "subtree merging" by default in the defaults database. * gconf/gconftool.c: (do_get_default_source): add the "merged" flag to the default target for --makefile-install-rule * backends/markup-backend.c: (resolve_address), (ms_new): add a new "merged" flag signalling that the entire tree should be saved as a subtree. * backends/markup-tree.[ch]: (markup_tree_get): add "merged" param and set flag on MarkupTree struct (recursively_load_subtree): copy function from gconf-merge-tree.c (markup_dir_sync): when saving the tree, save it as a merged subtree if the "merged" flag is set * backends/gconf-merge-tree.c: (recursively_load_subtree): remove; it's in markup-tree.c now * configure.in: remove --enable-gconf-source option which was only used when we installed standard-schemas * standard-schemas: remove old cruft
Diffstat (limited to 'backends/markup-tree.c')
-rw-r--r--backends/markup-tree.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/backends/markup-tree.c b/backends/markup-tree.c
index 1f6908b5..1af59593 100644
--- a/backends/markup-tree.c
+++ b/backends/markup-tree.c
@@ -93,6 +93,8 @@ struct _MarkupTree
MarkupDir *root;
guint refcount;
+
+ guint merged : 1;
};
static GHashTable *trees_by_root_dir = NULL;
@@ -100,7 +102,8 @@ static GHashTable *trees_by_root_dir = NULL;
MarkupTree*
markup_tree_get (const char *root_dir,
guint dir_mode,
- guint file_mode)
+ guint file_mode,
+ gboolean merged)
{
MarkupTree *tree = NULL;
@@ -112,6 +115,8 @@ markup_tree_get (const char *root_dir,
if (tree != NULL)
{
tree->refcount += 1;
+ if (merged && !tree->merged)
+ tree->merged = TRUE;
return tree;
}
@@ -120,6 +125,7 @@ markup_tree_get (const char *root_dir,
tree->dirname = g_strdup (root_dir);
tree->dir_mode = dir_mode;
tree->file_mode = file_mode;
+ tree->merged = merged != FALSE;
tree->root = markup_dir_new (tree, NULL, "/");
@@ -1069,6 +1075,26 @@ delete_useless_entries_recurse (MarkupDir *dir)
return retval;
}
+static void
+recursively_load_subtree (MarkupDir *dir)
+{
+ GSList *tmp;
+
+ load_entries (dir);
+ load_subdirs (dir);
+
+ tmp = dir->subdirs;
+ while (tmp != NULL)
+ {
+ MarkupDir *subdir = tmp->data;
+
+ recursively_load_subtree (subdir);
+ subdir->not_in_filesystem = TRUE;
+
+ tmp = tmp->next;
+ }
+}
+
static gboolean
markup_dir_sync (MarkupDir *dir)
{
@@ -1091,6 +1117,12 @@ markup_dir_sync (MarkupDir *dir)
/* Sanitize the entries */
clean_old_local_schemas_recurse (dir, dir->save_as_subtree);
+
+ if (!dir->save_as_subtree && dir->tree->merged)
+ {
+ dir->save_as_subtree = TRUE;
+ recursively_load_subtree (dir);
+ }
fs_dirname = markup_dir_build_dir_path (dir, TRUE);
fs_filename = markup_dir_build_file_path (dir, FALSE, NULL);