1 /* GTK - The GTK+ Toolkit
2 * gtkfilechooser.h: 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.
21 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
25 #ifndef __GTK_FILE_CHOOSER_H__
26 #define __GTK_FILE_CHOOSER_H__
28 #include <gtk/gtkfilefilter.h>
29 #include <gtk/gtkwidget.h>
33 #define GTK_TYPE_FILE_CHOOSER (gtk_file_chooser_get_type ())
34 #define GTK_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER, GtkFileChooser))
35 #define GTK_IS_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILE_CHOOSER))
37 typedef struct _GtkFileChooser GtkFileChooser;
41 GTK_FILE_CHOOSER_ACTION_OPEN,
42 GTK_FILE_CHOOSER_ACTION_SAVE,
43 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
44 GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
45 } GtkFileChooserAction;
49 GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM,
50 GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME,
51 GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN
52 } GtkFileChooserConfirmation;
54 GType gtk_file_chooser_get_type (void) G_GNUC_CONST;
56 /* GError enumeration for GtkFileChooser */
58 #define GTK_FILE_CHOOSER_ERROR (gtk_file_chooser_error_quark ())
61 GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
62 GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
63 GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS
64 } GtkFileChooserError;
66 GQuark gtk_file_chooser_error_quark (void);
70 void gtk_file_chooser_set_action (GtkFileChooser *chooser,
71 GtkFileChooserAction action);
72 GtkFileChooserAction gtk_file_chooser_get_action (GtkFileChooser *chooser);
73 void gtk_file_chooser_set_local_only (GtkFileChooser *chooser,
75 gboolean gtk_file_chooser_get_local_only (GtkFileChooser *chooser);
76 void gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser,
77 gboolean select_multiple);
78 gboolean gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser);
79 void gtk_file_chooser_set_show_hidden (GtkFileChooser *chooser,
80 gboolean show_hidden);
81 gboolean gtk_file_chooser_get_show_hidden (GtkFileChooser *chooser);
83 void gtk_file_chooser_set_do_overwrite_confirmation (GtkFileChooser *chooser,
84 gboolean do_overwrite_confirmation);
85 gboolean gtk_file_chooser_get_do_overwrite_confirmation (GtkFileChooser *chooser);
87 /* Suggested name for the Save-type actions
89 void gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
92 /* Filename manipulation
95 /* Reserve old names for DLL ABI backward compatibility */
96 #define gtk_file_chooser_get_filename gtk_file_chooser_get_filename_utf8
97 #define gtk_file_chooser_set_filename gtk_file_chooser_set_filename_utf8
98 #define gtk_file_chooser_select_filename gtk_file_chooser_select_filename_utf8
99 #define gtk_file_chooser_unselect_filename gtk_file_chooser_unselect_filename_utf8
100 #define gtk_file_chooser_get_filenames gtk_file_chooser_get_filenames_utf8
101 #define gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder_utf8
102 #define gtk_file_chooser_get_current_folder gtk_file_chooser_get_current_folder_utf8
103 #define gtk_file_chooser_get_preview_filename gtk_file_chooser_get_preview_filename_utf8
104 #define gtk_file_chooser_add_shortcut_folder gtk_file_chooser_add_shortcut_folder_utf8
105 #define gtk_file_chooser_remove_shortcut_folder gtk_file_chooser_remove_shortcut_folder_utf8
106 #define gtk_file_chooser_list_shortcut_folders gtk_file_chooser_list_shortcut_folders_utf8
109 gchar * gtk_file_chooser_get_filename (GtkFileChooser *chooser);
110 gboolean gtk_file_chooser_set_filename (GtkFileChooser *chooser,
111 const char *filename);
112 gboolean gtk_file_chooser_select_filename (GtkFileChooser *chooser,
113 const char *filename);
114 void gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
115 const char *filename);
116 void gtk_file_chooser_select_all (GtkFileChooser *chooser);
117 void gtk_file_chooser_unselect_all (GtkFileChooser *chooser);
118 GSList * gtk_file_chooser_get_filenames (GtkFileChooser *chooser);
119 gboolean gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
120 const gchar *filename);
121 gchar * gtk_file_chooser_get_current_folder (GtkFileChooser *chooser);
126 gchar * gtk_file_chooser_get_uri (GtkFileChooser *chooser);
127 gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser,
129 gboolean gtk_file_chooser_select_uri (GtkFileChooser *chooser,
131 void gtk_file_chooser_unselect_uri (GtkFileChooser *chooser,
133 GSList * gtk_file_chooser_get_uris (GtkFileChooser *chooser);
134 gboolean gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
136 gchar * gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser);
140 void gtk_file_chooser_set_preview_widget (GtkFileChooser *chooser,
141 GtkWidget *preview_widget);
142 GtkWidget *gtk_file_chooser_get_preview_widget (GtkFileChooser *chooser);
143 void gtk_file_chooser_set_preview_widget_active (GtkFileChooser *chooser,
145 gboolean gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser);
146 void gtk_file_chooser_set_use_preview_label (GtkFileChooser *chooser,
148 gboolean gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser);
150 char *gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser);
151 char *gtk_file_chooser_get_preview_uri (GtkFileChooser *chooser);
155 void gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser,
156 GtkWidget *extra_widget);
157 GtkWidget *gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser);
159 /* List of user selectable filters
161 void gtk_file_chooser_add_filter (GtkFileChooser *chooser,
162 GtkFileFilter *filter);
163 void gtk_file_chooser_remove_filter (GtkFileChooser *chooser,
164 GtkFileFilter *filter);
165 GSList *gtk_file_chooser_list_filters (GtkFileChooser *chooser);
169 void gtk_file_chooser_set_filter (GtkFileChooser *chooser,
170 GtkFileFilter *filter);
171 GtkFileFilter *gtk_file_chooser_get_filter (GtkFileChooser *chooser);
173 /* Per-application shortcut folders */
175 gboolean gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
178 gboolean gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
181 GSList *gtk_file_chooser_list_shortcut_folders (GtkFileChooser *chooser);
183 gboolean gtk_file_chooser_add_shortcut_folder_uri (GtkFileChooser *chooser,
186 gboolean gtk_file_chooser_remove_shortcut_folder_uri (GtkFileChooser *chooser,
189 GSList *gtk_file_chooser_list_shortcut_folder_uris (GtkFileChooser *chooser);
193 #endif /* __GTK_FILE_CHOOSER_H__ */