From c0b858a53c54c3d60f3b46a0733494447e813482 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Wed, 22 Jan 2003 01:50:28 +0000 Subject: [PATCH] Clarify some of the documentation a little. Add in a few example scripts 2003-01-22 Glynn Foster * help/C/zenity.xml: Clarify some of the documentation a little. Add in a few example scripts and commandlines. I'm pretty useless at this though, since I don't know how to write scripts. * TODO: Update accordingly. Only 2 things left. --- ChangeLog | 8 ++ TODO | 1 - help/C/zenity.xml | 181 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 167 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b4ded8..25339c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-01-22 Glynn Foster + + * help/C/zenity.xml: Clarify some of the documentation a little. Add + in a few example scripts and commandlines. I'm pretty useless at + this though, since I don't know how to write scripts. + + * TODO: Update accordingly. Only 2 things left. + 2003-01-21 Mike Newman * src/text.c: fix a bug where a textbuffer was only being diff --git a/TODO b/TODO index e99757d..d48f7da 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,2 @@ * Add some accessibility I guess * Remove extraneous cruft from configure.in -* Start writing help documentation diff --git a/help/C/zenity.xml b/help/C/zenity.xml index 167cd1d..591024b 100644 --- a/help/C/zenity.xml +++ b/help/C/zenity.xml @@ -169,6 +169,19 @@ detailed in the individual dialog sections. + + When using &app;, make sure that any arguments to the command line options are surrounded by + a set of quotes ' ' or " " as in &app; --calendar --dialog-title="Holiday Planner" + , for example. If you do not use quotes, then it is likely that you will get + unexpected results. + + + + For some of the dialogs, &app; supports the use of keyboard mnemonics. This allows you to + use an '_' before the letter you want the mnemonic for, as in "_Please choose a name:", for + example. + + The following exit codes are observed by &app;: @@ -242,8 +255,11 @@ To create a Calendar dialog, use --calendar. &app; will return the - date selected to standard error. The following list of options are also available for - the Calendar dialog: + date selected to standard error. If the day, month and year are not specified at the + command line, &app; will pre-select the current date in the Calendar dialog. + + + The following list of options are available for the Calendar dialog: @@ -306,7 +322,19 @@ - + + + The following script shows an example of how to use the Calendar dialog: + + + #!/bin/sh + + if zenity --calendar --dialog-title="Calendar selection" --text="Select a date from below" --day=18 --month=1 --year=2003 + then echo $? + else echo "No date selected" + fi + + @@ -317,8 +345,10 @@ To create a Text Entry dialog, use --text-entry. &app; returns the - contents of the text entry to standard error. The following list of options are also - available for the Text Entry dialog: + contents of the text entry to standard error. + + + The following list of options are available for the Text Entry dialog: @@ -360,7 +390,18 @@ - + + The following script shows an example of how to use the Calendar dialog: + + + #!/bin/sh + + if zenity --entry --dialog-title="Add a new entry" --text="Enter your _Password" --hide-text + then echo $? + else echo "No password entered" + fi + + @@ -373,8 +414,10 @@ There are 4 types of message dialogs in &app; - Error, Informational, Question and Warning. To create an Error dialog, use --error. To create an Informational dialog, use --info. To create a Question dialog, use --question. To - create a Warning dialog, use --question. The following list of options is - available for the message dialogs. + create a Warning dialog, use --question. + + + The following list of options are available for the message dialogs. @@ -444,7 +487,19 @@ - + + The following script shows an example of how to use the Warning message dialog: + + + #!/bin/bash + + FILE_TYPE=$(file -b $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS|awk '{ print $1}') + + if [ "$FILE_TYPE" != "PNG" ]; then + zenity --warning --text="Could not rotate image :" --hide-text + fi + + @@ -455,8 +510,10 @@ To create a File Selection dialog, use --file-selection. &app; returns - the file or directory selected to standard error. The following list of options are also - available for the File Selection dialog: + the file or directory selected to standard error. + + + The following list of options are available for the File Selection dialog: @@ -484,7 +541,24 @@ - + + The following script shows an example of how to use the File Selection dialog: + + + #!/bin/sh + + FILE=`zenity --file-selection --dialog-title="Select a file"' + + case $? in + 0) + echo "\"$FILE\" selected.";; + 1) + echo "No file selected.";; + -1) + echo "No file selected.";; + esac + + @@ -497,8 +571,21 @@ To create a List dialog, use --list. &app; returns the entries of the first columns selected to standard error. If --checklist or --radiolist is used, then &app; will return the entries of the - second columns selected to standard error. The following list of options are also - available for the File Selection dialog: + second columns selected to standard error. + + + + + + With the List dialog, you must specify the number of columns to be displayed by + specifying the column headers. To fill data into this dialog, you may specify + entries column by column, row by row. If you are using a checklist or a radiolist + then your first pieces of data for each row must be either 'TRUE' or 'FALSE'. See + examples below for how to fill data into this dialog. + + + + The following list of options are available for the List dialog: @@ -553,7 +640,17 @@ - + + The following commandline shows an example of how to use the List dialog: + + zenity --list --dialog-title="Choose bugs you wish to view" \ + --text="Select items from the list below." \ + --column="Bug Number" --column="Severity" --column="Description" \ + 992383 Normal "GtkTreeView crashes on multiple selections" \ + 293823 High "GNOME Dictionary does not handle proxy" \ + 393823 Critical "Menu editing does not work in GNOME 2.0" + + @@ -563,8 +660,11 @@ Progress - To create a Progress dialog, use --progress. The following list - of options are also available for the Progress dialog: + To create a Progress dialog, use --progress. + + + + The following list of options are available for the Progress dialog: @@ -607,7 +707,24 @@ - + + The following script shows an example of how to use the Progress dialog: + + #!/bin/sh + ( + echo "10" ; sleep 1 + echo "20" ; sleep 1 + echo "50" ; sleep 1 + echo "75" ; sleep 1 + echo "100" ; sleep 1 + ) | + zenity --progress --dialog-title="Update System Logs" --text="Updating mail logs..." --percentage=0 + + if [ "$?" = -1 ] ; then + zenity --error --text="Update cancelled." + fi + + @@ -617,8 +734,11 @@ Text Information - To create a Text Information dialog, use --text-info. The following list - of options are also available for the Text Information dialog: + To create a Text Information dialog, use --text-info. + + + + The following list of options are available for the Text Information dialog: @@ -633,7 +753,7 @@ --editable - Allow the displayed text to be edited and returned when the dialog is closed. + Allow the displayed text to be edited and returned to standard error when the dialog is closed. @@ -653,7 +773,24 @@ - + + The following script shows an example of how to use the Text Infomation dialog: + + #!/bin/sh + + FILE=`zenity --file-selection --dialog-title="Select a file"' + + case $? in + 0) + zenity --text-info --dialog-title=$FILE --editable 2>/tmp/tmp.txt + + 1) + echo "No file selected.";; + -1) + echo "No file selected.";; + esac + +