]> Pileus Git - ~andy/gtk/blob - gtk/gtkfilechooser.h
Use gtk_text_buffer_get_insert instead of get_mark. Fixes Bug 497164.
[~andy/gtk] / gtk / gtkfilechooser.h
1 /* GTK - The GIMP Toolkit
2  * gtkfilechooser.h: Abstract interface for file selector GUIs
3  * Copyright (C) 2003, Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef __GTK_FILE_CHOOSER_H__
22 #define __GTK_FILE_CHOOSER_H__
23
24 #include "gtkfilefilter.h"
25 #include <gtk/gtkwidget.h>
26
27 G_BEGIN_DECLS
28
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))
32
33 typedef struct _GtkFileChooser      GtkFileChooser;
34
35 typedef enum
36 {
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;
42
43 typedef enum
44 {
45   GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM,
46   GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME,
47   GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN
48 } GtkFileChooserConfirmation;
49
50 GType gtk_file_chooser_get_type (void) G_GNUC_CONST;
51
52 /* GError enumeration for GtkFileChooser */
53
54 #define GTK_FILE_CHOOSER_ERROR (gtk_file_chooser_error_quark ())
55
56 typedef enum {
57   GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
58   GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
59   GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS
60 } GtkFileChooserError;
61
62 GQuark gtk_file_chooser_error_quark (void);
63
64 /* Configuration
65  */
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,
70                                                            gboolean              local_only);
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);
78
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);
82
83 /* Suggested name for the Save-type actions
84  */
85 void     gtk_file_chooser_set_current_name   (GtkFileChooser *chooser,
86                                               const gchar    *name);
87
88 /* Filename manipulation
89  */
90 #ifdef G_OS_WIN32
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
103 #endif
104
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);
118
119
120 /* URI manipulation
121  */
122 gchar *  gtk_file_chooser_get_uri                (GtkFileChooser *chooser);
123 gboolean gtk_file_chooser_set_uri                (GtkFileChooser *chooser,
124                                                   const char     *uri);
125 gboolean gtk_file_chooser_select_uri             (GtkFileChooser *chooser,
126                                                   const char     *uri);
127 void     gtk_file_chooser_unselect_uri           (GtkFileChooser *chooser,
128                                                   const char     *uri);
129 GSList * gtk_file_chooser_get_uris               (GtkFileChooser *chooser);
130 gboolean gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
131                                                   const gchar    *uri);
132 gchar *  gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser);
133
134 /* Preview widget
135  */
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,
140                                                        gboolean        active);
141 gboolean   gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser);
142 void       gtk_file_chooser_set_use_preview_label     (GtkFileChooser *chooser,
143                                                        gboolean        use_label);
144 gboolean   gtk_file_chooser_get_use_preview_label     (GtkFileChooser *chooser);
145
146 char *gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser);
147 char *gtk_file_chooser_get_preview_uri      (GtkFileChooser *chooser);
148
149 /* Extra widget
150  */
151 void       gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser,
152                                               GtkWidget      *extra_widget);
153 GtkWidget *gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser);
154
155 /* List of user selectable filters
156  */
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);
162
163 /* Current filter
164  */
165 void           gtk_file_chooser_set_filter (GtkFileChooser *chooser,
166                                            GtkFileFilter  *filter);
167 GtkFileFilter *gtk_file_chooser_get_filter (GtkFileChooser *chooser);
168
169 /* Per-application shortcut folders */
170
171 gboolean gtk_file_chooser_add_shortcut_folder    (GtkFileChooser *chooser,
172                                                   const char     *folder,
173                                                   GError        **error);
174 gboolean gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
175                                                   const char     *folder,
176                                                   GError        **error);
177 GSList *gtk_file_chooser_list_shortcut_folders   (GtkFileChooser *chooser);
178
179 gboolean gtk_file_chooser_add_shortcut_folder_uri    (GtkFileChooser *chooser,
180                                                       const char     *uri,
181                                                       GError        **error);
182 gboolean gtk_file_chooser_remove_shortcut_folder_uri (GtkFileChooser *chooser,
183                                                       const char     *uri,
184                                                       GError        **error);
185 GSList *gtk_file_chooser_list_shortcut_folder_uris   (GtkFileChooser *chooser);
186
187 G_END_DECLS
188
189 #endif /* __GTK_FILE_CHOOSER_H__ */