]> Pileus Git - ~andy/gtk/blob - gtk/gtkfilechooser.h
Add gboolean return values and GError arguments to ::set_current_folder()
[~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 GType gtk_file_chooser_get_type (void);
44
45 /* GError enumeration for GtkFileChooser */
46
47 #define GTK_FILE_CHOOSER_ERROR (gtk_file_chooser_error_quark ())
48
49 typedef enum {
50   GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
51   GTK_FILE_CHOOSER_ERROR_BAD_FILENAME
52 } GtkFileChooserError;
53
54 GQuark gtk_file_chooser_error_quark (void);
55
56 /* Configuration
57  */
58 void                 gtk_file_chooser_set_action          (GtkFileChooser       *chooser,
59                                                            GtkFileChooserAction  action);
60 GtkFileChooserAction gtk_file_chooser_get_action          (GtkFileChooser       *chooser);
61 void                 gtk_file_chooser_set_local_only      (GtkFileChooser       *chooser,
62                                                            gboolean              local_only);
63 gboolean             gtk_file_chooser_get_local_only      (GtkFileChooser       *chooser);
64 void                 gtk_file_chooser_set_select_multiple (GtkFileChooser       *chooser,
65                                                            gboolean              select_multiple);
66 gboolean             gtk_file_chooser_get_select_multiple (GtkFileChooser       *chooser);
67
68 /* Suggested name for the Save-type actions
69  */
70 void     gtk_file_chooser_set_current_name   (GtkFileChooser *chooser,
71                                               const gchar    *name);
72
73 /* Filename manipulation
74  */
75 gchar *  gtk_file_chooser_get_filename       (GtkFileChooser *chooser);
76 gboolean gtk_file_chooser_set_filename       (GtkFileChooser *chooser,
77                                               const char     *filename);
78 gboolean gtk_file_chooser_select_filename    (GtkFileChooser *chooser,
79                                               const char     *filename);
80 void     gtk_file_chooser_unselect_filename  (GtkFileChooser *chooser,
81                                               const char     *filename);
82 void     gtk_file_chooser_select_all         (GtkFileChooser *chooser);
83 void     gtk_file_chooser_unselect_all       (GtkFileChooser *chooser);
84 GSList * gtk_file_chooser_get_filenames      (GtkFileChooser *chooser);
85 gboolean gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
86                                               const gchar    *filename);
87 gchar *  gtk_file_chooser_get_current_folder (GtkFileChooser *chooser);
88
89
90 /* URI manipulation
91  */
92 gchar *  gtk_file_chooser_get_uri                (GtkFileChooser *chooser);
93 gboolean gtk_file_chooser_set_uri                (GtkFileChooser *chooser,
94                                                   const char     *uri);
95 gboolean gtk_file_chooser_select_uri             (GtkFileChooser *chooser,
96                                                   const char     *uri);
97 void     gtk_file_chooser_unselect_uri           (GtkFileChooser *chooser,
98                                                   const char     *uri);
99 GSList * gtk_file_chooser_get_uris               (GtkFileChooser *chooser);
100 gboolean gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
101                                                   const gchar    *uri);
102 gchar *  gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser);
103
104 /* Preview widget
105  */
106 void       gtk_file_chooser_set_preview_widget        (GtkFileChooser *chooser,
107                                                        GtkWidget      *preview_widget);
108 GtkWidget *gtk_file_chooser_get_preview_widget        (GtkFileChooser *chooser);
109 void       gtk_file_chooser_set_preview_widget_active (GtkFileChooser *chooser,
110                                                        gboolean        active);
111 gboolean   gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser);
112 void       gtk_file_chooser_set_use_preview_label     (GtkFileChooser *chooser,
113                                                        gboolean        use_label);
114 gboolean   gtk_file_chooser_get_use_preview_label     (GtkFileChooser *chooser);
115
116 char *gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser);
117 char *gtk_file_chooser_get_preview_uri      (GtkFileChooser *chooser);
118
119 /* Extra widget
120  */
121 void       gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser,
122                                               GtkWidget      *extra_widget);
123 GtkWidget *gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser);
124
125 /* List of user selectable filters
126  */
127 void    gtk_file_chooser_add_filter    (GtkFileChooser *chooser,
128                                         GtkFileFilter  *filter);
129 void    gtk_file_chooser_remove_filter (GtkFileChooser *chooser,
130                                         GtkFileFilter  *filter);
131 GSList *gtk_file_chooser_list_filters  (GtkFileChooser *chooser);
132
133 /* Current filter
134  */
135 void           gtk_file_chooser_set_filter (GtkFileChooser *chooser,
136                                            GtkFileFilter  *filter);
137 GtkFileFilter *gtk_file_chooser_get_filter (GtkFileChooser *chooser);
138
139 /* Per-application shortcut folders */
140
141 gboolean gtk_file_chooser_add_shortcut_folder    (GtkFileChooser *chooser,
142                                                   const char     *folder,
143                                                   GError        **error);
144 gboolean gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
145                                                   const char     *folder,
146                                                   GError        **error);
147 GSList *gtk_file_chooser_list_shortcut_folders   (GtkFileChooser *chooser);
148
149 gboolean gtk_file_chooser_add_shortcut_folder_uri    (GtkFileChooser *chooser,
150                                                       const char     *uri,
151                                                       GError        **error);
152 gboolean gtk_file_chooser_remove_shortcut_folder_uri (GtkFileChooser *chooser,
153                                                       const char     *uri,
154                                                       GError        **error);
155 GSList *gtk_file_chooser_list_shortcut_folder_uris   (GtkFileChooser *chooser);
156
157 G_END_DECLS
158
159 #endif /* __GTK_FILE_CHOOSER_H__ */