]> Pileus Git - ~andy/gtk/blob - gtk/gtkrecentchooser.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkrecentchooser.h
1 /* GTK - The GIMP Toolkit
2  * gtkrecentchooser.h - Abstract interface for recent file selectors GUIs
3  *
4  * Copyright (C) 2006, Emmanuele Bassi
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef __GTK_RECENT_CHOOSER_H__
21 #define __GTK_RECENT_CHOOSER_H__
22
23 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24 #error "Only <gtk/gtk.h> can be included directly."
25 #endif
26
27 #include <gtk/gtkwidget.h>
28 #include <gtk/gtkrecentmanager.h>
29 #include <gtk/gtkrecentfilter.h>
30
31 G_BEGIN_DECLS
32
33 #define GTK_TYPE_RECENT_CHOOSER                 (gtk_recent_chooser_get_type ())
34 #define GTK_RECENT_CHOOSER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_CHOOSER, GtkRecentChooser))
35 #define GTK_IS_RECENT_CHOOSER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_CHOOSER))
36 #define GTK_RECENT_CHOOSER_GET_IFACE(inst)      (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_RECENT_CHOOSER, GtkRecentChooserIface))
37
38 /**
39  * GtkRecentSortType:
40  * @GTK_RECENT_SORT_NONE: Do not sort the returned list of recently used
41  *   resources.
42  * @GTK_RECENT_SORT_MRU: Sort the returned list with the most recently used
43  *   items first.
44  * @GTK_RECENT_SORT_LRU: Sort the returned list with the least recently used
45  *   items first.
46  * @GTK_RECENT_SORT_CUSTOM: Sort the returned list using a custom sorting
47  *   function passed using gtk_recent_chooser_set_sort_func().
48  *
49  * Used to specify the sorting method to be applyed to the recently
50  * used resource list.
51  *
52  * Since: 2.10
53  */
54 typedef enum
55 {
56   GTK_RECENT_SORT_NONE = 0,
57   GTK_RECENT_SORT_MRU,
58   GTK_RECENT_SORT_LRU,
59   GTK_RECENT_SORT_CUSTOM
60 } GtkRecentSortType;
61
62 typedef gint (*GtkRecentSortFunc) (GtkRecentInfo *a,
63                                    GtkRecentInfo *b,
64                                    gpointer       user_data);
65
66
67 typedef struct _GtkRecentChooser      GtkRecentChooser; /* dummy */
68 typedef struct _GtkRecentChooserIface GtkRecentChooserIface;
69
70 /**
71  * GTK_RECENT_CHOOSER_ERROR:
72  *
73  * Used to get the #GError quark for #GtkRecentChooser errors.
74  *
75  * Since: 2.10
76  */
77 #define GTK_RECENT_CHOOSER_ERROR        (gtk_recent_chooser_error_quark ())
78
79 /**
80  * GtkRecentChooserError:
81  * @GTK_RECENT_CHOOSER_ERROR_NOT_FOUND: Indicates that a file does not exist
82  * @GTK_RECENT_CHOOSER_ERROR_INVALID_URI: Indicates a malformed URI
83  *
84  * These identify the various errors that can occur while calling
85  * #GtkRecentChooser functions.
86  *
87  * Since: 2.10
88  */
89 typedef enum
90 {
91   GTK_RECENT_CHOOSER_ERROR_NOT_FOUND,
92   GTK_RECENT_CHOOSER_ERROR_INVALID_URI
93 } GtkRecentChooserError;
94
95 GQuark  gtk_recent_chooser_error_quark (void);
96
97
98 struct _GtkRecentChooserIface
99 {
100   GTypeInterface base_iface;
101
102   /*
103    * Methods
104    */
105   gboolean          (* set_current_uri)    (GtkRecentChooser  *chooser,
106                                             const gchar       *uri,
107                                             GError           **error);
108   gchar *           (* get_current_uri)    (GtkRecentChooser  *chooser);
109   gboolean          (* select_uri)         (GtkRecentChooser  *chooser,
110                                             const gchar       *uri,
111                                             GError           **error);
112   void              (* unselect_uri)       (GtkRecentChooser  *chooser,
113                                             const gchar       *uri);
114   void              (* select_all)         (GtkRecentChooser  *chooser);
115   void              (* unselect_all)       (GtkRecentChooser  *chooser);
116   GList *           (* get_items)          (GtkRecentChooser  *chooser);
117   GtkRecentManager *(* get_recent_manager) (GtkRecentChooser  *chooser);
118   void              (* add_filter)         (GtkRecentChooser  *chooser,
119                                             GtkRecentFilter   *filter);
120   void              (* remove_filter)      (GtkRecentChooser  *chooser,
121                                             GtkRecentFilter   *filter);
122   GSList *          (* list_filters)       (GtkRecentChooser  *chooser);
123   void              (* set_sort_func)      (GtkRecentChooser  *chooser,
124                                             GtkRecentSortFunc  sort_func,
125                                             gpointer           sort_data,
126                                             GDestroyNotify     data_destroy);
127
128   /*
129    * Signals
130    */
131   void              (* item_activated)     (GtkRecentChooser  *chooser);
132   void              (* selection_changed)  (GtkRecentChooser  *chooser);
133 };
134
135 GType   gtk_recent_chooser_get_type    (void) G_GNUC_CONST;
136
137 /*
138  * Configuration
139  */
140 void              gtk_recent_chooser_set_show_private    (GtkRecentChooser  *chooser,
141                                                           gboolean           show_private);
142 gboolean          gtk_recent_chooser_get_show_private    (GtkRecentChooser  *chooser);
143 void              gtk_recent_chooser_set_show_not_found  (GtkRecentChooser  *chooser,
144                                                           gboolean           show_not_found);
145 gboolean          gtk_recent_chooser_get_show_not_found  (GtkRecentChooser  *chooser);
146 void              gtk_recent_chooser_set_select_multiple (GtkRecentChooser  *chooser,
147                                                           gboolean           select_multiple);
148 gboolean          gtk_recent_chooser_get_select_multiple (GtkRecentChooser  *chooser);
149 void              gtk_recent_chooser_set_limit           (GtkRecentChooser  *chooser,
150                                                           gint               limit);
151 gint              gtk_recent_chooser_get_limit           (GtkRecentChooser  *chooser);
152 void              gtk_recent_chooser_set_local_only      (GtkRecentChooser  *chooser,
153                                                           gboolean           local_only);
154 gboolean          gtk_recent_chooser_get_local_only      (GtkRecentChooser  *chooser);
155 void              gtk_recent_chooser_set_show_tips       (GtkRecentChooser  *chooser,
156                                                           gboolean           show_tips);
157 gboolean          gtk_recent_chooser_get_show_tips       (GtkRecentChooser  *chooser);
158 void              gtk_recent_chooser_set_show_icons      (GtkRecentChooser  *chooser,
159                                                           gboolean           show_icons);
160 gboolean          gtk_recent_chooser_get_show_icons      (GtkRecentChooser  *chooser);
161 void              gtk_recent_chooser_set_sort_type       (GtkRecentChooser  *chooser,
162                                                           GtkRecentSortType  sort_type);
163 GtkRecentSortType gtk_recent_chooser_get_sort_type       (GtkRecentChooser  *chooser);
164 void              gtk_recent_chooser_set_sort_func       (GtkRecentChooser  *chooser,
165                                                           GtkRecentSortFunc  sort_func,
166                                                           gpointer           sort_data,
167                                                           GDestroyNotify     data_destroy);
168
169 /*
170  * Items handling
171  */
172 gboolean       gtk_recent_chooser_set_current_uri  (GtkRecentChooser  *chooser,
173                                                     const gchar       *uri,
174                                                     GError           **error);
175 gchar *        gtk_recent_chooser_get_current_uri  (GtkRecentChooser  *chooser);
176 GtkRecentInfo *gtk_recent_chooser_get_current_item (GtkRecentChooser  *chooser);
177 gboolean       gtk_recent_chooser_select_uri       (GtkRecentChooser  *chooser,
178                                                     const gchar       *uri,
179                                                     GError           **error);
180 void           gtk_recent_chooser_unselect_uri     (GtkRecentChooser  *chooser,
181                                                     const gchar       *uri);
182 void           gtk_recent_chooser_select_all       (GtkRecentChooser  *chooser);
183 void           gtk_recent_chooser_unselect_all     (GtkRecentChooser  *chooser);
184 GList *        gtk_recent_chooser_get_items        (GtkRecentChooser  *chooser);
185 gchar **       gtk_recent_chooser_get_uris         (GtkRecentChooser  *chooser,
186                                                     gsize             *length);
187
188 /*
189  * Filters
190  */
191 void             gtk_recent_chooser_add_filter    (GtkRecentChooser *chooser,
192                                                    GtkRecentFilter  *filter);
193 void             gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser,
194                                                    GtkRecentFilter  *filter);
195 GSList *         gtk_recent_chooser_list_filters  (GtkRecentChooser *chooser);
196 void             gtk_recent_chooser_set_filter    (GtkRecentChooser *chooser,
197                                                    GtkRecentFilter  *filter);
198 GtkRecentFilter *gtk_recent_chooser_get_filter    (GtkRecentChooser *chooser);
199
200
201 G_END_DECLS
202
203 #endif /* __GTK_RECENT_CHOOSER_H__ */