Class

GtkRecentManager

since: 2.10

Description [src]

class Gtk.RecentManager : GObject.Object
{
  /* No available fields */
}

GtkRecentManager 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 recently used files list is per user.

The GtkRecentManager acts like a database of all the recently used files. You can create new GtkRecentManager objects, but it is more efficient to use the default manager created by GTK+.

Adding a new recently used file is as simple as:

GtkRecentManager *manager;

manager = gtk_recent_manager_get_default ();
gtk_recent_manager_add_item (manager, file_uri);

The GtkRecentManager will try to gather all the needed information from the file itself through GIO.

Looking up the meta-data associated with a recently used file given its URI requires calling gtk_recent_manager_lookup_item():

GtkRecentManager *manager;
GtkRecentInfo *info;
GError *error = NULL;

manager = gtk_recent_manager_get_default ();
info = gtk_recent_manager_lookup_item (manager, file_uri, &error);
if (error)
  {
    g_warning ("Could not find the file: %s", error->message);
    g_error_free (error);
  }
else
 {
   // Use the info object
   gtk_recent_info_unref (info);
 }

In order to retrieve the list of recently used files, you can use gtk_recent_manager_get_items(), which returns a list of GtkRecentInfo-structs.

A GtkRecentManager is the model used to populate the contents of one, or more GtkRecentChooser implementations.

Note that the maximum age of the recently used files list is controllable through the GtkSettings:gtk-recent-files-max-age property.

Recently used files are supported since GTK+ 2.10.

Available since: 2.10

Hierarchy

hierarchy this GtkRecentManager ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

gtk_recent_manager_new

Creates a new recent manager object. Recent manager objects are used to handle the list of recently used resources. A GtkRecentManager object monitors the recently used resources list, and emits the “changed” signal each time something inside the list changes.

since: 2.10

Functions

gtk_recent_manager_get_default

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

since: 2.10

Instance methods

gtk_recent_manager_add_full

Adds a new resource, pointed by uri, into the recently used resources list, using the metadata specified inside the GtkRecentData-struct passed in recent_data.

since: 2.10

gtk_recent_manager_add_item

Adds a new resource, pointed by uri, into the recently used resources list.

since: 2.10

gtk_recent_manager_get_items

Gets the list of recently used resources.

since: 2.10

gtk_recent_manager_has_item

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

since: 2.10

gtk_recent_manager_lookup_item

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

since: 2.10

gtk_recent_manager_move_item

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

since: 2.10

gtk_recent_manager_purge_items

Purges every item from the recently used resources list.

since: 2.10

gtk_recent_manager_remove_item

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

since: 2.10

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Gtk.RecentManager:filename

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

since: 2.10

Gtk.RecentManager:size

The size of the recently used resources list.

since: 2.10

Signals

Gtk.RecentManager::changed

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

since: 2.10

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkRecentManagerClass {
  void (* changed) (
    GtkRecentManager* manager
  );
  void (* _gtk_recent1) (
void
  );
  void (* _gtk_recent2) (
void
  );
  void (* _gtk_recent3) (
void
  );
  void (* _gtk_recent4) (
void
  );
  
}

GtkRecentManagerClass contains only private data.

Class members
changed: void (* changed) ( GtkRecentManager* manager )

No description available.

_gtk_recent1: void (* _gtk_recent1) ( void )

No description available.

_gtk_recent2: void (* _gtk_recent2) ( void )

No description available.

_gtk_recent3: void (* _gtk_recent3) ( void )

No description available.

_gtk_recent4: void (* _gtk_recent4) ( void )

No description available.

Virtual methods

Gtk.RecentManagerClass.changed
No description available.