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_ACTION_OPEN);
       gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button),
                                            "/etc");
     }

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:

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

undocumented

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

Creates a new file-selecting button widget.

title
the title of the browse dialog.
action
the open mode for the widget.
ret
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.

button
the button widget to examine.
ret
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.

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

Since 2.6