[]Struct gtk::RecentFilter

pub struct RecentFilter(_, _);

A RecentFilter can be used to restrict the files being shown in a RecentChooser. Files can be filtered based on their name (with RecentFilter::add_pattern), on their mime type (with FileFilter::add_mime_type), on the application that has registered them (with RecentFilter::add_application), or by a custom filter function (with RecentFilter::add_custom).

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

Recently used files are supported since GTK+ 2.10.

RecentFilter as Buildable

The RecentFilter implementation of the Buildable 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 RecentFilter::add_mime_type, RecentFilter::add_pattern or RecentFilter::add_application.

An example of a UI definition fragment specifying RecentFilter rules:

<object class="GtkRecentFilter">
  <mime-types>
    <mime-type>text/plain</mime-type>
    <mime-type>image/png</mime-type>
  </mime-types>
  <patterns>
    <pattern>*.txt</pattern>
    <pattern>*.png</pattern>
  </patterns>
  <applications>
    <application>gimp</application>
    <application>gedit</application>
    <application>glade</application>
  </applications>
</object>

Implements

glib::object::ObjectExt, BuildableExt, BuildableExtManual

Implementations

impl RecentFilter[src]

pub fn new() -> RecentFilter[src]

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 RecentFilter::add_pattern, RecentFilter::add_mime_type, RecentFilter::add_application, RecentFilter::add_age. To create a filter that accepts any recently used resource, use:

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

Returns

a new RecentFilter

pub fn add_age(&self, days: i32)[src]

Adds a rule that allows resources based on their age - that is, the number of days elapsed since they were last modified.

days

number of days

pub fn add_application(&self, application: &str)[src]

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

application

an application name

pub fn add_group(&self, group: &str)[src]

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

group

a group name

pub fn add_mime_type(&self, mime_type: &str)[src]

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

mime_type

a MIME type

pub fn add_pattern(&self, pattern: &str)[src]

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

pattern

a file pattern

pub fn add_pixbuf_formats(&self)[src]

Adds a rule allowing image files in the formats supported by gdk_pixbuf::Pixbuf.

pub fn get_name(&self) -> Option<GString>[src]

Gets the human-readable name for the filter. See RecentFilter::set_name.

Returns

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

pub fn get_needed(&self) -> RecentFilterFlags[src]

Gets the fields that need to be filled in for the RecentFilterInfo passed to RecentFilter::filter

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

Returns

bitfield of flags indicating needed fields when calling RecentFilter::filter

pub fn set_name(&self, name: &str)[src]

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.

name

then human readable name of self

Trait Implementations

impl Clone for RecentFilter

impl Debug for RecentFilter

impl Default for RecentFilter[src]

impl Display for RecentFilter[src]

impl Eq for RecentFilter

impl Hash for RecentFilter

impl IsA<Buildable> for RecentFilter

impl Ord for RecentFilter

impl<T: ObjectType> PartialEq<T> for RecentFilter

impl<T: ObjectType> PartialOrd<T> for RecentFilter

impl StaticType for RecentFilter

Auto Trait Implementations

impl RefUnwindSafe for RecentFilter

impl !Send for RecentFilter

impl !Sync for RecentFilter

impl Unpin for RecentFilter

impl UnwindSafe for RecentFilter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.