summaryrefslogtreecommitdiff
path: root/help/C/file-selection.page
blob: ed1a4bbae1d657783f6e9d035410c34a1c22ba5d (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
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      id="file-selection">
  <info>
    <link type="guide" xref="index#dialogs"/>
    <desc>Use the <cmd>--file-selection</cmd> option.</desc>
    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude" />
  </info>
  <title>File Selection Dialog</title>
    <p>
	Use the <cmd>--file-selection</cmd> option to create a file selection dialog. <app>Zenity</app> returns the selected files or directories to standard 
        output. The default mode of the file selection dialog is open.
    </p>
    <p>
	The file selection dialog supports the following options:
    </p>

    <terms>

      <item>
        <title><cmd>--filename</cmd>=<var>filename</var></title>
	<p>Specifies the file or directory that is selected in the file selection dialog when the dialog is first shown.</p>
      </item>

      <item>
	<title><cmd>--multiple</cmd></title>
	<p>Allows the selection of multiple filenames in the file selection dialog.</p>
      </item>

      <item>
	<title><cmd>--directory</cmd></title>
	<p>Allows only selection of directories in the file selection dialog.</p>
      </item>

      <item>
	<title><cmd>--save</cmd></title>
	<p>Set the file selection dialog into save mode.</p>
      </item>

      <item>
	<title><cmd>--separator</cmd>=<var>separator</var></title>
	<p>Specifies the string that is used to divide the returned list of filenames.</p>
      </item>

    </terms>

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

<code>
#!/bin/sh

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

case $? in
         0)
                echo "\"$FILE\" selected.";;
         1)
                echo "No file selected.";;
        -1)
                echo "An unexpected error has occurred.";;
esac
</code>

    <figure>
      <title>File Selection Dialog Example</title>
      <desc><app>Zenity</app> file selection dialog example</desc>
      <media type="image" mime="image/png" src="figures/zenity-fileselection-screenshot.png"/>
    </figure>
</page>
bgstack15