FmIcon

## FmIcon FmIcon — A simple icons cache. |

## Synopsis

                        FmIcon;
    FmIcon *            fm_icon_from_gicon                  (GIcon *gicon);
    FmIcon *            fm_icon_from_name                   (const char *name);
    #define             fm_icon_get_gicon                   (icon)
    gpointer            fm_icon_get_user_data               (FmIcon *icon);
    FmIcon *            fm_icon_ref                         (FmIcon *icon);
    void                fm_icon_reset_user_data_cache       (GQuark quark);
    void                fm_icon_set_user_data               (FmIcon *icon,
                                                             gpointer user_data);
    void                fm_icon_set_user_data_destroy       (GDestroyNotify func);
    void                fm_icon_unload_cache                ();
    void                fm_icon_unload_user_data_cache      ();
    void                fm_icon_unref                       (FmIcon *icon);

## Description

`include`: libfm/fm.h

## Details

### FmIcon

    typedef struct _FmIcon FmIcon;

Opaque structure used in Libfm icon cache. Before version 1.2.0 it had own data structure. Since 1.2.0 it is derived from GIcon therefore it can be used basicly the same way.

### fm_icon_from_gicon ()

    FmIcon *            fm_icon_from_gicon                  (GIcon *gicon);

Retrives a FmIcon corresponding to `gicon` from cache inserting new one if there was no such icon there yet.

`gicon` : | a GIcon object
Returns : | a FmIcon object. [transfer full]

Since 0.1.0

### fm_icon_from_name ()

    FmIcon *            fm_icon_from_name                   (const char *name);

Retrives a FmIcon corresponding to `name` from cache inserting new one if there was no such icon there yet.

`name` : | a name for icon
Returns : | a FmIcon object. [transfer full]

Since 0.1.0

### fm_icon_get_gicon()

    #define fm_icon_get_gicon(icon) G_ICON(icon)

The macro to access GIcon instead of old direct access. For older versions applications can define it as (icon->gicon)

`icon` : | a FmIcon
Returns : | cached GIcon object.

Since 1.2.0

### fm_icon_get_user_data ()

    gpointer            fm_icon_get_user_data               (FmIcon *icon);

### Warning

`fm_icon_get_user_data` has been deprecated since version 1.2.0 and should not be used in newly-written code. Use `g_object_get_qdata()` instead.

Retrieves user data that was set via `fm_icon_set_user_data()`.

`icon` : | a FmIcon object
Returns : | user data.

Since 0.1.0

### fm_icon_ref ()

    FmIcon *            fm_icon_ref                         (FmIcon *icon);

### Warning

`fm_icon_ref` has been deprecated since version 1.2.0 and should not be used in newly-written code. Use `g_object_ref()` instead.

Increases reference count on `icon`.

`icon` : | an existing FmIcon object
Returns : | `icon`.

Since 0.1.0

### fm_icon_reset_user_data_cache ()

    void                fm_icon_reset_user_data_cache       (GQuark quark);

Flushes all user data by `quark` in cache.

`quark` : | the associated key for user data

Since 1.2.0

### fm_icon_set_user_data ()

    void                fm_icon_set_user_data               (FmIcon *icon,
                                                             gpointer user_data);

### Warning

`fm_icon_set_user_data` has been deprecated since version 1.2.0 and should not be used in newly-written code. Use `g_object_set_qdata_full()` instead.

Sets `user_data` to be associated with `icon`.

See also: `fm_icon_get_user_data()`, `fm_icon_unload_user_data_cache()`.

`icon` : | a FmIcon object
`user_data` : | data pointer to set

Since 0.1.0

### fm_icon_set_user_data_destroy ()

    void                fm_icon_set_user_data_destroy       (GDestroyNotify func);

### Warning

`fm_icon_set_user_data_destroy` has been deprecated since version 1.2.0 and should not be used in newly-written code.

Sets `func` to be used by `fm_icon_unload_user_data_cache()` to destroy user data that was set by `fm_icon_set_user_data()`.

`func` : | function for user data

Since 0.1.0

### fm_icon_unload_cache ()

    void                fm_icon_unload_cache                ();

Flushes cache.

Since 0.1.0

### fm_icon_unload_user_data_cache ()

    void                fm_icon_unload_user_data_cache      ();

### Warning

`fm_icon_unload_user_data_cache` has been deprecated since version 1.2.0 and should not be used in newly-written code. Use `fm_icon_reset_user_data_cache()` instead.

Flushes all user data in cache.

See also: `fm_icon_set_user_data()`.

Since 0.1.0

### fm_icon_unref ()

    void                fm_icon_unref                       (FmIcon *icon);

### Warning

`fm_icon_unref` has been deprecated since version 1.2.0 and should not be used in newly-written code. Use `g_object_unref()` instead.

Decreases reference count on `icon`. If refernce count went to 0 then removes `icon` from cache.

`icon` : | a FmIcon object

Since 0.1.0