AsIcon: AppStream Library Reference Manual

## AsIcon AsIcon — Describes an icon of an application. |

## Functions

AsIconKind | as_icon_kind_from_string ()
const gchar * | as_icon_kind_to_string ()
AsIcon * | as_icon_new ()
AsIconKind | as_icon_get_kind ()
void | as_icon_set_kind ()
const gchar * | as_icon_get_name ()
void | as_icon_set_name ()
const gchar * | as_icon_get_url ()
void | as_icon_set_url ()
const gchar * | as_icon_get_filename ()
void | as_icon_set_filename ()
guint | as_icon_get_width ()
void | as_icon_set_width ()
guint | as_icon_get_height ()
void | as_icon_set_height ()
guint | as_icon_get_scale ()
void | as_icon_set_scale ()

## Types and Values

#define | AS_TYPE_ICON
struct | AsIconClass
enum | AsIconKind
| AsIcon

## Includes

    #include <appstream.h>

## Description

## Functions

### as_icon_kind_from_string ()

    AsIconKind
    as_icon_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsIconKind or `AS_ICON_KIND_UNKNOWN` for unknown

### as_icon_kind_to_string ()

    const gchar *
    as_icon_kind_to_string (AsIconKind kind);

Converts the enumerated value to an text representation.

#### Parameters

kind | the `AsIconKind`. |

#### Returns

string version of `kind`

### as_icon_new ()

    AsIcon *
    as_icon_new (void);

Creates a new AsIcon.

#### Returns

a AsIcon.

[transfer full]

### as_icon_get_kind ()

    AsIconKind
    as_icon_get_kind (AsIcon *icon);

Gets the icon kind.

#### Parameters

icon | a AsIcon instance. |

#### Returns

the AsIconKind

### as_icon_set_kind ()

    void
    as_icon_set_kind (AsIcon *icon,
                      AsIconKind kind);

Sets the icon kind.

#### Parameters

icon | a AsIcon instance. |
kind | the AsIconKind, e.g. `AS_ICON_KIND_CACHED`. |

### as_icon_get_name ()

    const gchar *
    as_icon_get_name (AsIcon *icon);

#### Parameters

icon | a AsIcon instance. |

#### Returns

the stock name of the icon. In case the icon is not of kind "stock", the basename of the icon filename or URL is returned.

### as_icon_set_name ()

    void
    as_icon_set_name (AsIcon *icon,
                      const gchar *name);

Sets the stock name or basename to use for the icon.

#### Parameters

icon | a AsIcon instance. |
name | the icon stock name, e.g. "gwenview" |

### as_icon_get_url ()

    const gchar *
    as_icon_get_url (AsIcon *icon);

Gets the icon URL, pointing at a remote location. HTTPS and FTP urls are allowed. This property is only set for icons of type `AS_ICON_KIND_REMOTE`

#### Parameters

icon | a AsIcon instance. |

#### Returns

the URL

### as_icon_set_url ()

    void
    as_icon_set_url (AsIcon *icon,
                     const gchar *url);

Sets the icon URL.

#### Parameters

icon | a AsIcon instance. |
url | the new icon URL. |

### as_icon_get_filename ()

    const gchar *
    as_icon_get_filename (AsIcon *icon);

#### Parameters

icon | a AsIcon instance. |

#### Returns

The absolute path for the icon on disk. This is only set for icons of kind `AS_ICON_KIND_LOCAL` or `AS_ICON_KIND_CACHED`.

### as_icon_set_filename ()

    void
    as_icon_set_filename (AsIcon *icon,
                          const gchar *filename);

Sets the icon absolute filename.

#### Parameters

icon | a AsIcon instance. |
filename | the new icon URL. |

### as_icon_get_width ()

    guint
    as_icon_get_width (AsIcon *icon);

#### Parameters

icon | a AsIcon instance. |

#### Returns

The icon width in pixels, or 0 if unknown.

### as_icon_set_width ()

    void
    as_icon_set_width (AsIcon *icon,
                       guint width);

Sets the icon width.

#### Parameters

icon | a AsIcon instance. |
width | the width in pixels. |

### as_icon_get_height ()

    guint
    as_icon_get_height (AsIcon *icon);

#### Parameters

icon | a AsIcon instance. |

#### Returns

The icon height in pixels, or 0 if unknown.

### as_icon_set_height ()

    void
    as_icon_set_height (AsIcon *icon,
                        guint height);

Sets the icon height.

#### Parameters

icon | a AsIcon instance. |
height | the height in pixels. |

### as_icon_get_scale ()

    guint
    as_icon_get_scale (AsIcon *icon);

#### Parameters

icon | a AsIcon instance. |

#### Returns

The icon scaling factor.

Since: 0.11.0

### as_icon_set_scale ()

    void
    as_icon_set_scale (AsIcon *icon,
                       guint scale);

Sets the icon scaling factor used for HiDPI displays.

#### Parameters

icon | a AsIcon instance. |
scale | the icon scaling factor. |

Since: 0.11.0

## Types and Values

### AS_TYPE_ICON

    #define AS_TYPE_ICON (as_icon_get_type ())

### struct AsIconClass

    struct AsIconClass {
    	GObjectClass		parent_class;
    };

### enum AsIconKind

The icon type.

#### Members

AS_ICON_KIND_UNKNOWN | Unknown icon kind |
AS_ICON_KIND_CACHED | Icon in the internal caches |
AS_ICON_KIND_STOCK | Stock icon name |
AS_ICON_KIND_LOCAL | Local icon name |
AS_ICON_KIND_REMOTE | Remote icon URL |

### AsIcon

    typedef struct _AsIcon AsIcon;