slitaz-tools rev 505

add "wrong password" dialog to subox see http://labs.slitaz.org/issues/242 Thx to Francois Boulogne.
author frederic guilbault <fredericguilbault@live.ca>
date Fri Oct 22 14:31:39 2010 +0000 (2010-10-22)
parents 875a3d5d985f
children 2fb0d16ce27a
files tinyutils/subox
line diff
     1.1 --- a/tinyutils/subox	Wed Oct 20 21:18:35 2010 +0000
     1.2 +++ b/tinyutils/subox	Fri Oct 22 14:31:39 2010 +0000
     1.3 @@ -25,6 +25,27 @@
     1.4  # Keep command in an exported variable to be used by SU_DIALOG.
     1.5  export SU_CMD=$1
     1.6  
     1.7 +# Error window if the pwd is wrong.
     1.8 +export ERROR_DIALOG='
     1.9 +<window title="Subox">
    1.10 +  <vbox>
    1.11 +
    1.12 +    <text use-markup="true">
    1.13 +      <label>"
    1.14 +<b>SliTaz - Subox</b>"
    1.15 +      </label>
    1.16 +    </text>
    1.17 +    <text wrap="true" width-chars="48">
    1.18 +	<label>"'`gettext "Error: wrong password!"`'"</label>
    1.19 +    </text>
    1.20 +
    1.21 +    <hbox>
    1.22 +      <button ok></button>
    1.23 +    </hbox>
    1.24 +</vbox>
    1.25 +</window>
    1.26 +'
    1.27 +
    1.28  # Main window and root password default entry set to 'root'.
    1.29  SU_DIALOG='
    1.30  <window title="Subox" skip_taskbar_hint="true">
    1.31 @@ -72,10 +93,10 @@
    1.32  fi
    1.33  
    1.34  export SU_DIALOG=''${SU_DIALOG}'
    1.35 -			<default>false</default>
    1.36 +			
    1.37  		</checkbox>
    1.38  		<button ok>
    1.39 -			<action>echo $PASSWD | su -c "$SU_CMD" &</action>
    1.40 +			<action> echo $PASSWD | su -c "$SU_CMD &" || gtkdialog --center --program=ERROR_DIALOG</action>
    1.41  			<action>[ $AUTOSAVE == true ] && echo $PASSWD > '$HOME/.config/slitaz/subox.conf'</action>
    1.42  			<action>[ $AUTOSAVE == true ] && chmod 0600 '$HOME/.config/slitaz/subox.conf'</action>
    1.43  			<action>[ $AUTOSAVE == false ] && cat /dev/null > '$HOME/.config/slitaz/subox.conf'</action>