Gtk.RecentInfo

Fields

None

Methods

create_app_info (app_name)

exists ()

get_added ()

get_age ()

get_application_info (app_name)

get_applications ()

get_description ()

get_display_name ()

get_gicon ()

get_groups ()

get_mime_type ()

get_modified ()

get_private_hint ()

get_short_name ()

get_uri ()

get_uri_display ()

get_visited ()

has_application (app_name)

has_group (group_name)

is_local ()

last_application ()

match (info_b)

ref ()

unref ()

Details

class Gtk.RecentInfo

GtkRecentInfo contains the metadata associated with an item in the recently used files list.

create_app_info(app_name)[source]
Parameters:

app_name (str or None) – the name of the application that should be mapped to a GAppInfo; if None is used then the default application for the MIME type is used

Raises:

GLib.Error

Returns:

the newly created GAppInfo

Return type:

Gio.AppInfo or None

Creates a GAppInfo for the specified GtkRecentInfo

In case of error, error will be set either with a %GTK_RECENT_MANAGER_ERROR or a %G_IO_ERROR

exists()[source]
Returns:

True if the resource exists

Return type:

bool

Checks whether the resource pointed by self still exists. At the moment this check is done only on resources pointing to local files.

get_added()[source]
Returns:

a GDateTime for the time when the resource was added

Return type:

GLib.DateTime

Gets the time when the resource was added to the recently used resources list.

get_age()[source]
Returns:

a positive integer containing the number of days elapsed since the time this resource was last modified

Return type:

int

Gets the number of days elapsed since the last update of the resource pointed by self.

get_application_info(app_name)[source]
Parameters:

app_name (str) – the name of the application that has registered this item

Returns:

None if no application with app_name has registered this resource inside the recently used list otherwise a tuple containing:

app_exec:

string containing the command line

count:

the number of times this item was registered

time_:

the timestamp this item was last registered for this application

Return type:

(app_exec: str, count: int, time_: int) or None

Gets the data regarding the application that has registered the resource pointed by self.

If the command line contains any escape characters defined inside the storage specification, they will be expanded.

get_applications()[source]
Returns:

a newly allocated None-terminated array of strings. Use GLib.strfreev() to free it.

Return type:

[str]

Retrieves the list of applications that have registered this resource.

get_description()[source]
Returns:

the description of the resource. The returned string is owned by the recent manager, and should not be freed.

Return type:

str

Gets the (short) description of the resource.

get_display_name()[source]
Returns:

the display name of the resource. The returned string is owned by the recent manager, and should not be freed.

Return type:

str

Gets the name of the resource.

If none has been defined, the basename of the resource is obtained.

get_gicon()[source]
Returns:

a GIcon containing the icon

Return type:

Gio.Icon or None

Retrieves the icon associated to the resource MIME type.

get_groups()[source]
Returns:

a newly allocated None terminated array of strings. Use GLib.strfreev() to free it.

Return type:

[str]

Returns all groups registered for the recently used item self.

The array of returned group names will be None terminated, so length might optionally be None.

get_mime_type()[source]
Returns:

the MIME type of the resource. The returned string is owned by the recent manager, and should not be freed.

Return type:

str

Gets the MIME type of the resource.

get_modified()[source]
Returns:

a GDateTime for the time when the resource was last modified

Return type:

GLib.DateTime

Gets the time when the meta-data for the resource was last modified.

get_private_hint()[source]
Returns:

True if the private flag was found, False otherwise

Return type:

bool

Gets the value of the “private” flag.

Resources in the recently used list that have this flag set to True should only be displayed by the applications that have registered them.

get_short_name()[source]
Returns:

A newly-allocated string in UTF-8 encoding free it with GLib.free()

Return type:

str

Computes a valid UTF-8 string that can be used as the name of the item in a menu or list.

For example, calling this function on an item that refers to “file:///foo/bar.txt” will yield “bar.txt”.

get_uri()[source]
Returns:

the URI of the resource. The returned string is owned by the recent manager, and should not be freed.

Return type:

str

Gets the URI of the resource.

get_uri_display()[source]
Returns:

a newly allocated UTF-8 string containing the resource’s URI or None. Use GLib.free() when done using it.

Return type:

str or None

Gets a displayable version of the resource’s URI.

If the resource is local, it returns a local path; if the resource is not local, it returns the UTF-8 encoded content of [method`Gtk`.RecentInfo.get_uri].

get_visited()[source]
Returns:

a GDateTime for the time when the resource was last visited

Return type:

GLib.DateTime

Gets the time when the meta-data for the resource was last visited.

has_application(app_name)[source]
Parameters:

app_name (str) – a string containing an application name

Returns:

True if an application with name app_name was found, False otherwise

Return type:

bool

Checks whether an application registered this resource using app_name.

has_group(group_name)[source]
Parameters:

group_name (str) – name of a group

Returns:

True if the group was found

Return type:

bool

Checks whether group_name appears inside the groups registered for the recently used item self.

is_local()[source]
Returns:

True if the resource is local

Return type:

bool

Checks whether the resource is local or not by looking at the scheme of its URI.

last_application()[source]
Returns:

an application name. Use GLib.free() to free it.

Return type:

str

Gets the name of the last application that have registered the recently used resource represented by self.

match(info_b)[source]
Parameters:

info_b (Gtk.RecentInfo) – a GtkRecentInfo

Returns:

True if both GtkRecentInfo point to the same resource, False otherwise

Return type:

bool

Checks whether two GtkRecentInfo point to the same resource.

ref()[source]
Returns:

the recent info object with its reference count increased by one

Return type:

Gtk.RecentInfo

Increases the reference count of recent_info by one.

unref()[source]

Decreases the reference count of self by one.

If the reference count reaches zero, self is deallocated, and the memory freed.