Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
Defines | Functions | Variables
configdb.c File Reference
#include "configdb.h"
#include <libmcs/mcs.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Defines

#define RCFILE_DEFAULT_SECTION_NAME   "audacious"

Functions

mcs_handle_t * cfg_db_open ()
 Opens the configuration database.
void cfg_db_close (mcs_handle_t *handle)
 Closes the configuration database.
void cfg_db_flush (void)
gboolean cfg_db_get_string (mcs_handle_t *db, const gchar *section, const gchar *key, gchar **value)
 Fetches a string from the configuration database.
gboolean cfg_db_get_int (mcs_handle_t *db, const gchar *section, const gchar *key, gint *value)
 Fetches a integer value from the configuration database.
gboolean cfg_db_get_bool (mcs_handle_t *db, const gchar *section, const gchar *key, gboolean *value)
 Fetches a boolean value from the configuration database.
gboolean cfg_db_get_float (mcs_handle_t *db, const gchar *section, const gchar *key, gfloat *value)
 Fetches a single precision floating point value from the configuration database.
gboolean cfg_db_get_double (mcs_handle_t *db, const gchar *section, const gchar *key, gdouble *value)
 Fetches a double precision floating point value from the configuration database.
void cfg_db_set_string (mcs_handle_t *db, const gchar *section, const gchar *key, const gchar *value)
 Sets string value in given key of given section in the configuration database.
void cfg_db_set_int (mcs_handle_t *db, const gchar *section, const gchar *key, gint value)
 Sets integer value in given key of given section in the configuration database.
void cfg_db_set_bool (mcs_handle_t *db, const gchar *section, const gchar *key, gboolean value)
 Sets boolean value in given key of given section in the configuration database.
void cfg_db_set_float (mcs_handle_t *db, const gchar *section, const gchar *key, gfloat value)
 Sets single precision floating point value in given key of given section in the configuration database.
void cfg_db_set_double (mcs_handle_t *db, const gchar *section, const gchar *key, gdouble value)
 Sets double precision floating point value in given key of given section in the configuration database.
void cfg_db_unset_key (mcs_handle_t *db, const gchar *section, const gchar *key)
 Removes a value from the configuration database.

Variables

static gboolean mcs_initted = FALSE
static mcs_handle_t * config_handle = NULL
static gint config_refcount = 0

Define Documentation

#define RCFILE_DEFAULT_SECTION_NAME   "audacious"

Function Documentation

void cfg_db_close ( mcs_handle_t *  handle)

Closes the configuration database.

Parameters:
[in]dbA configuration database handle pointer.

Definition at line 59 of file configdb.c.

Referenced by aud_config_load(), aud_config_save(), on_entry_cfg_changed(), on_entry_cfg_realize(), on_toggle_button_cfg_realize(), and on_toggle_button_cfg_toggled().

void cfg_db_flush ( void  )

Definition at line 66 of file configdb.c.

Referenced by autosave_cb(), and shut_down().

gboolean cfg_db_get_bool ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gboolean value 
)

Fetches a boolean value from the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database to search.
[in]keyThe name of the field in the configuration database to look up.
[out]valuePointer to a buffer to put the data in.
Returns:
TRUE if successful, FALSE otherwise.

Definition at line 136 of file configdb.c.

Referenced by aud_config_load(), and on_toggle_button_cfg_realize().

gboolean cfg_db_get_double ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gdouble value 
)

Fetches a double precision floating point value from the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database to search.
[in]keyThe name of the field in the configuration database to look up.
[out]valuePointer to a buffer to put the data in.
Returns:
TRUE if successful, FALSE otherwise.

Definition at line 180 of file configdb.c.

gboolean cfg_db_get_float ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gfloat *  value 
)

Fetches a single precision floating point value from the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database to search.
[in]keyThe name of the field in the configuration database to look up.
[out]valuePointer to a buffer to put the data in.
Returns:
TRUE if successful, FALSE otherwise.

Definition at line 158 of file configdb.c.

gboolean cfg_db_get_int ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gint value 
)

Fetches a integer value from the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database to search.
[in]keyThe name of the field in the configuration database to look up.
[out]valuePointer to a buffer to put the data in.
Returns:
TRUE if successful, FALSE otherwise.

Definition at line 117 of file configdb.c.

gboolean cfg_db_get_string ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gchar **  value 
)

Fetches a string from the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database to search.
[in]keyThe name of the field in the configuration database to look up.
[out]valuePointer to a buffer to put the data in.
Returns:
TRUE if successful, FALSE otherwise.

Definition at line 86 of file configdb.c.

Referenced by aud_config_load(), and on_entry_cfg_realize().

mcs_handle_t* cfg_db_open ( )

Opens the configuration database.

Returns:
A configuration database handle pointer.

Definition at line 40 of file configdb.c.

Referenced by aud_config_load(), aud_config_save(), on_entry_cfg_changed(), on_entry_cfg_realize(), on_toggle_button_cfg_realize(), and on_toggle_button_cfg_toggled().

void cfg_db_set_bool ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gboolean  value 
)

Sets boolean value in given key of given section in the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database.
[in]keyThe name of the field in the configuration database to set.
[in]valueA double precision floating point value.

Definition at line 246 of file configdb.c.

void cfg_db_set_double ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gdouble  value 
)

Sets double precision floating point value in given key of given section in the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database.
[in]keyThe name of the field in the configuration database to set.
[in]valueA double precision floating point value.

Definition at line 288 of file configdb.c.

void cfg_db_set_float ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gfloat  value 
)

Sets single precision floating point value in given key of given section in the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database.
[in]keyThe name of the field in the configuration database to set.
[in]valueA double precision floating point value.

Definition at line 267 of file configdb.c.

Referenced by aud_config_save().

void cfg_db_set_int ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
gint  value 
)

Sets integer value in given key of given section in the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database.
[in]keyThe name of the field in the configuration database to set.
[in]valueA double precision floating point value.

Definition at line 225 of file configdb.c.

Referenced by aud_config_save().

void cfg_db_set_string ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key,
const gchar *  value 
)

Sets string value in given key of given section in the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database.
[in]keyThe name of the field in the configuration database to set.
[in]valueA double precision floating point value.

Definition at line 201 of file configdb.c.

void cfg_db_unset_key ( mcs_handle_t *  db,
const gchar *  section,
const gchar *  key 
)

Removes a value from the configuration database.

Parameters:
[in]dbA configuration database handle pointer.
[in]sectionThe section of the configuration database to search.
[in]keyThe name of the field in the configuration database to set.

Definition at line 307 of file configdb.c.


Variable Documentation

mcs_handle_t* config_handle = NULL [static]

Definition at line 31 of file configdb.c.

Referenced by cfg_db_close(), cfg_db_flush(), and cfg_db_open().

gint config_refcount = 0 [static]

Definition at line 32 of file configdb.c.

Referenced by cfg_db_close(), cfg_db_flush(), and cfg_db_open().

gboolean mcs_initted = FALSE [static]

Definition at line 30 of file configdb.c.

Referenced by cfg_db_open().