set_from_gicon_async


Description:

public async void set_from_gicon_async (Icon icon, int size, Cancellable? cancellable = null) throws Error

Sets the image to display an GLib.Icon with a specified size asynchronously.

This method sets the Granite.AsyncImage.gicon_async and Granite.AsyncImage.size_async properties and depending on the Granite.AsyncImage.load_on_realize setting, loads it when the image realizes or loads it immediately.

Use GLib.ThemedIcon or Granite.AsyncImage.set_from_icon_name_async to load the image from an icon name.

If the icon is a GLib.FileIcon then the image will be loaded using the Granite.AsyncImage.set_from_file_async method with the supplied size for both width and height with preserving the aspect ratio of the image.

If the Granite.AsyncImage.load_on_realize is true, the error will never be thrown in this method since the loading will happen internally in the AsyncImage when the Gtk.Widget.realize signal is invoked. In this case, a warning will be printed with relevant information about a fauilure.

Parameters:

icon

the GLib.Icon to display in the image

size

the size of the icon, 0 will clear the Gtk.Image.pixbuf, -1 to load the default size

cancellable

the cancellable to stop loading the icon

Exceptions:

GLib.Error

when the the icon was not found or failed to load