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

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

#include <gtkmm/recentmanager.h>

Inherits Glib::Object.

Classes

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

Public Types

typedef sigc::slot< void > SlotChanged
 For instance, void on_changed();. More...
 

Public Member Functions

 RecentManager (RecentManager && src) noexcept
 
RecentManageroperator= (RecentManager && src) noexcept
 
 ~RecentManager () noexcept override
 
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...
 
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< RecentInfolookup_item (const Glib::ustring & uri)
 Searches for a URI inside the recently used resources list, and returns a Gtk::RecentInfo-struct containing informations about the resource like its MIME type, or its display name. More...
 
Glib::RefPtr< const RecentInfolookup_item (const Glib::ustring & uri) const
 Searches for a URI inside the recently used resources list, and returns a Gtk::RecentInfo-struct 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...
 
std::vector< Glib::RefPtr< RecentInfo > > 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 ()
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_filename () const
 The full path to the file to be used to store and read the recently used resources list. More...
 
Glib::PropertyProxy_ReadOnly< int > property_size () const
 The size of the recently used resources list. More...
 

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< RecentManagercreate ()
 
static Glib::RefPtr< RecentManagerget_default ()
 Gets a unique instance of Gtk::RecentManager, that you can share in your application without caring about memory management. More...
 

Protected Member Functions

 RecentManager ()
 
virtual void on_changed ()
 This is a default handler for the signal signal_changed(). More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::RecentManagerwrap (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

◆ SlotChanged

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

For instance, void on_changed();.

Constructor & Destructor Documentation

◆ RecentManager() [1/2]

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

◆ ~RecentManager()

Gtk::RecentManager::~RecentManager ( )
overridenoexcept

◆ RecentManager() [2/2]

Gtk::RecentManager::RecentManager ( )
protected

Member Function Documentation

◆ add_item() [1/2]

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().

◆ add_item() [2/2]

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.

◆ create()

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

◆ get_default()

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.

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

◆ get_items()

std::vector< Glib::RefPtr< RecentInfo > > 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.

◆ get_type()

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

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

◆ gobj() [1/2]

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

Provides access to the underlying C GObject.

◆ gobj() [2/2]

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

Provides access to the underlying C GObject.

◆ gobj_copy()

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.

◆ has_item()

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
uriA URI.
Returns
true if the resource was found, false otherwise.

◆ lookup_item() [1/2]

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

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

Since gtkmm 2.10:
Parameters
uriA URI.
Returns
A Gtk::RecentInfo-struct 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().
Exceptions
Glib::Error

◆ lookup_item() [2/2]

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 Gtk::RecentInfo-struct containing informations about the resource like its MIME type, or its display name.

Since gtkmm 2.10:
Parameters
uriA URI.
Returns
A Gtk::RecentInfo-struct 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().
Exceptions
Glib::Error

◆ move_item()

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
uriThe URI of a recently used resource.
new_uriThe new URI of the recently used resource, or nullptr to remove the item pointed by uri in the list.
Returns
true on success.
Exceptions
Glib::Error

◆ on_changed()

virtual void Gtk::RecentManager::on_changed ( )
protectedvirtual

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

◆ operator=()

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

◆ property_filename()

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

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

Since gtkmm 2.10:

Default value: ""

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

◆ property_size()

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

The size of the recently used resources list.

Since gtkmm 2.10:

Default value: 0

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

◆ purge_items()

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.
Exceptions
Glib::Error

◆ remove_item()

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
uriThe 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.
Exceptions
Glib::Error

◆ signal_changed()

Glib::SignalProxy< void > Gtk::RecentManager::signal_changed ( )
Slot Prototype:
void on_my_changed()

Flags: Run First

Emitted when the current recently used resources manager changes its contents, either by calling Gtk::RecentManager::add_item() or by another application.

Since gtkmm 2.10:

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gtk::RecentManager > wrap ( GtkRecentManager *  object,
bool  take_copy = false 
)
related

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

Parameters
objectThe C instance.
take_copyFalse 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.