![]() |
![]() |
![]() |
OGMRip Gtk+ Reference Manual | ![]() |
---|---|---|---|---|
#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);
gboolean (*OGMRipPrefSetFunc) (GtkWidget *widget, GConfValue *value);
|
|
|
|
Returns : |
void ogmrip_preferences_init (const gchar *dir);
Initialize the preferences system and add add a directory to the list of directories to watch.
|
directory to add to the list |
void ogmrip_preferences_uninit (void);
Uninitialize the preferences system.
GConfValue* ogmrip_preferences_get (const gchar *key);
Gets the value of a configuration key.
|
key to get |
Returns : |
newly-allocated GConfValue, or NULL if unset and no default exists |
void ogmrip_preferences_set (const gchar *key, GConfValue *value);
Sets the value of a configuration key.
|
key to set |
|
new value |
gboolean ogmrip_preferences_get_bool (const gchar *key, gboolean def);
Requests the boolean value stored at key
.
|
key to get |
|
default value |
Returns : |
the value of key , or def if no value was stored
|
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 you want to set the value of |
|
new value of key
|
gdouble ogmrip_preferences_get_double (const gchar *key, gdouble def);
Requests the double value stored at key
.
|
key to get |
|
default value |
Returns : |
the value of key , or def if no value was stored
|
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 you want to set the value of |
|
new value of key
|
gint ogmrip_preferences_get_int (const gchar *key, gint def);
Requests the integer value stored at key
.
|
key to get |
|
default value |
Returns : |
the value of key , or def if no value was stored
|
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 you want to set the value of |
|
new value of key
|
gchar* ogmrip_preferences_get_string (const gchar *key, const gchar *def);
Requests the string value stored at key
.
|
key to get |
|
default value |
Returns : |
the value of key , or def if no value was stored
|
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 you want to set the value of |
|
new value of key
|
gchar* ogmrip_preferences_get_filename (const gchar *key, const gchar *def);
Requests the filename value stored at key
.
|
key to get |
|
default value |
Returns : |
the value of key , or def if no value was stored
|
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 you want to set the value of |
|
new value of key
|
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.
|
where to listen for changes |
|
function to call when changes occur |
|
user data to pass to func
|
Returns : |
a connection ID for removing the notification |
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.
|
where to listen for changes |
|
function to call when changes occur |
|
user data to pass to func
|
|
the widget whose destruction signals the removal of this notification |
Returns : |
a connection ID for removing the notification |
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()
.
|
A GtkToggleButton |
|
The associated key |
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
.
|
A GtkToggleButton |
|
The associated key |
|
The function to get the state of toggle
|
|
The function to set the state of toggle
|
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()
.
|
A GtkComboBox |
|
The associated key |
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
.
|
A GtkComboBox |
|
The associated key |
|
The function to get the selected item of combo
|
|
The function to set the selected item of combo
|
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()
.
|
A GtkFileChooser |
|
The associated key |
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.
|
A GtkChooserFile |
|
The associated key |
|
The function to get the selected file of chooser
|
|
The function to set the selected file of chooser
|
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()
.
|
A GtkSpinButton |
|
The associated key |
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
.
|
A GtkSpinButton |
|
The associated key |
|
The function to get the value of spin
|
|
The function to set the value of spin
|
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()
.
|
A GtkRadioButton |
|
The associated key |
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.
|
A GtkRadioButton |
|
The associated key |
|
The function to get the selected radio
|
|
The function to set the selected radio
|
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.
|
directory to get subdirectories from |
Returns : |
List of allocated subdirectory names |
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.
|
directory to get entries from |
Returns : |
List of GConfEntry |
gboolean ogmrip_preferences_dir_exists (const gchar *dir);
Queries whether the directory dir
exists in the database.
|
directory to check for |
Returns : |
TRUE or FALSE |
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.
|
a key or directory name to be unset |
void ogmrip_preferences_set_default_dir (const gchar *dir);
Sets the default preferences directory.
|
A preferences directory |
void ogmrip_preferences_unset (const gchar *key);
Unsets the value of key
; if key
is already unset, has no effect.
|
key to unset |