GNOME Bugzilla – Bug 138498
Allow the markup backend's subtree-in-a-file feature to be used
Last modified: 2007-06-15 15:13:29 UTC
Since the markup backend was made the default during 2.5 it has allowed any GConf subtree to be stored in a single file rather than every dir having its own %gconf.xml file. E.g. /apps/metacity looks like: /apps/metacity/%gconf.xml /apps/metacity/general/%gconf.xml /apps/metacity/global_keybindings/%gconf.xml /apps/metacity/keybinding_commands/%gconf.xml /apps/metacity/window_keybindings/%gconf.xml With 2.5 or later, you can do: $> gconf-merge-tree ~/.gconf/apps/metacity and it will create /apps/metacity/%gconf-tree.xml which is basically all the %gconf.xml files merged into a single file. The original %gconf.xml files are left in tact. From that point on, all changes made with the markup backend are made to %gconf-tree.xml only, but if you log into a machine using the old XML backend it will use the original %gconf.xml files. We haven't made the backend use this feature by default yet, since we don't want to break compatibility with older version of GNOME. However, we should figure out what the default behaviour *should* be if we switched it on and allow sysadmins to switch this on themselves if the compatibility with older versions is not an issue. Some thoughts: + The way it would work would be the backend would have a list of directories which should be merged. When loading any of those dirs, if it notices that the dir doesn't have a %gconf-tree.xml it would flag the dir to be saved in a merged file. When creating a dir, it just uses %gconf-tree.xml. + We need to decide whether that list should be hardcoded or configurable somehow. If configurable, we need to decide whether it should be configurable per-backend-source or just system-wide. + Thinking about it, I think we should make it configurable both system-wide and per-backend. This would allow us to use merged files in the defaults database, allow the sysadmin to decide whether users should have merged files and allow that to be overidden by the user. + Good defaults would be that each subdir under /apps, /desktop, /schemas/apps and /schemas/desktop should be merged. The defaults and mandatory database would use these, but homedirs wouldn't. + Individual apps may want to configure how their prefs are merged. E.g. panel would want each profile in a single file rather than everything in a single file (doesn't matter much since we don't use profiles really) and evo might want addressbook, calendar and mail preferences in separate files. The cheesy config file might look like this by default: <xmlbackend_config> <merging> <!-- Whether all sources should merge by default --> <merge>false</merge> <!-- List of dirs which should be merged --> <mergedirs> <dir>/apps/*</dir> <dir>/apps/panel/profiles/*</dir> <dir>/desktop</dir> <dir>/schemas/apps/*</dir> <dir>/schemas/desktop</dir> </mergedirs> <!-- Individually control each source --> <sources> <source> <location>/etc/gconf/gconf.xml.defaults</location> <merge>true</merge> </source> <source> <location>/etc/gconf/gconf.xml.mandatory</location> <merge>true</merge> </source> <!-- Uncomment to enable merging in homedirs <source> <location>$(HOME)/.gconf</location> <merge>true</merge> </source> --> </sources> </merging> </xmlbackend_config> This is rapidly feeling like its way to over-engineered and difficult for people to understand.
For the 2.4 vs. 2.6 vs. 2.8 question it seems OK if settings simply aren't shared, as long as they nicely coexist. So the KISS is to just hardcode that by default we merge each dir at a certain depth, i.e. all of /apps/panel, all of /apps/foo, etc. Question is what breaks and are we willing to live with that breakage. I guess mostly it could become less efficient to do updates on a large tree such as Evolution's. Can't we just try and see how slow this is, and see if it's too unuseable? Another option might be to merge at another depth down, e.g. /apps/metacity/general, etc. Works for the panel anyhow.
Okay, merging two levels down seems good to me (i.e. /apps/metacity/general and /schemas/apps/metacity) Since we know at least some people are going to be screwed by the 2.4 vs later thing, I'm thinking we should introduce a "nomerge" backend flag e.g. xml:readwrite,nomerge:$(HOME)/.gconf not only would it stop saving everything as %gconf-tree.xml files, but it would also explode existing %gconf-tree.xml files into a directory based hierarchy and delete the %gconf-tree.xml one.
Fixed on HEAD now. See also: http://mail.gnome.org/archives/desktop-devel-list/2004-June/msg00424.html 2004-06-21 Mark McLoughlin <mark@skynet.ie> Fix for bug #138498 - turn on "subtree-in-a-file" for the subdirectories of the following directories: /apps/evolution", /apps/panel/profiles", /apps /desktop/gnome /system /schemas/apps /schemas/desktop/gnome /schemas/system /schemas / You can turn this of by passing the "nomerge" flag to the backend - e.g. xml:readwrite,nomerge:$(HOME)/.gconf * backends/markup-tree.[ch]: (markup_tree_get): pass in the nomerge path. (markup_dir_build_file_path), (markup_dir_build_dir_path): simple wrappers for build_path(). (load_subtree), (load_entries), (load_subdirs), (delete_useless_subdirs): upd. for above change. (recursively_load_subtree): impl. recursively loading the tree below a given dir. (should_save_as_subtree): logic to figure out which dirs should be saved as merged files. (markup_dir_sync): save the dir in a merged file if neccessary. (markup_dir_build_path): allow building a non-filesystem path. (parse_tree), (save_tree): upd. (write_dir): set the "not_in_filesystem" flag. * backends/markup-backend.c: (resolve_address), (ms_new): parse and use the "nomerge" flag. * backends/gconf-merge-tree.c: (merge_tree): upd.
Okay, I've reverted this again. See: http://mail.gnome.org/archives/desktop-devel-list/2004-August/msg00393.html
Created attachment 30746 [details] [review] reverted patch