| Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
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
- newtype RecentFilter = RecentFilter (ManagedPtr RecentFilter)
- class GObject o => IsRecentFilter o
- toRecentFilter :: IsRecentFilter o => o -> IO RecentFilter
- noRecentFilter :: Maybe RecentFilter
- data RecentFilterAddAgeMethodInfo
- recentFilterAddAge :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> Int32 -> m ()
- data RecentFilterAddApplicationMethodInfo
- recentFilterAddApplication :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> Text -> m ()
- data RecentFilterAddCustomMethodInfo
- recentFilterAddCustom :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> [RecentFilterFlags] -> RecentFilterFunc -> m ()
- data RecentFilterAddGroupMethodInfo
- recentFilterAddGroup :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> Text -> m ()
- data RecentFilterAddMimeTypeMethodInfo
- recentFilterAddMimeType :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> Text -> m ()
- data RecentFilterAddPatternMethodInfo
- recentFilterAddPattern :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> Text -> m ()
- data RecentFilterAddPixbufFormatsMethodInfo
- recentFilterAddPixbufFormats :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> m ()
- data RecentFilterFilterMethodInfo
- recentFilterFilter :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> RecentFilterInfo -> m Bool
- data RecentFilterGetNameMethodInfo
- recentFilterGetName :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> m (Maybe Text)
- data RecentFilterGetNeededMethodInfo
- recentFilterGetNeeded :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> m [RecentFilterFlags]
- recentFilterNew :: (HasCallStack, MonadIO m) => m RecentFilter
- data RecentFilterSetNameMethodInfo
- recentFilterSetName :: (HasCallStack, MonadIO m, IsRecentFilter a) => a -> Text -> m ()
Exported types
newtype RecentFilter Source #
Constructors
| RecentFilter (ManagedPtr RecentFilter) |
Instances
| GObject RecentFilter Source # | |
| IsObject RecentFilter Source # | |
| IsRecentFilter RecentFilter Source # | |
| IsBuildable RecentFilter Source # | |
| ((~) * info (ResolveRecentFilterMethod t RecentFilter), MethodInfo * info RecentFilter p) => IsLabel t (RecentFilter -> p) Source # | |
| ((~) * info (ResolveRecentFilterMethod t RecentFilter), MethodInfo * info RecentFilter p) => IsLabelProxy t (RecentFilter -> p) Source # | |
| HasAttributeList * RecentFilter Source # | |
| type AttributeList RecentFilter Source # | |
| type SignalList RecentFilter Source # | |
class GObject o => IsRecentFilter o Source #
Instances
toRecentFilter :: IsRecentFilter o => o -> IO RecentFilter Source #
Methods
addAge
data RecentFilterAddAgeMethodInfo Source #
Instances
| ((~) * signature (Int32 -> m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterAddAgeMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> Int32 |
|
| -> 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
data RecentFilterAddApplicationMethodInfo Source #
Instances
| ((~) * signature (Text -> m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterAddApplicationMethodInfo a signature Source # | |
recentFilterAddApplication Source #
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> Text |
|
| -> m () |
Adds a rule that allows resources based on the name of the application that has registered them.
Since: 2.10
addCustom
data RecentFilterAddCustomMethodInfo Source #
Instances
| ((~) * signature ([RecentFilterFlags] -> RecentFilterFunc -> m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterAddCustomMethodInfo a signature Source # | |
recentFilterAddCustom Source #
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> [RecentFilterFlags] |
|
| -> RecentFilterFunc |
|
| -> 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
data RecentFilterAddGroupMethodInfo Source #
Instances
| ((~) * signature (Text -> m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterAddGroupMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> Text |
|
| -> m () |
Adds a rule that allows resources based on the name of the group to which they belong
Since: 2.10
addMimeType
data RecentFilterAddMimeTypeMethodInfo Source #
Instances
| ((~) * signature (Text -> m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterAddMimeTypeMethodInfo a signature Source # | |
recentFilterAddMimeType Source #
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> Text |
|
| -> m () |
Adds a rule that allows resources based on their registered MIME type.
Since: 2.10
addPattern
data RecentFilterAddPatternMethodInfo Source #
Instances
| ((~) * signature (Text -> m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterAddPatternMethodInfo a signature Source # | |
recentFilterAddPattern Source #
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> Text |
|
| -> m () |
Adds a rule that allows resources based on a pattern matching their display name.
Since: 2.10
addPixbufFormats
data RecentFilterAddPixbufFormatsMethodInfo Source #
Instances
| ((~) * signature (m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterAddPixbufFormatsMethodInfo a signature Source # | |
recentFilterAddPixbufFormats Source #
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> m () |
Adds a rule allowing image files in the formats supported by GdkPixbuf.
Since: 2.10
filter
data RecentFilterFilterMethodInfo Source #
Instances
| ((~) * signature (RecentFilterInfo -> m Bool), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterFilterMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> RecentFilterInfo |
|
| -> m Bool | Returns: |
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
data RecentFilterGetNameMethodInfo Source #
Instances
| ((~) * signature (m (Maybe Text)), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterGetNameMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> m (Maybe Text) | Returns: the name of the filter, or |
Gets the human-readable name for the filter.
See recentFilterSetName.
Since: 2.10
getNeeded
data RecentFilterGetNeededMethodInfo Source #
Instances
| ((~) * signature (m [RecentFilterFlags]), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterGetNeededMethodInfo a signature Source # | |
recentFilterGetNeeded Source #
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> m [RecentFilterFlags] | Returns: bitfield of flags indicating needed fields when
calling |
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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m RecentFilter | Returns: a new |
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
data RecentFilterSetNameMethodInfo Source #
Instances
| ((~) * signature (Text -> m ()), MonadIO m, IsRecentFilter a) => MethodInfo * RecentFilterSetNameMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsRecentFilter a) | |
| => a |
|
| -> Text |
|
| -> 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