package Gtk_Recent_Info_List is new Generic_List (Gtk.Recent_Info.Gtk_Recent_Info);
type Gtk_Recent_Manager_Record is new GObject_Record with null record;
type Gtk_Recent_Manager is access all Gtk_Recent_Manager_Record'Class;
type Gtk_Recent_Data is record Display_Name : Interfaces.C.Strings.chars_ptr; Description : Interfaces.C.Strings.chars_ptr; Mime_Type : Interfaces.C.Strings.chars_ptr; App_Name : Interfaces.C.Strings.chars_ptr; App_Exec : Interfaces.C.Strings.chars_ptr; Groups : Interfaces.C.Strings.char_array_access; Is_Private : Boolean; end record;
type Cb_Gtk_Recent_Manager_Void is not null access procedure (Self : access Gtk_Recent_Manager_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
Filename_Property : constant Glib.Properties.Property_String;
Size_Property : constant Glib.Properties.Property_Int;
Signal_Changed : constant Glib.Signal_Name := "changed";
function From_Object_Free
( | B | : access Gtk_Recent_Data) return Gtk_Recent_Data; |
function Convert
( | R | : Gtk.Recent_Info.Gtk_Recent_Info) return System.Address; |
function Convert
( | R | : System.Address) return Gtk.Recent_Info.Gtk_Recent_Info; |
procedure Gtk_New
( | Self | : out Gtk_Recent_Manager); |
procedure Initialize
( | Self | : not null access Gtk_Recent_Manager_Record'Class); |
function Gtk_Recent_Manager_New return Gtk_Recent_Manager;
function Get_Type return Glib.GType;
function Add_Item
( | Self | : not null access Gtk_Recent_Manager_Record; |
URI | : UTF8_String) return Boolean; |
function Get_Items
( | Self | : not null access Gtk_Recent_Manager_Record) return Gtk_Recent_Info_List.Glist; |
function Has_Item
( | Self | : not null access Gtk_Recent_Manager_Record; |
URI | : UTF8_String) return Boolean; |
function Lookup_Item
( | Self | : not null access Gtk_Recent_Manager_Record; |
URI | : UTF8_String) return Gtk.Recent_Info.Gtk_Recent_Info; |
function Move_Item
( | Self | : not null access Gtk_Recent_Manager_Record; |
URI | : UTF8_String; | |
New_Uri | : UTF8_String := "") return Boolean; |
function Purge_Items
( | Self | : not null access Gtk_Recent_Manager_Record) return Gint; |
function Remove_Item
( | Self | : not null access Gtk_Recent_Manager_Record; |
URI | : UTF8_String) return Boolean; |
function Add_Full
( | Manager | : access Gtk_Recent_Manager_Record; |
Uri | : UTF8_String; | |
Display_Name | : UTF8_String := ""; | |
Description | : UTF8_String := ""; | |
Mime_Type | : UTF8_String; | |
App_Name | : UTF8_String; | |
App_Exec | : UTF8_String; | |
Groups | : GNAT.Strings.String_List; | |
Is_Private | : Boolean) return Boolean; |
function Get_Default return Gtk_Recent_Manager;
procedure On_Changed
( | Self | : not null access Gtk_Recent_Manager_Record; |
Call | : Cb_Gtk_Recent_Manager_Void; | |
After | : Boolean := False); |
procedure On_Changed
( | Self | : not null access Gtk_Recent_Manager_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
Gtk.Recent_Manager.Gtk_Recent_Manager 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.
Note: The recently used files list is per user.
The Gtk.Recent_Manager.Gtk_Recent_Manager acts like a database of all the recently used files. You can create new Gtk.Recent_Manager.Gtk_Recent_Manager 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 Gtk.Recent_Manager.Gtk_Recent_Manager 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 Gtk.Recent_Info.Gtk_Recent_Info structures.
A Gtk.Recent_Manager.Gtk_Recent_Manager is the model used to populate the contents of one, or more Gtk.Recent_Chooser.Gtk_Recent_Chooser implementations.
Note: The maximum age of the recently used files list is controllable through the Gtk.Settings.Gtk_Settings:gtk-recent-files-max-age property.
Recently used files are supported since GTK+ 2.10.