summaryrefslogtreecommitdiff
path: root/help/C/zenity.xml
blob: 66c99a0daf0b94c6e92c895f2ef72f71a220c771 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
  <!ENTITY author1 "Sun">
  <!ENTITY author2 "Java Desktop System Documentation Team">
  <!ENTITY publisher "Sun Microsystems, Inc.">
  <!ENTITY legal SYSTEM "legal.xml">
  <!ENTITY appversion "2.6.0">
  <!ENTITY app "<application>Zenity</application>">
  <!ENTITY appname "Zenity">
  <!ENTITY date "August 2004">
  <!ENTITY manrevision "2.0">
]>

<!-- ================ Document Header ================= -->

<article id="index" lang="en">

  <articleinfo>
    <title>&appname;</title>
    <subtitle>&appname; Desktop Application Manual V&manrevision;</subtitle>
    <copyright>
	    <year>2003</year>
	    <year>2004</year>
	    <holder>&publisher;</holder>
    </copyright>

    <!-- Translators: uncomment this
    <copyright>
	    <year>2004</year>
	    <holder>ME_THE_TRANSLATOR</holder>
    </copyright>
    -->

    <publisher>
	    <publishername>&publisher;</publishername>
    </publisher>

    &legal;


    <authorgroup>
      <author>
        <firstname>&author1;</firstname>
        <surname>&author2;</surname>
        <affiliation><orgname>&publisher;</orgname></affiliation>
      </author>
      <author>
        <firstname>Glynn</firstname>
        <surname>Foster</surname>
        <affiliation>
          <orgname>GNOME Documentation Project</orgname>
        </affiliation>
      </author>
      <editor>
        <firstname>Nicholas</firstname>
        <surname>Curran</surname>
        <affiliation>
          <orgname>GNOME Documentation Project</orgname>
        </affiliation>
      </editor>
    </authorgroup>

    <revhistory>
      <revision>
        <revnumber>&appname; Desktop Application Manual V&manrevision;</revnumber>
        <date>&date;</date>
        <revdescription>
          <para role="author">&author1; &author2;</para>
          <para role="publisher">&publisher;</para>
        </revdescription>
      </revision>

      <revision>
        <revnumber>Zenity Manual V1.0</revnumber>
        <date>January 2003</date>
        <revdescription>
          <para role="author">Glynn Foster</para>
          <para role="publisher"> GNOME Documentation Project </para>
        </revdescription>
      </revision>
    </revhistory>

    <releaseinfo>This manual describes version &appversion; of &appname;.
    </releaseinfo>

    <legalnotice>
	    <title>Feedback</title>
	    <para>
              To send feedback, follow the directions in the <ulink url="ghelp:gnome-feedback" type="help">Feedback Page</ulink>.
	    </para>
<!-- Translators may also add here feedback address for translations -->

    </legalnotice>
  </articleinfo>
  
  <indexterm>
    <primary>zenity command</primary>
  </indexterm>
  <indexterm>
    <primary>dialog creator</primary>
  </indexterm>
<!-- ================ Document Body ================= -->

<!-- ==== Introduction ====== -->

  <sect1 id="zenity-introduction">
    <title>Introduction</title>

    <para>
        &app; enables you to create the following types of simple dialog:
    </para>

    <itemizedlist>
        <listitem><para>Calendar</para></listitem>
	<listitem><para>File selection</para></listitem>
	<listitem><para>List</para></listitem>
        <listitem><para>Message</para>
            <itemizedlist>
	        <listitem><para>Error</para></listitem>
		<listitem><para>Information</para></listitem>
		<listitem><para>Question</para></listitem>
		<listitem><para>Warning</para></listitem>
	    </itemizedlist>
	</listitem>
	<listitem><para>Progress</para></listitem>
        <listitem><para>Text entry</para></listitem>
	<listitem><para>Text information</para></listitem>
    </itemizedlist>

  </sect1>

<!-- ==== Usage ====== -->

  <sect1 id="zenity-usage">
    <title>Usage</title>

    <para>
	When you write scripts, you can use &app; to create simple dialogs that interact graphically with the user, as follows:
    </para>
    <itemizedlist>
      <listitem>
        <para>
	    You can create a dialog to obtain information from the user. For example, you can prompt the user to select a date from a calendar dialog, or to select a file from a file selection dialog.
        </para>
      </listitem>
      <listitem>
        <para>
	    You can create a dialog to provide the user with information. For example, you can use a progress dialog to indicate the current status of an operation, or use a warning message dialog to alert the user.
        </para>
      </listitem>
    </itemizedlist>
    <para>
	When the user closes the dialog, &app; prints the text produced by the dialog to standard error.
    </para>

    <note>
      <para>
        When you write &app; commands, ensure that you place quotation marks around each argument. 
      </para>
      <para>
        For example, use: <screen><userinput><command>zenity --calendar --title="Holiday Planner"</command></userinput></screen> Do not use: <screen><userinput><command>zenity --calendar --title=Holiday Planner</command></userinput></screen>
      </para>
      <para>
	If you do not use quotation marks, you might get unexpected results.
      </para>
    </note>

    <sect2 id="zenity-usage-mnemonics">
      <title>Access Keys</title>
	<para>
	  An access key is a key that enables you to perform an action from the keyboard rather than use the mouse to choose a command from a menu or dialog. Each access key is identified by an underlined letter on a menu or dialog option.
	</para>
	<para>
          Some &app; dialogs support the use of access keys. To specify the character to use as the access key, place an underscore before that character in the text of the dialog. The following example shows how to specify the letter 'C' as the access key:
	</para>
	<screen><userinput>"_Choose a name".</userinput></screen>
    </sect2>

    <sect2 id="zenity-usage-exitcodes">
      <title>Exit Codes</title>
    <para>
        &app; returns the following exit codes:
    </para>

    <informaltable frame="all">
      <tgroup cols="2" colsep="1" rowsep="1">
        <colspec colname="COLSPEC0" colwidth="50*"/>
        <colspec colname="COLSPEC1" colwidth="50*"/>
        <thead>
          <row valign="top">
            <entry colname="COLSPEC0">
              <para>Exit Code</para></entry>
            <entry colname="COLSPEC1">
              <para>Description</para></entry>
          </row>
        </thead>
        <tbody>
          <row valign="top">
            <entry>
              <para><varname>0</varname></para>
            </entry>
            <entry>
              <para>The user has pressed either <guibutton>OK</guibutton> or <guibutton>Close</guibutton>.</para>
            </entry>
          </row>
          <row valign="top">
            <entry>
              <para><varname>1</varname></para>
            </entry>
            <entry>
              <para>The user has either pressed <guibutton>Cancel</guibutton>, or used the window functions to close the dialog.</para>
            </entry>
          </row>
          <row valign="top">
            <entry>
              <para><varname>-1</varname></para>
            </entry>
            <entry>
              <para>An unexpected error has occurred.</para>
            </entry>
          </row>
        </tbody>
      </tgroup>
    </informaltable>

    </sect2>


  <!-- ==== General Options ====== -->

  <sect2 id="zenity-usage-general-options">
    <title>General Options</title>

    <para>
	All &app; dialogs support the following general options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--title</option>=<replaceable>title</replaceable></term>
	<listitem>
	  <para>Specifies the title of a dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--window-icon</option>=<replaceable>icon_path</replaceable></term>
	<listitem>
	  <para>Specifies the icon that is displayed in the window frame of the dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--width</option>=<replaceable>width</replaceable></term>
	<listitem>
	  <para>Specifies the width of the dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--height</option>=<replaceable>height</replaceable></term>
	<listitem>
	  <para>Specifies the height of the dialog.</para>
	</listitem>
      </varlistentry>

    </variablelist>

  </sect2>

<!-- ==== Miscellaneous Options ====== -->

  <sect2 id="zenity-help-options">
    <title>Help Options</title>

    <para>
	&app; provides the following help options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--help</option></term>
	<listitem>
	  <para>Displays help text. You can also use -? to specify this option.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--usage</option></term>
	<listitem>
	  <para>Displays brief usage text.</para>
	</listitem>
      </varlistentry>

    </variablelist>

  </sect2>

<!-- ==== Miscellaneous Options ====== -->

  <sect2 id="zenity-miscellaneous-options">
    <title>Miscellaneous Options</title>

    <para>
	&app; also provides the following miscellaneous options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--about</option></term>
	<listitem>
	  <para>Displays the <guilabel>About &appname;</guilabel> dialog, which contains &app; version information, copyright information, and developer information.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--version</option></term>
	<listitem>
	  <para>Displays the version number of &app;.</para>
	</listitem>
      </varlistentry>

    </variablelist>

  </sect2>

<!-- ==== GTK+ Options ====== -->

  <sect2 id="zenity-gtk-options">
    <title>GTK+ Options</title>

    <para>
	&app; supports the standard GTK+ options. For more information about the GTK+ options, execute the <command>zenity -?</command> command.
    </para>

  </sect2>

  </sect1>
<!-- ==== Calendar Options ====== -->

  <sect1 id="zenity-calendar-options">
    <title>Calendar Dialog</title>

    <para>
        Use the <option>--calendar</option> option to create a calendar dialog. &app; returns the selected date to standard error. If no date is specified on the command line, the dialog uses the current date.
    </para>
    <para>
	The calendar dialog supports the following options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--text</option>=<replaceable>text</replaceable></term>
	<listitem>
	  <para>Specifies the text that is displayed in the calendar dialog.</para>
	</listitem>
      </varlistentry>
     	
      <varlistentry>
        <term><option>--day</option>=<replaceable>day</replaceable></term>
	<listitem>
	  <para>Specifies the day that is selected in the calendar dialog. <replaceable>day</replaceable> must be a number between 1 and 31 inclusive.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--month</option>=<replaceable>month</replaceable></term>
	<listitem>
	  <para>Specifies the month that is selected in the calendar dialog. <replaceable>month</replaceable> must be a number between 1 and 12 inclusive.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--year</option>=<replaceable>year</replaceable></term>
	<listitem>
	  <para>Specifies the year that is selected in the calendar dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--date-format</option>=<replaceable>format</replaceable></term>
	<listitem>
	  <para>Specifies the format that is returned from the calendar dialog after date selection. The default format depends on your locale. <replaceable>format</replaceable> must be a format that is acceptable to the <command>strftime</command> function, for example <literal>%A %d/%m/%y</literal>.
	  </para>
	</listitem>
      </varlistentry>

    </variablelist>

    <para>
      The following example script shows how to create a calendar dialog:

      <programlisting>
        #!/bin/sh


        if zenity --calendar \
        --title="Select a Date" \
        --text="Click on a date to select that date." \
        --day=10 --month=8 --year=2004
          then echo $?
          else echo "No date selected"
        fi
      </programlisting>

    </para>

    <figure id="zenity-calendar-screenshot">
      <title>Calendar Dialog Example</title>
      <screenshot>
        <mediaobject>
          <imageobject>
              <imagedata fileref="figures/zenity-calendar-screenshot.png" format="PNG"/>
          </imageobject>
          <textobject>
              <phrase>&app; calendar dialog example</phrase>
          </textobject>
        </mediaobject>
      </screenshot>
   </figure>
													  
  </sect1>


<!-- ==== File Selection Options ====== -->

  <sect1 id="zenity-file-selection-options">
    <title>File Selection Dialog</title>

    <para>
	Use the <option>--file-selection</option> option to create a file selection dialog. &app; returns the selected files or directories to standard error. 
    </para>
    <para>
	The file selection dialog supports the following options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--filename</option>=<replaceable>filename</replaceable></term>
	<listitem>
	  <para>Specifies the file or directory that is selected in the file selection dialog when the dialog is first shown.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term><option>--multiple</option></term>
	<listitem>
	  <para>Allows the selection of multiple filenames in the file selection dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term><option>--separator</option>=<replaceable>separator</replaceable></term>
	<listitem>
	  <para>Specifies the string that is used to divide the returned list of filenames.</para>
	</listitem>
      </varlistentry>

    </variablelist>

    <para>
      The following example script shows how to create a file selection dialog:

      <programlisting>
        #!/bin/sh

        FILE=`zenity --file-selection --title="Select a File"`

        case $? in
                 0)
                        echo "\"$FILE\" selected.";;
                 1)
                        echo "No file selected.";;
                -1)
                        echo "No file selected.";;
        esac
      </programlisting>
    </para>

    <figure id="zenity-fileselection-screenshot">
      <title>File Selection Dialog Example</title>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/zenity-fileselection-screenshot.png" format="PNG"/>
	  </imageobject>
	  <textobject>
	    <phrase>&app; file selection dialog example</phrase>
	  </textobject>
        </mediaobject>
      </screenshot>
    </figure>

  </sect1>

<!-- ==== List Options ====== -->

  <sect1 id="zenity-list-options">
    <title>List Dialog</title>

    <para>
	Use the <option>--list</option> option to create a list dialog. &app; returns the entries in the first column of text of selected rows to standard error.
    </para>

    <para>
	Data for the dialog must specified column by column, row by row. Data can be provided to the dialog through standard input. Each entry must be separated by a newline character.
    </para>

    <para>
	If you use the <option>--checklist</option> or <option>--radiolist</option> options, each row must start with either 'TRUE' or 'FALSE'.
    </para>

    <para>
	The list dialog supports the following options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--column</option>=<replaceable>column</replaceable></term>
	<listitem>
	  <para>Specifies the column headers that are displayed in the list dialog. You must specify a <option>--column</option> option for each column that you want to display in the dialog.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--checklist</option></term>
	<listitem>
	  <para>Specifies that the first column in the list dialog contains check boxes.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--radiolist</option></term>
	<listitem>
	  <para>Specifies that the first column in the list dialog contains radio boxes.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--editable</option></term>
	<listitem>
	  <para>Allows the displayed items to be edited.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--separator</option>=<replaceable>separator</replaceable></term>
	<listitem>
	  <para>Specifies what string is used when the list dialog returns the selected entries.
	  </para>
	</listitem>
      </varlistentry>

    </variablelist>

    <para>
      The following example script shows how to create a list dialog:
      <programlisting>
        #!/bin/sh

        zenity --list \
          --title="Choose the Bugs You Wish to View" \
          --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"
      </programlisting>

    </para>

    <figure id="zenity-list-screenshot">
      <title>List Dialog Example</title>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/zenity-list-screenshot.png" format="PNG"/>
	  </imageobject>
	  <textobject>
	    <phrase>&app; list dialog example</phrase>
	  </textobject>
        </mediaobject>
      </screenshot>
    </figure>

  </sect1>

<!-- ==== Message Options ====== -->

  <sect1 id="zenity-message-options">
    <title>Message Dialogs</title>

    <para>
        &app; can create four types of message dialog: 
    </para>
    <itemizedlist>
      <listitem>
        <para>Error</para>
      </listitem>
      <listitem>
        <para>Information</para>
      </listitem>
      <listitem>
        <para>Question</para>
      </listitem>
      <listitem>
        <para>Warning</para>
      </listitem>
    </itemizedlist>

    <para>
For each type, use the <option>--text</option> option to specify the text that is displayed in the dialog.
    </para>

    <sect2 id="zenity-error-dialog">
      <title>Error Dialog</title>

      <para>
          Use the <option>--error</option> option to create an error dialog.  
      </para>

      <para>
        The following example script shows how to create an error dialog:

        <programlisting>
          #!/bin/bash

          zenity --error \
          --text="Could not find /var/log/syslog."
        </programlisting>

      </para>

      <figure id="zenity-error-screenshot">
        <title>Error Dialog Example</title>
        <screenshot>
          <mediaobject>
            <imageobject>
              <imagedata fileref="figures/zenity-error-screenshot.png" format="PNG"/>
	    </imageobject>
	    <textobject>
	      <phrase>&app; error dialog example</phrase>
	    </textobject>
          </mediaobject>
        </screenshot>
      </figure>
    </sect2>

    <sect2 id="zenity-info-dialog">
      <title>Information Dialog</title>

      <para>
          Use the <option>--info</option> option to create an information dialog.
      </para>

      <para>
        The following example script shows how to create an information dialog:

        <programlisting>
          #!/bin/bash

          zenity --info \
          --text="Merge complete. Updated 3 of 10 files."
        </programlisting>

      </para>

      <figure id="zenity-information-screenshot">
        <title>Information Dialog Example</title>
        <screenshot>
          <mediaobject>
            <imageobject>
              <imagedata fileref="figures/zenity-information-screenshot.png" format="PNG"/>
	    </imageobject>
	    <textobject>
	      <phrase>&app; information dialog example</phrase>
	    </textobject>
          </mediaobject>
        </screenshot>
      </figure>
    </sect2>

    <sect2 id="zenity-question-dialog">
      <title>Question Dialog</title>

      <para>
          Use the <option>--question</option> option to create a question dialog.
      </para>

      <para>
        The following example script shows how to create a question dialog:

        <programlisting>
          #!/bin/bash

          zenity --question \
          --text="Are you sure you wish to proceed?"
        </programlisting>

      </para>

      <figure id="zenity-question-screenshot">
        <title>Question Dialog Example</title>
        <screenshot>
          <mediaobject>
            <imageobject>
              <imagedata fileref="figures/zenity-question-screenshot.png" format="PNG"/>
	    </imageobject>
	    <textobject>
	      <phrase>&app; question dialog example</phrase>
	    </textobject>
          </mediaobject>
        </screenshot>
      </figure>
    </sect2>

    <sect2 id="zenity-warning-dialog">
      <title>Warning Dialog</title>

      <para>
          Use the <option>--warning</option> option to create a warning dialog.
      </para>

      <para>
        The following example script shows how to create a warning dialog:

        <programlisting>
          #!/bin/bash
        
          zenity --warning \
          --text="Disconnect the power cable to avoid electrical shock."
        </programlisting>

      </para>

      <figure id="zenity-warning-screenshot">
        <title>Warning Dialog Example</title>
        <screenshot>
          <mediaobject>
            <imageobject>
              <imagedata fileref="figures/zenity-warning-screenshot.png" format="PNG"/>
	    </imageobject>
	    <textobject>
	      <phrase>&app; warning dialog example</phrase>
	    </textobject>
          </mediaobject>
        </screenshot>
      </figure>
    </sect2>

  </sect1>

<!-- ==== Progress Options ====== -->

  <sect1 id="zenity-progress-options">
    <title>Progress Dialog</title>

    <para>
	Use the <option>--progress</option> option to create a progress dialog. 
    </para>

    <para>
      &app; reads data from standard input line by line. If a line is prefixed with #, the text is updated with the text on that line. If a line contains only a number, the percentage is updated with that number.
    </para>
	
    <para>
	The progress dialog supports the following options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--text</option>=<replaceable>text</replaceable></term>
	<listitem>
	  <para>Specifies the text that is displayed in the progress dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--percentage</option>=<replaceable>percentage</replaceable></term>
	<listitem>
	  <para>Specifies the initial percentage that is set in the progress dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term><option>--auto-close</option></term>
	<listitem>
	  <para>Closes the progress dialog when 100% has been reached.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--pulsate</option></term>
	<listitem>
	  <para>Specifies that the progress bar pulsates until an EOF character is read from standard input.</para>
	</listitem>
      </varlistentry>

    </variablelist>

    <para>
      The following example script shows how to create a progress dialog:
      <programlisting>
        #!/bin/sh
        (
        echo "10" ; sleep 1
        echo "# Updating mail logs" ; sleep 1
        echo "20" ; sleep 1
        echo "# Resetting cron jobs" ; sleep 1
        echo "50" ; sleep 1
        echo "This line will just be ignored" ; sleep 1
        echo "75" ; sleep 1
        echo "# Rebooting system" ; sleep 1
        echo "100" ; sleep 1
        ) |
        zenity --progress \
          --title="Update System Logs" \
          --text="Scanning mail logs..." \
          --percentage=0

        if [ "$?" = -1 ] ; then
                zenity --error \
                  --text="Update canceled."
        fi

      </programlisting>

    </para>

    <figure id="zenity-progress-screenshot">
      <title>Progress Dialog Example</title>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/zenity-progress-screenshot.png" format="PNG"/>
	  </imageobject>
	  <textobject>
	    <phrase>&app; progress dialog example</phrase>
	  </textobject>
        </mediaobject>
      </screenshot>
    </figure>

  </sect1>

<!-- ==== Text Entry Options ====== -->

  <sect1 id="zenity-text-entry-options">
    <title>Text Entry Dialog</title>

    <para>
        Use the <option>-entry</option> option to create a text entry dialog. &app; returns the contents of the text entry to standard error. 
    </para>	
    <para>	
	The text entry dialog supports the following options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--text</option>=<replaceable>text</replaceable></term>
	<listitem>
	  <para>Specifies the text that is displayed in the text entry dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--entry-text</option>=<replaceable>text</replaceable></term>
	<listitem>
	  <para>Specifies the text that is displayed in the entry field of the text entry dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--hide-text</option></term>
	<listitem>
	  <para>Hides the text in the entry field of the text entry dialog.</para>
	</listitem>
      </varlistentry>

    </variablelist>

    <para>
      The following example script shows how to create a text entry dialog:

      <programlisting>
        #!/bin/sh

        if zenity --entry \
        --title="Add an Entry" \
        --text="Enter your _password:" \
        --entry-text "password" \
        --hide-text
          then echo $?
          else echo "No password entered"
        fi
      </programlisting>

    </para>

    <figure id="zenity-entry-screenshot">
      <title>Text Entry Dialog Example</title>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/zenity-entry-screenshot.png" format="PNG"/>
	  </imageobject>
	  <textobject>
	    <phrase>&app; text entry dialog example</phrase>
	  </textobject>
        </mediaobject>
      </screenshot>
    </figure>
  </sect1>

<!-- ==== Text Information Options ====== -->

  <sect1 id="zenity-text-options">
    <title>Text Information Dialog</title>

    <para>
	Use the <option>--text-info</option> option to create a text information dialog. 
    </para>
	
    <para>
	The text information dialog supports the following options:
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--filename</option>=<replaceable>filename</replaceable></term>
	<listitem>
	  <para>Specifies a file that is loaded in the text information dialog.</para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--editable</option></term>
        <listitem>
          <para>Allows the displayed text to be edited. The edited text is returned to standard error when the dialog is closed.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para>
      The following example script shows how to create a text information dialog:
      <programlisting>
        #!/bin/sh

        FILE=`zenity --file-selection \
          --title="Select a File"`

        case $? in
                 0)
                        zenity --text-info \
                          --title=$FILE \
                          --filename=$FILE \
                          --editable 2>/tmp/tmp.txt;;
                 1)
                        echo "No file selected.";;
                -1)
                        echo "No file selected.";;
        esac
      </programlisting>

    </para>

    <figure id="zenity-text-screenshot">
      <title>Text Information Dialog Example</title>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/zenity-text-screenshot.png" format="PNG"/>
	  </imageobject>
	  <textobject>
	    <phrase>&app; text information dialog example</phrase>
	  </textobject>
        </mediaobject>
      </screenshot>
    </figure>

  </sect1>

</article>
bgstack15