1 /* GTK - The GIMP 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 #ifndef __GTK_FILE_CHOOSER_H__
22 #define __GTK_FILE_CHOOSER_H__
24 #include "gtkfilefilter.h"
25 #include <gtk/gtkwidget.h>
29 #define GTK_TYPE_FILE_CHOOSER (gtk_file_chooser_get_type ())
30 #define GTK_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER, GtkFileChooser))
31 #define GTK_IS_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILE_CHOOSER))
33 typedef struct _GtkFileChooser GtkFileChooser;
37 GTK_FILE_CHOOSER_ACTION_OPEN,
38 GTK_FILE_CHOOSER_ACTION_SAVE,
39 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
40 GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
41 } GtkFileChooserAction;
45 GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM,
46 GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME,
47 GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN
48 } GtkFileChooserConfirmation;
50 GType gtk_file_chooser_get_type (void) G_GNUC_CONST;
52 /* GError enumeration for GtkFileChooser */
54 #define GTK_FILE_CHOOSER_ERROR (gtk_file_chooser_error_quark ())
57 GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
58 GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
59 GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS
60 } GtkFileChooserError;
62 GQuark gtk_file_chooser_error_quark (void);
66 void gtk_file_chooser_set_action (GtkFileChooser *chooser,
67 GtkFileChooserAction action);
68 GtkFileChooserAction gtk_file_chooser_get_action (GtkFileChooser *chooser);
69 void gtk_file_chooser_set_local_only (GtkFileChooser *chooser,
71 gboolean gtk_file_chooser_get_local_only (GtkFileChooser *chooser);
72 void gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser,
73 gboolean select_multiple);
74 gboolean gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser);
75 void gtk_file_chooser_set_show_hidden (GtkFileChooser *chooser,
76 gboolean show_hidden);
77 gboolean gtk_file_chooser_get_show_hidden (GtkFileChooser *chooser);
79 void gtk_file_chooser_set_do_overwrite_confirmation (GtkFileChooser *chooser,
80 gboolean do_overwrite_confirmation);
81 gboolean gtk_file_chooser_get_do_overwrite_confirmation (GtkFileChooser *chooser);
83 /* Suggested name for the Save-type actions
85 void gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
88 /* Filename manipulation
91 /* Reserve old names for DLL ABI backward compatibility */
92 #define gtk_file_chooser_get_filename gtk_file_chooser_get_filename_utf8
93 #define gtk_file_chooser_set_filename gtk_file_chooser_set_filename_utf8
94 #define gtk_file_chooser_select_filename gtk_file_chooser_select_filename_utf8
95 #define gtk_file_chooser_unselect_filename gtk_file_chooser_unselect_filename_utf8
96 #define gtk_file_chooser_get_filenames gtk_file_chooser_get_filenames_utf8
97 #define gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder_utf8
98 #define gtk_file_chooser_get_current_folder gtk_file_chooser_get_current_folder_utf8
99 #define gtk_file_chooser_get_preview_filename gtk_file_chooser_get_preview_filename_utf8
100 #define gtk_file_chooser_add_shortcut_folder gtk_file_chooser_add_shortcut_folder_utf8
101 #define gtk_file_chooser_remove_shortcut_folder gtk_file_chooser_remove_shortcut_folder_utf8
102 #define gtk_file_chooser_list_shortcut_folders gtk_file_chooser_list_shortcut_folders_utf8
105 gchar * gtk_file_chooser_get_filename (GtkFileChooser *chooser);
106 gboolean gtk_file_chooser_set_filename (GtkFileChooser *chooser,
107 const char *filename);
108 gboolean gtk_file_chooser_select_filename (GtkFileChooser *chooser,
109 const char *filename);
110 void gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
111 const char *filename);
112 void gtk_file_chooser_select_all (GtkFileChooser *chooser);
113 void gtk_file_chooser_unselect_all (GtkFileChooser *chooser);
114 GSList * gtk_file_chooser_get_filenames (GtkFileChooser *chooser);
115 gboolean gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
116 const gchar *filename);
117 gchar * gtk_file_chooser_get_current_folder (GtkFileChooser *chooser);
122 gchar * gtk_file_chooser_get_uri (GtkFileChooser *chooser);
123 gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser,
125 gboolean gtk_file_chooser_select_uri (GtkFileChooser *chooser,
127 void gtk_file_chooser_unselect_uri (GtkFileChooser *chooser,
129 GSList * gtk_file_chooser_get_uris (GtkFileChooser *chooser);
130 gboolean gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
132 gchar * gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser);
136 void gtk_file_chooser_set_preview_widget (GtkFileChooser *chooser,
137 GtkWidget *preview_widget);
138 GtkWidget *gtk_file_chooser_get_preview_widget (GtkFileChooser *chooser);
139 void gtk_file_chooser_set_preview_widget_active (GtkFileChooser *chooser,
141 gboolean gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser);
142 void gtk_file_chooser_set_use_preview_label (GtkFileChooser *chooser,
144 gboolean gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser);
146 char *gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser);
147 char *gtk_file_chooser_get_preview_uri (GtkFileChooser *chooser);
151 void gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser,
152 GtkWidget *extra_widget);
153 GtkWidget *gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser);
155 /* List of user selectable filters
157 void gtk_file_chooser_add_filter (GtkFileChooser *chooser,
158 GtkFileFilter *filter);
159 void gtk_file_chooser_remove_filter (GtkFileChooser *chooser,
160 GtkFileFilter *filter);
161 GSList *gtk_file_chooser_list_filters (GtkFileChooser *chooser);
165 void gtk_file_chooser_set_filter (GtkFileChooser *chooser,
166 GtkFileFilter *filter);
167 GtkFileFilter *gtk_file_chooser_get_filter (GtkFileChooser *chooser);
169 /* Per-application shortcut folders */
171 gboolean gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
174 gboolean gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
177 GSList *gtk_file_chooser_list_shortcut_folders (GtkFileChooser *chooser);
179 gboolean gtk_file_chooser_add_shortcut_folder_uri (GtkFileChooser *chooser,
182 gboolean gtk_file_chooser_remove_shortcut_folder_uri (GtkFileChooser *chooser,
185 GSList *gtk_file_chooser_list_shortcut_folder_uris (GtkFileChooser *chooser);
189 #endif /* __GTK_FILE_CHOOSER_H__ */