#!/bin/sh
confirm()
{
    msg=\
"<b><big>  fbpanel 終了</big></b>\n\
\n\
fbpanel を終了します"
    ttl="fbpanel 終了"
    if [ "$LANG" == "ja_JP.eucJP" ]; then
        msg=`echo "$msg" | nkf -e`
        ttl=`echo "$ttl" | nkf -e`
    fi
    zenity --question --title="$ttl" --no-wrap \
        --text="$msg" && exec killall fbpanel-bin
}

# ------------------------------

CONFIG=~/.config/fbpanel/fbpanel_conf
reboot_confirm=false

if [ ! -f "$CONFIG" ]; then
    cat > "$CONFIG" <<EOF
# Fbpanel setting for Vine Linux
# 各値を true か false に設定して下さい。
# '=' の左右に空白は入れないで下さい。

quit_confirm=true    # リブート時に確認をとる
EOF
else
    if [ ! `grep quit_confirm "$CONFIG"` ]; then
        cat >> "$CONFIG" <<EOF
quit_confirm=true    # fbpanel 終了時に確認をとる
EOF
    fi
fi

. "$CONFIG"

if [ "$quit_confirm" == true ]; then
    confirm
else
    exec killall fbpanel-bin
fi
