Top | ![]() |
![]() |
![]() |
![]() |
GtkWidget * | gtk_file_chooser_button_new () |
GtkWidget * | gtk_file_chooser_button_new_with_dialog () |
const char * | gtk_file_chooser_button_get_title () |
void | gtk_file_chooser_button_set_title () |
int | gtk_file_chooser_button_get_width_chars () |
void | gtk_file_chooser_button_set_width_chars () |
gboolean | gtk_file_chooser_button_get_modal () |
void | gtk_file_chooser_button_set_modal () |
GtkFileChooser * | dialog | Write / Construct Only |
gboolean | modal | Read / Write |
char * | title | Read / Write |
int | width-chars | Read / Write |
GtkFileChooserButton implements GtkAccessible, GtkBuildable, GtkConstraintTarget and GtkFileChooser.
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
“select-multiple” property to TRUE
.
1 2 3 4 5 6 7 8 9 |
{ GtkWidget *button; GFile *cwd = g_file_new_for_path ("/etc"); button = gtk_file_chooser_button_new (_("Select a file"), GTK_FILE_CHOOSER_ACTION_OPEN); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button), cwd, NULL); g_object_unref (cwd); } |
The GtkFileChooserButton supports the GtkFileChooserActions
GTK_FILE_CHOOSER_ACTION_OPEN
and GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
.
The GtkFileChooserButton will ellipsize the label, and will thus request little horizontal space. To give the button more space, you should call
gtk_widget_get_preferred_size()
,gtk_file_chooser_button_set_width_chars()
, or pack the button in such a way that other interface elements give space to the widget.
GtkWidget * gtk_file_chooser_button_new (const char *title
,GtkFileChooserAction action
);
Creates a new file-selecting button widget.
GtkWidget *
gtk_file_chooser_button_new_with_dialog
(GtkWidget *dialog
);
Creates a GtkFileChooserButton widget which uses dialog
as its
file-picking window.
Note that dialog
must be a GtkDialog (or subclass) which
implements the GtkFileChooser interface and must not have
GTK_DIALOG_DESTROY_WITH_PARENT
set.
Also note that the dialog needs to have its confirmative button
added with response GTK_RESPONSE_ACCEPT
or GTK_RESPONSE_OK
in
order for the button to take over the file selected in the dialog.
const char *
gtk_file_chooser_button_get_title (GtkFileChooserButton *button
);
Retrieves the title of the browse dialog used by button
. The returned value
should not be modified or freed.
void gtk_file_chooser_button_set_title (GtkFileChooserButton *button
,const char *title
);
Modifies the title
of the browse dialog used by button
.
int
gtk_file_chooser_button_get_width_chars
(GtkFileChooserButton *button
);
Retrieves the width in characters of the button
widget’s entry and/or label.
void gtk_file_chooser_button_set_width_chars (GtkFileChooserButton *button
,int n_chars
);
Sets the width (in characters) that button
will use to n_chars
.
gboolean
gtk_file_chooser_button_get_modal (GtkFileChooserButton *button
);
Gets whether the dialog is modal.
void gtk_file_chooser_button_set_modal (GtkFileChooserButton *button
,gboolean modal
);
Sets whether the dialog should be modal.
“dialog”
property“dialog” GtkFileChooser *
Instance of the GtkFileChooserDialog associated with the button.
Owner: GtkFileChooserButton
Flags: Write / Construct Only
“modal”
property “modal” gboolean
Whether to make the dialog modal.
Owner: GtkFileChooserButton
Flags: Read / Write
Default value: TRUE
“title”
property “title” char *
Title to put on the GtkFileChooserDialog associated with the button.
Owner: GtkFileChooserButton
Flags: Read / Write
Default value: "Select a File"
“file-set”
signalvoid user_function (GtkFileChooserButton *widget, gpointer user_data)
The ::file-set signal is emitted when the user selects a file.
Note that this signal is only emitted when the user changes the file.
widget |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First