1 /* GTK - The GIMP Toolkit
2 * gtkrecentfilter.h - Filter object for recently used resources
3 * Copyright (C) 2006, Emmanuele Bassi
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef __GTK_RECENT_FILTER_H__
20 #define __GTK_RECENT_FILTER_H__
22 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23 #error "Only <gtk/gtk.h> can be included directly."
26 #include <glib-object.h>
30 #define GTK_TYPE_RECENT_FILTER (gtk_recent_filter_get_type ())
31 #define GTK_RECENT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_FILTER, GtkRecentFilter))
32 #define GTK_IS_RECENT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_FILTER))
34 typedef struct _GtkRecentFilter GtkRecentFilter;
35 typedef struct _GtkRecentFilterInfo GtkRecentFilterInfo;
38 * GtkRecentFilterFlags:
39 * @GTK_RECENT_FILTER_URI: the URI of the file being tested
40 * @GTK_RECENT_FILTER_DISPLAY_NAME: the string that will be used to
41 * display the file in the recent chooser
42 * @GTK_RECENT_FILTER_MIME_TYPE: the mime type of the file
43 * @GTK_RECENT_FILTER_APPLICATION: the list of applications that have
45 * @GTK_RECENT_FILTER_GROUP: the groups to which the file belongs to
46 * @GTK_RECENT_FILTER_AGE: the number of days elapsed since the file
49 * These flags indicate what parts of a #GtkRecentFilterInfo struct
50 * are filled or need to be filled.
53 GTK_RECENT_FILTER_URI = 1 << 0,
54 GTK_RECENT_FILTER_DISPLAY_NAME = 1 << 1,
55 GTK_RECENT_FILTER_MIME_TYPE = 1 << 2,
56 GTK_RECENT_FILTER_APPLICATION = 1 << 3,
57 GTK_RECENT_FILTER_GROUP = 1 << 4,
58 GTK_RECENT_FILTER_AGE = 1 << 5
59 } GtkRecentFilterFlags;
62 * GtkRecentFilterFunc:
63 * @filter_info: a #GtkRecentFilterInfo that is filled according
64 * to the @needed flags passed to gtk_recent_filter_add_custom()
65 * @user_data: user data passed to gtk_recent_filter_add_custom()
67 * The type of function that is used with custom filters,
68 * see gtk_recent_filter_add_custom().
70 * Return value: %TRUE if the file should be displayed
72 typedef gboolean (*GtkRecentFilterFunc) (const GtkRecentFilterInfo *filter_info,
77 * GtkRecentFilterInfo:
79 * A GtkRecentFilterInfo struct is used
80 * to pass information about the tested file to gtk_recent_filter_filter().
82 struct _GtkRecentFilterInfo
84 GtkRecentFilterFlags contains;
87 const gchar *display_name;
88 const gchar *mime_type;
89 const gchar **applications;
95 GType gtk_recent_filter_get_type (void) G_GNUC_CONST;
97 GtkRecentFilter * gtk_recent_filter_new (void);
98 void gtk_recent_filter_set_name (GtkRecentFilter *filter,
100 const gchar * gtk_recent_filter_get_name (GtkRecentFilter *filter);
102 void gtk_recent_filter_add_mime_type (GtkRecentFilter *filter,
103 const gchar *mime_type);
104 void gtk_recent_filter_add_pattern (GtkRecentFilter *filter,
105 const gchar *pattern);
106 void gtk_recent_filter_add_pixbuf_formats (GtkRecentFilter *filter);
107 void gtk_recent_filter_add_application (GtkRecentFilter *filter,
108 const gchar *application);
109 void gtk_recent_filter_add_group (GtkRecentFilter *filter,
111 void gtk_recent_filter_add_age (GtkRecentFilter *filter,
113 void gtk_recent_filter_add_custom (GtkRecentFilter *filter,
114 GtkRecentFilterFlags needed,
115 GtkRecentFilterFunc func,
117 GDestroyNotify data_destroy);
119 GtkRecentFilterFlags gtk_recent_filter_get_needed (GtkRecentFilter *filter);
120 gboolean gtk_recent_filter_filter (GtkRecentFilter *filter,
121 const GtkRecentFilterInfo *filter_info);
125 #endif /* ! __GTK_RECENT_FILTER_H__ */