# If the .gconf directory already exists, merge it in a single tree.
# Otherwise, create %gconf-tree.xml so that a single tree is always
# used.

if [ -x /usr/bin/gconf-merge-tree ]; then
	GCONF_DIR="$HOME/.gconf"
	GCONF_TREE="$GCONF_DIR/%gconf-tree.xml"
	GCONF_DONT="$GCONF_DIR/DONT-MIGRATE"

	if [ -d "$GCONF_DIR" ]
	then
		if [ ! -f "$GCONF_TREE" ] && [ ! -f "$GCONF_DONT" ]
		then
			/usr/bin/gconf-merge-tree "$GCONF_DIR"
			killall -q -u "$USER" -s HUP gconfd-2 >/dev/null 2>&1 || true
		fi
	else
		mkdir -p -m 700 "$GCONF_DIR"
		touch "$GCONF_TREE"
		chmod 600 "$GCONF_TREE"
	fi
fi
