GritsPrefs

GritsPrefs — Persistent preference handing

Synopsis

struct              GritsPrefs;
struct              GritsPrefsClass;
gboolean            grits_prefs_get_boolean             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);
gboolean            grits_prefs_get_boolean_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);
gdouble             grits_prefs_get_double              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);
gdouble             grits_prefs_get_double_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);
gint                grits_prefs_get_integer             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);
gint                grits_prefs_get_integer_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);
gchar *             grits_prefs_get_string              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);
gchar *             grits_prefs_get_string_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);
GritsPrefs *        grits_prefs_new                     (const gchar *config,
                                                         const gchar *defaults);
void                grits_prefs_set_boolean             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         gboolean value);
void                grits_prefs_set_boolean_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gboolean value);
void                grits_prefs_set_double              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         gdouble value);
void                grits_prefs_set_double_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gdouble value);
void                grits_prefs_set_integer             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         gint value);
void                grits_prefs_set_integer_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gint value);
void                grits_prefs_set_string              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         const gchar *string);
void                grits_prefs_set_string_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         const gchar *string);

Object Hierarchy

  GObject
   +----GritsPrefs

Signals

  "pref-changed"                                   : Run Last

Description

GritsPrefs is used to store and access preferences in grits. It is mostly a wrapper around a GKeyFile. Preferences can be stored for the application using grits, but may also be stored by grits itself. An example of this are whether grits is in online or offline mode. Many GritsPlugins also store preferences.

There are two variants of preference functions. The normal variant takes group and a key separated by a "/" as they key to the preference. The "_v" variant takes the group and the key as separate parameters.

Details

struct GritsPrefs

struct GritsPrefs;


struct GritsPrefsClass

struct GritsPrefsClass {
	GObjectClass parent_class;
	
	/* class members */
};


grits_prefs_get_boolean ()

gboolean            grits_prefs_get_boolean             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_get_boolean_v ()

gboolean            grits_prefs_get_boolean_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_get_double ()

gdouble             grits_prefs_get_double              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_get_double_v ()

gdouble             grits_prefs_get_double_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_get_integer ()

gint                grits_prefs_get_integer             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_get_integer_v ()

gint                grits_prefs_get_integer_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_get_string ()

gchar *             grits_prefs_get_string              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_get_string_v ()

gchar *             grits_prefs_get_string_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         GError **error);


grits_prefs_new ()

GritsPrefs *        grits_prefs_new                     (const gchar *config,
                                                         const gchar *defaults);

Create a new preference object for the given config. If the config does not exist the defaults file is loaded.

config :

the path to the config file

defaults :

the path to the default config file

Returns :

the new GritsPrefs

grits_prefs_set_boolean ()

void                grits_prefs_set_boolean             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         gboolean value);


grits_prefs_set_boolean_v ()

void                grits_prefs_set_boolean_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gboolean value);


grits_prefs_set_double ()

void                grits_prefs_set_double              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         gdouble value);


grits_prefs_set_double_v ()

void                grits_prefs_set_double_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gdouble value);


grits_prefs_set_integer ()

void                grits_prefs_set_integer             (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         gint value);


grits_prefs_set_integer_v ()

void                grits_prefs_set_integer_v           (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gint value);


grits_prefs_set_string ()

void                grits_prefs_set_string              (GritsPrefs *prefs,
                                                         const gchar *key,
                                                         const gchar *string);


grits_prefs_set_string_v ()

void                grits_prefs_set_string_v            (GritsPrefs *prefs,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         const gchar *string);

Signal Details

The "pref-changed" signal

void                user_function                      (GritsPrefs *prefs,
                                                        gchar      *key,
                                                        guint       type,
                                                        gpointer    value,
                                                        gpointer    user_data)      : Run Last

The ::pref-changed signal is emitted each time a preference is changed.

prefs :

the preference store.

key :

the key to the preference.

type :

the type of the preference that changed.

value :

a pointer to the value of the preference.

user_data :

user data set when the signal handler was connected.