开发者

How to create/delete gconf directory with gconftool-2?

... ughm ... the subject?

I am writing a script that will create gnome-terminal profiles for various machines that I want to connect to. I need a custom command to run on each terminal and profile is ideal solution for the problem. The script should do various modifications to the gnome-terminal profiles. Each profile has a directory in gconf. I wa开发者_开发问答nt to be able to create and delete these directories from command line. Any idea how to do it?


You can use:

$ gconftool-2 --recursive-unset /apps/gnome-terminal/foo/bar

for unset everything from foo/bar in gnome-terminal.

Another alternative is to use an XML file with the keys you would like to change/unset, and use:

$ gconftool-2 --unload clean-settings.xml

and later:

$ gconftool-2 --load new-settings.xml

However, I do not think you need to "delete" or "unset" anything. My recommendation is:

  1. Customize gnome-terminal as you need it.
  2. Export the settings using:

    $ gconftool-2 --dump /apps/gnome-terminal > my-gnome-terminal-settings.xml

  3. Copy the files (or use whatever mechanisms for working with your remotes machines) and in your remote machine run:

    $ gconftool-2 --load my-gnome-terminal-settings.xml


You can create/delete appropriate directories inside "~/.gconf" and then restart gconfd by executing gconftool-2 --shutdown followed by gconftool-2 --spawn. This will flush gconf caches and will apply your settings right away.


Apparently you can't do that directly. Instead, deleting contents of the directory deletes it. The problem is that, as it seems, gconf and friends implement some sort of settings caching. As a result, it takes some time until you see that directory is actually gone. Sometimes it is immediately, but more often you have to wait few minutes or even relogin. I could not identify what exactly takes for gconf to refresh it's directory structure.


To create a new directory with gconf-editor, find the parent of the dir you want, then create a new key of the form <directory-name>/key. That creates the dir for you.

I assume you can do the same implicit creation with gconftool-2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜