1 /* GTK - The GIMP Toolkit
2 * gtkrecentmanager.h: a manager for the recently used resources
4 * Copyright (C) 2006 Emmanuele Bassi
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library 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.
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 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
25 #ifndef __GTK_RECENT_MANAGER_H__
26 #define __GTK_RECENT_MANAGER_H__
28 #include <gdk-pixbuf/gdk-pixbuf.h>
34 #define GTK_TYPE_RECENT_INFO (gtk_recent_info_get_type ())
36 #define GTK_TYPE_RECENT_MANAGER (gtk_recent_manager_get_type ())
37 #define GTK_RECENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_MANAGER, GtkRecentManager))
38 #define GTK_IS_RECENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_MANAGER))
39 #define GTK_RECENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RECENT_MANAGER, GtkRecentManagerClass))
40 #define GTK_IS_RECENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RECENT_MANAGER))
41 #define GTK_RECENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RECENT_MANAGER, GtkRecentManagerClass))
43 typedef struct _GtkRecentInfo GtkRecentInfo;
44 typedef struct _GtkRecentData GtkRecentData;
45 typedef struct _GtkRecentManager GtkRecentManager;
46 typedef struct _GtkRecentManagerClass GtkRecentManagerClass;
47 typedef struct _GtkRecentManagerPrivate GtkRecentManagerPrivate;
51 * @display_name: a UTF-8 encoded string, containing the name of the recently
52 * used resource to be displayed, or %NULL;
53 * @description: a UTF-8 encoded string, containing a short description of
54 * the resource, or %NULL;
55 * @mime_type: the MIME type of the resource;
56 * @app_name: the name of the application that is registering this recently
58 * @app_exec: command line used to launch this resource; may contain the
59 * "%f" and "%u" escape characters which will be expanded
60 * to the resource file path and URI respectively when the command line
62 * @groups: a vector of strings containing groups names;
63 * @is_private: whether this resource should be displayed only by the
64 * applications that have registered it or not.
66 * Meta-data to be passed to gtk_recent_manager_add_full() when
67 * registering a recently used resource.
87 * #GtkRecentManager contains only private data
88 * and should be accessed using the provided API.
92 struct _GtkRecentManager
95 GObject parent_instance;
97 GtkRecentManagerPrivate *priv;
101 * GtkRecentManagerClass:
103 * #GtkRecentManagerClass contains only private data.
107 struct _GtkRecentManagerClass
110 GObjectClass parent_class;
112 void (*changed) (GtkRecentManager *manager);
114 /* padding for future expansion */
115 void (*_gtk_recent1) (void);
116 void (*_gtk_recent2) (void);
117 void (*_gtk_recent3) (void);
118 void (*_gtk_recent4) (void);
122 * GtkRecentManagerError:
123 * @GTK_RECENT_MANAGER_ERROR_NOT_FOUND: the URI specified does not exists in
124 * the recently used resources list.
125 * @GTK_RECENT_MANAGER_ERROR_INVALID_URI: the URI specified is not valid.
126 * @GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING: the supplied string is not
128 * @GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED: no application has registered
129 * the specified item.
130 * @GTK_RECENT_MANAGER_ERROR_READ: failure while reading the recently used
132 * @GTK_RECENT_MANAGER_ERROR_WRITE: failure while writing the recently used
134 * @GTK_RECENT_MANAGER_ERROR_UNKNOWN: unspecified error.
136 * Error codes for #GtkRecentManager operations
142 GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
143 GTK_RECENT_MANAGER_ERROR_INVALID_URI,
144 GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING,
145 GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED,
146 GTK_RECENT_MANAGER_ERROR_READ,
147 GTK_RECENT_MANAGER_ERROR_WRITE,
148 GTK_RECENT_MANAGER_ERROR_UNKNOWN
149 } GtkRecentManagerError;
152 * GTK_RECENT_MANAGER_ERROR:
154 * The #GError domain for #GtkRecentManager errors.
158 #define GTK_RECENT_MANAGER_ERROR (gtk_recent_manager_error_quark ())
159 GQuark gtk_recent_manager_error_quark (void);
162 GType gtk_recent_manager_get_type (void) G_GNUC_CONST;
164 GtkRecentManager *gtk_recent_manager_new (void);
165 GtkRecentManager *gtk_recent_manager_get_default (void);
167 gboolean gtk_recent_manager_add_item (GtkRecentManager *manager,
169 gboolean gtk_recent_manager_add_full (GtkRecentManager *manager,
171 const GtkRecentData *recent_data);
172 gboolean gtk_recent_manager_remove_item (GtkRecentManager *manager,
175 GtkRecentInfo * gtk_recent_manager_lookup_item (GtkRecentManager *manager,
178 gboolean gtk_recent_manager_has_item (GtkRecentManager *manager,
180 gboolean gtk_recent_manager_move_item (GtkRecentManager *manager,
182 const gchar *new_uri,
184 GList * gtk_recent_manager_get_items (GtkRecentManager *manager);
185 gint gtk_recent_manager_purge_items (GtkRecentManager *manager,
189 GType gtk_recent_info_get_type (void) G_GNUC_CONST;
191 GtkRecentInfo * gtk_recent_info_ref (GtkRecentInfo *info);
192 void gtk_recent_info_unref (GtkRecentInfo *info);
194 const gchar * gtk_recent_info_get_uri (GtkRecentInfo *info);
195 const gchar * gtk_recent_info_get_display_name (GtkRecentInfo *info);
196 const gchar * gtk_recent_info_get_description (GtkRecentInfo *info);
197 const gchar * gtk_recent_info_get_mime_type (GtkRecentInfo *info);
198 time_t gtk_recent_info_get_added (GtkRecentInfo *info);
199 time_t gtk_recent_info_get_modified (GtkRecentInfo *info);
200 time_t gtk_recent_info_get_visited (GtkRecentInfo *info);
201 gboolean gtk_recent_info_get_private_hint (GtkRecentInfo *info);
202 gboolean gtk_recent_info_get_application_info (GtkRecentInfo *info,
203 const gchar *app_name,
204 const gchar **app_exec,
207 GAppInfo * gtk_recent_info_create_app_info (GtkRecentInfo *info,
208 const gchar *app_name,
210 gchar ** gtk_recent_info_get_applications (GtkRecentInfo *info,
211 gsize *length) G_GNUC_MALLOC;
212 gchar * gtk_recent_info_last_application (GtkRecentInfo *info) G_GNUC_MALLOC;
213 gboolean gtk_recent_info_has_application (GtkRecentInfo *info,
214 const gchar *app_name);
215 gchar ** gtk_recent_info_get_groups (GtkRecentInfo *info,
216 gsize *length) G_GNUC_MALLOC;
217 gboolean gtk_recent_info_has_group (GtkRecentInfo *info,
218 const gchar *group_name);
219 GdkPixbuf * gtk_recent_info_get_icon (GtkRecentInfo *info,
221 GIcon * gtk_recent_info_get_gicon (GtkRecentInfo *info);
222 gchar * gtk_recent_info_get_short_name (GtkRecentInfo *info) G_GNUC_MALLOC;
223 gchar * gtk_recent_info_get_uri_display (GtkRecentInfo *info) G_GNUC_MALLOC;
224 gint gtk_recent_info_get_age (GtkRecentInfo *info);
225 gboolean gtk_recent_info_is_local (GtkRecentInfo *info);
226 gboolean gtk_recent_info_exists (GtkRecentInfo *info);
227 gboolean gtk_recent_info_match (GtkRecentInfo *info_a,
228 GtkRecentInfo *info_b);
231 void _gtk_recent_manager_sync (void);
235 #endif /* __GTK_RECENT_MANAGER_H__ */