From 4c612df49db924a526c61d10b5c0100e68f5be28 Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Tue, 28 Sep 2010 01:23:17 +0200 Subject: [PATCH] op_lcdsettings: Fixed a small bug: You cannot delete the Default Gamma anymore. --- .../pandora-scripts/op_lcdsettings.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/recipes/pandora-system/pandora-scripts/op_lcdsettings.sh b/recipes/pandora-system/pandora-scripts/op_lcdsettings.sh index 49861d5..821400d 100755 --- a/recipes/pandora-system/pandora-scripts/op_lcdsettings.sh +++ b/recipes/pandora-system/pandora-scripts/op_lcdsettings.sh @@ -29,7 +29,7 @@ case $mainsel in gamma=$(grep "$selection" /etc/pandora/conf/gamma.conf | awk -F\; '{print $3}') - if [ ${gamma} = "syssyscreatenew" ]; then + if [ "${gamma}" = "syssyscreatenew" ]; then cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /tmp/gamma.current op_gammatool if zenity --question --title="Confirm new gamma setting" --text="Do you want to keep the current gamma setting or revert to the previous one?" --ok-label="Keep it" --cancel-label="Revert"; then @@ -45,7 +45,7 @@ case $mainsel in else cat /tmp/gamma.current > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma fi - elif [ ${gamma} = "syssyssavecurrent" ]; then + elif [ "${gamma}" = "syssyssavecurrent" ]; then curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma) while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6 @@ -55,15 +55,19 @@ case $mainsel in zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6 elif [ ${gamma} = "syssysdeleteprofile" ]; then if selection2=$(cat /etc/pandora/conf/gamma.conf | grep -v syssys | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Delete gamma profile" --list --column "Name" --column "Description" --text "Please select a Gamma Profile to Delete" ); then - if zenity --question --title="Confirm Profile Removal" --text="Are you REALLY sure you want to remove the profile $selection2?\n\nThere will be NO other confirmation and this can NOT be undone!" --ok-label="Yes, remove the profile!" --cancel-label="Don't remove the profile"; then + if [ "${selection2}" = "Default Gamma" ]; then + zenity --title="Error" --error --text="You cannot delete the default Gamma settings" --timeout 6 + else + if zenity --question --title="Confirm Profile Removal" --text="Are you REALLY sure you want to remove the profile $selection2?\n\nThere will be NO other confirmation and this can NOT be undone!" --ok-label="Yes, remove the profile!" --cancel-label="Don't remove the profile"; then remove=$(grep "$selection2" /etc/pandora/conf/gamma.conf) cat /etc/pandora/conf/gamma.conf | grep -v "$remove" > /tmp/gamma.conf mv /tmp/gamma.conf /etc/pandora/conf/gamma.conf zenity --info --title="Profile deleted" --text "The profile has been deleted." --timeout 6 - else + else zenity --info --title="Profile not deleted" --text "The profile has not been deleted." --timeout 6 - fi + fi fi + fi else echo $gamma > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma fi -- 2.39.2