:right-sidebar: True ThemedIcon =================================================================== .. currentmodule:: gi.repository.Gio .. class:: ThemedIcon(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gio.Icon` ``GThemedIcon`` is an implementation of :obj:`~gi.repository.Gio.Icon` that supports icon themes. ``GThemedIcon`` contains a list of all of the icons present in an icon theme, so that icons can be looked up quickly. ``GThemedIcon`` does not provide actual pixmaps for icons, just the icon names. Ideally something like :obj:`~gi.repository.Gtk.IconTheme.choose_icon` should be used to resolve the list of names so that fallback icons work nicely with themes that inherit other themes. Constructors ------------ .. rst-class:: interim-class .. class:: ThemedIcon :no-index: .. classmethod:: new(iconname: str) -> ~gi.repository.Gio.ThemedIcon Creates a new themed icon for ``iconname``. :param iconname: a string containing an icon name. .. classmethod:: new_from_names(iconnames: ~typing.Sequence[str]) -> ~gi.repository.Gio.ThemedIcon Creates a new themed icon for ``iconnames``. :param iconnames: an array of strings containing icon names. .. classmethod:: new_with_default_fallbacks(iconname: str) -> ~gi.repository.Gio.ThemedIcon Creates a new themed icon for ``iconname``, and all the names that can be created by shortening ``iconname`` at '-' characters. In the following example, ``icon1`` and ``icon2`` are equivalent: .. code-block:: C :dedent: const char *names[] = { "gnome-dev-cdrom-audio", "gnome-dev-cdrom", "gnome-dev", "gnome" }; icon1 = g_themed_icon_new_from_names (names, 4); icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio"); :param iconname: a string containing an icon name Methods ------- .. rst-class:: interim-class .. class:: ThemedIcon :no-index: .. method:: append_name(iconname: str) -> None Append a name to the list of icons from within ``icon``. Note that doing so invalidates the hash computed by prior calls to :func:`~gi.repository.Gio.Icon.hash`. :param iconname: name of icon to append to list of icons from within ``icon``. .. method:: get_names() -> list[str] Gets the names of icons from within ``icon``. .. method:: prepend_name(iconname: str) -> None Prepend a name to the list of icons from within ``icon``. Note that doing so invalidates the hash computed by prior calls to :func:`~gi.repository.Gio.Icon.hash`. .. versionadded:: 2.18 :param iconname: name of icon to prepend to list of icons from within ``icon``. Properties ---------- .. rst-class:: interim-class .. class:: ThemedIcon :no-index: .. attribute:: props.name :type: str The icon name. .. attribute:: props.names :type: ~typing.Sequence[str] A :const:`None`-terminated array of icon names. .. attribute:: props.use_default_fallbacks :type: bool Whether to use the default fallbacks found by shortening the icon name at '-' characters. If the "names" array has more than one element, ignores any past the first. For example, if the icon name was "gnome-dev-cdrom-audio", the array would become .. code-block:: C :dedent: { "gnome-dev-cdrom-audio", "gnome-dev-cdrom", "gnome-dev", "gnome", NULL };