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