Trait gtk4::prelude::RecentManagerExt
source · pub trait RecentManagerExt: IsA<RecentManager> + Sealed + 'static {
// Provided methods
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
Provided Methods§
sourcefn 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
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
, 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
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
sourcefn add_item(&self, uri: &str) -> bool
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 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
sourcefn items(&self) -> Vec<RecentInfo>
fn items(&self) -> Vec<RecentInfo>
Gets the list of recently used resources.
§Returns
a list of
newly allocated GtkRecentInfo objects
. Use
Gtk::RecentInfo::unref()
on each item inside the list, and then
free the list itself using g_list_free().
sourcefn 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
containing information about the resource
like its MIME type, or its display name.
§uri
a URI
§Returns
a RecentInfo
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::RecentInfo::unref()
.
sourcefn move_item(&self, uri: &str, new_uri: Option<&str>) -> Result<(), Error>
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
sourcefn 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
sourcefn filename(&self) -> Option<GString>
fn filename(&self) -> Option<GString>
The full path to the file to be used to store and read the recently used resources list
sourcefn 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.
This can happen either by calling add_item()
or by another application.