Trait gtk::prelude::RecentManagerExt
source · [−]pub trait RecentManagerExt: 'static {
fn add_full(&self, uri: &str, recent_data: &RecentData) -> bool;
fn add_item(&self, uri: &str) -> bool;
fn 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 filename(&self) -> Option<GString>;
fn size(&self) -> i32;
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_size_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
fn add_full(&self, uri: &str, recent_data: &RecentData) -> bool
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
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 add_full()
.
See 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 items(&self) -> Vec<RecentInfo>
fn items(&self) -> Vec<RecentInfo>
Gets the list of recently used resources.
Returns
a list of
newly allocated RecentInfo
objects. Use
gtk_recent_info_unref()
on each item inside the list, and then
free the list itself using g_list_free()
.
fn lookup_item(&self, uri: &str) -> Result<Option<RecentInfo>, Error>
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
gtk_recent_info_unref()
.
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>
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
The full path to the file to be used to store and read the recently used resources list
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
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 add_item()
or
by another application.