1 | /* GTK - The GIMP Toolkit |
2 | * gtkrecentfilter.h - Filter object for recently used resources |
3 | * Copyright (C) 2006, Emmanuele Bassi |
4 | * |
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. |
9 | * |
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. |
14 | * |
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. |
19 | */ |
20 | |
21 | #ifndef __GTK_RECENT_FILTER_H__ |
22 | #define __GTK_RECENT_FILTER_H__ |
23 | |
24 | #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
25 | #error "Only <gtk/gtk.h> can be included directly." |
26 | #endif |
27 | |
28 | #include <glib-object.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
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)) |
35 | |
36 | typedef struct _GtkRecentFilter GtkRecentFilter; |
37 | typedef struct _GtkRecentFilterInfo GtkRecentFilterInfo; |
38 | |
39 | typedef enum { |
40 | GTK_RECENT_FILTER_URI = 1 << 0, |
41 | GTK_RECENT_FILTER_DISPLAY_NAME = 1 << 1, |
42 | GTK_RECENT_FILTER_MIME_TYPE = 1 << 2, |
43 | GTK_RECENT_FILTER_APPLICATION = 1 << 3, |
44 | GTK_RECENT_FILTER_GROUP = 1 << 4, |
45 | GTK_RECENT_FILTER_AGE = 1 << 5 |
46 | } GtkRecentFilterFlags; |
47 | |
48 | typedef gboolean (*GtkRecentFilterFunc) (const GtkRecentFilterInfo *filter_info, |
49 | gpointer user_data); |
50 | |
51 | struct _GtkRecentFilterInfo |
52 | { |
53 | GtkRecentFilterFlags contains; |
54 | |
55 | const gchar *uri; |
56 | const gchar *display_name; |
57 | const gchar *mime_type; |
58 | const gchar **applications; |
59 | const gchar **groups; |
60 | |
61 | gint age; |
62 | }; |
63 | |
64 | GType gtk_recent_filter_get_type (void) G_GNUC_CONST; |
65 | |
66 | GtkRecentFilter * gtk_recent_filter_new (void); |
67 | void gtk_recent_filter_set_name (GtkRecentFilter *filter, |
68 | const gchar *name); |
69 | const gchar * gtk_recent_filter_get_name (GtkRecentFilter *filter); |
70 | |
71 | void gtk_recent_filter_add_mime_type (GtkRecentFilter *filter, |
72 | const gchar *mime_type); |
73 | void gtk_recent_filter_add_pattern (GtkRecentFilter *filter, |
74 | const gchar *pattern); |
75 | void gtk_recent_filter_add_pixbuf_formats (GtkRecentFilter *filter); |
76 | void gtk_recent_filter_add_application (GtkRecentFilter *filter, |
77 | const gchar *application); |
78 | void gtk_recent_filter_add_group (GtkRecentFilter *filter, |
79 | const gchar *group); |
80 | void gtk_recent_filter_add_age (GtkRecentFilter *filter, |
81 | gint days); |
82 | void gtk_recent_filter_add_custom (GtkRecentFilter *filter, |
83 | GtkRecentFilterFlags needed, |
84 | GtkRecentFilterFunc func, |
85 | gpointer data, |
86 | GDestroyNotify data_destroy); |
87 | |
88 | GtkRecentFilterFlags gtk_recent_filter_get_needed (GtkRecentFilter *filter); |
89 | gboolean gtk_recent_filter_filter (GtkRecentFilter *filter, |
90 | const GtkRecentFilterInfo *filter_info); |
91 | |
92 | G_END_DECLS |
93 | |
94 | #endif /* ! __GTK_RECENT_FILTER_H__ */ |
95 | |