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 <refsect2 id="gtkfilechooser-key-bindings">
120 <title>Key Bindings</title>
123 Internally, GTK+ implements a file chooser's graphical user
124 interface with the private
125 <classname>GtkFileChooserDefaultClass</classname>. This
126 widget has several <link linkend="gtk-Bindings"">key
127 bindings</link> and their associated signals. This section
128 describes the available key binding signals.
131 <refsect3 id="GtkFileChooserDefault-location-popup">
132 <title>The "GtkFileChooserDefault::location-popup" signal</title>
135 void user_function (GtkFileChooserDefault *chooser,
136 <link linkend="gpointer">gpointer</link> user_data);
140 This is used to make the file chooser show a "Location"
141 dialog which the user can use to manually type the name of
142 the file he wishes to select. By default this is bound to
143 <keycombo><keycap>Control</keycap><keycap>L</keycap></keycombo>.
146 <variablelist role="params">
148 <term><parameter>chooser</parameter> :</term>
151 the object which received the signal.
156 <term><parameter>user_data</parameter> :</term>
159 user data set when the signal handler was connected.
166 <refsect3 id="GtkFileChooserDefault-up-folder">
167 <title>The "GtkFileChooserDefault::up-folder" signal</title>
170 void user_function (GtkFileChooserDefault *chooser,
171 <link linkend="gpointer">gpointer</link> user_data);
175 This is used to make the file chooser go to the parent of
176 the current folder in the file hierarchy. By default this
178 <keycombo><keycap>Alt</keycap><keycap>Up</keycap></keycombo>.
181 <variablelist role="params">
183 <term><parameter>chooser</parameter> :</term>
186 the object which received the signal.
191 <term><parameter>user_data</parameter> :</term>
194 user data set when the signal handler was connected.
201 <refsect3 id="GtkFileChooserDefault-down-folder">
202 <title>The "GtkFileChooserDefault::down-folder" signal</title>
205 void user_function (GtkFileChooserDefault *chooser,
206 <link linkend="gpointer">gpointer</link> user_data);
210 This is used to make the file chooser go to a child of the
211 current folder in the file hierarchy. The subfolder that
212 will be used is displayed in the path bar widget of the file
213 chooser. For example, if the path bar is showing
214 "/foo/<emphasis>bar/</emphasis>baz", then this will cause
215 the file chooser to switch to the "baz" subfolder. By
216 default this is bound to
217 <keycombo><keycap>Alt</keycap><keycap>Down</keycap></keycombo>.
220 <variablelist role="params">
222 <term><parameter>chooser</parameter> :</term>
225 the object which received the signal.
230 <term><parameter>user_data</parameter> :</term>
233 user data set when the signal handler was connected.
240 <refsect3 id="GtkFileChooserDefault-home-folder">
241 <title>The "GtkFileChooserDefault::home-folder" signal</title>
244 void user_function (GtkFileChooserDefault *chooser,
245 <link linkend="gpointer">gpointer</link> user_data);
249 This is used to make the file chooser show the user's home
250 folder in the file list. By default this is bound to
251 <keycombo><keycap>Alt</keycap><keycap>Home</keycap></keycombo>.
254 <variablelist role="params">
256 <term><parameter>chooser</parameter> :</term>
259 the object which received the signal.
264 <term><parameter>user_data</parameter> :</term>
267 user data set when the signal handler was connected.
275 <!-- ##### SECTION See_Also ##### -->
277 #GtkFileChooserDialog, #GtkFileChooserWidget
280 <!-- ##### STRUCT GtkFileChooser ##### -->
286 <!-- ##### SIGNAL GtkFileChooser::current-folder-changed ##### -->
291 @filechooser: the object which received the signal.
293 <!-- ##### SIGNAL GtkFileChooser::file-activated ##### -->
298 @filechooser: the object which received the signal.
300 <!-- ##### SIGNAL GtkFileChooser::selection-changed ##### -->
305 @filechooser: the object which received the signal.
307 <!-- ##### SIGNAL GtkFileChooser::update-preview ##### -->
312 @filechooser: the object which received the signal.
314 <!-- ##### ARG GtkFileChooser:action ##### -->
319 <!-- ##### ARG GtkFileChooser:extra-widget ##### -->
324 <!-- ##### ARG GtkFileChooser:file-system-backend ##### -->
329 <!-- ##### ARG GtkFileChooser:filter ##### -->
334 <!-- ##### ARG GtkFileChooser:local-only ##### -->
339 <!-- ##### ARG GtkFileChooser:preview-widget ##### -->
344 <!-- ##### ARG GtkFileChooser:preview-widget-active ##### -->
349 <!-- ##### ARG GtkFileChooser:select-multiple ##### -->
354 <!-- ##### ARG GtkFileChooser:show-hidden ##### -->
359 <!-- ##### ARG GtkFileChooser:use-preview-label ##### -->
364 <!-- ##### ENUM GtkFileChooserAction ##### -->
366 Describes whether a #GtkFileChooser is being used to open
367 existing files or to save to a possibly new file.
370 @GTK_FILE_CHOOSER_ACTION_OPEN: Indicates open mode. The file chooser
371 will only let the user pick an existing file.
372 @GTK_FILE_CHOOSER_ACTION_SAVE: Indicates save mode. The file chooser
373 will let the user pick an existing file, or type in a new
375 @GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: Indicates an Open mode for
376 selecting folders. The file chooser will let the user pick an
378 @GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER: Indicates a mode for creating a
379 new folder. The file chooser will let the user name an existing or
382 <!-- ##### MACRO GTK_FILE_CHOOSER_ERROR ##### -->
384 Used to get the #GError quark for #GtkFileChooser errors.
389 <!-- ##### ENUM GtkFileChooserError ##### -->
391 These identify the various errors that can occur while calling
392 #GtkFileChooser functions.
395 @GTK_FILE_CHOOSER_ERROR_NONEXISTENT: Indicates that a file does not exist.
396 @GTK_FILE_CHOOSER_ERROR_BAD_FILENAME: Indicates a malformed filename.
398 <!-- ##### FUNCTION gtk_file_chooser_error_quark ##### -->
406 <!-- ##### FUNCTION gtk_file_chooser_set_action ##### -->
415 <!-- ##### FUNCTION gtk_file_chooser_get_action ##### -->
424 <!-- ##### FUNCTION gtk_file_chooser_set_local_only ##### -->
431 <!-- # Unused Parameters # -->
435 <!-- ##### FUNCTION gtk_file_chooser_get_local_only ##### -->
444 <!-- ##### FUNCTION gtk_file_chooser_set_select_multiple ##### -->
453 <!-- ##### FUNCTION gtk_file_chooser_get_select_multiple ##### -->
462 <!-- ##### FUNCTION gtk_file_chooser_set_current_name ##### -->
471 <!-- ##### FUNCTION gtk_file_chooser_get_filename ##### -->
480 <!-- ##### FUNCTION gtk_file_chooser_set_filename ##### -->
490 <!-- ##### FUNCTION gtk_file_chooser_select_filename ##### -->
500 <!-- ##### FUNCTION gtk_file_chooser_unselect_filename ##### -->
509 <!-- ##### FUNCTION gtk_file_chooser_select_all ##### -->
517 <!-- ##### FUNCTION gtk_file_chooser_unselect_all ##### -->
525 <!-- ##### FUNCTION gtk_file_chooser_get_filenames ##### -->
534 <!-- ##### FUNCTION gtk_file_chooser_set_current_folder ##### -->
544 <!-- ##### FUNCTION gtk_file_chooser_get_current_folder ##### -->
553 <!-- ##### FUNCTION gtk_file_chooser_get_uri ##### -->
562 <!-- ##### FUNCTION gtk_file_chooser_set_uri ##### -->
572 <!-- ##### FUNCTION gtk_file_chooser_select_uri ##### -->
582 <!-- ##### FUNCTION gtk_file_chooser_unselect_uri ##### -->
591 <!-- ##### FUNCTION gtk_file_chooser_get_uris ##### -->
600 <!-- ##### FUNCTION gtk_file_chooser_set_current_folder_uri ##### -->
610 <!-- ##### FUNCTION gtk_file_chooser_get_current_folder_uri ##### -->
619 <!-- ##### FUNCTION gtk_file_chooser_set_preview_widget ##### -->
628 <!-- ##### FUNCTION gtk_file_chooser_get_preview_widget ##### -->
637 <!-- ##### FUNCTION gtk_file_chooser_set_preview_widget_active ##### -->
646 <!-- ##### FUNCTION gtk_file_chooser_get_preview_widget_active ##### -->
655 <!-- ##### FUNCTION gtk_file_chooser_set_use_preview_label ##### -->
664 <!-- ##### FUNCTION gtk_file_chooser_get_use_preview_label ##### -->
673 <!-- ##### FUNCTION gtk_file_chooser_get_preview_filename ##### -->
680 <!-- # Unused Parameters # -->
684 <!-- ##### FUNCTION gtk_file_chooser_get_preview_uri ##### -->
691 <!-- # Unused Parameters # -->
695 <!-- ##### FUNCTION gtk_file_chooser_set_extra_widget ##### -->
704 <!-- ##### FUNCTION gtk_file_chooser_get_extra_widget ##### -->
713 <!-- ##### FUNCTION gtk_file_chooser_add_filter ##### -->
722 <!-- ##### FUNCTION gtk_file_chooser_remove_filter ##### -->
731 <!-- ##### FUNCTION gtk_file_chooser_list_filters ##### -->
740 <!-- ##### FUNCTION gtk_file_chooser_set_filter ##### -->
749 <!-- ##### FUNCTION gtk_file_chooser_get_filter ##### -->
758 <!-- ##### FUNCTION gtk_file_chooser_add_shortcut_folder ##### -->
769 <!-- ##### FUNCTION gtk_file_chooser_remove_shortcut_folder ##### -->
780 <!-- ##### FUNCTION gtk_file_chooser_list_shortcut_folders ##### -->
789 <!-- ##### FUNCTION gtk_file_chooser_add_shortcut_folder_uri ##### -->
798 <!-- # Unused Parameters # -->
802 <!-- ##### FUNCTION gtk_file_chooser_remove_shortcut_folder_uri ##### -->
811 <!-- # Unused Parameters # -->
815 <!-- ##### FUNCTION gtk_file_chooser_list_shortcut_folder_uris ##### -->
828 sgml-parent-document: ("../gtk-docs.sgml" "book" "refentry")