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