[][src]Trait gtk::prelude::RecentManagerExt

pub trait RecentManagerExt: 'static {
    fn add_full(&self, uri: &str, recent_data: &RecentData) -> bool;
fn add_item(&self, uri: &str) -> bool;
fn get_items(&self) -> Vec<RecentInfo>;
fn has_item(&self, uri: &str) -> bool;
fn lookup_item(&self, uri: &str) -> Result<Option<RecentInfo>, Error>;
fn move_item(&self, uri: &str, new_uri: Option<&str>) -> Result<(), Error>;
fn purge_items(&self) -> Result<i32, Error>;
fn remove_item(&self, uri: &str) -> Result<(), Error>;
fn get_property_filename(&self) -> Option<GString>;
fn get_property_size(&self) -> i32;
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_size_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all RecentManager methods.

Implementors

RecentManager

Required methods

fn add_full(&self, uri: &str, recent_data: &RecentData) -> bool

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

The passed URI will be used to identify this resource inside the list.

In order to register the new recently used resource, metadata about the resource must be passed as well as the URI; the metadata is stored in a RecentData-struct, which must contain the MIME type of the resource pointed by the URI; the name of the application that is registering the item, and a command line to be used when launching the item.

Optionally, a RecentData-struct might contain a UTF-8 string to be used when viewing the item instead of the last component of the URI; a short description of the item; whether the item should be considered private - that is, should be displayed only by the applications that have registered it.

uri

a valid URI

recent_data

metadata of the resource

Returns

true if the new item was successfully added to the recently used resources list, false otherwise

fn add_item(&self, uri: &str) -> bool

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

This function automatically retrieves some of the needed metadata and setting other metadata to common default values; it then feeds the data to RecentManagerExt::add_full.

See RecentManagerExt::add_full if you want to explicitly define the metadata for the resource pointed by uri.

uri

a valid URI

Returns

true if the new item was successfully added to the recently used resources list

fn get_items(&self) -> Vec<RecentInfo>

Gets the list of recently used resources.

Returns

a list of newly allocated RecentInfo objects. Use RecentInfo::unref on each item inside the list, and then free the list itself using glib::List::free.

fn has_item(&self, uri: &str) -> bool

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

uri

a URI

Returns

true if the resource was found, false otherwise

fn lookup_item(&self, uri: &str) -> Result<Option<RecentInfo>, Error>

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

uri

a URI

Returns

a RecentInfo-struct containing information about the resource pointed by uri, or None if the URI was not registered in the recently used resources list. Free with RecentInfo::unref.

fn move_item(&self, uri: &str, new_uri: Option<&str>) -> Result<(), Error>

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.

uri

the URI of a recently used resource

new_uri

the new URI of the recently used resource, or None to remove the item pointed by uri in the list

Returns

true on success

fn purge_items(&self) -> Result<i32, Error>

Purges every item from the recently used resources list.

Returns

the number of items that have been removed from the recently used resources list

fn remove_item(&self, uri: &str) -> Result<(), Error>

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

uri

the 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

fn get_property_filename(&self) -> Option<GString>

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

fn get_property_size(&self) -> i32

The size of the recently used resources list.

fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

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

fn connect_property_size_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Loading content...

Implementors

impl<O: IsA<RecentManager>> RecentManagerExt for O[src]

Loading content...