## GThemedIcon

GThemedIcon — Icon theming support

## Functions

GIcon * | g_themed_icon_new ()
GIcon * | g_themed_icon_new_from_names ()
GIcon * | g_themed_icon_new_with_default_fallbacks ()
void | g_themed_icon_prepend_name ()
void | g_themed_icon_append_name ()
const gchar * const * | g_themed_icon_get_names ()

## Properties

gchar * | name | Write / Construct Only
GStrv | names | Read / Write / Construct Only
gboolean | use-default-fallbacks | Read / Write / Construct Only

## Types and Values

| GThemedIcon

## Object Hierarchy

        GObject
        ╰── GThemedIcon

## Implemented Interfaces

GThemedIcon implements GIcon.

## Includes

    #include <gio/gio.h>

## Description

GThemedIcon is an implementation of GIcon 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 `gtk_icon_theme_choose_icon()` should be used to resolve the list of names so that fallback icons work nicely with themes that inherit other themes.

## Functions

### g_themed_icon_new ()

    GIcon *
    g_themed_icon_new (const char *iconname);

Creates a new themed icon for `iconname` .

#### Parameters

iconname | a string containing an icon name. |

#### Returns

a new GThemedIcon.

[transfer full][type GThemedIcon]

### g_themed_icon_new_from_names ()

    GIcon *
    g_themed_icon_new_from_names (char **iconnames,
                                  int len);

Creates a new themed icon for `iconnames` .

#### Parameters

iconnames | an array of strings containing icon names. | [array length=len]
len | the length of the `iconnames` array, or -1 if `iconnames` is `NULL`-terminated |

#### Returns

a new GThemedIcon.

[transfer full][type GThemedIcon]

### g_themed_icon_new_with_default_fallbacks ()

    GIcon *
    g_themed_icon_new_with_default_fallbacks
                                   (const char *iconname);

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:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    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");

#### Parameters

iconname | a string containing an icon name |

#### Returns

a new GThemedIcon.

[transfer full][type GThemedIcon]

### g_themed_icon_prepend_name ()

    void
    g_themed_icon_prepend_name (GThemedIcon *icon,
                                const char *iconname);

Prepend a name to the list of icons from within `icon` .

Note that doing so invalidates the hash computed by prior calls to `g_icon_hash()`.

#### Parameters

icon | a GThemedIcon |
iconname | name of icon to prepend to list of icons from within `icon` . |

Since: 2.18

### g_themed_icon_append_name ()

    void
    g_themed_icon_append_name (GThemedIcon *icon,
                               const char *iconname);

Append a name to the list of icons from within `icon` .

Note that doing so invalidates the hash computed by prior calls to `g_icon_hash()`.

#### Parameters

icon | a GThemedIcon |
iconname | name of icon to append to list of icons from within `icon` . |

### g_themed_icon_get_names ()

    const gchar * const *
    g_themed_icon_get_names (GThemedIcon *icon);

Gets the names of icons from within `icon` .

#### Parameters

icon | a GThemedIcon. |

#### Returns

a list of icon names.

[transfer none]

## Types and Values

### GThemedIcon

    typedef struct _GThemedIcon GThemedIcon;

An implementation of GIcon for themed icons.

## Property Details

### The `“name”` property

      “name”                     gchar *

The icon name.

Flags: Write / Construct Only

Default value: NULL

### The `“names”` property

      “names”                    GStrv

A `NULL`-terminated array of icon names.

Flags: Read / Write / Construct Only

### The `“use-default-fallbacks”` property

      “use-default-fallbacks”    gboolean

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

    1
    2
    3
    4
    5
    6
    7
    {
      "gnome-dev-cdrom-audio",
      "gnome-dev-cdrom",
      "gnome-dev",
      "gnome",
      NULL
    };

Flags: Read / Write / Construct Only

Default value: FALSE

## See Also

GIcon, GLoadableIcon