Next: , Previous: GtkFileChooser, Up: Top

82 GtkFileChooserButton

A button to launch a file selection dialog

82.1 Overview

The <gtk-file-chooser-button> is a widget that lets the user select a file. It implements the <gtk-file-chooser> interface. Visually, it is a file name with a button to bring up a <gtk-file-chooser-dialog>. The user can then use that dialog to change the file associated with that button. This widget does not support setting the "select-multiple" property to ‘#t’.

       GtkWidget *button;
       button = gtk_file_chooser_button_new (_("Select a file"),
       gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button),

The <gtk-file-chooser-button> supports the <gtk-file-chooser-action>s ‘GTK_FILE_CHOOSER_ACTION_OPEN’ and ‘GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER’.

The <gtk-file-chooser-button> will ellipsize the label, and thus will thus request little horizontal space. To give the button more space, you should call gtk-widget-size-request, gtk-file-chooser-button-set-width-chars, or pack the button in such a way that other interface elements give space to the widget.

82.2 Usage

— Class: <gtk-file-chooser-button>

Derives from <gtk-file-chooser>, <gtk-hbox>.

This class defines the following slots:

The file chooser dialog to use.
Whether the button grabs focus when it is clicked with the mouse
The title of the file chooser dialog.
The desired width of the button widget, in characters.
— Signal on <gtk-file-chooser-button>: file-set


— Function: gtk-file-chooser-button-new (title mchars) (action <gtk-file-chooser-action>) ⇒  (ret <gtk-widget>)

Creates a new file-selecting button widget.

the title of the browse dialog.
the open mode for the widget.
a new button widget.

Since 2.6

— Function: gtk-file-chooser-button-get-title (self <gtk-file-chooser-button>) ⇒  (ret mchars)
— Method: get-title

Retrieves the title of the browse dialog used by button. The returned value should not be modified or freed.

the button widget to examine.
a pointer to the browse dialog's title.

Since 2.6

— Function: gtk-file-chooser-button-set-title (self <gtk-file-chooser-button>) (title mchars)
— Method: set-title

Modifies the title of the browse dialog used by button.

the button widget to modify.
the new browse dialog title.

Since 2.6