gtkmm: Gtk::RecentManager Class Reference

gtkmm 2.24.4

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

RecentManager provides a facility for adding, removing and looking up recently used files. More...

Inheritance diagram for Gtk::RecentManager:
[legend]
Collaboration diagram for Gtk::RecentManager:
[legend]

## Classes
class | Data
| Meta-data passed to add_item(). More...

## Public Types
typedef Glib::ListHandle< RecentInfo, RecentInfoTraits > | ListHandle_RecentInfos
typedef sigc::slot< void > | SlotChanged
| For instance, void on_changed();. More...
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
| RecentManager (RecentManager&& src) noexcept
RecentManager& | operator= (RecentManager&& src) noexcept
| ~RecentManager () noexceptoverride
GtkRecentManager* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkRecentManager* | gobj () const
| Provides access to the underlying C GObject. More...
GtkRecentManager* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
void | set_screen (const Glib::RefPtr< Gdk::Screen >& screen)
| Sets the screen for a recent manager; the screen is used to track the user's currently configured recently used documents storage. More...
bool | add_item (const Glib::ustring& uri)
| Adds a new resource into the recently used resources list. More...
bool | add_item (const Glib::ustring& uri, const Data& recent_data)
| Adds a new resource into the recently used resources list, taking meta data from the given Data instead of guessing it from the URI. More...
bool | remove_item (const Glib::ustring& uri)
| Removes a resource pointed by uri from the recently used resources list handled by a recent manager. More...
Glib::RefPtr< RecentInfo > | lookup_item (const Glib::ustring& uri)
| Searches for a URI inside the recently used resources list, and returns a structure containing informations about the resource like its MIME type, or its display name. More...
Glib::RefPtr< const RecentInfo > | lookup_item (const Glib::ustring& uri) const
| Searches for a URI inside the recently used resources list, and returns a structure containing informations about the resource like its MIME type, or its display name. More...
bool | has_item (const Glib::ustring& uri) const
| Checks whether there is a recently used resource registered with uri inside the recent manager. More...
bool | move_item (const Glib::ustring& uri, const Glib::ustring& new_uri)
| Changes the location of a recently used resource from uri to new_uri. More...
void | set_limit (int limit)
| Sets the maximum number of item that the get_items() function should return. More...
int | get_limit () const
| Gets the maximum number of items that the get_items() function should return. More...
ListHandle_RecentInfos | get_items () const
| Gets the list of recently used resources. More...
int | purge_items ()
| Purges every item from the recently used resources list. More...
Glib::SignalProxy< void > | signal_changed ()
| The "changed" signal is emitted when an item in the recently used resources list is changed. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_filename () const
| The full path to the file to be used to store and read the list. More...
Glib::PropertyProxy< int > | property_limit ()
| The maximum number of items to be returned by gtk_recent_manager_get_items(). More...
Glib::PropertyProxy_ReadOnly< int > | property_limit () const
| The maximum number of items to be returned by gtk_recent_manager_get_items(). More...
Glib::PropertyProxy_ReadOnly< int > | property_size () const
| The size of the recently used resources list. More...
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. More...
static Glib::RefPtr< RecentManager > | create ()
static Glib::RefPtr< RecentManager > | get_default ()
| Gets a unique instance of Gtk::RecentManager, that you can share in your application without caring about memory management. More...
static Glib::RefPtr< RecentManager > | get_for_screen (const Glib::RefPtr< Gdk::Screen >& screen)
| Gets the recent manager object associated with screen; if this function has not previously been called for the given screen, a new recent manager object will be created and associated with the screen. More...

## Protected Member Functions
| RecentManager ()
virtual void | on_changed ()
| This is a default handler for the signal signal_changed(). More...
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexceptoverride
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 Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::RecentManager > | wrap (GtkRecentManager* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

RecentManager provides a facility for adding, removing and looking up recently used files.

Each recently used file is identified by its URI, and has meta-data associated to it, like the names and command lines of the applications that have registered it, the number of time each application has registered the same file, the mime type of the file and whether the file should be displayed only by the applications that have registered it.

The RecentManager acts like a database of all the recently used files. You can create new RecentManager objects, but it is more efficient to use the standard recent manager for the Gdk::Screen so that informations about the recently used files is shared with other people using them. Normally, you retrieve the recent manager for a particular screen using get_for_screen() and it will contain information about current recent manager for that screen.

Since gtkmm 2.10:

## Member Typedef Documentation

typedef Glib::ListHandle<RecentInfo, RecentInfoTraits> Gtk::RecentManager::ListHandle_RecentInfos

typedef sigc::slot<void> Gtk::RecentManager::SlotChanged

For instance, void on_changed();.

## Constructor & Destructor Documentation

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

Gtk::RecentManager::~RecentManager | ( |  | ) |
| override noexcept

Gtk::RecentManager::RecentManager | ( |  | ) |
| protected

## Member Function Documentation

bool Gtk::RecentManager::add_item | ( | const Glib::ustring & | uri | ) |

Adds a new resource into the recently used resources list.

This function will try and guess some of the meta-data associated to a URI. If you know some of meta-data about the document yourself, set the desired fields of a RecentManager::Data structure and pass it to add_item().

bool Gtk::RecentManager::add_item | ( | const Glib::ustring & | uri,
|  | const Data& | recent_data
| ) |  |

Adds a new resource into the recently used resources list, taking meta data from the given Data instead of guessing it from the URI.

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

static Glib::RefPtr<RecentManager> Gtk::RecentManager::get_default | ( |  | ) |
| static

Gets a unique instance of Gtk::RecentManager, that you can share in your application without caring about memory management.

The returned instance will be freed when you application terminates.

Since gtkmm 2.10:

Returns
  A unique Gtk::RecentManager. Do not ref or unref it.

static Glib::RefPtr<RecentManager> Gtk::RecentManager::get_for_screen | ( | const Glib::RefPtr< Gdk::Screen >& | screen | ) |
| static

Gets the recent manager object associated with screen; if this function has not previously been called for the given screen, a new recent manager object will be created and associated with the screen.

Recent manager objects are fairly expensive to create, so using this function is usually a better choice than calling new() and setting the screen yourself; by using this function a single recent manager object will be shared between users.

Deprecated: 2.12: This function has been deprecated and should not be used in newly written code. Calling this function is equivalent to calling get_default().

Since gtkmm 2.10:

Parameters

  screen | A Gdk::Screen.

Returns
  A unique Gtk::RecentManager associated with the given screen. This recent manager is associated to the with the screen and can be used as long as the screen is open. Do not ref or unref it.

ListHandle_RecentInfos Gtk::RecentManager::get_items | ( |  | ) | const

Gets the list of recently used resources.

Since gtkmm 2.10:

Returns
  A list of newly allocated Gtk::RecentInfo objects.

int Gtk::RecentManager::get_limit | ( |  | ) | const

Gets the maximum number of items that the get_items() function should return.

Since gtkmm 2.10:

Deprecated: 2.22: The length of the list should be managed by the view (implementing Gtk::RecentChooser), and not by the model (the Gtk::RecentManager). See Gtk::RecentChooser::property_limit().

Returns
  The number of items to return, or -1 for every item.

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

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

GtkRecentManager* Gtk::RecentManager::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GtkRecentManager* Gtk::RecentManager::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GtkRecentManager* Gtk::RecentManager::gobj_copy | ( |  | ) |

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

bool Gtk::RecentManager::has_item | ( | const Glib::ustring & | uri | ) | const

Checks whether there is a recently used resource registered with uri inside the recent manager.

Since gtkmm 2.10:

Parameters

  uri | A URI.

Returns
  `true` if the resource was found, `false` otherwise.

Glib::RefPtr<RecentInfo> Gtk::RecentManager::lookup_item | ( | const Glib::ustring & | uri | ) |

Searches for a URI inside the recently used resources list, and returns a structure containing informations about the resource like its MIME type, or its display name.

Since gtkmm 2.10:

Parameters

  uri | A URI.

Returns
  A Gtk::RecentInfo structure containing information about the resource pointed by uri, or `nullptr` if the URI was not registered in the recently used resources list. Free with Gtk::RecentInfo::unref().

Glib::RefPtr<const RecentInfo> Gtk::RecentManager::lookup_item | ( | const Glib::ustring & | uri | ) | const

Searches for a URI inside the recently used resources list, and returns a structure containing informations about the resource like its MIME type, or its display name.

Since gtkmm 2.10:

Parameters

  uri | A URI.

Returns
  A Gtk::RecentInfo structure containing information about the resource pointed by uri, or `nullptr` if the URI was not registered in the recently used resources list. Free with Gtk::RecentInfo::unref().

bool Gtk::RecentManager::move_item | ( | const Glib::ustring & | uri,
|  | const Glib::ustring & | new_uri
| ) |  |

Changes the location of a recently used resource from uri to new_uri.

Please note that this function will not affect the resource pointed by the URIs, but only the URI used in the recently used resources list.

Since gtkmm 2.10:

Parameters

  uri | The URI of a recently used resource.
  new_uri | The new URI of the recently used resource, or `nullptr` to remove the item pointed by uri in the list.

Returns
  `true` on success.

virtual void Gtk::RecentManager::on_changed | ( |  | ) |
| protected virtual

This is a default handler for the signal signal_changed().

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

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::RecentManager::property_filename | ( |  | ) | const

The full path to the file to be used to store and read the list.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::RecentManager::property_limit | ( |  | ) |

The maximum number of items to be returned by gtk_recent_manager_get_items().

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::RecentManager::property_limit | ( |  | ) | const

The maximum number of items to be returned by gtk_recent_manager_get_items().

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::RecentManager::property_size | ( |  | ) | const

The size of the recently used resources list.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

int Gtk::RecentManager::purge_items | ( |  | ) |

Purges every item from the recently used resources list.

Since gtkmm 2.10:

Returns
  The number of items that have been removed from the recently used resources list.

bool Gtk::RecentManager::remove_item | ( | const Glib::ustring & | uri | ) |

Removes a resource pointed by uri from the recently used resources list handled by a recent manager.

Since gtkmm 2.10:

Parameters

  uri | The URI of the item you wish to remove.

Returns
  `true` if the item pointed by uri has been successfully removed by the recently used resources list, and `false` otherwise.

void Gtk::RecentManager::set_limit | ( | int | limit | ) |

Sets the maximum number of item that the get_items() function should return.

If limit is set to -1, then return all the items.

Since gtkmm 2.10:

Deprecated: 2.22: The length of the list should be managed by the view (implementing Gtk::RecentChooser), and not by the model (the Gtk::RecentManager). See Gtk::RecentChooser::property_limit().

Parameters

  limit | The maximum number of items to return, or -1.

void Gtk::RecentManager::set_screen | ( | const Glib::RefPtr< Gdk::Screen >& | screen | ) |

Sets the screen for a recent manager; the screen is used to track the user's currently configured recently used documents storage.

Since gtkmm 2.10:

Deprecated: 2.12: This function has been deprecated and should not be used in newly written code. Calling this function has no effect.

Parameters

  screen | A Gdk::Screen.

Glib::SignalProxy< void > Gtk::RecentManager::signal_changed | ( |  | ) |

The "changed" signal is emitted when an item in the recently used resources list is changed.

Slot Prototype:
  `void on_my_changed()`

## Friends And Related Function Documentation

Glib::RefPtr< Gtk::RecentManager > wrap | ( | GtkRecentManager * | 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.

The documentation for this class was generated from the following file:

- gtkmm/recentmanager.h