Synopsis
#include <gtk/gtk.h>
GtkRecentFilter;
GtkRecentFilterInfo;
enum GtkRecentFilterFlags;
gboolean (*GtkRecentFilterFunc) (const GtkRecentFilterInfo *filter_info,
gpointer user_data);
GtkRecentFilter* gtk_recent_filter_new (void);
const gchar* gtk_recent_filter_get_name (GtkRecentFilter *filter);
void gtk_recent_filter_set_name (GtkRecentFilter *filter,
const gchar *name);
void gtk_recent_filter_add_mime_type (GtkRecentFilter *filter,
const gchar *mime_type);
void gtk_recent_filter_add_pattern (GtkRecentFilter *filter,
const gchar *pattern);
void gtk_recent_filter_add_pixbuf_formats
(GtkRecentFilter *filter);
void gtk_recent_filter_add_application (GtkRecentFilter *filter,
const gchar *application);
void gtk_recent_filter_add_group (GtkRecentFilter *filter,
const gchar *group);
void gtk_recent_filter_add_age (GtkRecentFilter *filter,
gint days);
void gtk_recent_filter_add_custom (GtkRecentFilter *filter,
GtkRecentFilterFlags needed,
GtkRecentFilterFunc func,
gpointer data,
GDestroyNotify data_destroy);
GtkRecentFilterFlags gtk_recent_filter_get_needed (GtkRecentFilter *filter);
gboolean gtk_recent_filter_filter (GtkRecentFilter *filter,
const GtkRecentFilterInfo *filter_info);
Description
A GtkRecentFilter can be used to restrict the files being shown
in a GtkRecentChooser. Files can be filtered based on their name
(with Filtering by mime type handles aliasing and subclassing of mime types; e.g. a filter for text/plain also matches a file with mime type application/rtf, since application/rtf is a subclass of text/plain. Note that GtkRecentFilter allows wildcards for the subtype of a mime type, so you can e.g. filter for image/*.
Normally, filters are used by adding them to a GtkRecentChooser,
see Recently used files are supported since GTK+ 2.10. DetailsGtkRecentFiltertypedef struct _GtkRecentFilter GtkRecentFilter; The GtkRecentFilter struct contains only private fields and should not be directly accessed. GtkRecentFilterInfotypedef struct {
GtkRecentFilterFlags contains;
const gchar *uri;
const gchar *display_name;
const gchar *mime_type;
const gchar **applications;
const gchar **groups;
gint age;
} GtkRecentFilterInfo;
A GtkRecentFilterInfo struct is used
to pass information about the tested file to
enum GtkRecentFilterFlagstypedef enum {
GTK_RECENT_FILTER_URI = 1 << 0,
GTK_RECENT_FILTER_DISPLAY_NAME = 1 << 1,
GTK_RECENT_FILTER_MIME_TYPE = 1 << 2,
GTK_RECENT_FILTER_APPLICATION = 1 << 3,
GTK_RECENT_FILTER_GROUP = 1 << 4,
GTK_RECENT_FILTER_AGE = 1 << 5
} GtkRecentFilterFlags;
These flags indicate what parts of a GtkRecentFilterInfo struct are filled or need to be filled.
GtkRecentFilterFunc ()gboolean (*GtkRecentFilterFunc) (const GtkRecentFilterInfo *filter_info, gpointer user_data);
The type of function that is used with custom filters,
see
gtk_recent_filter_new ()GtkRecentFilter* gtk_recent_filter_new (void);
Creates a new GtkRecentFilter with no rules added to it.
Such filter does not accept any recently used resources, so is not
particularly useful until you add rules with
GtkRecentFilter *filter = gtk_recent_filter_new (); gtk_recent_filter_add_pattern (filter, "*");
Since 2.10 gtk_recent_filter_get_name ()const gchar* gtk_recent_filter_get_name (GtkRecentFilter *filter);
Gets the human-readable name for the filter.
See
Since 2.10 gtk_recent_filter_set_name ()void gtk_recent_filter_set_name (GtkRecentFilter *filter, const gchar *name); Sets the human-readable name of the filter; this is the string that will be displayed in the recently used resources selector user interface if there is a selectable list of filters.
Since 2.10 gtk_recent_filter_add_mime_type ()void gtk_recent_filter_add_mime_type (GtkRecentFilter *filter, const gchar *mime_type); Adds a rule that allows resources based on their registered MIME type.
Since 2.10 gtk_recent_filter_add_pattern ()void gtk_recent_filter_add_pattern (GtkRecentFilter *filter, const gchar *pattern); Adds a rule that allows resources based on a pattern matching their display name.
Since 2.10 gtk_recent_filter_add_pixbuf_formats ()void gtk_recent_filter_add_pixbuf_formats
(GtkRecentFilter *filter);
Adds a rule allowing image files in the formats supported by GdkPixbuf.
Since 2.10 gtk_recent_filter_add_application ()void gtk_recent_filter_add_application (GtkRecentFilter *filter, const gchar *application); Adds a rule that allows resources based on the name of the application that has registered them.
Since 2.10 gtk_recent_filter_add_group ()void gtk_recent_filter_add_group (GtkRecentFilter *filter, const gchar *group); Adds a rule that allows resources based on the name of the group to which they belong
Since 2.10 gtk_recent_filter_add_age ()void gtk_recent_filter_add_age (GtkRecentFilter *filter, gint days); Adds a rule that allows resources based on their age - that is, the number of days elapsed since they were last modified.
Since 2.10 gtk_recent_filter_add_custom ()void gtk_recent_filter_add_custom (GtkRecentFilter *filter, GtkRecentFilterFlags needed, GtkRecentFilterFunc func, gpointer data, GDestroyNotify data_destroy);
Adds a rule to a filter that allows resources based on a custom callback
function. The bitfield
Since 2.10 gtk_recent_filter_get_needed ()GtkRecentFilterFlags gtk_recent_filter_get_needed (GtkRecentFilter *filter);
Gets the fields that need to be filled in for the structure
passed to This function will not typically be used by applications; it is intended principally for use in the implementation of GtkRecentChooser.
Since 2.10 gtk_recent_filter_filter ()gboolean gtk_recent_filter_filter (GtkRecentFilter *filter, const GtkRecentFilterInfo *filter_info);
Tests whether a file should be displayed according to This function will not typically be used by applications; it is intended principally for use in the implementation of GtkRecentChooser.
Since 2.10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||