gi-gtk-3.0.26: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.RecentFilter

Contents

Description

A RecentFilter can be used to restrict the files being shown in a RecentChooser. Files can be filtered based on their name (with recentFilterAddPattern), on their mime type (with fileFilterAddMimeType), on the application that has registered them (with recentFilterAddApplication), or by a custom filter function (with recentFilterAddCustom).

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 RecentFilter 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 RecentChooser, see recentChooserAddFilter, but it is also possible to manually use a filter on a file with recentFilterFilter.

Recently used files are supported since GTK+ 2.10.

GtkRecentFilter as GtkBuildable

The GtkRecentFilter implementation of the GtkBuildable interface supports adding rules using the <mime-types>, <patterns> and <applications> elements and listing the rules within. Specifying a <mime-type>, <pattern> or <application> has the same effect as calling recentFilterAddMimeType, recentFilterAddPattern or recentFilterAddApplication.

An example of a UI definition fragment specifying GtkRecentFilter rules: > >class="GtkRecentFilter" > mime-types > mime-typetextplain<mime-type> > mime-typeimagepng<mime-type> > /mime-types > patterns > pattern*.txt/pattern > pattern*.png/pattern > /patterns > applications > applicationgimp/application > applicationgedit/application > applicationglade/application > /applications >/object

Synopsis

Exported types

newtype RecentFilter Source #

Memory-managed wrapper type.

class GObject o => IsRecentFilter o Source #

Type class for types which can be safely cast to RecentFilter, for instance with toRecentFilter.

toRecentFilter :: (MonadIO m, IsRecentFilter o) => o -> m RecentFilter Source #

Cast to RecentFilter, for types for which this is known to be safe. For general casts, use castTo.

Methods

addAge

recentFilterAddAge Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> Int32

days: number of days

-> m () 

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

addApplication

recentFilterAddApplication Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> Text

application: an application name

-> m () 

Adds a rule that allows resources based on the name of the application that has registered them.

Since: 2.10

addCustom

recentFilterAddCustom Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> [RecentFilterFlags]

needed: bitfield of flags indicating the information that the custom filter function needs.

-> RecentFilterFunc

func: callback function; if the function returns True, then the file will be displayed.

-> m () 

Adds a rule to a filter that allows resources based on a custom callback function. The bitfield needed which is passed in provides information about what sorts of information that the filter function needs; this allows GTK+ to avoid retrieving expensive information when it isn’t needed by the filter.

Since: 2.10

addGroup

recentFilterAddGroup Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> Text

group: a group name

-> m () 

Adds a rule that allows resources based on the name of the group to which they belong

Since: 2.10

addMimeType

recentFilterAddMimeType Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> Text

mimeType: a MIME type

-> m () 

Adds a rule that allows resources based on their registered MIME type.

Since: 2.10

addPattern

recentFilterAddPattern Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> Text

pattern: a file pattern

-> m () 

Adds a rule that allows resources based on a pattern matching their display name.

Since: 2.10

addPixbufFormats

recentFilterAddPixbufFormats Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> m () 

Adds a rule allowing image files in the formats supported by GdkPixbuf.

Since: 2.10

filter

recentFilterFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> RecentFilterInfo

filterInfo: a RecentFilterInfo containing information about a recently used resource

-> m Bool

Returns: True if the file should be displayed

Tests whether a file should be displayed according to filter. The RecentFilterInfo filterInfo should include the fields returned from recentFilterGetNeeded, and must set the RecentFilterInfo.contains field of filterInfo to indicate which fields have been set.

This function will not typically be used by applications; it is intended principally for use in the implementation of RecentChooser.

Since: 2.10

getName

recentFilterGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> m (Maybe Text)

Returns: the name of the filter, or Nothing. The returned string is owned by the filter object and should not be freed.

Gets the human-readable name for the filter. See recentFilterSetName.

Since: 2.10

getNeeded

recentFilterGetNeeded Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> m [RecentFilterFlags]

Returns: bitfield of flags indicating needed fields when calling recentFilterFilter

Gets the fields that need to be filled in for the RecentFilterInfo passed to recentFilterFilter

This function will not typically be used by applications; it is intended principally for use in the implementation of RecentChooser.

Since: 2.10

new

recentFilterNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m RecentFilter

Returns: a new RecentFilter

Creates a new RecentFilter 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 recentFilterAddPattern, recentFilterAddMimeType, recentFilterAddApplication, recentFilterAddAge. To create a filter that accepts any recently used resource, use:

C code

GtkRecentFilter *filter = gtk_recent_filter_new ();
gtk_recent_filter_add_pattern (filter, "*");

Since: 2.10

setName

recentFilterSetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsRecentFilter a) 
=> a

filter: a RecentFilter

-> Text

name: then human readable name of filter

-> m () 

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