Gtk.FileChooserButton

const Gtk = imports.gi.Gtk;

let file_chooser_button = new Gtk.FileChooserButton({
    dialog: value,
    focus_on_click: value,
    title: value,
    width_chars: value,
});
  

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

<example> <title>Create a button to let the user select a file in /etc</title> <programlisting> { 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"); } </programlisting> </example>

The Gtk.FileChooserButton supports the Gtk.FileChooserAction<!-- -->s Gtk.FileChooserAction.open and Gtk.FileChooserAction.select_folder.

<important> The Gtk.FileChooserButton will ellipsize the label, and thus will thus request little horizontal space. To give the button more space, you should call Gtk.get_preferred_size, Gtk.set_width_chars, or pack the button in such a way that other interface elements give space to the widget. </important>

Hierarchy

  • GObject.Object
    • GObject.InitiallyUnowned
      • Gtk.Widget
        • Gtk.Container
          • Gtk.Box
            • Gtk.FileChooserButton