XApp.Favorites

g GObject.Object GObject.Object XApp.Favorites XApp.Favorites GObject.Object->XApp.Favorites

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_default ()

add (uri)

create_actions (mimetypes)

create_menu (mimetypes, callback, *user_data)

find_by_display_name (display_name)

find_by_uri (uri)

get_favorites (mimetypes)

get_n_favorites ()

launch (uri, timestamp)

remove (uri)

rename (old_uri, new_uri)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

changed

Notifies when the favorites list has changed.

Fields

Inherited:

GObject.Object (1)

Class Details

class XApp.Favorites(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

XApp.FavoritesClass

classmethod get_default()
Returns:

the XApp.Favorites instance for the process. Do not free.

Return type:

XApp.Favorites

Returns the XApp.Favorites instance.

New in version 2.0.

add(uri)
Parameters:

uri (str) – The uri the favorite is for

Adds a new favorite. If the uri already exists, this does nothing.

New in version 2.0.

create_actions(mimetypes)
Parameters:

mimetypes (str or None) – The mimetypes to filter for, or None to include all favorites.

Returns:

a new Gtk.ActionGroup populated with a list of favorites, or None if there are no favorites.

Return type:

[Gtk.Action]

Generates a list of favorite GtkActions.

New in version 2.0.

create_menu(mimetypes, callback, *user_data)
Parameters:
  • mimetypes (str or None) – The mimetypes to filter for, or None to include all favorites.

  • callback (XApp.FavoritesItemSelectedCallback) – (closure user_data): The callback to use when a menu item has been selected.

  • user_data (object or None) – The data to pass to the callback

Returns:

a new Gtk.Menu populated with a list of favorites, or None if there are no favorites.

Return type:

Gtk.Widget

Generates a Gtk.Menu widget populated with favorites. The callback will be called when a menu item has been activated, and will include the uri of the respective item.

New in version 2.0.

find_by_display_name(display_name)
Parameters:

display_name (str) – The display name to lookup info for.

Returns:

an XApp.FavoriteInfo or None if one was not found. This is owned by the favorites manager and should not be freed.

Return type:

XApp.FavoriteInfo

Looks for an XApp.FavoriteInfo that corresponds to display_name.

New in version 2.0.

find_by_uri(uri)
Parameters:

uri (str) – The uri to lookup info for.

Returns:

an XApp.FavoriteInfo or None if one was not found. This is owned by the favorites manager and should not be freed.

Return type:

XApp.FavoriteInfo

Looks for an XApp.FavoriteInfo that corresponds to uri.

New in version 2.0.

get_favorites(mimetypes)
Parameters:

mimetypes ([str] or None) – The mimetypes to filter by for results

Returns:

a list of XApp.FavoriteInfos. Free the list with #g_list_free, free elements with XApp.FavoriteInfo.free.

Return type:

[XApp.FavoriteInfo]

Gets a list of all favorites. If mimetype is not None, the list will contain only favorites with that mimetype.

New in version 2.0.

get_n_favorites()
Returns:

The number of favorite files

Return type:

int

New in version 2.0.

launch(uri, timestamp)
Parameters:
  • uri (str) – The uri for the favorite to launch

  • timestamp (int) – The timestamp from an event or 0

Opens a favorite in its default app.

New in version 2.0.

remove(uri)
Parameters:

uri (str) – The uri for the favorite being removed

Removes a favorite from the list.

New in version 2.0.

rename(old_uri, new_uri)
Parameters:
  • old_uri (str) – the old favorite’s uri.

  • new_uri (str) – The new uri.

Removes old_uri and adds new_uri. This is mainly for file managers to use as a convenience instead of add/remove, and guarantees the result, without having to worry about multiple dbus calls (gsettings).

New in version 2.0.

Signal Details

XApp.Favorites.signals.changed(favorites)
Signal Name:

changed

Flags:

RUN_FIRST, ACTION

Parameters:

favorites (XApp.Favorites) – The object which received the signal

Notifies when the favorites list has changed.