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