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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
25 #ifndef __GTK_RECENT_FILTER_H__
26 #define __GTK_RECENT_FILTER_H__
28 #include <glib-object.h>
32 #define GTK_TYPE_RECENT_FILTER (gtk_recent_filter_get_type ())
33 #define GTK_RECENT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_FILTER, GtkRecentFilter))
34 #define GTK_IS_RECENT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_FILTER))
36 typedef struct _GtkRecentFilter GtkRecentFilter;
37 typedef struct _GtkRecentFilterInfo GtkRecentFilterInfo;
40 * GtkRecentFilterFlags:
41 * @GTK_RECENT_FILTER_URI: the URI of the file being tested
42 * @GTK_RECENT_FILTER_DISPLAY_NAME: the string that will be used to
43 * display the file in the recent chooser
44 * @GTK_RECENT_FILTER_MIME_TYPE: the mime type of the file
45 * @GTK_RECENT_FILTER_APPLICATION: the list of applications that have
47 * @GTK_RECENT_FILTER_GROUP: the groups to which the file belongs to
48 * @GTK_RECENT_FILTER_AGE: the number of days elapsed since the file
51 * These flags indicate what parts of a #GtkRecentFilterInfo struct
52 * are filled or need to be filled.
55 GTK_RECENT_FILTER_URI = 1 << 0,
56 GTK_RECENT_FILTER_DISPLAY_NAME = 1 << 1,
57 GTK_RECENT_FILTER_MIME_TYPE = 1 << 2,
58 GTK_RECENT_FILTER_APPLICATION = 1 << 3,
59 GTK_RECENT_FILTER_GROUP = 1 << 4,
60 GTK_RECENT_FILTER_AGE = 1 << 5
61 } GtkRecentFilterFlags;
64 * GtkRecentFilterFunc:
65 * @filter_info: a #GtkRecentFilterInfo that is filled according
66 * to the @needed flags passed to gtk_recent_filter_add_custom()
67 * @user_data: user data passed to gtk_recent_filter_add_custom()
69 * The type of function that is used with custom filters,
70 * see gtk_recent_filter_add_custom().
72 * Return value: %TRUE if the file should be displayed
74 typedef gboolean (*GtkRecentFilterFunc) (const GtkRecentFilterInfo *filter_info,
79 * GtkRecentFilterInfo:
81 * A GtkRecentFilterInfo struct is used
82 * to pass information about the tested file to gtk_recent_filter_filter().
84 struct _GtkRecentFilterInfo
86 GtkRecentFilterFlags contains;
89 const gchar *display_name;
90 const gchar *mime_type;
91 const gchar **applications;
97 GType gtk_recent_filter_get_type (void) G_GNUC_CONST;
99 GtkRecentFilter * gtk_recent_filter_new (void);
100 void gtk_recent_filter_set_name (GtkRecentFilter *filter,
102 const gchar * gtk_recent_filter_get_name (GtkRecentFilter *filter);
104 void gtk_recent_filter_add_mime_type (GtkRecentFilter *filter,
105 const gchar *mime_type);
106 void gtk_recent_filter_add_pattern (GtkRecentFilter *filter,
107 const gchar *pattern);
108 void gtk_recent_filter_add_pixbuf_formats (GtkRecentFilter *filter);
109 void gtk_recent_filter_add_application (GtkRecentFilter *filter,
110 const gchar *application);
111 void gtk_recent_filter_add_group (GtkRecentFilter *filter,
113 void gtk_recent_filter_add_age (GtkRecentFilter *filter,
115 void gtk_recent_filter_add_custom (GtkRecentFilter *filter,
116 GtkRecentFilterFlags needed,
117 GtkRecentFilterFunc func,
119 GDestroyNotify data_destroy);
121 GtkRecentFilterFlags gtk_recent_filter_get_needed (GtkRecentFilter *filter);
122 gboolean gtk_recent_filter_filter (GtkRecentFilter *filter,
123 const GtkRecentFilterInfo *filter_info);
127 #endif /* ! __GTK_RECENT_FILTER_H__ */