gtk.icon_theme

Module for [IconTheme] class

Types 3

classIconTheme : gobject.object.ObjectWrap

[gtk.icon_theme.IconTheme] provides a facility for loading themed icons.

The main reason for using a name rather than simply providing a filename is to allow different icons to be used depending on what “icon theme” is selected by the user. The operation of icon themes on Linux and Unix follows the Icon Theme Specification There is a fallback icon theme, named hicolor, where applications should install their icons, but additional icon themes can be installed as operating system vendors and users choose.

In many cases, named themes are used indirectly, via [gtk.image.Image] rather than directly, but looking up icons directly is also simple. The [gtk.icon_theme.IconTheme] object acts as a database of all the icons in the current theme. You can create new [gtk.icon_theme.IconTheme] objects, but it’s much more efficient to use the standard icon theme of the [gtk.widget.Widget] so that the icon information is shared with other people looking up icons.

GtkIconTheme *icon_theme;
GtkIconPaintable *icon;
GdkPaintable *paintable;

icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (my_widget));
icon = gtk_icon_theme_lookup_icon (icon_theme,
                                  "my-icon-name", // icon name
                                  48, // icon size
                                  1,  // scale
                                  0,  // flags);
paintable = GDK_PAINTABLE (icon);
// Use the paintable
g_object_unref (icon);

Methods
GType _gType() @property
IconTheme self()Returns `this`, for use in `with` statements.
IconThemeGidBuilder builder()Get builder for [gtk.icon_theme.IconTheme] Returns: New builder object
gdk.display.Display display() @propertyGet `display` property. Returns: The display that this icon theme object is attached to.
void display(gdk.display.Display propval) @propertySet `display` property. Params: propval = The display that this icon theme object is attached to.
string themeName() @propertyGet `themeName` property. Returns: The name of the icon theme that is being used.
void themeName(string propval) @propertySet `themeName` property. Params: propval = The name of the icon theme that is being used.
gtk.icon_theme.IconTheme getForDisplay(gdk.display.Display display)Gets the icon theme object associated with display.
void addResourcePath(string path)Adds a resource path that will be looked at when looking for icons, similar to search paths.
void addSearchPath(string path)Appends a directory to the search path.
gdk.display.Display getDisplay()Returns the display that the [gtk.icontheme.IconTheme] object was created for. Returns: the display of icontheme
string[] getIconNames()Lists the names of icons in the current icon theme. Returns: a string array holding the names of all the icons in the theme. You must free the array using [glib.global.strfreev].
int[] getIconSizes(string iconName)Returns an array of integers describing the sizes at which the icon is available without scaling.
string[] getResourcePath()Gets the current resource path.
string[] getSearchPath()Gets the current search path.
string getThemeName()Gets the current icon theme name.
bool hasGicon(gio.icon.Icon gicon)Checks whether an icon theme includes an icon for a particular [gio.icon.Icon].
bool hasIcon(string iconName)Checks whether an icon theme includes an icon for a particular name.
gtk.icon_paintable.IconPaintable lookupByGicon(gio.icon.Icon icon, int size, int scale, gtk.types.TextDirection direction, gtk.types.IconLookupFlags flags)Looks up a icon for a desired size and window scale.
gtk.icon_paintable.IconPaintable lookupIcon(string iconName, string[] fallbacks, int size, int scale, gtk.types.TextDirection direction, gtk.types.IconLookupFlags flags)Looks up a named icon for a desired size and window scale, returning a [gtk.icon_paintable.IconPaintable].
void setResourcePath(string[] path = null)Sets the resource paths that will be looked at when looking for icons, similar to search paths.
void setSearchPath(string[] path = null)Sets the search path for the icon theme object.
void setThemeName(string themeName = null)Sets the name of the icon theme that the [gtk.icon_theme.IconTheme] object uses overriding system configuration.
gulong connectChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_theme.IconTheme))) && Parameters!T.length < 2)Connect to `Changed` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new icon theme object.
Methods
T display(gdk.display.Display propval)Set `display` property. Params: propval = The display that this icon theme object is attached to. Returns: Builder instance for fluent chaining
T themeName(string propval)Set `themeName` property. Params: propval = The name of the icon theme that is being used.

Fluent builder for [gtk.icon_theme.IconTheme]

Methods
IconTheme build()