1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 File chooser interface used by #GtkFileChooserWidget and #GtkFileChooserDialog.
7 <!-- ##### SECTION Long_Description ##### -->
9 #GtkFileChooser is an interface that can be implemented by file
10 selection widgets. In GTK+, the main objects that implement
11 this interface are #GtkFileChooserWidget and
12 #GtkFileChooserDialog. You do not need to write an object that
13 implements the #GtkFileChooser interface unless you are trying
14 to adapt an existing file selector to expose a standard
15 programming interface.
18 <refsect2 id="gtkfilechooser-preview">
19 <title>Adding a Preview Widget</title>
22 You can add a custom preview widget to a file chooser and then
23 get notification about when the preview needs to be updated.
24 To install a preview widget, use
25 gtk_file_chooser_set_preview_widget(). Then, connect to the
26 #GtkFileChooser::update-preview signal to get notified when
27 you need to update the contents of the preview.
31 Your callback should use
32 gtk_file_chooser_get_preview_filename() to see what needs
33 previewing. Once you have generated the preview for the
34 corresponding file, you must call
35 gtk_file_chooser_set_preview_widget_active() with a boolean
36 flag that indicates whether your callback could successfully
40 <example id="example-gtkfilechooser-preview">
41 <title>Sample Usage</title>
49 preview = gtk_image_new (<!-- -->);
51 gtk_file_chooser_set_preview_widget (my_file_chooser, preview);
52 g_signal_connect (my_file_chooser, "update-preview",
53 G_CALLBACK (update_preview_cb), preview);
57 update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
62 gboolean have_preview;
64 preview = GTK_WIDGET (data);
65 filename = gtk_file_chooser_get_preview_filename (file_chooser);
67 pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL);
68 have_preview = (pixbuf != NULL);
71 gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf);
73 gdk_pixbuf_unref (pixbuf);
75 gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview);
81 <refsect2 id="gtkfilechooser-extra">
82 <title>Adding Extra Widgets</title>
85 You can add extra widgets to a file chooser to provide options
86 that are not present in the default design. For example, you
87 can add a toggle button to give the user the option to open a
88 file in read-only mode. You can use
89 gtk_file_chooser_set_extra_widget() to insert additional
90 widgets in a file chooser.
93 <example id="example-gtkfilechooser-extra">
94 <title>Sample Usage</title>
102 toggle = gtk_check_button_new_with_label ("Open file read-only");
103 gtk_widget_show (toggle);
104 gtk_file_chooser_set_extra_widget (my_file_chooser, toggle);
111 If you want to set more than one extra widget in the file
112 chooser, you can a container such as a GtkVBox or a GtkTable
113 and include your widgets in it. Then, set the container as
114 the whole extra widget.
119 <!-- ##### SECTION See_Also ##### -->
121 #GtkFileChooserDialog, #GtkFileChooserWidget
124 <!-- ##### STRUCT GtkFileChooser ##### -->
130 <!-- ##### SIGNAL GtkFileChooser::current-folder-changed ##### -->
135 @filechooser: the object which received the signal.
137 <!-- ##### SIGNAL GtkFileChooser::file-activated ##### -->
142 @filechooser: the object which received the signal.
144 <!-- ##### SIGNAL GtkFileChooser::selection-changed ##### -->
149 @filechooser: the object which received the signal.
151 <!-- ##### SIGNAL GtkFileChooser::update-preview ##### -->
156 @filechooser: the object which received the signal.
158 <!-- ##### ARG GtkFileChooser:action ##### -->
163 <!-- ##### ARG GtkFileChooser:extra-widget ##### -->
168 <!-- ##### ARG GtkFileChooser:file-system-backend ##### -->
173 <!-- ##### ARG GtkFileChooser:filter ##### -->
178 <!-- ##### ARG GtkFileChooser:local-only ##### -->
183 <!-- ##### ARG GtkFileChooser:preview-widget ##### -->
188 <!-- ##### ARG GtkFileChooser:preview-widget-active ##### -->
193 <!-- ##### ARG GtkFileChooser:select-multiple ##### -->
198 <!-- ##### ARG GtkFileChooser:show-hidden ##### -->
203 <!-- ##### ARG GtkFileChooser:use-preview-label ##### -->
208 <!-- ##### ENUM GtkFileChooserAction ##### -->
210 Describes whether a #GtkFileChooser is being used to open
211 existing files or to save to a possibly new file.
214 @GTK_FILE_CHOOSER_ACTION_OPEN: Indicates open mode. The file chooser
215 will only let the user pick an existing file.
216 @GTK_FILE_CHOOSER_ACTION_SAVE: Indicates save mode. The file chooser
217 will let the user pick an existing file, or type in a new
219 @GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: Indicates an Open mode for
220 selecting folders. The file chooser will let the user pick an
222 @GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER: Indicates a mode for creating a
223 new folder. The file chooser will let the user name an existing or
226 <!-- ##### MACRO GTK_FILE_CHOOSER_ERROR ##### -->
228 Used to get the #GError quark for #GtkFileChooser errors.
233 <!-- ##### ENUM GtkFileChooserError ##### -->
235 These identify the various errors that can occur while calling
236 #GtkFileChooser functions.
239 @GTK_FILE_CHOOSER_ERROR_NONEXISTENT: Indicates that a file does not exist.
240 @GTK_FILE_CHOOSER_ERROR_BAD_FILENAME: Indicates a malformed filename.
242 <!-- ##### FUNCTION gtk_file_chooser_error_quark ##### -->
250 <!-- ##### FUNCTION gtk_file_chooser_set_action ##### -->
259 <!-- ##### FUNCTION gtk_file_chooser_get_action ##### -->
268 <!-- ##### FUNCTION gtk_file_chooser_set_local_only ##### -->
275 <!-- # Unused Parameters # -->
279 <!-- ##### FUNCTION gtk_file_chooser_get_local_only ##### -->
288 <!-- ##### FUNCTION gtk_file_chooser_set_select_multiple ##### -->
297 <!-- ##### FUNCTION gtk_file_chooser_get_select_multiple ##### -->
306 <!-- ##### FUNCTION gtk_file_chooser_set_current_name ##### -->
315 <!-- ##### FUNCTION gtk_file_chooser_get_filename ##### -->
324 <!-- ##### FUNCTION gtk_file_chooser_set_filename ##### -->
333 <!-- ##### FUNCTION gtk_file_chooser_select_filename ##### -->
342 <!-- ##### FUNCTION gtk_file_chooser_unselect_filename ##### -->
351 <!-- ##### FUNCTION gtk_file_chooser_select_all ##### -->
359 <!-- ##### FUNCTION gtk_file_chooser_unselect_all ##### -->
367 <!-- ##### FUNCTION gtk_file_chooser_get_filenames ##### -->
376 <!-- ##### FUNCTION gtk_file_chooser_set_current_folder ##### -->
385 <!-- ##### FUNCTION gtk_file_chooser_get_current_folder ##### -->
394 <!-- ##### FUNCTION gtk_file_chooser_get_uri ##### -->
403 <!-- ##### FUNCTION gtk_file_chooser_set_uri ##### -->
412 <!-- ##### FUNCTION gtk_file_chooser_select_uri ##### -->
421 <!-- ##### FUNCTION gtk_file_chooser_unselect_uri ##### -->
430 <!-- ##### FUNCTION gtk_file_chooser_get_uris ##### -->
439 <!-- ##### FUNCTION gtk_file_chooser_set_current_folder_uri ##### -->
448 <!-- ##### FUNCTION gtk_file_chooser_get_current_folder_uri ##### -->
457 <!-- ##### FUNCTION gtk_file_chooser_set_preview_widget ##### -->
466 <!-- ##### FUNCTION gtk_file_chooser_get_preview_widget ##### -->
475 <!-- ##### FUNCTION gtk_file_chooser_set_preview_widget_active ##### -->
484 <!-- ##### FUNCTION gtk_file_chooser_get_preview_widget_active ##### -->
493 <!-- ##### FUNCTION gtk_file_chooser_get_preview_filename ##### -->
500 <!-- # Unused Parameters # -->
504 <!-- ##### FUNCTION gtk_file_chooser_get_preview_uri ##### -->
511 <!-- # Unused Parameters # -->
515 <!-- ##### FUNCTION gtk_file_chooser_set_extra_widget ##### -->
524 <!-- ##### FUNCTION gtk_file_chooser_get_extra_widget ##### -->
533 <!-- ##### FUNCTION gtk_file_chooser_add_filter ##### -->
542 <!-- ##### FUNCTION gtk_file_chooser_remove_filter ##### -->
551 <!-- ##### FUNCTION gtk_file_chooser_list_filters ##### -->
560 <!-- ##### FUNCTION gtk_file_chooser_set_filter ##### -->
569 <!-- ##### FUNCTION gtk_file_chooser_get_filter ##### -->
578 <!-- ##### FUNCTION gtk_file_chooser_add_shortcut_folder ##### -->
589 <!-- ##### FUNCTION gtk_file_chooser_remove_shortcut_folder ##### -->
600 <!-- ##### FUNCTION gtk_file_chooser_list_shortcut_folders ##### -->
609 <!-- ##### FUNCTION gtk_file_chooser_add_shortcut_folder_uri ##### -->
618 <!-- # Unused Parameters # -->
622 <!-- ##### FUNCTION gtk_file_chooser_remove_shortcut_folder_uri ##### -->
631 <!-- # Unused Parameters # -->
635 <!-- ##### FUNCTION gtk_file_chooser_list_shortcut_folder_uris ##### -->
648 sgml-parent-document: ("../gtk-docs.sgml" "book" "refentry")