Browse files

dconf: use text-based key file and dconf update

BUG=none
TEST=manually

Review URL: https://codereview.appspot.com/6215062
  • Loading branch information...
1 parent 32533c7 commit 4bee2863e8d2e51b185b6d149e6259848d8c0cb6 @ueno ueno committed May 20, 2012
Showing with 35 additions and 16 deletions.
  1. +11 −7 data/dconf/Makefile.am
  2. +24 −9 data/dconf/make-dconf-override-db.sh
View
18 data/dconf/Makefile.am
@@ -32,6 +32,7 @@ EXTRA_DIST = \
$(gsettings_schemas_in_files) \
make-dconf-override-db.sh \
profile/ibus \
+ 00-upstream-settings \
$(NULL)
DISTCLEANFILES = \
@@ -40,23 +41,26 @@ DISTCLEANFILES = \
MAINTAINERCLEANFILES = \
$(gsettings_schemas_in_files) \
+ 00-upstream-settings \
$(NULL)
-CLEANFILES = \
- db/ibus \
- $(NULL)
+dconfprofiledir = $(sysconfdir)/dconf/profile
+dconfprofile_DATA = profile/ibus
-dconfprofiledir = $(sysconfdir)/dconf
-nobase_dconfprofile_DATA = db/ibus profile/ibus
+dconfdbdir = $(sysconfdir)/dconf/db/ibus.d
+dconfdb_DATA = 00-upstream-settings
org.freedesktop.ibus.gschema.xml.in: $(top_srcdir)/data/ibus.schemas.in
$(AM_V_GEN) gsettings-schema-convert --force --gconf --xml \
--schema-id "org.freedesktop.ibus" \
--output $@ $<
-db/ibus: $(srcdir)/make-dconf-override-db.sh $(gsettings_SCHEMAS)
+00-upstream-settings: $(srcdir)/make-dconf-override-db.sh $(gsettings_SCHEMAS)
@$(MKDIR_P) db
- $(AM_V_GEN) $(srcdir)/make-dconf-override-db.sh $@ || \
+ $(AM_V_GEN) $(srcdir)/make-dconf-override-db.sh > $@ || \
{ rc=$$?; $(RM) -rf $@; exit $$rc; }
+install-data-hook:
+ dconf update
+
-include $(top_srcdir)/git.mk
View
33 data/dconf/make-dconf-override-db.sh
@@ -15,17 +15,32 @@ trap 'rm -rf $TMPDIR; kill $DBUS_SESSION_BUS_PID' ERR
# in case that schema is not installed on the system
glib-compile-schemas --targetdir "$GSETTINGS_SCHEMA_DIR" "$PWD"
-gsettings list-recursively org.freedesktop.ibus.general | \
-while read schema key val; do
- gsettings set "$schema" "$key" "$val"
+cat <<EOF
+# This file is a part of the IBus packaging and should not be changed.
+#
+# Instead create your own file next to it with a higher numbered prefix,
+# and run
+#
+# dconf update
+#
+EOF
+
+# Loop over top level schemas since "gsettings list-recursively" only
+# looks for direct children.
+schemas="org.freedesktop.ibus.general org.freedesktop.ibus.panel"
+current_schema=
+for schema in $schemas; do
+ gsettings list-recursively $schema | \
+ while read schema key val; do
+ if test "$schema" != "$current_schema"; then
+ echo
+ echo $schema | sed 's/org\.freedesktop\(.*\)/[desktop\1]/' | tr '.' '/'
+ current_schema="$schema"
+ fi
+ echo "$key=$val"
+ done
done
-gsettings list-recursively org.freedesktop.ibus.panel | \
-while read schema key val; do
- gsettings set "$schema" "$key" "$val"
-done
-
-mv $XDG_CONFIG_HOME/dconf/user "$1"
rm -rf $TMPDIR
kill $DBUS_SESSION_BUS_PID

0 comments on commit 4bee286

Please sign in to comment.