diff options
author | Mark McLoughlin <mark@skynet.ie> | 2004-08-19 11:03:12 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@src.gnome.org> | 2004-08-19 11:03:12 +0000 |
commit | 2dc7f99881c9b04725374f38b1edcd13fb2ca33d (patch) | |
tree | 79fc721032640b3644920b90a079a76df99f01d2 | |
parent | bf00576738a9794e534c8750f885d2ed4a0f6913 (diff) | |
download | gconf-2dc7f99881c9b04725374f38b1edcd13fb2ca33d.tar.gz |
Revert the patch to make use of the merge-subtree feature at specific
2004-08-19 Mark McLoughlin <mark@skynet.ie>
Revert the patch to make use of the merge-subtree feature at
specific points in the tree. Not clear that it solves the
problems we thought it solved. Patch archived in bug #138498
* backends/markup-tree.[ch]:
(markup_tree_get): remove try_merge flag.
(markup_dir_sync): don't try and save as a merged subtree.
* backends/markup-backend.c: (resolve_address), (ms_new):
Remove the "nomerge" backend flag.
* backends/gconf-merge-tree.c:
(recursively_load_subtree): add back.
(merge_tree): upd. for markup_tree_get() change.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | backends/gconf-merge-tree.c | 22 | ||||
-rw-r--r-- | backends/markup-backend.c | 18 | ||||
-rw-r--r-- | backends/markup-tree.c | 104 | ||||
-rw-r--r-- | backends/markup-tree.h | 3 |
5 files changed, 42 insertions, 122 deletions
@@ -1,3 +1,20 @@ +2004-08-19 Mark McLoughlin <mark@skynet.ie> + + Revert the patch to make use of the merge-subtree feature at + specific points in the tree. Not clear that it solves the + problems we thought it solved. Patch archived in bug #138498 + + * backends/markup-tree.[ch]: + (markup_tree_get): remove try_merge flag. + (markup_dir_sync): don't try and save as a merged subtree. + + * backends/markup-backend.c: (resolve_address), (ms_new): + Remove the "nomerge" backend flag. + + * backends/gconf-merge-tree.c: + (recursively_load_subtree): add back. + (merge_tree): upd. for markup_tree_get() change. + 2004-08-16 Christian Rose <menthos@menthos.com> * configure.in: Added "bs" to ALL_LINGUAS. diff --git a/backends/gconf-merge-tree.c b/backends/gconf-merge-tree.c index fff83797..c3241dab 100644 --- a/backends/gconf-merge-tree.c +++ b/backends/gconf-merge-tree.c @@ -39,6 +39,26 @@ _gconf_mode_t_to_mode (mode_t orig) return mode; } +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 merge_tree (const char *root_dir) { @@ -61,7 +81,7 @@ merge_tree (const char *root_dir) } - tree = markup_tree_get (root_dir, dir_mode, file_mode, FALSE); + tree = markup_tree_get (root_dir, dir_mode, file_mode); recursively_load_subtree (tree->root); diff --git a/backends/markup-backend.c b/backends/markup-backend.c index c94253ad..f4e6fec0 100644 --- a/backends/markup-backend.c +++ b/backends/markup-backend.c @@ -65,13 +65,11 @@ typedef struct MarkupTree *tree; guint dir_mode; guint file_mode; - guint try_merge : 1; } MarkupSource; static MarkupSource* ms_new (const char *root_dir, guint dir_mode, guint file_mode, - gboolean try_merge, GConfLock *lock); static void ms_destroy (MarkupSource *source); @@ -264,7 +262,6 @@ resolve_address (const char *address, char** address_flags; char** iter; gboolean force_readonly; - gboolean try_merge; root_dir = get_dir_from_address (address, err); if (root_dir == NULL) @@ -289,7 +286,6 @@ resolve_address (const char *address, } force_readonly = FALSE; - try_merge = TRUE; address_flags = gconf_address_flags (address); if (address_flags) @@ -301,10 +297,6 @@ resolve_address (const char *address, { force_readonly = TRUE; } - else if (strcmp (*iter, "nomerge") == 0) - { - try_merge = FALSE; - } ++iter; } @@ -393,12 +385,9 @@ resolve_address (const char *address, return NULL; } - if (try_merge && !(flags & GCONF_SOURCE_ALL_WRITEABLE)) - try_merge = FALSE; - /* Create the new source */ - xsource = ms_new (root_dir, dir_mode, file_mode, try_merge, lock); + xsource = ms_new (root_dir, dir_mode, file_mode, lock); gconf_log (GCL_DEBUG, _("Directory/file permissions for XML source at root %s are: %o/%o"), @@ -901,7 +890,6 @@ static MarkupSource* ms_new (const char* root_dir, guint dir_mode, guint file_mode, - gboolean try_merge, GConfLock *lock) { MarkupSource* ms; @@ -920,12 +908,10 @@ ms_new (const char* root_dir, ms->dir_mode = dir_mode; ms->file_mode = file_mode; - ms->try_merge = try_merge; ms->tree = markup_tree_get (ms->root_dir, ms->dir_mode, - ms->file_mode, - ms->try_merge); + ms->file_mode); return ms; } diff --git a/backends/markup-tree.c b/backends/markup-tree.c index 8aa25de0..ba8b5b88 100644 --- a/backends/markup-tree.c +++ b/backends/markup-tree.c @@ -90,34 +90,14 @@ struct _MarkupTree MarkupDir *root; guint refcount; - - guint try_merge : 1; }; static GHashTable *trees_by_root_dir = NULL; -/* List of dirs whose subdirs should be saved as a - * subtree-in-a-file. The order is important. - */ -static const char *save_as_subtree_dirs[] = -{ - "/apps/evolution", - "/apps/panel/profiles", - "/apps", - "/desktop/gnome", - "/system", - "/schemas/apps", - "/schemas/desktop/gnome", - "/schemas/system", - "/schemas", - "/" -}; - MarkupTree* markup_tree_get (const char *root_dir, guint dir_mode, - guint file_mode, - gboolean try_merge) + guint file_mode) { MarkupTree *tree = NULL; @@ -137,7 +117,6 @@ markup_tree_get (const char *root_dir, tree->dirname = g_strdup (root_dir); tree->dir_mode = dir_mode; tree->file_mode = file_mode; - tree->try_merge = try_merge != FALSE; tree->root = markup_dir_new (tree, NULL, "/"); @@ -974,81 +953,6 @@ 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 -should_save_as_subtree (MarkupDir *dir) -{ - gboolean save_as_subtree = FALSE; - char *dir_path; - char *parent_path; - int pathlen; - int i; - - if (!dir->tree->try_merge) - return FALSE; - - /* never merge root */ - if (!dir->parent) - return FALSE; - - dir_path = markup_dir_build_dir_path (dir, FALSE); - pathlen = strlen (dir_path); - - parent_path = markup_dir_build_dir_path (dir->parent, FALSE); - - i = 0; - while (i < G_N_ELEMENTS (save_as_subtree_dirs)) - { - const char *match = save_as_subtree_dirs [i]; - - /* 2 rules: - * 1) If @match is an ancestor of this dir, don't - * consider merging this dir - * 2) If @match is this dir's parent, then merge - * this dir - * - * (1) is so that we don't e.g., with "/apps" and - * "/apps/panel/profiles", merge /apps/panel when - * we really want to merge /apps/panel/profiles/default - */ - - if (strncmp (match, dir_path, pathlen) == 0) - break; - - if (strcmp (match, parent_path) == 0) - { - save_as_subtree = TRUE; - break; - } - - ++i; - } - - g_free (dir_path); - g_free (parent_path); - - return save_as_subtree; -} - static gboolean markup_dir_sync (MarkupDir *dir) { @@ -1069,12 +973,6 @@ markup_dir_sync (MarkupDir *dir) if (dir->not_in_filesystem) return TRUE; - if (!dir->save_as_subtree && should_save_as_subtree (dir)) - { - dir->save_as_subtree = TRUE; - recursively_load_subtree (dir); - } - /* Sanitize the entries */ clean_old_local_schemas_recurse (dir, dir->save_as_subtree); diff --git a/backends/markup-tree.h b/backends/markup-tree.h index 47d7dd99..a6bf566e 100644 --- a/backends/markup-tree.h +++ b/backends/markup-tree.h @@ -31,8 +31,7 @@ typedef struct _MarkupEntry MarkupEntry; MarkupTree* markup_tree_get (const char *root_dir, guint dir_mode, - guint file_mode, - gboolean try_merge); + guint file_mode); void markup_tree_unref (MarkupTree *tree); void markup_tree_rebuild (MarkupTree *tree); MarkupDir* markup_tree_lookup_dir (MarkupTree *tree, |