Declaration [src]

gtk_icon_theme_lookup_icon (
  GtkIconTheme* self,
  const char* icon_name,
  const char** fallbacks,
  int size,
  int scale,
  GtkTextDirection direction,
  GtkIconLookupFlags flags

Description [src]

Looks up a named icon for a desired size and window scale, returning a GtkIconPaintable.

The icon can then be rendered by using it as a GdkPaintable, or you can get information such as the filename and size.

If the available icon_name is not available and fallbacks are provided, they will be tried in order.

If no matching icon is found, then a paintable that renders the “missing icon” icon is returned. If you need to do something else for missing icons you need to use gtk_icon_theme_has_icon().

Note that you probably want to listen for icon theme changes and update the icon. This is usually done by overriding the GtkWidgetClass.css-changed() function.


icon_name const char*

The name of the icon to lookup.

 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.
fallbacks An array of char*
  No description available.
 The argument can be NULL.
 The array must be NULL-terminated.
 The data is owned by the caller of the function.
 Each element is a NUL terminated UTF-8 string.
size int

Desired icon size.

scale int

The window scale this will be displayed on.

direction GtkTextDirection

Text direction the icon will be displayed in.

flags GtkIconLookupFlags

Flags modifying the behavior of the icon lookup.

Return value

Returns: GtkIconPaintable

A GtkIconPaintable object containing the icon.

 The caller of the method takes ownership of the data, and is responsible for freeing it.