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 #ifndef __GTK_RECENT_MANAGER_H__
22 #define __GTK_RECENT_MANAGER_H__
24 #include <glib-object.h>
25 #include <gdk/gdkscreen.h>
26 #include <gdk-pixbuf/gdk-pixbuf.h>
31 #define GTK_TYPE_RECENT_INFO (gtk_recent_info_get_type ())
33 #define GTK_TYPE_RECENT_MANAGER (gtk_recent_manager_get_type ())
34 #define GTK_RECENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_MANAGER, GtkRecentManager))
35 #define GTK_IS_RECENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_MANAGER))
36 #define GTK_RECENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RECENT_MANAGER, GtkRecentManagerClass))
37 #define GTK_IS_RECENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RECENT_MANAGER))
38 #define GTK_RECENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RECENT_MANAGER, GtkRecentManagerClass))
40 typedef struct _GtkRecentInfo GtkRecentInfo;
41 typedef struct _GtkRecentData GtkRecentData;
42 typedef struct _GtkRecentManager GtkRecentManager;
43 typedef struct _GtkRecentManagerClass GtkRecentManagerClass;
44 typedef struct _GtkRecentManagerPrivate GtkRecentManagerPrivate;
48 * @display_name: a UTF-8 encoded string, containing the name of the recently
49 * used resource to be displayed, or %NULL;
50 * @description: a UTF-8 encoded string, containing a short description of
51 * the resource, or %NULL;
52 * @mime_type: the MIME type of the resource;
53 * @app_name: the name of the application that is registering this recently
55 * @app_exec: command line used to launch this resource; may contain the
56 * "%f" and "%u" escape characters which will be expanded to the resource
57 * file path and URI respectively when the command line is retrieved;
58 * @groups: a vector of strings containing groups names;
59 * @is_private: whether this resource should be displayed only by the
60 * applications that have registered it or not.
62 * Meta-data to be passed to gtk_recent_manager_add_full() when
63 * registering a recently used resource.
80 struct _GtkRecentManager
83 GObject parent_instance;
85 GtkRecentManagerPrivate *priv;
88 struct _GtkRecentManagerClass
91 GObjectClass parent_class;
93 void (*changed) (GtkRecentManager *manager);
95 /* padding for future expansion */
96 void (*_gtk_recent1) (void);
97 void (*_gtk_recent2) (void);
98 void (*_gtk_recent3) (void);
99 void (*_gtk_recent4) (void);
103 * GtkRecentManagerError:
104 * @GTK_RECENT_MANAGER_ERROR_NOT_FOUND: the URI specified does not exists in
105 * the recently used resources list.
106 * @GTK_RECENT_MANAGER_ERROR_INVALID_URI: the URI specified is not valid.
107 * @GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING: the supplied string is not
109 * @GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED: no application has registered
110 * the specified item.
111 * @GTK_RECENT_MANAGER_ERROR_READ: failure while reading the recently used
113 * @GTK_RECENT_MANAGER_ERROR_WRITE: failure while writing the recently used
115 * @GTK_RECENT_MANAGER_ERROR_UNKNOWN: unspecified error.
117 * Error codes for GtkRecentManager operations
121 GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
122 GTK_RECENT_MANAGER_ERROR_INVALID_URI,
123 GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING,
124 GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED,
125 GTK_RECENT_MANAGER_ERROR_READ,
126 GTK_RECENT_MANAGER_ERROR_WRITE,
127 GTK_RECENT_MANAGER_ERROR_UNKNOWN
128 } GtkRecentManagerError;
130 #define GTK_RECENT_MANAGER_ERROR (gtk_recent_manager_error_quark ())
131 GQuark gtk_recent_manager_error_quark (void);
134 GType gtk_recent_manager_get_type (void) G_GNUC_CONST;
136 GtkRecentManager *gtk_recent_manager_new (void);
137 GtkRecentManager *gtk_recent_manager_get_default (void);
138 GtkRecentManager *gtk_recent_manager_get_for_screen (GdkScreen *screen);
140 void gtk_recent_manager_set_screen (GtkRecentManager *manager,
143 gboolean gtk_recent_manager_add_item (GtkRecentManager *manager,
145 gboolean gtk_recent_manager_add_full (GtkRecentManager *manager,
147 const GtkRecentData *recent_data);
148 gboolean gtk_recent_manager_remove_item (GtkRecentManager *manager,
151 GtkRecentInfo * gtk_recent_manager_lookup_item (GtkRecentManager *manager,
154 gboolean gtk_recent_manager_has_item (GtkRecentManager *manager,
156 gboolean gtk_recent_manager_move_item (GtkRecentManager *manager,
158 const gchar *new_uri,
160 void gtk_recent_manager_set_limit (GtkRecentManager *manager,
162 gint gtk_recent_manager_get_limit (GtkRecentManager *manager);
163 GList * gtk_recent_manager_get_items (GtkRecentManager *manager);
164 gint gtk_recent_manager_purge_items (GtkRecentManager *manager,
168 GType gtk_recent_info_get_type (void) G_GNUC_CONST;
170 GtkRecentInfo * gtk_recent_info_ref (GtkRecentInfo *info);
171 void gtk_recent_info_unref (GtkRecentInfo *info);
173 G_CONST_RETURN gchar *gtk_recent_info_get_uri (GtkRecentInfo *info);
174 G_CONST_RETURN gchar *gtk_recent_info_get_display_name (GtkRecentInfo *info);
175 G_CONST_RETURN gchar *gtk_recent_info_get_description (GtkRecentInfo *info);
176 G_CONST_RETURN gchar *gtk_recent_info_get_mime_type (GtkRecentInfo *info);
177 time_t gtk_recent_info_get_added (GtkRecentInfo *info);
178 time_t gtk_recent_info_get_modified (GtkRecentInfo *info);
179 time_t gtk_recent_info_get_visited (GtkRecentInfo *info);
180 gboolean gtk_recent_info_get_private_hint (GtkRecentInfo *info);
181 gboolean gtk_recent_info_get_application_info (GtkRecentInfo *info,
182 const gchar *app_name,
186 gchar ** gtk_recent_info_get_applications (GtkRecentInfo *info,
187 gsize *length) G_GNUC_MALLOC;
188 gchar * gtk_recent_info_last_application (GtkRecentInfo *info) G_GNUC_MALLOC;
189 gboolean gtk_recent_info_has_application (GtkRecentInfo *info,
190 const gchar *app_name);
191 gchar ** gtk_recent_info_get_groups (GtkRecentInfo *info,
192 gsize *length) G_GNUC_MALLOC;
193 gboolean gtk_recent_info_has_group (GtkRecentInfo *info,
194 const gchar *group_name);
195 GdkPixbuf * gtk_recent_info_get_icon (GtkRecentInfo *info,
197 gchar * gtk_recent_info_get_short_name (GtkRecentInfo *info) G_GNUC_MALLOC;
198 gchar * gtk_recent_info_get_uri_display (GtkRecentInfo *info) G_GNUC_MALLOC;
199 gint gtk_recent_info_get_age (GtkRecentInfo *info);
200 gboolean gtk_recent_info_is_local (GtkRecentInfo *info);
201 gboolean gtk_recent_info_exists (GtkRecentInfo *info);
202 gboolean gtk_recent_info_match (GtkRecentInfo *info_a,
203 GtkRecentInfo *info_b);
207 #endif /* __GTK_RECENT_MANAGER_H__ */