## FmFolderConfig

FmFolderConfig — Folder specific settings cache.

## Functions

FmFolderConfig * | fm_folder_config_open ()
gboolean | fm_folder_config_close ()
gboolean | fm_folder_config_is_empty ()
gboolean | fm_folder_config_get_integer ()
gboolean | fm_folder_config_get_uint64 ()
gboolean | fm_folder_config_get_double ()
gboolean | fm_folder_config_get_boolean ()
char * | fm_folder_config_get_string ()
char ** | fm_folder_config_get_string_list ()
void | fm_folder_config_set_integer ()
void | fm_folder_config_set_uint64 ()
void | fm_folder_config_set_double ()
void | fm_folder_config_set_boolean ()
void | fm_folder_config_set_string ()
void | fm_folder_config_set_string_list ()
void | fm_folder_config_remove_key ()
void | fm_folder_config_purge ()
void | fm_folder_config_save_cache ()

## Types and Values

| FmFolderConfig

## Description

`include` : libfm/fm.h

This API represents access to folder-specific configuration settings. Each setting is a key/value pair. To use it the descriptor should be opened first, then required operations performed, then closed. Each opened descriptor holds a lock on the cache so it is not adviced to keep it somewhere.

## Functions

### fm_folder_config_open ()

    FmFolderConfig *
    fm_folder_config_open (FmPath *path);

Searches for settings in the cache that are specific to `path` . Locks the cache. Returned descriptor can be used for access to settings.

#### Parameters

path | path to get config |

#### Returns

new configuration descriptor.

[transfer full]

Since: 1.2.0

### fm_folder_config_close ()

    gboolean
    fm_folder_config_close (FmFolderConfig *fc,
                            GError **error);

Unlocks the cache and releases any data related to `fc` .

#### Parameters

fc | a configuration descriptor |
error | location to save error. | [out][allow-none]

#### Returns

`FALSE` if any error happened on data save.

Since: 1.2.0

### fm_folder_config_is_empty ()

    gboolean
    fm_folder_config_is_empty (FmFolderConfig *fc);

Checks if there is no data associated with the folder.

#### Parameters

fc | a configuration descriptor |

#### Returns

`TRUE` if the folder has no settings.

Since: 1.2.0

### fm_folder_config_get_integer ()

    gboolean
    fm_folder_config_get_integer (FmFolderConfig *fc,
                                  const char *key,
                                  gint *val);

Returns the value associated with `key` as an integer.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | location to save the value. | [out]

#### Returns

`TRUE` if key was found and parsed succesfully.

Since: 1.2.0

### fm_folder_config_get_uint64 ()

    gboolean
    fm_folder_config_get_uint64 (FmFolderConfig *fc,
                                 const char *key,
                                 guint64 *val);

Returns the value associated with `key` as an unsigned integer.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | location to save the value. | [out]

#### Returns

`TRUE` if key was found and value is an unsigned integer.

Since: 1.2.0

### fm_folder_config_get_double ()

    gboolean
    fm_folder_config_get_double (FmFolderConfig *fc,
                                 const char *key,
                                 gdouble *val);

Returns the value associated with `key` as a double.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | location to save the value. | [out]

#### Returns

`TRUE` if key was found and value can be parsed as double.

Since: 1.2.0

### fm_folder_config_get_boolean ()

    gboolean
    fm_folder_config_get_boolean (FmFolderConfig *fc,
                                  const char *key,
                                  gboolean *val);

Returns the value associated with `key` as a boolean.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | location to save the value. | [out]

#### Returns

`TRUE` if key was found and parsed succesfully.

Since: 1.2.0

### fm_folder_config_get_string ()

    char *
    fm_folder_config_get_string (FmFolderConfig *fc,
                                 const char *key);

Returns the value associated with `key` as a string. This function handles escape sequences like \s.

#### Parameters

fc | a configuration descriptor |
key | a key to search |

#### Returns

a newly allocated string or `NULL` if the specified key cannot be found.

Since: 1.2.0

### fm_folder_config_get_string_list ()

    char **
    fm_folder_config_get_string_list (FmFolderConfig *fc,
                                      const char *key,
                                      gsize *length);

Returns the values associated with `key` . If the specified key cannot be found then returns `NULL`. Returned data array should be freed with `g_strfreev()` after usage.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
length | location for the number of returned strings. | [out][allow-none]

#### Returns

a `NULL`-terminated string array.

Since: 1.2.0

### fm_folder_config_set_integer ()

    void
    fm_folder_config_set_integer (FmFolderConfig *fc,
                                  const char *key,
                                  gint val);

Associates integer `val` with `key` for given folder configuration.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | data to set |

Since: 1.2.0

### fm_folder_config_set_uint64 ()

    void
    fm_folder_config_set_uint64 (FmFolderConfig *fc,
                                 const char *key,
                                 guint64 val);

Associates unsigned integer `val` with `key` for given folder configuration.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | data to set |

Since: 1.2.0

### fm_folder_config_set_double ()

    void
    fm_folder_config_set_double (FmFolderConfig *fc,
                                 const char *key,
                                 gdouble val);

Associates double `val` with `key` for given folder configuration.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | data to set |

Since: 1.2.0

### fm_folder_config_set_boolean ()

    void
    fm_folder_config_set_boolean (FmFolderConfig *fc,
                                  const char *key,
                                  gboolean val);

Associates boolean `val` with `key` for given folder configuration.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
val | data to set |

Since: 1.2.0

### fm_folder_config_set_string ()

    void
    fm_folder_config_set_string (FmFolderConfig *fc,
                                 const char *key,
                                 const char *string);

Associates `string` with `key` for given folder configuration. This function handles characters that need escaping, such as newlines.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
string | data to set |

Since: 1.2.0

### fm_folder_config_set_string_list ()

    void
    fm_folder_config_set_string_list (FmFolderConfig *fc,
                                      const char *key,
                                      const gchar * const list[],
                                      gsize length);

Associates NULL-terminated `list` with `key` for given folder configuration.

#### Parameters

fc | a configuration descriptor |
key | a key to search |
list | a string list to set |
length | number of elements in `list` |

Since: 1.2.0

### fm_folder_config_remove_key ()

    void
    fm_folder_config_remove_key (FmFolderConfig *fc,
                                 const char *key);

Removes the key and associated data from the cache.

#### Parameters

fc | a configuration descriptor |
key | a key to search |

Since: 1.2.0

### fm_folder_config_purge ()

    void
    fm_folder_config_purge (FmFolderConfig *fc);

Clears all the data for the folder from the configuration.

#### Parameters

fc | a configuration descriptor |

Since: 1.2.0

### fm_folder_config_save_cache ()

    void
    fm_folder_config_save_cache (void);

Saves current data into the cache file.

Since: 1.2.0

## Types and Values

### FmFolderConfig

    typedef struct _FmFolderConfig FmFolderConfig;