1
\alias{gtkFileChooserSetFile}
2
\name{gtkFileChooserSetFile}
3
\title{gtkFileChooserSetFile}
4
\description{Sets \code{file} as the current filename for the file chooser, by changing
5
to the file's parent folder and actually selecting the file in list. If
6
the \code{chooser} is in \code{GTK_FILE_CHOOSER_ACTION_SAVE} mode, the file's base name
7
will also appear in the dialog's file name entry.}
8
\usage{gtkFileChooserSetFile(object, file, .errwarn = TRUE)}
10
\item{\verb{object}}{a \code{\link{GtkFileChooser}}}
11
\item{\verb{file}}{the \code{\link{GFile}} to set as current}
12
\item{.errwarn}{Whether to issue a warning on error or fail silently}
14
\details{If the file name isn't in the current folder of \code{chooser}, then the current
15
folder of \code{chooser} will be changed to the folder containing \code{filename}. This
16
is equivalent to a sequence of \code{\link{gtkFileChooserUnselectAll}} followed by
17
\code{\link{gtkFileChooserSelectFilename}}.
19
Note that the file must exist, or nothing will be done except
20
for the directory change.
22
If you are implementing a \emph{File/Save As...} dialog,
23
you should use this function if you already have a file name to which the
24
user may save; for example, when the user opens an existing file and then
25
does \emph{File/Save As...} on it. If you don't have
26
a file name already -- for example, if the user just created a new
27
file and is saving it for the first time, do not call this function.
28
Instead, use something similar to this:
29
\preformatted{if (document_is_new)
31
/* the user just created a new document */
32
gtk_file_chooser_set_current_folder_file (chooser, default_file_for_saving);
33
gtk_file_chooser_set_current_name (chooser, "Untitled document");
37
/* the user edited an existing document */
38
gtk_file_chooser_set_file (chooser, existing_file);
43
A list containing the following elements:
44
\item{retval}{[logical] \code{TRUE} if both the folder could be changed and the file was
45
selected successfully, \code{FALSE} otherwise.}
46
\item{\verb{error}}{ location to store the error, or \code{NULL} to ignore errors. \emph{[ \acronym{allow-none} ]}}
48
\author{Derived by RGtkGen from GTK+ documentation}