gnome-config

Name

gnome-config -- Simple access to configuration values (50% done)

Synopsis


#include gnome.h


#define     gnome_config_get_string_with_default(path,def)
#define     gnome_config_get_translated_string_with_default(path,def)
#define     gnome_config_get_int_with_default(path,def)
#define     gnome_config_get_float_with_default(path,def)
#define     gnome_config_get_bool_with_default(path,def)
#define     gnome_config_get_vector_with_default(path, argcp, argvp, def)
#define     gnome_config_private_get_string_with_default(path,def)
#define     gnome_config_private_get_translated_string_with_default(path,def)
#define     gnome_config_private_get_int_with_default(path,def)
#define     gnome_config_private_get_float_with_default(path,def)
#define     gnome_config_private_get_bool_with_default(path,def)
#define     gnome_config_private_get_vector_with_default(path, argcp, argvp, def)
#define     gnome_config_get_string         (path)
#define     gnome_config_get_translated_string(path)
#define     gnome_config_get_int            (path)
#define     gnome_config_get_float          (path)
#define     gnome_config_get_bool           (path)
#define     gnome_config_get_vector         (path, argcp, argvp)
#define     gnome_config_private_get_string (path)
#define     gnome_config_private_get_translated_string(path)
#define     gnome_config_private_get_int    (path)
#define     gnome_config_private_get_float  (path)
#define     gnome_config_private_get_bool   (path)
#define     gnome_config_private_get_vector (path, argcp, argvp)
#define     gnome_config_set_string         (path,new_value)
#define     gnome_config_set_translated_string(path,value)
#define     gnome_config_set_int            (path,new_value)
#define     gnome_config_set_float          (path,new_value)
#define     gnome_config_set_bool           (path,new_value)
#define     gnome_config_set_vector         (path,argc,argv)
#define     gnome_config_private_set_string (path,new_value)
#define     gnome_config_private_set_translated_string(path,new_value)
#define     gnome_config_private_set_int    (path,new_value)
#define     gnome_config_private_set_float  (path,new_value)
#define     gnome_config_private_set_bool   (path,new_value)
#define     gnome_config_private_set_vector (path,argc,argv)
#define     gnome_config_has_section        (path)
#define     gnome_config_private_has_section(path)
#define     gnome_config_init_iterator      (path)
#define     gnome_config_private_init_iterator(path)
#define     gnome_config_init_iterator_sections(path)
#define     gnome_config_private_init_iterator_sections(path)
void*       gnome_config_iterator_next      (void *iterator_handle,
                                             char **key,
                                             char **value);
void        gnome_config_drop_all           (void);
void        gnome_config_sync               (void);
#define     gnome_config_sync_file          (path)
#define     gnome_config_private_sync_file  (path)
#define     gnome_config_drop_file          (path)
#define     gnome_config_private_drop_file  (path)
#define     gnome_config_clean_file         (path)
#define     gnome_config_private_clean_file (path)
#define     gnome_config_clean_section      (path)
#define     gnome_config_private_clean_section(path)
#define     gnome_config_clean_key          (path)
#define     gnome_config_private_clean_key  (path)
#define     gnome_config_get_real_path      (path)
#define     gnome_config_private_get_real_path(path)
void        gnome_config_push_prefix        (const char *path);
void        gnome_config_pop_prefix         (void);
void        gnome_config_make_vector        (const char *string,
                                             int *argcp,
                                             char ***argvp);
char*       gnome_config_assemble_vector    (int argc,
                                             const char *const argv[]);
void        gnome_config_set_set_handler    (void (*func) (void *),
                                             void *data);
void        gnome_config_set_sync_handler   (void (*func) (void *),
                                             void *data);

Description

gnome-config routines provide a simple way of retrieving and storing configuration values (the routines provide handling of default values to simplify the code).

Definitions.

How Config Items are Read.

GNOME has a versatile method of storing config items. When a config item is written by a program, it is written to a file under the ~/.gnome hierarchy. However, when config items are read, the process is a little more complicated. There are a number of places that are searched. If the config item is not found in one, then the next place is checked, finally falling back to the default value provided by the application. The locations are as follows:

Possible uses for this are setting system wide defaults such as proxy servers for the system (either using config-override to enforce such a policy or the config directory to suggest such a default). It is also possible to configure the application through its graphical interface, and then copy the configuration file accross to the appropriate system-wide directory. The config-override directory should be used sparingly, as it could annoy or confuse some users. Note also that some applications will not read the config items every time they are needed, so putting defaults into the config-override directory will not always completely enforce a setting.

There are two types of routines

FIXME: Finish this. Explain the different types of routines, explain the _private versions, explain the vector use, etc

Details

#define     gnome_config_get_string_with_default(path,def)

Retrieves returns the value of a configuration item as a string. The returned value should be g_free()'d when no longer needed.


#define     gnome_config_get_translated_string_with_default(path,def)

Retrieves returns the value of a configuration item as a string appropriate for the current language. The returned value should be g_free()'d when no longer needed.


#define     gnome_config_get_int_with_default(path,def)

Retrieves returns the value of a configuration item as an integer.