1<page xmlns="http://projectmallard.org/1.0/"
2      type="topic"
3      id="progress">
4  <info>
5    <link type="guide" xref="index#dialogs"/>
6    <desc>Use the <cmd>--progress</cmd> option.</desc>
7  </info>
8  <title>Progress Dialog</title>
9    <p>
10	Use the <cmd>--progress</cmd> option to create a progress dialog.
11    </p>
12
13    <p>
14      <app>Zenity</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.
15    </p>
16
17    <p>
18	The progress dialog supports the following options:
19    </p>
20
21    <terms>
22
23      <item>
24        <title><cmd>--text</cmd>=<var>text</var></title>
25	  <p>Specifies the text that is displayed in the progress dialog.</p>
26      </item>
27
28      <item>
29        <title><cmd>--percentage</cmd>=<var>percentage</var></title>
30	  <p>Specifies the initial percentage that is set in the progress dialog.</p>
31      </item>
32
33      <item>
34	<title><cmd>--auto-close</cmd></title>
35	  <p>Closes the progress dialog when 100% has been reached.</p>
36      </item>
37
38      <item>
39        <title><cmd>--pulsate</cmd></title>
40	  <p>Specifies that the progress bar pulsates until an EOF character is read from standard input.</p>
41      </item>
42
43    </terms>
44
45    <p>
46      The following example script shows how to create a progress dialog:
47    </p>
48
49<code>
50#!/bin/sh
51(
52echo "10" ; sleep 1
53echo "# Updating mail logs" ; sleep 1
54echo "20" ; sleep 1
55echo "# Resetting cron jobs" ; sleep 1
56echo "50" ; sleep 1
57echo "This line will just be ignored" ; sleep 1
58echo "75" ; sleep 1
59echo "# Rebooting system" ; sleep 1
60echo "100" ; sleep 1
61) |
62zenity --progress \
63  --title="Update System Logs" \
64  --text="Scanning mail logs..." \
65  --percentage=0
66
67if [ "$?" = -1 ] ; then
68        zenity --error \
69          --text="Update canceled."
70fi
71</code>
72
73
74    <figure>
75      <title>Progress Dialog Example</title>
76      <desc><app>Zenity</app> progress dialog example</desc>
77      <media type="image" mime="image/png" src="figures/zenity-progress-screenshot.png"/>
78    </figure>
79</page>
80