gtkmm: Gtk::RecentFilter Class Reference

gtkmm 3.24.11

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::RecentFilter Class Reference
RecentFiles

RecentFilter can be used to restrict the files being shown in a RecentChooser. More...

`#include <gtkmm/recentfilter.h>`

Inheritance diagram for Gtk::RecentFilter:
[legend]

## Classes
class | Info
| A RecentFilter::Info class is used to pass information about the tested file to filter(). More...

## Public Types
typedef sigc::slot< bool, const Info & > | SlotCustom
| For instance, bool on_custom(const Gtk::RecentFilter::Info& filter_info);.
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Public Member Functions
| RecentFilter (RecentFilter && src) noexcept
RecentFilter & | operator= (RecentFilter && src) noexcept
| ~RecentFilter () noexcept override
GtkRecentFilter * | gobj ()
| Provides access to the underlying C GObject.
const GtkRecentFilter * | gobj () const
| Provides access to the underlying C GObject.
GtkRecentFilter * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | set_name (const Glib::ustring & 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.
Glib::ustring | get_name () const
| Gets the human-readable name for the filter.
void | add_mime_type (const Glib::ustring & mime_type)
| Adds a rule that allows resources based on their registered MIME type.
void | add_pattern (const Glib::ustring & pattern)
| Adds a rule that allows resources based on a pattern matching their display name.
void | add_pixbuf_formats ()
| Adds a rule allowing image files in the formats supported by GdkPixbuf.
void | add_application (const Glib::ustring & application)
| Adds a rule that allows resources based on the name of the application that has registered them.
void | add_group (const Glib::ustring & group)
| Adds a rule that allows resources based on the name of the group to which they belong.
void | add_age (int days)
| Adds a rule that allows resources based on their age - that is, the number of days elapsed since they were last modified.
void | add_custom (RecentFilterFlags needed, const SlotCustom & slot)
RecentFilterFlags | get_needed () const
| Gets the fields that need to be filled in for the Gtk::RecentFilterInfo passed to filter().
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< RecentFilter > | create ()

## Protected Member Functions
| RecentFilter ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::RecentFilter > | wrap (GtkRecentFilter * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

RecentFilter can be used to restrict the files being shown in a RecentChooser.

Files can be filtered based on their name (with add_pattern()), on their mime type (with add_mime_type()), on the application that has registered them (with add_application()), or by a custom filter function (with 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 filter().

Since gtkmm 2.10

## Member Typedef Documentation

## ◆ SlotCustom

typedef sigc::slot<bool, const Info&> Gtk::RecentFilter::SlotCustom

For instance, bool on_custom(const Gtk::RecentFilter::Info& filter_info);.

## Constructor & Destructor Documentation

## ◆ RecentFilter() [1/2]

Gtk::RecentFilter::RecentFilter | ( | RecentFilter && | src | ) |
| noexcept

## ◆ ~RecentFilter()

Gtk::RecentFilter::~RecentFilter | ( |  | ) |
| overridenoexcept

## ◆ RecentFilter() [2/2]

Gtk::RecentFilter::RecentFilter | ( |  | ) |
| protected

## Member Function Documentation

## ◆ add_age()

void Gtk::RecentFilter::add_age | ( | int | days | ) |

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

Since gtkmm 2.10

Parameters

  days | Number of days.

## ◆ add_application()

void Gtk::RecentFilter::add_application | ( | const Glib::ustring & | application | ) |

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

Since gtkmm 2.10

Parameters

  application | An application name.

## ◆ add_custom()

void Gtk::RecentFilter::add_custom | ( | RecentFilterFlags | needed,
|  | const SlotCustom & | slot )

## ◆ add_group()

void Gtk::RecentFilter::add_group | ( | const Glib::ustring & | group | ) |

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

Since gtkmm 2.10

Parameters

  group | A group name.

## ◆ add_mime_type()

void Gtk::RecentFilter::add_mime_type | ( | const Glib::ustring & | mime_type | ) |

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

Since gtkmm 2.10

Parameters

  mime_type | A MIME type.

## ◆ add_pattern()

void Gtk::RecentFilter::add_pattern | ( | const Glib::ustring & | pattern | ) |

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

Since gtkmm 2.10

Parameters

  pattern | A file pattern.

## ◆ add_pixbuf_formats()

void Gtk::RecentFilter::add_pixbuf_formats | ( |  | ) |

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

Since gtkmm 2.10

## ◆ create()

Glib::RefPtr< RecentFilter > Gtk::RecentFilter::create | ( |  | ) |
| static

## ◆ get_name()

Glib::ustring Gtk::RecentFilter::get_name | ( |  | ) | const

Gets the human-readable name for the filter.

See set_name().

Since gtkmm 2.10

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

## ◆ get_needed()

RecentFilterFlags Gtk::RecentFilter::get_needed | ( |  | ) | const

Gets the fields that need to be filled in for the Gtk::RecentFilterInfo passed to filter().

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

Since gtkmm 2.10

Returns
  Bitfield of flags indicating needed fields when calling filter().

## ◆ get_type()

GType Gtk::RecentFilter::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GtkRecentFilter * Gtk::RecentFilter::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkRecentFilter * Gtk::RecentFilter::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkRecentFilter * Gtk::RecentFilter::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ operator=()

RecentFilter & Gtk::RecentFilter::operator= | ( | RecentFilter && | src | ) |
| noexcept

## ◆ set_name()

void Gtk::RecentFilter::set_name | ( | const Glib::ustring & | 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 gtkmm 2.10

Parameters

  name | Then human readable name of filter.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::RecentFilter > wrap | ( | GtkRecentFilter * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.