AscIconPolicy: AppStream Compose Library Reference Manual

## AscIconPolicy

AscIconPolicy — Set policy on how to deal with different icon types.

## Functions

AscIconPolicy * | asc_icon_policy_new ()
void | asc_icon_policy_set_policy ()
void | asc_icon_policy_iter_init ()
gboolean | asc_icon_policy_iter_next ()

## Types and Values

#define | ASC_TYPE_ICON_POLICY
struct | AscIconPolicyClass
enum | AscIconState
| AscIconPolicy

## Includes

    #include <appstream-compose.h>

## Description

## Functions

### asc_icon_policy_new ()

    AscIconPolicy *
    asc_icon_policy_new (void);

Creates a new AscIconPolicy.

### asc_icon_policy_set_policy ()

    void
    asc_icon_policy_set_policy (AscIconPolicy *ipolicy,
                                guint icon_size,
                                guint icon_scale,
                                AscIconState state);

Sets a designated state for an icon of the given size.

#### Parameters

ipolicy | an AscIconPolicy instance. |
icon_size | the size of the icon to set policy for (e.g. 64 for 64x64px icons) |
icon_scale | the icon scale factor, e.g. 1 |
state | the designated AscIconState |

### asc_icon_policy_iter_init ()

    void
    asc_icon_policy_iter_init (AscIconPolicyIter *iter,
                               AscIconPolicy *ipolicy);

Initializes a policy iterator for the policy entry list and associates it it with `ipolicy` . The AscIconPolicyIter structure is typically allocated on the stack and does not need to be freed explicitly.

#### Parameters

iter | an uninitialized AscIconPolicyIter |
ipolicy | an AscIconPolicy |

### asc_icon_policy_iter_next ()

    gboolean
    asc_icon_policy_iter_next (AscIconPolicyIter *iter,
                               guint *size,
                               guint *scale,
                               AscIconState *state);

Returns the current icon policy entry and advances the iterator. Example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    AscIconPolicyIter iter;
    guint icon_size;
    guint icon_scale;
    AscIconState istate;

    asc_icon_policy_iter_init (&iter, ipolicy);
    while (asc_icon_policy_iter_next (&iter, &icon_size, &icon_scale, &istate)) {
        // do something with the icon entry data
    }

#### Parameters

iter | an initialized AscIconPolicyIter |
size | Destination of the returned icon size. | [out][optional][not nullable]
scale | Destination of the returned icon scale factor. | [out][optional][not nullable]
state | Destination of the returned designated icon state. | [out][optional][nullable]

#### Returns

`FALSE` if the last entry has been reached.

## Types and Values

### ASC_TYPE_ICON_POLICY

    #define ASC_TYPE_ICON_POLICY (asc_icon_policy_get_type ())

### struct AscIconPolicyClass

    struct AscIconPolicyClass {
    	GObjectClass parent_class;
    };

### enum AscIconState

Designated state for an icon of a given size.

#### Members

ASC_ICON_STATE_IGNORED | Ignore icons of this size. |
ASC_ICON_STATE_CACHED_REMOTE | Create cache for the icon, and provide remote link as well. |
ASC_ICON_STATE_CACHED_ONLY | Set if the icon should be stored in an icon tarball and be cached locally. |
ASC_ICON_STATE_REMOTE_ONLY | Set if this icon should be stored remotely and fetched on demand. |

### AscIconPolicy

    typedef struct _AscIconPolicy AscIconPolicy;