Package: gtk

Class gtk:icon-theme

Superclasses

gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

display
The display property of type gdk:display (Read / Write)
The display that the icon theme object is attached to.
icon-names
The icon-names property of type glib:strv-t (Read)
The icon names that are supported by the icon theme.
resource-path
The resource-path property of type glib:strv-t (Read / Write)
Resource paths that will be looked at when looking for icons, similar to search paths. The resources are considered as part of the hicolor icon theme and must be located in subdirectories that are defined in the hicolor icon theme, such as @path/16x16/actions/run.png. Icons that are directly placed in the resource path instead of a subdirectory are also considered as ultimate fallback.
search-path
The search-path property of type glib:strv-t (Read / Write)
The search path for this icon theme. When looking for icons, GTK will search for a subdirectory of one or more of the directories in the search path with the same name as the icon theme containing an index.theme file. Themes from multiple of the path elements are combined to allow themes to be extended by adding icons in the home directory of the user.
theme-name
The theme-name property of type :string (Read / Write)
The name of the icon theme that is being used. Unless set to a different value, this will be the value of the gtk-icon-theme-name property of the gtk:settings object associated to the display of the icon theme object.
Default value: nil

Details

The gtk:icon-theme class provides a facility for looking up icons by name and size. 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 default icon theme, named Hicolor where applications should install their icons, but more additional application themes can be installed as operating system vendors and users choose.

In many cases, named themes are used indirectly, via the gtk:image widget rather than directly, but looking up icons directly is also simple. The gtk:icon-theme object acts as a database of all the icons in the current theme. You can create new gtk:icon-theme objects, but it is 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.

Examples

In the case where the default screen is being used, looking up an icon can be as simple as:
(let* ((theme (gtk:icon-theme-for-display (gdk:display-default)))
       (paintable (gtk:icon-theme-lookup-icon theme
                                              "gtk-ok"    ; icon name
                                              nil         ; fallbacks
                                              48          ; size
                                              1           ; scale
                                              :none)))    ; no flags
   ... )    

Signal Details

The "changed" signal
lambda (theme)    :run-last      
theme
The gtk:icon-theme object.
Emitted when the current icon theme is switched or GTK detects that a change has occurred in the contents of the current icon theme.
 

Slot Access Functions

Inherited Slot Access Functions

See also

2023-8-30