From: Grazvydas Ignotas Date: Sat, 12 May 2012 14:02:56 +0000 (+0300) Subject: op_datetime.sh: fix various issues X-Git-Tag: sz_beta5~16 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=commitdiff_plain;h=c0813df0c77aa3aa3db04c6bebbfbd013041fa82;hp=989b6f45f9fc8931cc654801c9a1a81f71d54b1e;ds=sidebyside op_datetime.sh: fix various issues - allow to cancel dialogs - remove duplicate time set loop - disable screensaver when changing time - write to hwclock --- diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb index fad59db..7de19c4 100644 --- a/recipes/pandora-system/pandora-scripts.bb +++ b/recipes/pandora-system/pandora-scripts.bb @@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora" DEPENDS = "zenity dbus" RDEPENDS = "zenity dbus" -PR = "r94" +PR = "r95" SRC_URI = " \ file://op_paths.sh \ diff --git a/recipes/pandora-system/pandora-scripts/op_datetime.sh b/recipes/pandora-system/pandora-scripts/op_datetime.sh index 9983023..04aa5ed 100755 --- a/recipes/pandora-system/pandora-scripts/op_datetime.sh +++ b/recipes/pandora-system/pandora-scripts/op_datetime.sh @@ -28,8 +28,9 @@ case $mainsel in date_m=`date +%m | sed 's/^0//'` date_y=`date +%Y` - while ! date=$(zenity --calendar --text="Please select the current date" --title "Please select the current date" --day=$date_d --month=$date_m --year=$date_y --date-format="%Y%m%d" --width=500) || [ "x$date" = "x" ] ; do - zenity --title="Error" --error --text="Please select the date." --timeout 6 + date="" + while [ "x$date" = "x" ] ; do + date=$(zenity --calendar --text="Please select the current date" --title "Please select the current date" --day=$date_d --month=$date_m --year=$date_y --date-format="%Y%m%d" --width=500) || exit 1 done echo $date @@ -37,16 +38,29 @@ case $mainsel in time_h=`date +%H` time_m=`date +%M` - while ! time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM).\n\nThe screen might blank out after you changed the time.\nDon't panic. Simply press a button on the keyboard.\n" --entry-text "$time_h:$time_m") || [ "x$time" = "x" ] ; do - zenity --title="Error" --error --text="Please input the time." --timeout 6 + while true; do + time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM).\n\nThe screen might blank out after you changed the time.\nDon't panic. Simply press a button on the keyboard.\n" --entry-text "$time_h:$time_m") || exit 1 + if test -n "$time" && date -d "$time"; then + break; + fi + zenity --title="Error" --error --text="Please input the time." --timeout 6 done - while ! date -d $time ; do - time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM).\n\nThe screen might blank out after you changed the time.\nDon't panic. Simply press a button on the keyboard.\n" --entry-text "$time_h:$time_m") - done + # take care of screensaver first + screensaver_enabled=true + if xset q | grep -A2 'Screen Saver' | grep -q 'timeout:.*\<0\>.*cycle'; then + screensaver_enabled=false + fi + xset s off + date +%Y%m%d -s $date date +%H:%M -s $time + hwclock -u -w + + if $screensaver_enabled; then + xset s on + fi ;; esac -done \ No newline at end of file +done