| AppStream-glib Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <appstream-glib.h> enum AsIconError; enum AsIconKind; enum AsIconLoadFlags; #define AS_ICON_ERROR AsIcon * as_icon_new (void); GQuark as_icon_error_quark (void); const gchar * as_icon_kind_to_string (AsIconKind icon_kind); AsIconKind as_icon_kind_from_string (const gchar *icon_kind); const gchar * as_icon_get_name (AsIcon *icon); const gchar * as_icon_get_url (AsIcon *icon); const gchar * as_icon_get_filename (AsIcon *icon); const gchar * as_icon_get_prefix (AsIcon *icon); guint as_icon_get_width (AsIcon *icon); guint as_icon_get_height (AsIcon *icon); AsIconKind as_icon_get_kind (AsIcon *icon); GdkPixbuf * as_icon_get_pixbuf (AsIcon *icon); void as_icon_set_name (AsIcon *icon,const gchar *name,gssize name_len); void as_icon_set_url (AsIcon *icon,const gchar *url); void as_icon_set_filename (AsIcon *icon,const gchar *filename); void as_icon_set_prefix (AsIcon *icon,const gchar *prefix); void as_icon_set_width (AsIcon *icon,guint width); void as_icon_set_height (AsIcon *icon,guint height); void as_icon_set_kind (AsIcon *icon,AsIconKind kind); void as_icon_set_pixbuf (AsIcon *icon,GdkPixbuf *pixbuf); gboolean as_icon_load (AsIcon *icon,AsIconLoadFlags flags,GError **error); gboolean as_icon_convert_to_kind (AsIcon *icon,AsIconKind kind,GError **error);
Screenshot may have multiple versions of an icon in different resolutions or aspect ratios. This object allows access to the location and size of a single icon.
See also: AsScreenshot
typedef enum {
AS_ICON_KIND_UNKNOWN, /* Since: 0.1.0 */
AS_ICON_KIND_STOCK, /* Since: 0.1.0 */
AS_ICON_KIND_CACHED, /* Since: 0.1.0 */
AS_ICON_KIND_REMOTE, /* Since: 0.1.0 */
AS_ICON_KIND_EMBEDDED, /* Since: 0.3.1 */
AS_ICON_KIND_LOCAL, /* Since: 0.3.1 */
} AsIconKind;
The icon type.
| Type invalid or not known | |
| Stock icon or present in the generic icon theme | |
| An icon shipped with the AppStream metadata | |
| An icon referenced by a remote URL | |
| An embedded Base64 icon | |
| An icon with absolute path and filename |
typedef enum {
AS_ICON_LOAD_FLAG_NONE = 0, /* Since: 0.3.1 */
AS_ICON_LOAD_FLAG_SEARCH_SIZE = 1, /* Since: 0.3.1 */
} AsIconLoadFlags;
The flags to use when loading icons.
AsIcon * as_icon_new (void);
Creates a new AsIcon.
Returns : |
a AsIcon. [transfer full] |
Since 0.3.1
const gchar * as_icon_kind_to_string (AsIconKind icon_kind);
Converts the enumerated value to an text representation.
|
the AsIconKind. |
Returns : |
string version of icon_kind
|
Since 0.1.0
AsIconKind as_icon_kind_from_string (const gchar *icon_kind);
Converts the text representation to an enumerated value.
|
the string. |
Returns : |
a AsIconKind or AS_ICON_KIND_UNKNOWN for unknown |
Since 0.1.0
const gchar * as_icon_get_name (AsIcon *icon);
Gets the name of the icon, e.g. "epiphany.png"
|
a AsIcon instance. |
Returns : |
the basename of the icon |
Since 0.3.1
const gchar * as_icon_get_url (AsIcon *icon);
Gets the full qualified URL for the icon, usually pointing at some mirror.
NOTE: This is only set for icons of type AS_ICON_KIND_REMOTE
|
a AsIcon instance. |
Returns : |
the fully qualified URL |
Since 0.3.2
const gchar * as_icon_get_filename (AsIcon *icon);
Gets the absolute path on disk of the icon.
NOTE: This is only set for icons of type AS_ICON_KIND_LOCAL
|
a AsIcon instance. |
Returns : |
the absolute filename on disk |
Since 0.3.2
const gchar * as_icon_get_prefix (AsIcon *icon);
Gets the suggested prefix of the icon.
|
a AsIcon instance. |
Returns : |
filename |
Since 0.1.6
guint as_icon_get_width (AsIcon *icon);
Gets the icon width.
|
a AsIcon instance. |
Returns : |
width in pixels |
Since 0.3.1
guint as_icon_get_height (AsIcon *icon);
Gets the icon height.
|
a AsIcon instance. |
Returns : |
height in pixels |
Since 0.3.1
AsIconKind as_icon_get_kind (AsIcon *icon);
Gets the icon kind.
|
a AsIcon instance. |
Returns : |
the AsIconKind |
Since 0.3.1
GdkPixbuf * as_icon_get_pixbuf (AsIcon *icon);
Gets the icon pixbuf if set.
|
a AsIcon instance. |
Returns : |
the GdkPixbuf, or NULL. [transfer none]
|
Since 0.3.1
void as_icon_set_name (AsIcon *icon,const gchar *name,gssize name_len);
Sets the basename to use for the icon.
|
a AsIcon instance. |
|
the icon name, e.g. "gimp.png" |
|
the size of name, or -1 if NULL-terminated. |
Since 0.3.1
void as_icon_set_url (AsIcon *icon,const gchar *url);
Sets the icon URL.
|
a AsIcon instance. |
|
the new icon URL. |
Since 0.3.2
void as_icon_set_filename (AsIcon *icon,const gchar *filename);
Sets the icon absolute filename.
|
a AsIcon instance. |
|
the new icon URL. |
Since 0.3.2
void as_icon_set_prefix (AsIcon *icon,const gchar *prefix);
Sets the icon prefix filename.
|
a AsIcon instance. |
|
the new filename prefix. |
Since 0.1.6
void as_icon_set_width (AsIcon *icon,guint width);
Sets the icon width.
|
a AsIcon instance. |
|
the width in pixels. |
Since 0.3.1
void as_icon_set_height (AsIcon *icon,guint height);
Sets the icon height.
|
a AsIcon instance. |
|
the height in pixels. |
Since 0.3.1
void as_icon_set_kind (AsIcon *icon,AsIconKind kind);
Sets the icon kind.
|
a AsIcon instance. |
|
the AsIconKind, e.g. AS_ICON_KIND_STOCK. |
Since 0.3.1
void as_icon_set_pixbuf (AsIcon *icon,GdkPixbuf *pixbuf);
Sets the icon pixbuf.
|
a AsIcon instance. |
|
the GdkPixbuf, or NULL
|
Since 0.3.1
gboolean as_icon_load (AsIcon *icon,AsIconLoadFlags flags,GError **error);
Loads the icon into a local pixbuf.
|
a AsIcon instance. |
|
a AsIconLoadFlags, e.g. AS_ICON_LOAD_FLAG_SEARCH_SIZE
|
|
A GError or NULL. |
Returns : |
TRUE for success |
Since 0.3.1
gboolean as_icon_convert_to_kind (AsIcon *icon,AsIconKind kind,GError **error);
Converts the icon from one kind to another.
|
a AsIcon instance. |
|
a AsIconKind, e.g. AS_ICON_KIND_EMBEDDED
|
|
A GError or NULL. |
Returns : |
TRUE for success |
Since 0.3.1