]> Pileus Git - ~andy/gtk/blob - gtk/gtkrecentchooser.h
Merge branch 'notebooks-without-mouse-scrolling'
[~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, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23 #error "Only <gtk/gtk.h> can be included directly."
24 #endif
25
26 #ifndef __GTK_RECENT_CHOOSER_H__
27 #define __GTK_RECENT_CHOOSER_H__
28
29 #include <gtk/gtkwidget.h>
30 #include <gtk/gtkrecentmanager.h>
31 #include <gtk/gtkrecentfilter.h>
32
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_RECENT_CHOOSER                 (gtk_recent_chooser_get_type ())
36 #define GTK_RECENT_CHOOSER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_CHOOSER, GtkRecentChooser))
37 #define GTK_IS_RECENT_CHOOSER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_CHOOSER))
38 #define GTK_RECENT_CHOOSER_GET_IFACE(inst)      (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_RECENT_CHOOSER, GtkRecentChooserIface))
39
40 /**
41  * GtkRecentSortType:
42  * @GTK_RECENT_SORT_NONE: Do not sort the returned list of recently used
43  *   resources.
44  * @GTK_RECENT_SORT_MRU: Sort the returned list with the most recently used
45  *   items first.
46  * @GTK_RECENT_SORT_LRU: Sort the returned list with the least recently used
47  *   items first.
48  * @GTK_RECENT_SORT_CUSTOM: Sort the returned list using a custom sorting
49  *   function passed using gtk_recent_manager_set_sort_func().
50  *
51  * Used to specify the sorting method to be applyed to the recently
52  * used resource list.
53  *
54  * Since: 2.10
55  */
56 typedef enum
57 {
58   GTK_RECENT_SORT_NONE = 0,
59   GTK_RECENT_SORT_MRU,
60   GTK_RECENT_SORT_LRU,
61   GTK_RECENT_SORT_CUSTOM
62 } GtkRecentSortType;
63
64 typedef gint (*GtkRecentSortFunc) (GtkRecentInfo *a,
65                                    GtkRecentInfo *b,
66                                    gpointer       user_data);
67
68
69 typedef struct _GtkRecentChooser      GtkRecentChooser; /* dummy */
70 typedef struct _GtkRecentChooserIface GtkRecentChooserIface;
71
72 /**
73  * GTK_RECENT_CHOOSER_ERROR:
74  *
75  * Used to get the #GError quark for #GtkRecentChooser errors.
76  *
77  * Since: 2.10
78  */
79 #define GTK_RECENT_CHOOSER_ERROR        (gtk_recent_chooser_error_quark ())
80
81 /**
82  * GtkRecentChooserError:
83  * @GTK_RECENT_CHOOSER_ERROR_NOT_FOUND: Indicates that a file does not exist
84  * @GTK_RECENT_CHOOSER_ERROR_INVALID_URI: Indicates a malformed URI
85  *
86  * These identify the various errors that can occur while calling
87  * #GtkRecentChooser functions.
88  *
89  * Since: 2.10
90  */
91 typedef enum
92 {
93   GTK_RECENT_CHOOSER_ERROR_NOT_FOUND,
94   GTK_RECENT_CHOOSER_ERROR_INVALID_URI
95 } GtkRecentChooserError;
96
97 GQuark  gtk_recent_chooser_error_quark (void);
98
99
100 struct _GtkRecentChooserIface
101 {
102   GTypeInterface base_iface;
103
104   /*
105    * Methods
106    */
107   gboolean          (* set_current_uri)    (GtkRecentChooser  *chooser,
108                                             const gchar       *uri,
109                                             GError           **error);
110   gchar *           (* get_current_uri)    (GtkRecentChooser  *chooser);
111   gboolean          (* select_uri)         (GtkRecentChooser  *chooser,
112                                             const gchar       *uri,
113                                             GError           **error);
114   void              (* unselect_uri)       (GtkRecentChooser  *chooser,
115                                             const gchar       *uri);
116   void              (* select_all)         (GtkRecentChooser  *chooser);
117   void              (* unselect_all)       (GtkRecentChooser  *chooser);
118   GList *           (* get_items)          (GtkRecentChooser  *chooser);
119   GtkRecentManager *(* get_recent_manager) (GtkRecentChooser  *chooser);
120   void              (* add_filter)         (GtkRecentChooser  *chooser,
121                                             GtkRecentFilter   *filter);
122   void              (* remove_filter)      (GtkRecentChooser  *chooser,
123                                             GtkRecentFilter   *filter);
124   GSList *          (* list_filters)       (GtkRecentChooser  *chooser);
125   void              (* set_sort_func)      (GtkRecentChooser  *chooser,
126                                             GtkRecentSortFunc  sort_func,
127                                             gpointer           sort_data,
128                                             GDestroyNotify     data_destroy);
129
130   /*
131    * Signals
132    */
133   void              (* item_activated)     (GtkRecentChooser  *chooser);
134   void              (* selection_changed)  (GtkRecentChooser  *chooser);
135 };
136
137 GType   gtk_recent_chooser_get_type    (void) G_GNUC_CONST;
138
139 /*
140  * Configuration
141  */
142 void              gtk_recent_chooser_set_show_private    (GtkRecentChooser  *chooser,
143                                                           gboolean           show_private);
144 gboolean          gtk_recent_chooser_get_show_private    (GtkRecentChooser  *chooser);
145 void              gtk_recent_chooser_set_show_not_found  (GtkRecentChooser  *chooser,
146                                                           gboolean           show_not_found);
147 gboolean          gtk_recent_chooser_get_show_not_found  (GtkRecentChooser  *chooser);
148 void              gtk_recent_chooser_set_select_multiple (GtkRecentChooser  *chooser,
149                                                           gboolean           select_multiple);
150 gboolean          gtk_recent_chooser_get_select_multiple (GtkRecentChooser  *chooser);
151 void              gtk_recent_chooser_set_limit           (GtkRecentChooser  *chooser,
152                                                           gint               limit);
153 gint              gtk_recent_chooser_get_limit           (GtkRecentChooser  *chooser);
154 void              gtk_recent_chooser_set_local_only      (GtkRecentChooser  *chooser,
155                                                           gboolean           local_only);
156 gboolean          gtk_recent_chooser_get_local_only      (GtkRecentChooser  *chooser);
157 void              gtk_recent_chooser_set_show_tips       (GtkRecentChooser  *chooser,
158                                                           gboolean           show_tips);
159 gboolean          gtk_recent_chooser_get_show_tips       (GtkRecentChooser  *chooser);
160 void              gtk_recent_chooser_set_show_icons      (GtkRecentChooser  *chooser,
161                                                           gboolean           show_icons);
162 gboolean          gtk_recent_chooser_get_show_icons      (GtkRecentChooser  *chooser);
163 void              gtk_recent_chooser_set_sort_type       (GtkRecentChooser  *chooser,
164                                                           GtkRecentSortType  sort_type);
165 GtkRecentSortType gtk_recent_chooser_get_sort_type       (GtkRecentChooser  *chooser);
166 void              gtk_recent_chooser_set_sort_func       (GtkRecentChooser  *chooser,
167                                                           GtkRecentSortFunc  sort_func,
168                                                           gpointer           sort_data,
169                                                           GDestroyNotify     data_destroy);
170
171 /*
172  * Items handling
173  */
174 gboolean       gtk_recent_chooser_set_current_uri  (GtkRecentChooser  *chooser,
175                                                     const gchar       *uri,
176                                                     GError           **error);
177 gchar *        gtk_recent_chooser_get_current_uri  (GtkRecentChooser  *chooser);
178 GtkRecentInfo *gtk_recent_chooser_get_current_item (GtkRecentChooser  *chooser);
179 gboolean       gtk_recent_chooser_select_uri       (GtkRecentChooser  *chooser,
180                                                     const gchar       *uri,
181                                                     GError           **error);
182 void           gtk_recent_chooser_unselect_uri     (GtkRecentChooser  *chooser,
183                                                     const gchar       *uri);
184 void           gtk_recent_chooser_select_all       (GtkRecentChooser  *chooser);
185 void           gtk_recent_chooser_unselect_all     (GtkRecentChooser  *chooser);
186 GList *        gtk_recent_chooser_get_items        (GtkRecentChooser  *chooser);
187 gchar **       gtk_recent_chooser_get_uris         (GtkRecentChooser  *chooser,
188                                                     gsize             *length);
189
190 /*
191  * Filters
192  */
193 void             gtk_recent_chooser_add_filter    (GtkRecentChooser *chooser,
194                                                    GtkRecentFilter  *filter);
195 void             gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser,
196                                                    GtkRecentFilter  *filter);
197 GSList *         gtk_recent_chooser_list_filters  (GtkRecentChooser *chooser);
198 void             gtk_recent_chooser_set_filter    (GtkRecentChooser *chooser,
199                                                    GtkRecentFilter  *filter);
200 GtkRecentFilter *gtk_recent_chooser_get_filter    (GtkRecentChooser *chooser);
201
202
203 G_END_DECLS
204
205 #endif /* __GTK_RECENT_CHOOSER_H__ */