#!/bin/sh

#Use this to ensure we only set keys that are not already set by the user.
checkkey() {
    gconftool-2 --get "$1" 2>&1 | grep \`"$1"\' > /dev/null 2>&1
}

case "$1" in
    configure)
        #We aren't installing schemas (why?) so we have to manually set up the
        # default configuration.
        #The dictionary paths are set up by gjiten-dics (et al.).
        if checkkey /apps/gjiten/general/bigwords ; then
            gconftool-2 --type bool --set /apps/gjiten/general/bigwords true
        fi
        if checkkey /apps/gjiten/general/bigkanji ; then
            gconftool-2 --type bool --set /apps/gjiten/general/bigkanji true
        fi
        if checkkey /apps/gjiten/general/deinflection_enabled ; then
            gconftool-2 --type bool --set /apps/gjiten/general/deinflection_enabled true
        fi
        if checkkey /apps/gjiten/general/search_kata_on_hira ; then
            gconftool-2 --type bool --set /apps/gjiten/general/search_kata_on_hira true
        fi
        if checkkey /apps/gjiten/kanjidic/kanji ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/kanji true
        fi
        if checkkey /apps/gjiten/kanjidic/radical ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/radical true
        fi
        if checkkey /apps/gjiten/kanjidic/strokes ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/strokes true
        fi
        if checkkey /apps/gjiten/kanjidic/reading ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/reading true
        fi
        if checkkey /apps/gjiten/kanjidic/english ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/english true
        fi
        if checkkey /apps/gjiten/kanjidic/freq ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/freq true
        fi
        if checkkey /apps/gjiten/kanjidic/jouyou ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/jouyou true
        fi
        if checkkey /apps/gjiten/kanjidic/cref ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/cref true
        fi
        if checkkey /apps/gjiten/kanjidic/unicode ; then
            gconftool-2 --type bool --set /apps/gjiten/kanjidic/unicode true
        fi
    ;;
    abort-upgrade|abort-remove|abort-deconfigure)
    ;;
esac

#DEBHELPER#

exit 0
