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 _getGType() static nothrow
GType _gType() @property nothrow
FileChooserButton self() nothrowReturns `this`, for use in `with` statements.
FileChooserButtonGidBuilder builder() static nothrowGet builder for [gtk.file_chooser_button.FileChooserButton] Returns: New builder object
string title() @property nothrowGet `title` property. Returns: Title to put on the #GtkFileChooserDialog associated with the button.
void title(string propval) @property nothrowSet `title` property. Params: propval = Title to put on the #GtkFileChooserDialog associated with the button.
int widthChars() @property nothrowGet `widthChars` property. Returns: The width of the entry and label inside the button, in characters.
void widthChars(int propval) @property nothrowSet `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) static nothrowCreates a #GtkFileChooserButton widget which uses dialog as its file-picking window.
bool getFocusOnClick() nothrowReturns whether the button grabs focus when it is clicked with the mouse. See [gtk.file_chooser_button.FileChooserButton.setFocusOnClick]. Returns: true if the button grabs focus when it is clicked...
string getTitle() nothrowRetrieves 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() nothrowRetrieves 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) nothrowSets 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) nothrowModifies the title of the browse dialog used by button.
void setWidthChars(int nChars) nothrowSets 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) nothrowConnect to `FileSet` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this(string title, gtk.types.FileChooserAction action)Creates a new file-selecting button widget.

Fluent builder implementation template for gtk.file_chooser_button.FileChooserButton

Methods
T dialog(gtk.file_chooser.FileChooser propval) nothrowSet `dialog` property. Params: propval = Instance of the #GtkFileChooserDialog associated with the button. Returns: Builder instance for fluent chaining
T title(string propval) nothrowSet `title` property. Params: propval = Title to put on the #GtkFileChooserDialog associated with the button. Returns: Builder instance for fluent chaining
T widthChars(int propval) nothrowSet `widthChars` property. Params: propval = The width of the entry and label inside the button, in characters. Returns: Builder instance for fluent chaining