]> icculus.org git repositories - dana/openbox.git/blob - openbox/config.h
more build fixes
[dana/openbox.git] / openbox / config.h
1 #ifndef __config_h
2 #define __config_h
3
4 #include <glib.h>
5
6 typedef enum {
7     Config_String,
8     Config_Integer,
9     Config_Bool
10 } ConfigValueType;
11
12 typedef union {
13     char *string;
14     int integer;
15     gboolean bool;
16 } ConfigValue;
17
18 typedef struct {
19     char *name;
20     ConfigValueType type;
21     ConfigValue value;
22 } ConfigEntry;
23
24 typedef struct {
25     char *name;
26     char *descriptive_name; /* user friendly name */
27     char *long_description; /* text description of option */
28     ConfigValueType type;
29     /* if it is a string type optionally provide a list of valid strings */
30     gboolean hasList;
31     GSList *values;
32 } ConfigDefEntry;
33
34 void config_startup();
35 void config_shutdown();
36
37 /* Set a config variable's value. The variable must have already been defined
38    with a call to config_def_set */
39 gboolean config_set(char *name, ConfigValueType type, ConfigValue value);
40
41 /* Get a config variable's value. Returns FALSE if the value has not been
42    set. */
43 gboolean config_get(char *name, ConfigValueType type, ConfigValue *value);
44
45 /* Create a new config definition to add to the config system */
46 ConfigDefEntry *config_def_new(char *name, ConfigValueType type,
47                                char *descriptive_name, char *long_description);
48
49 /* Add a value to a String type config definition */
50 gboolean config_def_add_value(ConfigDefEntry *entry, char *value);
51
52 /* Sets up the definition in the config system, Don't free or touch the entry
53    after setting it with this. It is invalidated even if the function returns
54    FALSE. */
55 gboolean config_def_set(ConfigDefEntry *entry);
56
57 #endif