Top | ![]() |
![]() |
![]() |
![]() |
GIcon * | gs_remote_icon_new () |
const gchar * | gs_remote_icon_get_uri () |
gboolean | gs_remote_icon_ensure_cached () |
GsRemoteIcon is a GIcon implementation which represents remote icons —
icons which have an HTTP or HTTPS URI. It provides a well-known local filename
for a cached copy of the icon, accessible as “file”, and a method
to download the icon to the cache, gs_remote_icon_ensure_cached()
.
Constructing a GsRemoteIcon does not guarantee that the icon is cached. Call
gs_remote_icon_ensure_cached()
for that.
GsRemoteIcon is immutable after construction and hence is entirely thread safe.
FIXME: Currently does no cache invalidation.
GIcon *
gs_remote_icon_new (const gchar *uri
);
Create a new GsRemoteIcon representing uri
. The “file” of the
resulting icon will represent the local cache location for the icon.
Since: 40
const gchar *
gs_remote_icon_get_uri (GsRemoteIcon *self
);
Gets the value of “uri”.
Since: 40
gboolean gs_remote_icon_ensure_cached (GsRemoteIcon *self
,SoupSession *soup_session
,guint maximum_icon_size
,guint scale
,GCancellable *cancellable
,GError **error
);
Ensure the given icon is present in the local cache, potentially downloading it from its remote server if needed. This will do network and disk I/O.
maximum_icon_size
specifies the maximum size (in logical pixels) of the icon
which should be saved to the cache. This is the maximum size that the icon
can ever be used at, as icons can be downscaled but never upscaled. Typically
this will be 160px. The device scale factor (
)
is provided separately as gtk_widget_get_scale_factor()
scale
.
This can be called from any thread, as GsRemoteIcon is immutable and hence thread-safe.
self |
||
soup_session |
a SoupSession to use to download the icon |
|
maximum_icon_size |
maximum size (in logical pixels) of the icon to save |
|
scale |
scale the icon will be used at |
|
cancellable |
a GCancellable, or |
[nullable] |
error |
return location for a GError, or |
Since: 48