slitaz-tools rev 187 2.3

deskopbox: add logout command and dialog box
author Christophe Lincoln <pankso@slitaz.org>
date Mon May 12 01:23:51 2008 +0200 (2008-05-12)
parents b3e9410f28ca
children dcc5d11de1b3
files tinyutils/desktopbox
line diff
     1.1 --- a/tinyutils/desktopbox	Sun May 11 15:02:54 2008 +0000
     1.2 +++ b/tinyutils/desktopbox	Mon May 12 01:23:51 2008 +0200
     1.3 @@ -5,7 +5,7 @@
     1.4  #
     1.5  # (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
     1.6  #
     1.7 -VERSION=20080509
     1.8 +VERSION=20080512
     1.9  
    1.10  # Standards directories.
    1.11  mkdir -p $HOME/Desktop $HOME/.local/share/applications
    1.12 @@ -18,21 +18,24 @@
    1.13  		FOLDER_ENTRY_MSG="dirname"
    1.14  		NEW_FILE_LABEL="Creat a new file on the desktop:"
    1.15  		FILE_ENTRY_MSG="filename"
    1.16 -		ADD_ICON_LABEL="Add some desktop icons" ;;
    1.17 +		ADD_ICON_LABEL="Add some desktop icons"
    1.18 +		DESKTOP_DIALOG_LABEL="Session logout, system shutdown or reboot"  ;;
    1.19  	fr*)
    1.20  		lang="fr"
    1.21  		NEW_FOLDER_LABEL="Créer un nouveau dossier sur le bureau:"
    1.22  		FOLDER_ENTRY_MSG="dossier"
    1.23  		NEW_FILE_LABEL="Créer un nouveau fichier sur le bureau:"
    1.24  		FILE_ENTRY_MSG="fichier"
    1.25 -		ADD_ICON_LABEL="Ajouter des icons de bureau" ;;
    1.26 +		ADD_ICON_LABEL="Ajouter des icons de bureau"
    1.27 +		DESKTOP_DIALOG_LABEL="Déconnexion, arrêt ou redémarrage du système" ;;
    1.28  	*)
    1.29  		lang=""
    1.30  		NEW_FOLDER_LABEL="Creat a new folder on the desktop:"
    1.31  		FOLDER_ENTRY_MSG="dirname"
    1.32  		NEW_FILE_LABEL="Creat a new file on the desktop:"
    1.33  		FILE_ENTRY_MSG="filename"
    1.34 -		ADD_ICON_LABEL="Add some desktop icons" ;;
    1.35 +		ADD_ICON_LABEL="Add some desktop icons"
    1.36 +		DESKTOP_DIALOG_LABEL="Session logout, system shutdown or reboot" ;;
    1.37  esac
    1.38  
    1.39  # Command line usage.
    1.40 @@ -43,7 +46,8 @@
    1.41  \033[1mCommands: \033[0m\n
    1.42    new-folder   Creat a new folder on the desktop with mkdir.
    1.43    new-file     Creat a new empty file or SHell script on the desktop.
    1.44 -  add-icons     Add a system icon on the desktop.\n"
    1.45 +  add-icons    Add a system icon on the desktop.
    1.46 +  logout       Prompt for X session exit or system halt/reboot.\n"
    1.47  }
    1.48  
    1.49  # Box commands.
    1.50 @@ -169,9 +173,54 @@
    1.51  		</button>
    1.52  	</hbox>
    1.53  </vbox>
    1.54 -</window>
    1.55 -'
    1.56 -		export DESKTOP_DIALOG="${DESKTOP_DIALOG}${ACTIONS}" ;;
    1.57 +</window>'
    1.58 +		export DESKTOP_DIALOG=${DESKTOP_DIALOG}${ACTIONS} ;;
    1.59 +	logout)
    1.60 +		# X session/system logout.
    1.61 +		#
    1.62 +		DESKTOP_DIALOG="
    1.63 +<window title=\"SliTaz Desktop logout\" icon-name=\"user-desktop\">
    1.64 +<vbox>
    1.65 +	<pixmap>
    1.66 +		<input file>/usr/share/icons/Tango/32x32/places/user-desktop.png</input>
    1.67 +	</pixmap>
    1.68 +	<hbox>
    1.69 +		<text use-markup=\"true\" width-chars=\"64\">
    1.70 +			<label>
    1.71 +\"<b>$DESKTOP_DIALOG_LABEL</b>
    1.72 +\"
    1.73 +			</label>
    1.74 +		</text>
    1.75 +	</hbox>"
    1.76 +		# Logout for Openbox or JWM and system shutdown or reboot.
    1.77 +		ACTIONS='
    1.78 +	<hbox>
    1.79 +		<button>
    1.80 +			<label>Logout X session</label>
    1.81 +			<input file icon="video-display"></input>
    1.82 +			<action>openbox --exit || jwm -exit</action>
    1.83 +			<action type="exit">Exit</action>
    1.84 +		</button>
    1.85 +		<button>
    1.86 +			<label>Shutdown computer</label>
    1.87 +			<input file icon="system-shutdown"></input>
    1.88 +			<action>poweroff</action>
    1.89 +			<action type="exit">Exit</action>
    1.90 +		</button>
    1.91 +		<button>
    1.92 +			<label>Reboot system</label>
    1.93 +			<input file icon="reload"></input>
    1.94 +			<action>reboot</action>
    1.95 +			<action type="exit">Exit</action>
    1.96 +		</button>
    1.97 +		<button cancel>
    1.98 +			<action type="exit">Exit</action>
    1.99 +		</button>
   1.100 +	</hbox>
   1.101 +
   1.102 +</vbox>
   1.103 +</window>'
   1.104 +		export DESKTOP_DIALOG=${DESKTOP_DIALOG}${ACTIONS} ;;
   1.105  	*)
   1.106  		# Usage if executet from cmdline.
   1.107  		#