<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" id="file-selection" xml:lang="zh-CN">
  <info>
    <link type="guide" xref="index#dialogs"/>
    <desc>Use the <cmd>--file-selection</cmd> option.</desc>
  </info>
  <title>文件选择对话框</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>文件对话框支持以下选项：</p>

    <terms>

      <item>
        <title><cmd>--filename</cmd>=<var>filename</var></title>
	<p>指定文件选择对话框在第一次显示时，选定的文件或文件夹。</p>
      </item>

      <item>
	<title><cmd>--multiple</cmd></title>
	<p>允许在文件选择对话框里选中多个文件。</p>
      </item>

      <item>
	<title><cmd>--directory</cmd></title>
	<p>在文件选择对话框里只允许选中文件夹</p>
      </item>

      <item>
	<title><cmd>--save</cmd></title>
	<p>设置文件选择对话框模式为保存对话框。</p>
      </item>

      <item>
	<title><cmd>--separator</cmd>=<var>separator</var></title>
	<p>指定用于分隔返回的文件名列表的字符。</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 id="zenity-fileselection-screenshot">
      <title>文件选择对话框范例</title>
      <desc><app>Zenity</app> file selection dialog example</desc>
      <media type="image" mime="image/png" src="figures/zenity-fileselection-screenshot.png"/>
    </figure>
</page>
