pnmixer
Volume mixer for the system tray
Functions
prefs.h File Reference

Header for prefs.c. More...

#include <glib.h>
Include dependency graph for prefs.h:

Go to the source code of this file.

Functions

void prefs_load (void)
 
void prefs_save (void)
 
void prefs_ensure_save_dir (void)
 
gboolean prefs_get_boolean (const gchar *key, gboolean def)
 
gint prefs_get_integer (const gchar *key, gint def)
 
gdouble prefs_get_double (const gchar *key, gdouble def)
 
gchar * prefs_get_string (const gchar *key, const gchar *def)
 
gdouble * prefs_get_double_list (const gchar *key, gsize *n)
 
gchar * prefs_get_channel (const gchar *card)
 
void prefs_set_boolean (const gchar *key, gboolean value)
 
void prefs_set_integer (const gchar *key, gint value)
 
void prefs_set_double (const gchar *key, gdouble value)
 
void prefs_set_string (const gchar *key, const gchar *value)
 
void prefs_set_double_list (const gchar *key, gdouble *list, gsize n)
 
void prefs_set_channel (const gchar *card, const gchar *channel)
 

Detailed Description

Header for prefs.c.

Header for prefs.c.

Definition in file prefs.h.

Function Documentation

◆ prefs_ensure_save_dir()

void prefs_ensure_save_dir ( void  )

Checks if the preferences dir for saving is present and accessible. Creates it if doesn't exist. Reports errors via run_error_dialog().

Definition at line 405 of file prefs.c.

◆ prefs_get_boolean()

gboolean prefs_get_boolean ( const gchar *  key,
gboolean  def 
)

Gets a boolean value from preferences. On error, returns def as default value.

Parameters
keythe specific settings key
defthe default value to return on error
Returns
the preference value or def on error

Definition at line 102 of file prefs.c.

◆ prefs_get_channel()

gchar* prefs_get_channel ( const gchar *  card)

Gets the currently selected channel of the specified Alsa Card from the global keyFile and returns the result.

Parameters
cardthe Alsa Card to get the currently selected channel of
Returns
the currently selected channel as newly allocated string, NULL on failure

Definition at line 259 of file prefs.c.

◆ prefs_get_double()

gdouble prefs_get_double ( const gchar *  key,
gdouble  def 
)

Gets a double value from preferences. On error, returns def as default value.

Parameters
keythe specific settings key
defthe default value to return on error
Returns
the preference value or def on error

Definition at line 148 of file prefs.c.

◆ prefs_get_double_list()

gdouble* prefs_get_double_list ( const gchar *  key,
gsize *  n 
)

Gets a list of doubles from preferences. On error, returns NULL.

Parameters
keythe specific settings key
ninteger pointer that will contain the returned array size
Returns
the preference value or NULL on error

Definition at line 206 of file prefs.c.

◆ prefs_get_integer()

gint prefs_get_integer ( const gchar *  key,
gint  def 
)

Gets an int value from a preferences. On error, returns def as default value.

Parameters
keythe specific settings key
defthe default value to return on error
Returns
the preference value or def on error

Definition at line 125 of file prefs.c.

◆ prefs_get_string()

gchar* prefs_get_string ( const gchar *  key,
const gchar *  def 
)

Gets a string value from preferences. On error, returns def as default value.

Parameters
keythe specific settings key
defthe default value to return on error
Returns
the preference value or def on error. Must be freed.

Definition at line 171 of file prefs.c.

◆ prefs_load()

void prefs_load ( void  )

Loads the preferences from the config file to the keyFile object (GKeyFile type). Creates the keyFile object if it doesn't exist.

Definition at line 344 of file prefs.c.

◆ prefs_save()

void prefs_save ( void  )

Save the preferences from the keyFile object to the config file.

Definition at line 381 of file prefs.c.

◆ prefs_set_boolean()

void prefs_set_boolean ( const gchar *  key,
gboolean  value 
)

Sets a boolean value to preferences.

Parameters
keythe specific settings key
valuethe value to set

Definition at line 273 of file prefs.c.

◆ prefs_set_channel()

void prefs_set_channel ( const gchar *  card,
const gchar *  channel 
)

Sets the channel for a given card in preferences.

Parameters
cardthe Alsa Card associated with the channel
channelthe channel to save in the preferences.

Definition at line 334 of file prefs.c.

◆ prefs_set_double()

void prefs_set_double ( const gchar *  key,
gdouble  value 
)

Sets a double value to preferences.

Parameters
keythe specific settings key
valuethe value to set

Definition at line 297 of file prefs.c.

◆ prefs_set_double_list()

void prefs_set_double_list ( const gchar *  key,
gdouble *  list,
gsize  n 
)

Sets a list of doubles to preferences.

Parameters
keythe specific settings key
listthe array of double values to set
nthe array length

Definition at line 322 of file prefs.c.

◆ prefs_set_integer()

void prefs_set_integer ( const gchar *  key,
gint  value 
)

Sets a integer value to preferences.

Parameters
keythe specific settings key
valuethe value to set

Definition at line 285 of file prefs.c.

◆ prefs_set_string()

void prefs_set_string ( const gchar *  key,
const gchar *  value 
)

Sets a string value to preferences.

Parameters
keythe specific settings key
valuethe value to set

Definition at line 309 of file prefs.c.