## FmIcon

FmIcon — A simple icons cache.

## Functions

FmIcon * | fm_icon_from_gicon ()
FmIcon * | fm_icon_from_name ()
FmIcon * | fm_icon_ref ()
void | fm_icon_unref ()
gpointer | fm_icon_get_user_data ()
void | fm_icon_set_user_data ()
void | fm_icon_set_user_data_destroy ()
void | fm_icon_unload_user_data_cache ()
#define | fm_icon_get_gicon()
void | fm_icon_reset_user_data_cache ()
void | fm_icon_unload_cache ()

## Types and Values

| FmIcon

## Description

`include` : libfm/fm.h

## Functions

### 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.

#### Parameters

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.

#### Parameters

name | a name for icon |

#### Returns

a FmIcon object.

[transfer full]

Since: 0.1.0

### fm_icon_ref ()

    FmIcon *
    fm_icon_ref (FmIcon *icon);

`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` .

#### Parameters

icon | an existing FmIcon object |

#### Returns

`icon` .

Since: 0.1.0

### fm_icon_unref ()

    void
    fm_icon_unref (FmIcon *icon);

`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.

#### Parameters

icon | a FmIcon object |

Since: 0.1.0

### fm_icon_get_user_data ()

    gpointer
    fm_icon_get_user_data (FmIcon *icon);

`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()`.

#### Parameters

icon | a FmIcon object |

#### Returns

user data.

Since: 0.1.0

### fm_icon_set_user_data ()

    void
    fm_icon_set_user_data (FmIcon *icon,
                           gpointer user_data);

`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()`.

#### Parameters

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);

`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()`.

#### Parameters

func | function for user data |

Since: 0.1.0

### fm_icon_unload_user_data_cache ()

    void
    fm_icon_unload_user_data_cache ();

`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_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)

#### Parameters

icon | a FmIcon |

#### Returns

cached GIcon object.

Since: 1.2.0

### fm_icon_reset_user_data_cache ()

    void
    fm_icon_reset_user_data_cache (GQuark quark);

Flushes all user data by `quark` in cache.

#### Parameters

quark | the associated key for user data |

Since: 1.2.0

### fm_icon_unload_cache ()

    void
    fm_icon_unload_cache ();

Flushes cache.

Since: 0.1.0

## Types and Values

### 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.