1 /* GTK - The GIMP Toolkit
2 * gtkfilechooser.c: Abstract interface for file selector GUIs
3 * Copyright (C) 2003, Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 #include "gtkfilechooser.h"
23 #include "gtkfilechooserprivate.h"
24 #include "gtkfilesystem.h"
26 #include "gtktypebuiltins.h"
28 static void gtk_file_chooser_class_init (gpointer g_iface);
30 static GtkFilePath *gtk_file_chooser_get_path (GtkFileChooser *chooser);
33 gtk_file_chooser_get_type (void)
35 static GType file_chooser_type = 0;
37 if (!file_chooser_type)
39 static const GTypeInfo file_chooser_info =
41 sizeof (GtkFileChooserIface), /* class_size */
43 NULL, /* base_finalize */
44 (GClassInitFunc)gtk_file_chooser_class_init, /* class_init */
47 file_chooser_type = g_type_register_static (G_TYPE_INTERFACE,
49 &file_chooser_info, 0);
51 g_type_interface_add_prerequisite (file_chooser_type, GTK_TYPE_WIDGET);
54 return file_chooser_type;
58 gtk_file_chooser_class_init (gpointer g_iface)
60 GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
63 * GtkFileChooser::current-folder-changed
64 * @chooser: the object which received the signal.
66 * This signal is emitted when the current folder in a #GtkFileChooser
67 * changes. This can happen due to the user performing some action that
68 * changes folders, such as selecting a bookmark or visiting a folder on the
69 * file list. It can also happen as a result of calling a function to
70 * explicitly change the current folder in a file chooser.
72 * Normally you do not need to connect to this signal, unless you need to keep
73 * track of which folder a file chooser is showing.
75 * See also: gtk_file_chooser_set_current_folder(),
76 * gtk_file_chooser_get_current_folder(),
77 * gtk_file_chooser_set_current_folder_uri(),
78 * gtk_file_chooser_get_current_folder_uri().
80 g_signal_new ("current-folder-changed",
83 G_STRUCT_OFFSET (GtkFileChooserIface, current_folder_changed),
85 g_cclosure_marshal_VOID__VOID,
89 * GtkFileChooser::selection-changed
90 * @chooser: the object which received the signal.
92 * This signal is emitted when there is a change in the set of selected files
93 * in a #GtkFileChooser. This can happen when the user modifies the selection
94 * with the mouse or the keyboard, or when explicitly calling functions to
95 * change the selection.
97 * Normally you do not need to connect to this signal, as it is easier to wait
98 * for the file chooser to finish running, and then to get the list of
99 * selected files using the functions mentioned below.
101 * See also: gtk_file_chooser_select_filename(),
102 * gtk_file_chooser_unselect_filename(), gtk_file_chooser_get_filename(),
103 * gtk_file_chooser_get_filenames(), gtk_file_chooser_select_uri(),
104 * gtk_file_chooser_unselect_uri(), gtk_file_chooser_get_uri(),
105 * gtk_file_chooser_get_uris().
107 g_signal_new ("selection-changed",
110 G_STRUCT_OFFSET (GtkFileChooserIface, selection_changed),
112 g_cclosure_marshal_VOID__VOID,
116 * GtkFileChooser::update-preview
117 * @chooser: the object which received the signal.
119 * This signal is emitted when the preview in a file chooser should be
120 * regenerated. For example, this can happen when the currently selected file
121 * changes. You should use this signal if you want your file chooser to have
124 * Once you have installed a preview widget with
125 * gtk_file_chooser_set_preview_widget(), you should update it when this
126 * signal is emitted. You can use the functions
127 * gtk_file_chooser_get_preview_filename() or
128 * gtk_file_chooser_get_preview_uri() to get the name of the file to preview.
129 * Your widget may not be able to preview all kinds of files; your callback
130 * must call gtk_file_chooser_set_preview_wiget_active() to inform the file
131 * chooser about whether the preview was generated successfully or not.
133 * Please see the example code in <xref linkend="gtkfilechooser-preview"/>.
135 * See also: gtk_file_chooser_set_preview_widget(),
136 * gtk_file_chooser_set_preview_widget_active(),
137 * gtk_file_chooser_set_use_preview_label(),
138 * gtk_file_chooser_get_preview_filename(),
139 * gtk_file_chooser_get_preview_uri().
141 g_signal_new ("update-preview",
144 G_STRUCT_OFFSET (GtkFileChooserIface, update_preview),
146 g_cclosure_marshal_VOID__VOID,
150 * GtkFileChooser::file-activated
151 * @chooser: the object which received the signal.
153 * This signal is emitted when the user "activates" a file in the file
154 * chooser. This can happen by double-clicking on a file in the file list, or
155 * by pressing <keycap>Enter</keycap>.
157 * Normally you do not need to connect to this signal. It is used internally
158 * by #GtkFileChooserDialog to know when to activate the default button in the
161 * See also: gtk_file_chooser_get_filename(),
162 * gtk_file_chooser_get_filenames(), gtk_file_chooser_get_uri(),
163 * gtk_file_chooser_get_uris().
165 g_signal_new ("file-activated",
168 G_STRUCT_OFFSET (GtkFileChooserIface, file_activated),
170 g_cclosure_marshal_VOID__VOID,
173 g_object_interface_install_property (g_iface,
174 g_param_spec_enum ("action",
176 P_("The type of operation that the file selector is performing"),
177 GTK_TYPE_FILE_CHOOSER_ACTION,
178 GTK_FILE_CHOOSER_ACTION_OPEN,
180 g_object_interface_install_property (g_iface,
181 g_param_spec_string ("file-system-backend",
182 P_("File System Backend"),
183 P_("Name of file system backend to use"),
185 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
186 g_object_interface_install_property (g_iface,
187 g_param_spec_object ("filter",
189 P_("The current filter for selecting which files are displayed"),
190 GTK_TYPE_FILE_FILTER,
192 g_object_interface_install_property (g_iface,
193 g_param_spec_boolean ("local-only",
195 P_("Whether the selected file(s) should be limited to local file: URLs"),
198 g_object_interface_install_property (g_iface,
199 g_param_spec_object ("preview-widget",
200 P_("Preview widget"),
201 P_("Application supplied widget for custom previews."),
204 g_object_interface_install_property (g_iface,
205 g_param_spec_boolean ("preview-widget-active",
206 P_("Preview Widget Active"),
207 P_("Whether the application supplied widget for custom previews should be shown."),
210 g_object_interface_install_property (g_iface,
211 g_param_spec_boolean ("use-preview-label",
212 P_("Use Preview Label"),
213 P_("Whether to display a stock label with the name of the previewed file."),
216 g_object_interface_install_property (g_iface,
217 g_param_spec_object ("extra-widget",
219 P_("Application supplied widget for extra options."),
222 g_object_interface_install_property (g_iface,
223 g_param_spec_boolean ("select-multiple",
224 P_("Select Multiple"),
225 P_("Whether to allow multiple files to be selected"),
229 g_object_interface_install_property (g_iface,
230 g_param_spec_boolean ("show-hidden",
232 P_("Whether the hidden files and folders should be displayed"),
238 * gtk_file_chooser_error_quark:
240 * Registers an error quark for #GtkFileChooser if necessary.
242 * Return value: The error quark used for #GtkFileChooser errors.
247 gtk_file_chooser_error_quark (void)
249 static GQuark quark = 0;
251 quark = g_quark_from_static_string ("gtk-file-chooser-error-quark");
256 * gtk_file_chooser_set_action:
257 * @chooser: a #GtkFileChooser
258 * @action: the action that the file selector is performing
260 * Sets the type of operation that that the chooser is performing; the
261 * user interface is adapted to suit the selected action. For example,
262 * an option to create a new folder might be shown if the action is
263 * %GTK_FILE_CHOOSER_ACTION_SAVE but not if the action is
264 * %GTK_FILE_CHOOSER_ACTION_OPEN.
269 gtk_file_chooser_set_action (GtkFileChooser *chooser,
270 GtkFileChooserAction action)
272 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
274 g_object_set (chooser, "action", action, NULL);
278 * gtk_file_chooser_get_action:
279 * @chooser: a #GtkFileChooser
281 * Gets the type of operation that the file chooser is performing; see
282 * gtk_file_chooser_set_action().
284 * Return value: the action that the file selector is performing
289 gtk_file_chooser_get_action (GtkFileChooser *chooser)
291 GtkFileChooserAction action;
293 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
295 g_object_get (chooser, "action", &action, NULL);
301 * gtk_file_chooser_set_local_only:
302 * @chooser: a #GtkFileChooser
303 * @local_only: %TRUE if only local files can be selected
305 * Sets whether only local files can be selected in the
306 * file selector. If @local_only is %TRUE (the default),
307 * then the selected file are files are guaranteed to be
308 * accessible through the operating systems native file
309 * file system and therefore the application only
310 * needs to worry about the filename functions in
311 * #GtkFileChooser, like gtk_file_chooser_get_filename(),
312 * rather than the URI functions like
313 * gtk_file_chooser_get_uri(),
318 gtk_file_chooser_set_local_only (GtkFileChooser *chooser,
321 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
323 g_object_set (chooser, "local-only", local_only, NULL);
327 * gtk_file_chooser_get_local_only:
328 * @chooser: a #GtkFileChoosre
330 * Gets whether only local files can be selected in the
331 * file selector. See gtk_file_chooser_set_local_only()
333 * Return value: %TRUE if only local files can be selected.
338 gtk_file_chooser_get_local_only (GtkFileChooser *chooser)
342 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
344 g_object_get (chooser, "local-only", &local_only, NULL);
350 * gtk_file_chooser_set_select_multiple:
351 * @chooser: a #GtkFileChooser
352 * @select_multiple: %TRUE if multiple files can be selected.
354 * Sets whether multiple files can be selected in the file selector. This is
355 * only relevant if the action is set to be GTK_FILE_CHOOSER_ACTION_OPEN or
356 * GTK_FILE_CHOOSER_ACTION_SAVE. It cannot be set with either of the folder
362 gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser,
363 gboolean select_multiple)
365 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
367 g_object_set (chooser, "select-multiple", select_multiple, NULL);
371 * gtk_file_chooser_get_select_multiple:
372 * @chooser: a #GtkFileChooser
374 * Gets whether multiple files can be selected in the file
375 * selector. See gtk_file_chooser_set_select_multiple().
377 * Return value: %TRUE if multiple files can be selected.
382 gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser)
384 gboolean select_multiple;
386 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
388 g_object_get (chooser, "select-multiple", &select_multiple, NULL);
390 return select_multiple;
394 * gtk_file_chooser_get_filename:
395 * @chooser: a #GtkFileChooser
397 * Gets the filename for the currently selected file in
398 * the file selector. If multiple files are selected,
399 * one of the filenames will be returned at random.
401 * If the file chooser is in folder mode, this function returns the selected
404 * Return value: The currently selected filename, or %NULL
405 * if no file is selected, or the selected file can't
406 * be represented with a local filename. Free with g_free().
411 gtk_file_chooser_get_filename (GtkFileChooser *chooser)
413 GtkFileSystem *file_system;
415 gchar *result = NULL;
417 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
419 file_system = _gtk_file_chooser_get_file_system (chooser);
420 path = gtk_file_chooser_get_path (chooser);
423 result = gtk_file_system_path_to_filename (file_system, path);
424 gtk_file_path_free (path);
431 * gtk_file_chooser_set_filename:
432 * @chooser: a #GtkFileChooser
433 * @filename: the filename to set as current
435 * Sets @filename as the current filename for the the file chooser;
436 * If the file name isn't in the current folder of @chooser, then the
437 * current folder of @chooser will be changed to the folder containing
438 * @filename. This is equivalent to a sequence of
439 * gtk_file_chooser_unselect_all() followed by gtk_file_chooser_select_filename().
441 * Note that the file must exist, or nothing will be done except
442 * for the directory change. To pre-enter a filename for the user, as in
443 * a save-as dialog, use gtk_file_chooser_set_current_name()
445 * Return value: %TRUE if both the folder could be changed and the file was
446 * selected successfully, %FALSE otherwise.
451 gtk_file_chooser_set_filename (GtkFileChooser *chooser,
452 const gchar *filename)
454 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
456 gtk_file_chooser_unselect_all (chooser);
457 return gtk_file_chooser_select_filename (chooser, filename);
461 * gtk_file_chooser_select_filename:
462 * @chooser: a #GtkFileChooser
463 * @filename: the filename to select
465 * Selects a filename. If the file name isn't in the current
466 * folder of @chooser, then the current folder of @chooser will
467 * be changed to the folder containing @filename.
469 * Return value: %TRUE if both the folder could be changed and the file was
470 * selected successfully, %FALSE otherwise.
475 gtk_file_chooser_select_filename (GtkFileChooser *chooser,
476 const gchar *filename)
478 GtkFileSystem *file_system;
482 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
483 g_return_val_if_fail (filename != NULL, FALSE);
485 file_system = _gtk_file_chooser_get_file_system (chooser);
487 path = gtk_file_system_filename_to_path (file_system, filename);
490 result = _gtk_file_chooser_select_path (chooser, path, NULL);
491 gtk_file_path_free (path);
500 * gtk_file_chooser_unselect_filename:
501 * @chooser: a #GtkFileChooser
502 * @filename: the filename to unselect
504 * Unselects a currently selected filename. If the filename
505 * is not in the current directory, does not exist, or
506 * is otherwise not currently selected, does nothing.
511 gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
512 const char *filename)
514 GtkFileSystem *file_system;
517 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
518 g_return_if_fail (filename != NULL);
520 file_system = _gtk_file_chooser_get_file_system (chooser);
522 path = gtk_file_system_filename_to_path (file_system, filename);
525 _gtk_file_chooser_unselect_path (chooser, path);
526 gtk_file_path_free (path);
530 /* Converts a list of GtkFilePath* to a list of strings using the specified function */
532 file_paths_to_strings (GtkFileSystem *fs,
534 gchar * (*convert_func) (GtkFileSystem *fs, const GtkFilePath *path))
540 for (; paths; paths = paths->next)
546 string = (* convert_func) (fs, path);
549 strings = g_slist_prepend (strings, string);
552 return g_slist_reverse (strings);
556 * gtk_file_chooser_get_filenames:
557 * @chooser: a #GtkFileChooser
559 * Lists all the selected files and subfolders in the current folder of
560 * @chooser. The returned names are full absolute paths. If files in the current
561 * folder cannot be represented as local filenames they will be ignored. (See
562 * gtk_file_chooser_get_uris())
564 * Return value: a #GSList containing the filenames of all selected
565 * files and subfolders in the current folder. Free the returned list
566 * with g_slist_free(), and the filenames with g_free().
571 gtk_file_chooser_get_filenames (GtkFileChooser *chooser)
573 GtkFileSystem *file_system;
577 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
579 file_system = _gtk_file_chooser_get_file_system (chooser);
580 paths = _gtk_file_chooser_get_paths (chooser);
582 result = file_paths_to_strings (file_system, paths, gtk_file_system_path_to_filename);
583 gtk_file_paths_free (paths);
588 * gtk_file_chooser_set_current_folder:
589 * @chooser: a #GtkFileChooser
590 * @filename: the full path of the new current folder
592 * Sets the current folder for @chooser from a local filename.
593 * The user will be shown the full contents of the current folder,
594 * plus user interface elements for navigating to other folders.
596 * Return value: %TRUE if the folder could be changed successfully, %FALSE
602 gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
603 const gchar *filename)
605 GtkFileSystem *file_system;
609 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
610 g_return_val_if_fail (filename != NULL, FALSE);
612 file_system = _gtk_file_chooser_get_file_system (chooser);
614 path = gtk_file_system_filename_to_path (file_system, filename);
617 result = _gtk_file_chooser_set_current_folder_path (chooser, path, NULL);
618 gtk_file_path_free (path);
627 * gtk_file_chooser_get_current_folder:
628 * @chooser: a #GtkFileChooser
630 * Gets the current folder of @chooser as a local filename.
631 * See gtk_file_chooser_set_current_folder().
633 * Return value: the full path of the current folder, or %NULL
634 * if the current path cannot be represented as a local filename.
635 * Free with g_free().
640 gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
642 GtkFileSystem *file_system;
646 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
648 file_system = _gtk_file_chooser_get_file_system (chooser);
650 path = _gtk_file_chooser_get_current_folder_path (chooser);
651 filename = gtk_file_system_path_to_filename (file_system, path);
652 gtk_file_path_free (path);
658 * gtk_file_chooser_set_current_name:
659 * @chooser: a #GtkFileChooser
660 * @name: the filename to use, as a UTF-8 string
662 * Sets the current name in the file selector, as if entered
663 * by the user. Note that the name passed in here is a UTF-8
664 * string rather than a filename. This function is meant for
665 * such uses as a suggested name in a "Save As..." dialog.
667 * If you want to preselect a particular existing file, you
668 * should use gtk_file_chooser_set_filename() instead.
673 gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
676 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
677 g_return_if_fail (name != NULL);
679 GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_name (chooser, name);
683 * gtk_file_chooser_get_uri:
684 * @chooser: a #GtkFileChooser
686 * Gets the URI for the currently selected file in
687 * the file selector. If multiple files are selected,
688 * one of the filenames will be returned at random.
690 * If the file chooser is in folder mode, this function returns the selected
693 * Return value: The currently selected URI, or %NULL
694 * if no file is selected. Free with g_free()
699 gtk_file_chooser_get_uri (GtkFileChooser *chooser)
701 GtkFileSystem *file_system;
703 gchar *result = NULL;
705 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
707 file_system = _gtk_file_chooser_get_file_system (chooser);
708 path = gtk_file_chooser_get_path (chooser);
711 result = gtk_file_system_path_to_uri (file_system, path);
712 gtk_file_path_free (path);
719 * gtk_file_chooser_set_uri:
720 * @chooser: a #GtkFileChooser
721 * @uri: the URI to set as current
723 * Sets the file referred to by @uri as the current file for the the
724 * file chooser; If the file name isn't in the current folder of @chooser,
725 * then the current folder of @chooser will be changed to the folder containing
726 * @uri. This is equivalent to a sequence of gtk_file_chooser_unselect_all()
727 * followed by gtk_file_chooser_select_uri().
729 * Note that the file must exist, or nothing will be done except
730 * for the directory change. To pre-enter a filename for the user, as in
731 * a save-as dialog, use gtk_file_chooser_set_current_name()
733 * Return value: %TRUE if both the folder could be changed and the URI was
734 * selected successfully, %FALSE otherwise.
739 gtk_file_chooser_set_uri (GtkFileChooser *chooser,
742 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
744 gtk_file_chooser_unselect_all (chooser);
745 return gtk_file_chooser_select_uri (chooser, uri);
749 * gtk_file_chooser_select_uri:
750 * @chooser: a #GtkFileChooser
751 * @uri: the URI to select
753 * Selects the file to by @uri. If the URI doesn't refer to a
754 * file in the current folder of @chooser, then the current folder of
755 * @chooser will be changed to the folder containing @filename.
757 * Return value: %TRUE if both the folder could be changed and the URI was
758 * selected successfully, %FALSE otherwise.
763 gtk_file_chooser_select_uri (GtkFileChooser *chooser,
766 GtkFileSystem *file_system;
770 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
771 g_return_val_if_fail (uri != NULL, FALSE);
773 file_system = _gtk_file_chooser_get_file_system (chooser);
775 path = gtk_file_system_uri_to_path (file_system, uri);
778 result = _gtk_file_chooser_select_path (chooser, path, NULL);
779 gtk_file_path_free (path);
788 * gtk_file_chooser_unselect_uri:
789 * @chooser: a #GtkFileChooser
790 * @uri: the URI to unselect
792 * Unselects the file referred to by @uri. If the file
793 * is not in the current directory, does not exist, or
794 * is otherwise not currently selected, does nothing.
799 gtk_file_chooser_unselect_uri (GtkFileChooser *chooser,
802 GtkFileSystem *file_system;
805 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
806 g_return_if_fail (uri != NULL);
808 file_system = _gtk_file_chooser_get_file_system (chooser);
810 path = gtk_file_system_uri_to_path (file_system, uri);
813 _gtk_file_chooser_unselect_path (chooser, path);
814 gtk_file_path_free (path);
819 * gtk_file_chooser_select_all:
820 * @chooser: a #GtkFileChooser
822 * Selects all the files in the current folder of a file chooser.
827 gtk_file_chooser_select_all (GtkFileChooser *chooser)
829 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
831 GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_all (chooser);
835 * gtk_file_chooser_unselect_all:
836 * @chooser: a #GtkFileChooser
838 * Unselects all the files in the current folder of a file chooser.
843 gtk_file_chooser_unselect_all (GtkFileChooser *chooser)
846 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
848 GTK_FILE_CHOOSER_GET_IFACE (chooser)->unselect_all (chooser);
852 * gtk_file_chooser_get_uris:
853 * @chooser: a #GtkFileChooser
855 * Lists all the selected files and subfolders in the current folder of
856 * @chooser. The returned names are full absolute URIs.
858 * Return value: a #GSList containing the URIs of all selected
859 * files and subfolders in the current folder. Free the returned list
860 * with g_slist_free(), and the filenames with g_free().
865 gtk_file_chooser_get_uris (GtkFileChooser *chooser)
867 GtkFileSystem *file_system;
871 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
873 file_system = _gtk_file_chooser_get_file_system (chooser);
874 paths = _gtk_file_chooser_get_paths (chooser);
876 result = file_paths_to_strings (file_system, paths, gtk_file_system_path_to_uri);
877 gtk_file_paths_free (paths);
882 * gtk_file_chooser_set_current_folder_uri:
883 * @chooser: a #GtkFileChooser
884 * @uri: the URI for the new current folder
886 * Sets the current folder for @chooser from an URI.
887 * The user will be shown the full contents of the current folder,
888 * plus user interface elements for navigating to other folders.
890 * Return value: %TRUE if the folder could be changed successfully, %FALSE
896 gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
899 GtkFileSystem *file_system;
903 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
904 g_return_val_if_fail (uri != NULL, FALSE);
906 file_system = _gtk_file_chooser_get_file_system (chooser);
908 path = gtk_file_system_uri_to_path (file_system, uri);
911 result = _gtk_file_chooser_set_current_folder_path (chooser, path, NULL);
912 gtk_file_path_free (path);
921 * gtk_file_chooser_get_current_folder_uri:
922 * @chooser: a #GtkFileChooser
924 * Gets the current folder of @chooser as an URI.
925 * See gtk_file_chooser_set_current_folder_uri().
927 * Return value: the URI for the current folder.
928 * Free with g_free().
933 gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser)
935 GtkFileSystem *file_system;
939 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
941 file_system = _gtk_file_chooser_get_file_system (chooser);
943 path = _gtk_file_chooser_get_current_folder_path (chooser);
944 uri = gtk_file_system_path_to_uri (file_system, path);
945 gtk_file_path_free (path);
951 * _gtk_file_chooser_set_current_folder_path:
952 * @chooser: a #GtkFileChooser
953 * @path: the #GtkFilePath for the new folder
954 * @error: location to store error, or %NULL.
956 * Sets the current folder for @chooser from a #GtkFilePath.
957 * Internal function, see gtk_file_chooser_set_current_folder_uri().
959 * Return value: %TRUE if the folder could be changed successfully, %FALSE
965 _gtk_file_chooser_set_current_folder_path (GtkFileChooser *chooser,
966 const GtkFilePath *path,
969 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
970 g_return_val_if_fail (path != NULL, FALSE);
971 g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
973 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_folder (chooser, path, error);
977 * _gtk_file_chooser_get_current_folder_path:
978 * @chooser: a #GtkFileChooser
980 * Gets the current folder of @chooser as #GtkFilePath.
981 * See gtk_file_chooser_get_current_folder_uri().
983 * Return value: the #GtkFilePath for the current folder.
984 * Free with gtk_file_path_free().
989 _gtk_file_chooser_get_current_folder_path (GtkFileChooser *chooser)
991 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
993 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_current_folder (chooser);
997 * _gtk_file_chooser_select_path:
998 * @chooser: a #GtkFileChooser
999 * @path: the path to select
1000 * @error: location to store error, or %NULL
1002 * Selects the file referred to by @path. An internal function. See
1003 * _gtk_file_chooser_select_uri().
1005 * Return value: %TRUE if both the folder could be changed and the path was
1006 * selected successfully, %FALSE otherwise.
1011 _gtk_file_chooser_select_path (GtkFileChooser *chooser,
1012 const GtkFilePath *path,
1015 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1016 g_return_val_if_fail (path != NULL, FALSE);
1017 g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1019 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_path (chooser, path, error);
1023 * _gtk_file_chooser_unselect_path:
1024 * @chooser: a #GtkFileChooser
1025 * @path: the filename to path
1027 * Unselects the file referred to by @path. An internal
1028 * function. See _gtk_file_chooser_unselect_uri().
1033 _gtk_file_chooser_unselect_path (GtkFileChooser *chooser,
1034 const GtkFilePath *path)
1036 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1038 GTK_FILE_CHOOSER_GET_IFACE (chooser)->unselect_path (chooser, path);
1042 * _gtk_file_chooser_get_paths:
1043 * @chooser: a #GtkFileChooser
1045 * Lists all the selected files and subfolders in the current folder of @chooser
1046 * as #GtkFilePath. An internal function, see gtk_file_chooser_get_uris().
1048 * Return value: a #GSList containing a #GtkFilePath for each selected
1049 * file and subfolder in the current folder. Free the returned list
1050 * with g_slist_free(), and the paths with gtk_file_path_free().
1055 _gtk_file_chooser_get_paths (GtkFileChooser *chooser)
1057 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1059 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_paths (chooser);
1062 static GtkFilePath *
1063 gtk_file_chooser_get_path (GtkFileChooser *chooser)
1066 GtkFilePath *result = NULL;
1068 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1070 list = _gtk_file_chooser_get_paths (chooser);
1073 result = list->data;
1074 list = g_slist_delete_link (list, list);
1075 gtk_file_paths_free (list);
1082 * _gtk_file_chooser_get_file_system:
1083 * @chooser: a #GtkFileChooser
1085 * Gets the #GtkFileSystem of @chooser; this is an internal
1086 * implementation detail, used for conversion between paths
1087 * and filenames and URIs.
1089 * Return value: the file system for @chooser.
1094 _gtk_file_chooser_get_file_system (GtkFileChooser *chooser)
1096 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1098 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_file_system (chooser);
1104 * gtk_file_chooser_set_preview_widget:
1105 * @chooser: a #GtkFileChooser
1106 * @preview_widget: widget for displaying preview.
1108 * Sets an application-supplied widget to use to display a custom preview
1109 * of the currently selected file. To implement a preview, after setting the
1110 * preview widget, you connect to the ::selection-changed
1111 * signal, and call gtk_file_chooser_get_preview_filename() or
1112 * gtk_file_chooser_get_preview_uri() on each change. If you can
1113 * display a preview of the new file, update your widget and
1114 * set the preview active using gtk_file_chooser_set_preview_widget_active().
1115 * Otherwise, set the preview inactive.
1117 * When there is no application-supplied preview widget, or the
1118 * application-supplied preview widget is not active, the file chooser
1119 * may display an internally generated preview of the current file or
1120 * it may display no preview at all.
1125 gtk_file_chooser_set_preview_widget (GtkFileChooser *chooser,
1126 GtkWidget *preview_widget)
1128 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1130 g_object_set (chooser, "preview-widget", preview_widget, NULL);
1134 * gtk_file_chooser_get_preview_widget:
1135 * @chooser: a #GtkFileChooser
1137 * Gets the current preview widget; see
1138 * gtk_file_chooser_set_preview_widget().
1140 * Return value: the current preview widget, or %NULL
1145 gtk_file_chooser_get_preview_widget (GtkFileChooser *chooser)
1147 GtkWidget *preview_widget;
1149 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1151 g_object_get (chooser, "preview-widget", &preview_widget, NULL);
1153 /* Horrid hack; g_object_get() refs returned objects but
1154 * that contradicts the memory management conventions
1158 g_object_unref (preview_widget);
1160 return preview_widget;
1164 * gtk_file_chooser_set_preview_widget_active:
1165 * @chooser: a #GtkFileChooser
1166 * @active: whether to display the user-specified preview widget
1168 * Sets whether the preview widget set by
1169 * gtk_file_chooser_set_preview_widget_active() should be shown for the
1170 * current filename. When @active is set to false, the file chooser
1171 * may display an internally generated preview of the current file
1172 * or it may display no preview at all. See
1173 * gtk_file_chooser_set_preview_widget() for more details.
1178 gtk_file_chooser_set_preview_widget_active (GtkFileChooser *chooser,
1181 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1183 g_object_set (chooser, "preview-widget-active", active, NULL);
1187 * gtk_file_chooser_get_preview_widget_active:
1188 * @chooser: a #GtkFileChooser
1190 * Gets whether the preview widget set by gtk_file_chooser_set_preview_widget()
1191 * should be shown for the current filename. See
1192 * gtk_file_chooser_set_preview_widget_active().
1194 * Return value: %TRUE if the preview widget is active for the current filename.
1199 gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser)
1203 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1205 g_object_get (chooser, "preview-widget-active", &active, NULL);
1211 * gtk_file_chooser_set_use_preview_label:
1212 * @chooser: a #GtkFileChooser
1213 * @use_label: whether to display a stock label with the name of the previewed file
1215 * Sets whether the file chooser should display a stock label with the name of
1216 * the file that is being previewed; the default is %TRUE. Applications that
1217 * want to draw the whole preview area themselves should set this to %FALSE and
1218 * display the name themselves in their preview widget.
1220 * See also: gtk_file_chooser_set_preview_widget()
1225 gtk_file_chooser_set_use_preview_label (GtkFileChooser *chooser,
1228 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1230 g_object_set (chooser, "use-preview-label", use_label, NULL);
1234 * gtk_file_chooser_get_use_preview_label:
1235 * @chooser: a #GtkFileChooser
1237 * Gets whether a stock label should be drawn with the name of the previewed
1238 * file. See gtk_file_chooser_set_use_preview_label().
1240 * Return value: %TRUE if the file chooser is set to display a label with the
1241 * name of the previewed file, %FALSE otherwise.
1244 gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser)
1248 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1250 g_object_get (chooser, "use-preview-label", &use_label, NULL);
1256 * gtk_file_chooser_get_preview_filename:
1257 * @chooser: a #GtkFileChooser
1259 * Gets the filename that should be previewed in a custom preview
1260 * Internal function, see gtk_file_chooser_get_preview_uri().
1262 * Return value: the #GtkFilePath for the file to preview, or %NULL if no file
1263 * is selected. Free with gtk_file_path_free().
1268 _gtk_file_chooser_get_preview_path (GtkFileChooser *chooser)
1270 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1272 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_preview_path (chooser);
1276 * _gtk_file_chooser_add_shortcut_folder:
1277 * @chooser: a #GtkFileChooser
1278 * @path: path of the folder to add
1279 * @error: location to store error, or %NULL
1281 * Adds a folder to be displayed with the shortcut folders in a file chooser.
1282 * Internal function, see gtk_file_chooser_add_shortcut_folder().
1284 * Return value: %TRUE if the folder could be added successfully, %FALSE
1290 _gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
1291 const GtkFilePath *path,
1294 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1295 g_return_val_if_fail (path != NULL, FALSE);
1297 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_shortcut_folder (chooser, path, error);
1301 * _gtk_file_chooser_remove_shortcut_folder:
1302 * @chooser: a #GtkFileChooser
1303 * @path: path of the folder to remove
1304 * @error: location to store error, or %NULL
1306 * Removes a folder from the shortcut folders in a file chooser. Internal
1307 * function, see gtk_file_chooser_remove_shortcut_folder().
1309 * Return value: %TRUE if the folder could be removed successfully, %FALSE
1315 _gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
1316 const GtkFilePath *path,
1319 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1320 g_return_val_if_fail (path != NULL, FALSE);
1322 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_shortcut_folder (chooser, path, error);
1326 * gtk_file_chooser_get_preview_filename:
1327 * @chooser: a #GtkFileChooser
1329 * Gets the filename that should be previewed in a custom preview
1330 * widget. See gtk_file_chooser_set_preview_widget().
1332 * Return value: the filename to preview, or %NULL if no file
1333 * is selected, or if the selected file cannot be represented
1334 * as a local filename. Free with g_free()
1339 gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser)
1341 GtkFileSystem *file_system;
1343 gchar *result = NULL;
1345 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1347 file_system = _gtk_file_chooser_get_file_system (chooser);
1348 path = _gtk_file_chooser_get_preview_path (chooser);
1351 result = gtk_file_system_path_to_filename (file_system, path);
1352 gtk_file_path_free (path);
1359 * gtk_file_chooser_get_preview_uri:
1360 * @chooser: a #GtkFileChooser
1362 * Gets the URI that should be previewed in a custom preview
1363 * widget. See gtk_file_chooser_set_preview_widget().
1365 * Return value: the URI for the file to preview, or %NULL if no file is
1366 * selected. Free with g_free().
1371 gtk_file_chooser_get_preview_uri (GtkFileChooser *chooser)
1373 GtkFileSystem *file_system;
1375 gchar *result = NULL;
1377 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1379 file_system = _gtk_file_chooser_get_file_system (chooser);
1380 path = _gtk_file_chooser_get_preview_path (chooser);
1383 result = gtk_file_system_path_to_uri (file_system, path);
1384 gtk_file_path_free (path);
1391 * gtk_file_chooser_set_extra_widget:
1392 * @chooser: a #GtkFileChooser
1393 * @extra_widget: widget for extra options
1395 * Sets an application-supplied widget to provide extra options to the user.
1400 gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser,
1401 GtkWidget *extra_widget)
1403 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1405 g_object_set (chooser, "extra-widget", extra_widget, NULL);
1409 * gtk_file_chooser_get_extra_widget:
1410 * @chooser: a #GtkFileChooser
1412 * Gets the current preview widget; see
1413 * gtk_file_chooser_set_extra_widget().
1415 * Return value: the current extra widget, or %NULL
1420 gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser)
1422 GtkWidget *extra_widget;
1424 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1426 g_object_get (chooser, "extra-widget", &extra_widget, NULL);
1428 /* Horrid hack; g_object_get() refs returned objects but
1429 * that contradicts the memory management conventions
1433 g_object_unref (extra_widget);
1435 return extra_widget;
1439 * gtk_file_chooser_add_filter:
1440 * @chooser: a #GtkFileChooser
1441 * @filter: a #GtkFileFilter
1443 * Adds @filter to the list of filters that the user can select between.
1444 * When a filter is selected, only files that are passed by that
1445 * filter are displayed.
1450 gtk_file_chooser_add_filter (GtkFileChooser *chooser,
1451 GtkFileFilter *filter)
1453 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1455 GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_filter (chooser, filter);
1459 * gtk_file_chooser_remove_filter:
1460 * @chooser: a #GtkFileChooser
1461 * @filter: a #GtkFileFilter
1463 * Removes @filter from the list of filters that the user can select between.
1468 gtk_file_chooser_remove_filter (GtkFileChooser *chooser,
1469 GtkFileFilter *filter)
1471 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1473 GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_filter (chooser, filter);
1477 * gtk_file_chooser_list_filters:
1478 * @chooser: a #GtkFileChooser
1480 * Lists the current set of user-selectable filters; see
1481 * gtk_file_chooser_add_filter(), gtk_file_chooser_remove_filter().
1483 * Return value: a #GSList containing the current set of
1484 * user selectable filters. The contents of the list are
1485 * owned by GTK+, but you must free the list itself with
1486 * g_slist_free() when you are done with it.
1491 gtk_file_chooser_list_filters (GtkFileChooser *chooser)
1493 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1495 return GTK_FILE_CHOOSER_GET_IFACE (chooser)->list_filters (chooser);
1499 * gtk_file_chooser_set_filter:
1500 * @chooser: a #GtkFileChooser
1501 * @filter: a #GtkFileFilter
1503 * Sets the current filter; only the files that pass the
1504 * filter will be displayed. If the user-selectable list of filters
1505 * is non-empty, then the filter should be one of the filters
1506 * in that list. Setting the current filter when the list of
1507 * filters is empty is useful if you want to restrict the displayed
1508 * set of files without letting the user change it.
1513 gtk_file_chooser_set_filter (GtkFileChooser *chooser,
1514 GtkFileFilter *filter)
1516 g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
1517 g_return_if_fail (GTK_IS_FILE_FILTER (filter));
1519 g_object_set (chooser, "filter", filter, NULL);
1523 * gtk_file_chooser_get_filter:
1524 * @chooser: a #GtkFileChooser
1526 * Gets the current filter; see gtk_file_chooser_set_filter().
1528 * Return value: the current filter, or %NULL
1533 gtk_file_chooser_get_filter (GtkFileChooser *chooser)
1535 GtkFileFilter *filter;
1537 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1539 g_object_get (chooser, "filter", &filter, NULL);
1540 /* Horrid hack; g_object_get() refs returned objects but
1541 * that contradicts the memory management conventions
1545 g_object_unref (filter);
1551 * gtk_file_chooser_add_shortcut_folder:
1552 * @chooser: a #GtkFileChooser
1553 * @folder: filename of the folder to add
1554 * @error: location to store error, or %NULL
1556 * Adds a folder to be displayed with the shortcut folders in a file chooser.
1557 * Note that shortcut folders do not get saved, as they are provided by the
1558 * application. For example, you can use this to add a
1559 * "/usr/share/mydrawprogram/Clipart" folder to the volume list.
1561 * Return value: %TRUE if the folder could be added successfully, %FALSE
1562 * otherwise. In the latter case, the @error will be set as appropriate.
1567 gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
1574 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1575 g_return_val_if_fail (folder != NULL, FALSE);
1577 path = gtk_file_system_filename_to_path (_gtk_file_chooser_get_file_system (chooser), folder);
1581 GTK_FILE_CHOOSER_ERROR,
1582 GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
1583 _("Invalid filename: %s"),
1588 result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_shortcut_folder (chooser, path, error);
1590 gtk_file_path_free (path);
1596 * gtk_file_chooser_remove_shortcut_folder:
1597 * @chooser: a #GtkFileChooser
1598 * @folder: filename of the folder to remove
1599 * @error: location to store error, or %NULL
1601 * Removes a folder from a file chooser's list of shortcut folders.
1603 * Return value: %TRUE if the operation succeeds, %FALSE otherwise.
1604 * In the latter case, the @error will be set as appropriate.
1606 * See also: gtk_file_chooser_add_shortcut_folder()
1611 gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
1618 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1619 g_return_val_if_fail (folder != NULL, FALSE);
1621 path = gtk_file_system_filename_to_path (_gtk_file_chooser_get_file_system (chooser), folder);
1625 GTK_FILE_CHOOSER_ERROR,
1626 GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
1627 _("Invalid filename: %s"),
1632 result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_shortcut_folder (chooser, path, error);
1634 gtk_file_path_free (path);
1640 * gtk_file_chooser_list_shortcut_folders:
1641 * @chooser: a #GtkFileChooser
1643 * Queries the list of shortcut folders in the file chooser, as set by
1644 * gtk_file_chooser_set_shortcut_folders().
1646 * Return value: A list of folder filenames, or %NULL if there are no shortcut
1647 * folders. Free the returned list with g_slist_free(), and the filenames with
1653 gtk_file_chooser_list_shortcut_folders (GtkFileChooser *chooser)
1658 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1660 folders = GTK_FILE_CHOOSER_GET_IFACE (chooser)->list_shortcut_folders (chooser);
1662 result = file_paths_to_strings (_gtk_file_chooser_get_file_system (chooser),
1664 gtk_file_system_path_to_filename);
1665 gtk_file_paths_free (folders);
1670 * gtk_file_chooser_add_shortcut_folder_uri:
1671 * @chooser: a #GtkFileChooser
1672 * @uri: URI of the folder to add
1673 * @error: location to store error, or %NULL
1675 * Adds a folder URI to be displayed with the shortcut folders in a file
1676 * chooser. Note that shortcut folders do not get saved, as they are provided
1677 * by the application. For example, you can use this to add a
1678 * "file:///usr/share/mydrawprogram/Clipart" folder to the volume list.
1680 * Return value: %TRUE if the folder could be added successfully, %FALSE
1681 * otherwise. In the latter case, the @error will be set as appropriate.
1686 gtk_file_chooser_add_shortcut_folder_uri (GtkFileChooser *chooser,
1693 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1694 g_return_val_if_fail (uri != NULL, FALSE);
1696 path = gtk_file_system_uri_to_path (_gtk_file_chooser_get_file_system (chooser), uri);
1700 GTK_FILE_CHOOSER_ERROR,
1701 GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
1702 _("Invalid filename: %s"),
1707 result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_shortcut_folder (chooser, path, error);
1709 gtk_file_path_free (path);
1715 * gtk_file_chooser_remove_shortcut_folder_uri:
1716 * @chooser: a #GtkFileChooser
1717 * @uri: URI of the folder to remove
1718 * @error: location to store error, or %NULL
1720 * Removes a folder URI from a file chooser's list of shortcut folders.
1722 * Return value: %TRUE if the operation succeeds, %FALSE otherwise.
1723 * In the latter case, the @error will be set as appropriate.
1725 * See also: gtk_file_chooser_add_shortcut_folder_uri()
1730 gtk_file_chooser_remove_shortcut_folder_uri (GtkFileChooser *chooser,
1737 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
1738 g_return_val_if_fail (uri != NULL, FALSE);
1740 path = gtk_file_system_filename_to_path (_gtk_file_chooser_get_file_system (chooser), uri);
1744 GTK_FILE_CHOOSER_ERROR,
1745 GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
1746 _("Invalid filename: %s"),
1751 result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_shortcut_folder (chooser, path, error);
1753 gtk_file_path_free (path);
1759 * gtk_file_chooser_list_shortcut_folder_uris:
1760 * @chooser: a #GtkFileChooser
1762 * Queries the list of shortcut folders in the file chooser, as set by
1763 * gtk_file_chooser_set_shortcut_folder_uris().
1765 * Return value: A list of folder URIs, or %NULL if there are no shortcut
1766 * folders. Free the returned list with g_slist_free(), and the URIs with
1772 gtk_file_chooser_list_shortcut_folder_uris (GtkFileChooser *chooser)
1777 g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
1779 folders = GTK_FILE_CHOOSER_GET_IFACE (chooser)->list_shortcut_folders (chooser);
1781 result = file_paths_to_strings (_gtk_file_chooser_get_file_system (chooser),
1783 gtk_file_system_path_to_uri);
1784 gtk_file_paths_free (folders);