Preferences

Preferences — Functions to manage preferences

Synopsis


#include <ogmrip-preferences.h>

GConfValue*         (*OGMRipPrefGetFunc)                (GtkWidget *widget);
gboolean            (*OGMRipPrefSetFunc)                (GtkWidget *widget,
                                                         GConfValue *value);
void                ogmrip_preferences_init             (const gchar *dir);
void                ogmrip_preferences_uninit           (void);
GConfValue*         ogmrip_preferences_get              (const gchar *key);
void                ogmrip_preferences_set              (const gchar *key,
                                                         GConfValue *value);
gboolean            ogmrip_preferences_get_bool         (const gchar *key,
                                                         gboolean def);
void                ogmrip_preferences_set_bool         (const gchar *key,
                                                         gboolean value);
gdouble             ogmrip_preferences_get_double       (const gchar *key,
                                                         gdouble def);
void                ogmrip_preferences_set_double       (const gchar *key,
                                                         gdouble value);
gint                ogmrip_preferences_get_int          (const gchar *key,
                                                         gint def);
void                ogmrip_preferences_set_int          (const gchar *key,
                                                         gint value);
gchar*              ogmrip_preferences_get_string       (const gchar *key,
                                                         const gchar *def);
void                ogmrip_preferences_set_string       (const gchar *key,
                                                         const gchar *value);
gchar*              ogmrip_preferences_get_filename     (const gchar *key,
                                                         const gchar *def);
void                ogmrip_preferences_set_filename     (const gchar *key,
                                                         const gchar *value);
guint               ogmrip_preferences_add_notify       (const gchar *key,
                                                         GFunc func,
                                                         gpointer data);
guint               ogmrip_preferences_add_notify_while_alive
                                                        (const gchar *key,
                                                         GFunc func,
                                                         gpointer data,
                                                         gpointer widget);
void                ogmrip_preferences_connect_toggle   (GtkWidget *toggle,
                                                         const gchar *key);
void                ogmrip_preferences_connect_toggle_custom
                                                        (GtkWidget *toggle,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);
void                ogmrip_preferences_connect_combo    (GtkWidget *combo,
                                                         const gchar *key);
void                ogmrip_preferences_connect_combo_custom
                                                        (GtkWidget *combo,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);
void                ogmrip_preferences_connect_chooser  (GtkWidget *chooser,
                                                         const gchar *key);
void                ogmrip_preferences_connect_chooser_custom
                                                        (GtkWidget *chooser,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);
void                ogmrip_preferences_connect_spin     (GtkWidget *spin,
                                                         const gchar *key);
void                ogmrip_preferences_connect_spin_custom
                                                        (GtkWidget *spin,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);
void                ogmrip_preferences_connect_radio    (GtkWidget *radio,
                                                         const gchar *key);
void                ogmrip_preferences_connect_radio_custom
                                                        (GtkWidget *radio,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);
GSList*             ogmrip_preferences_all_dirs         (const gchar *dir);
GSList*             ogmrip_preferences_all_entries      (const gchar *dir);
gboolean            ogmrip_preferences_dir_exists       (const gchar *dir);
void                ogmrip_preferences_recursive_unset  (const gchar *key);
void                ogmrip_preferences_set_default_dir  (const gchar *dir);
void                ogmrip_preferences_unset            (const gchar *key);

Description

Details

OGMRipPrefGetFunc ()

GConfValue*         (*OGMRipPrefGetFunc)                (GtkWidget *widget);

widget :

Returns :


OGMRipPrefSetFunc ()

gboolean            (*OGMRipPrefSetFunc)                (GtkWidget *widget,
                                                         GConfValue *value);

widget :

value :

Returns :


ogmrip_preferences_init ()

void                ogmrip_preferences_init             (const gchar *dir);

Initialize the preferences system and add add a directory to the list of directories to watch.

dir :

directory to add to the list

ogmrip_preferences_uninit ()

void                ogmrip_preferences_uninit           (void);

Uninitialize the preferences system.


ogmrip_preferences_get ()

GConfValue*         ogmrip_preferences_get              (const gchar *key);

Gets the value of a configuration key.

key :

key to get

Returns :

newly-allocated GConfValue, or NULL if unset and no default exists

ogmrip_preferences_set ()

void                ogmrip_preferences_set              (const gchar *key,
                                                         GConfValue *value);

Sets the value of a configuration key.

key :

key to set

value :

new value

ogmrip_preferences_get_bool ()

gboolean            ogmrip_preferences_get_bool         (const gchar *key,
                                                         gboolean def);

Requests the boolean value stored at key.

key :

key to get

def :

default value

Returns :

the value of key, or def if no value was stored

ogmrip_preferences_set_bool ()

void                ogmrip_preferences_set_bool         (const gchar *key,
                                                         gboolean value);

Change the value of key to val. Automatically creates the key if it didn't exist before.

key :

key you want to set the value of

value :

new value of key

ogmrip_preferences_get_double ()

gdouble             ogmrip_preferences_get_double       (const gchar *key,
                                                         gdouble def);

Requests the double value stored at key.

key :

key to get

def :

default value

Returns :

the value of key, or def if no value was stored

ogmrip_preferences_set_double ()

void                ogmrip_preferences_set_double       (const gchar *key,
                                                         gdouble value);

Change the value of key to val. Automatically creates the key if it didn't exist before.

key :

key you want to set the value of

value :

new value of key

ogmrip_preferences_get_int ()

gint                ogmrip_preferences_get_int          (const gchar *key,
                                                         gint def);

Requests the integer value stored at key.

key :

key to get

def :

default value

Returns :

the value of key, or def if no value was stored

ogmrip_preferences_set_int ()

void                ogmrip_preferences_set_int          (const gchar *key,
                                                         gint value);

Change the value of key to val. Automatically creates the key if it didn't exist before.

key :

key you want to set the value of

value :

new value of key

ogmrip_preferences_get_string ()

gchar*              ogmrip_preferences_get_string       (const gchar *key,
                                                         const gchar *def);

Requests the string value stored at key.

key :

key to get

def :

default value

Returns :

the value of key, or def if no value was stored

ogmrip_preferences_set_string ()

void                ogmrip_preferences_set_string       (const gchar *key,
                                                         const gchar *value);

Change the value of key to val. Automatically creates the key if it didn't exist before.

key :

key you want to set the value of

value :

new value of key

ogmrip_preferences_get_filename ()

gchar*              ogmrip_preferences_get_filename     (const gchar *key,
                                                         const gchar *def);

Requests the filename value stored at key.

key :

key to get

def :

default value

Returns :

the value of key, or def if no value was stored

ogmrip_preferences_set_filename ()

void                ogmrip_preferences_set_filename     (const gchar *key,
                                                         const gchar *value);

Change the value of key to val. Automatically creates the key if it didn't exist before.

key :

key you want to set the value of

value :

new value of key

ogmrip_preferences_add_notify ()

guint               ogmrip_preferences_add_notify       (const gchar *key,
                                                         GFunc func,
                                                         gpointer data);

Request notification of changes to namespace_section. This includes the key namespace_section itself, and any keys below it.

key :

where to listen for changes

func :

function to call when changes occur

data :

user data to pass to func

Returns :

a connection ID for removing the notification

ogmrip_preferences_add_notify_while_alive ()

guint               ogmrip_preferences_add_notify_while_alive
                                                        (const gchar *key,
                                                         GFunc func,
                                                         gpointer data,
                                                         gpointer widget);

Request notification of changes to namespace_section. This includes the key namespace_section itself, and any keys below it. The notification is removed when widget is destroyed.

key :

where to listen for changes

func :

function to call when changes occur

data :

user data to pass to func

widget :

the widget whose destruction signals the removal of this notification

Returns :

a connection ID for removing the notification

ogmrip_preferences_connect_toggle ()

void                ogmrip_preferences_connect_toggle   (GtkWidget *toggle,
                                                         const gchar *key);

Connects toggle to key. key must be associated to a boolean value. See ogmrip_preferences_connect_toggle_custom().

toggle :

A GtkToggleButton

key :

The associated key

ogmrip_preferences_connect_toggle_custom ()

void                ogmrip_preferences_connect_toggle_custom
                                                        (GtkWidget *toggle,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);

Connects toggle to key. When the state of toggle changes, get_func is called and returns the new value for key. Accordingly, when key changes, set_func is called and sets the new state of toggle.

toggle :

A GtkToggleButton

key :

The associated key

get_func :

The function to get the state of toggle

set_func :

The function to set the state of toggle

ogmrip_preferences_connect_combo ()

void                ogmrip_preferences_connect_combo    (GtkWidget *combo,
                                                         const gchar *key);

Connects combo to key. key must be associated to an integer value. See ogmrip_preferences_connect_combo_custom().

combo :

A GtkComboBox

key :

The associated key

ogmrip_preferences_connect_combo_custom ()

void                ogmrip_preferences_connect_combo_custom
                                                        (GtkWidget *combo,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);

Connects combo to key. When a new item in combo is selected, get_func is called and returns the new value for key. Accordingly, when key changes, set_func is called and sets the new selected item of combo.

combo :

A GtkComboBox

key :

The associated key

get_func :

The function to get the selected item of combo

set_func :

The function to set the selected item of combo

ogmrip_preferences_connect_chooser ()

void                ogmrip_preferences_connect_chooser  (GtkWidget *chooser,
                                                         const gchar *key);

Connects chooser to key. key must be associated to an integer value. See ogmrip_preferences_connect_chooser_custom().

chooser :

A GtkFileChooser

key :

The associated key

ogmrip_preferences_connect_chooser_custom ()

void                ogmrip_preferences_connect_chooser_custom
                                                        (GtkWidget *chooser,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);

Connects chooser to key. When a new file is selected, get_func is called and returns the new value for key. Accordingly, when key changes, set_func is called and selects the file.

chooser :

A GtkChooserFile

key :

The associated key

get_func :

The function to get the selected file of chooser

set_func :

The function to set the selected file of chooser

ogmrip_preferences_connect_spin ()

void                ogmrip_preferences_connect_spin     (GtkWidget *spin,
                                                         const gchar *key);

Connects spin to key. key must be associated to an integer value. See ogmrip_preferences_connect_spin_custom().

spin :

A GtkSpinButton

key :

The associated key

ogmrip_preferences_connect_spin_custom ()

void                ogmrip_preferences_connect_spin_custom
                                                        (GtkWidget *spin,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);

Connects spin to key. When a new value in spin is selected, get_func is called and returns the new value for key. Accordingly, when key changes, set_func is called and sets the new value of spin.

spin :

A GtkSpinButton

key :

The associated key

get_func :

The function to get the value of spin

set_func :

The function to set the value of spin

ogmrip_preferences_connect_radio ()

void                ogmrip_preferences_connect_radio    (GtkWidget *radio,
                                                         const gchar *key);

Connects radio to key. key must be associated to an integer value. See ogmrip_preferences_connect_radio_custom().

radio :

A GtkRadioButton

key :

The associated key

ogmrip_preferences_connect_radio_custom ()

void                ogmrip_preferences_connect_radio_custom
                                                        (GtkWidget *radio,
                                                         const gchar *key,
                                                         OGMRipPrefGetFunc get_func,
                                                         OGMRipPrefSetFunc set_func);

Connects radio to key. When radio is selected, get_func is called and returns the new value for key. Accordingly, when key changes, set_func is called and selects radio if necessary.

radio :

A GtkRadioButton

key :

The associated key

get_func :

The function to get the selected radio

set_func :

The function to set the selected radio

ogmrip_preferences_all_dirs ()

GSList*             ogmrip_preferences_all_dirs         (const gchar *dir);

Lists the subdirectories in dir. The returned list contains allocated strings. Each string is the absolute path of a subdirectory. You should g_free() each string in the list, then g_slist_free() the list itself.

dir :

directory to get subdirectories from

Returns :

List of allocated subdirectory names

ogmrip_preferences_all_entries ()

GSList*             ogmrip_preferences_all_entries      (const gchar *dir);

Lists the key-value pairs in dir. Does not list subdirectories; for that use ogmrip_preferences_all_dirs(). The returned list contains GConfEntry objects. A GConfEntry contains an absolute key and a value. The list is not recursive, it contains only the immediate children of dir. To free the returned list, gconf_entry_free() each list element, then g_slist_free() the list itself.

dir :

directory to get entries from

Returns :

List of GConfEntry

ogmrip_preferences_dir_exists ()

gboolean            ogmrip_preferences_dir_exists       (const gchar *dir);

Queries whether the directory dir exists in the database.

dir :

directory to check for

Returns :

TRUE or FALSE

ogmrip_preferences_recursive_unset ()

void                ogmrip_preferences_recursive_unset  (const gchar *key);

Unsets all keys below key, including key itself. If any unset fails, continues on to unset as much as it can.

key :

a key or directory name to be unset

ogmrip_preferences_set_default_dir ()

void                ogmrip_preferences_set_default_dir  (const gchar *dir);

Sets the default preferences directory.

dir :

A preferences directory

ogmrip_preferences_unset ()

void                ogmrip_preferences_unset            (const gchar *key);

Unsets the value of key; if key is already unset, has no effect.

key :

key to unset