gtk.file_chooser_button

Module for [FileChooserButton] class

Types 3

The #GtkFileChooserButton is a widget that lets the user select a file. It implements the #GtkFileChooser interface. Visually, it is a file name with a button to bring up a #GtkFileChooserDialog. The user can then use that dialog to change the file associated with that button. This widget does not support setting the #GtkFileChooser:select-multiple property to true.

Create a button to let the user select a file in /etc

{
 GtkWidget *button;

 button = gtk_file_chooser_button_new (_("Select a file"),
                                       GTK_FILE_CHOOSER_ACTION_OPEN);
 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button),
                                      "/etc");
}

The #GtkFileChooserButton supports the #GtkFileChooserActions [gtk.types.FileChooserAction.Open] and [gtk.types.FileChooserAction.SelectFolder].

The #GtkFileChooserButton will ellipsize the label, and will thus

request little horizontal space. To give the button more space, you should call [gtk.widget.Widget.getPreferredSize], [gtk.file_chooser_button.FileChooserButton.setWidthChars], or pack the button in such a way that other interface elements give space to the widget.

CSS nodes

GtkFileChooserButton has a CSS node with name “filechooserbutton”, containing a subnode for the internal button with name “button” and style class “.file”.

Methods
GType _gType() @property
FileChooserButton self()Returns `this`, for use in `with` statements.
FileChooserButtonGidBuilder builder()Get builder for [gtk.filechooserbutton.FileChooserButton] Returns: New builder object
string title() @propertyGet `title` property. Returns: Title to put on the #GtkFileChooserDialog associated with the button.
void title(string propval) @propertySet `title` property. Params: propval = Title to put on the #GtkFileChooserDialog associated with the button.
int widthChars() @propertyGet `widthChars` property. Returns: The width of the entry and label inside the button, in characters.
void widthChars(int propval) @propertySet `widthChars` property. Params: propval = The width of the entry and label inside the button, in characters.
gtk.file_chooser_button.FileChooserButton newWithDialog(gtk.dialog.Dialog dialog)Creates a #GtkFileChooserButton widget which uses dialog as its file-picking window.
bool getFocusOnClick()Returns whether the button grabs focus when it is clicked with the mouse. See [gtk.filechooserbutton.FileChooserButton.setFocusOnClick]. Returns: true if the button grabs focus when it is clicked w...
string getTitle()Retrieves the title of the browse dialog used by button. The returned value should not be modified or freed. Returns: a pointer to the browse dialog’s title.
int getWidthChars()Retrieves the width in characters of the button widget’s entry and/or label. Returns: an integer width (in characters) that the button will use to size itself.
void setFocusOnClick(bool focusOnClick)Sets whether the button will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed fro...
void setTitle(string title)Modifies the title of the browse dialog used by button.
void setWidthChars(int nChars)Sets the width (in characters) that button will use to n_chars.
gulong connectFileSet(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.file_chooser_button.FileChooserButton))) && Parameters!T.length < 2)Connect to `FileSet` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this(string title, gtk.types.FileChooserAction action)Creates a new file-selecting button widget.
Methods
T dialog(gtk.file_chooser.FileChooser propval)Set `dialog` property. Params: propval = Instance of the #GtkFileChooserDialog associated with the button. Returns: Builder instance for fluent chaining
T title(string propval)Set `title` property. Params: propval = Title to put on the #GtkFileChooserDialog associated with the button. Returns: Builder instance for fluent chaining
T widthChars(int propval)Set `widthChars` property. Params: propval = The width of the entry and label inside the button, in characters. Returns: Builder instance for fluent chaining

Fluent builder for [gtk.file_chooser_button.FileChooserButton]