aboutsummaryrefslogtreecommitdiffstats
path: root/gcfg.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcfg.h')
-rw-r--r--gcfg.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcfg.h b/gcfg.h
new file mode 100644
index 0000000..4acfb15
--- /dev/null
+++ b/gcfg.h
@@ -0,0 +1,27 @@
+#include <glib.h>
+
+#define ARRAY_SIZE(_x) (sizeof(_x)/sizeof(_x[0]))
+
+#define GCFG_GROUP_DEFAULT "default"
+#define GCFG_GROUP_CMDLINE "_cmdline_"
+#define GCFG_KEY_PROFILE "profile"
+
+/* ------------------------------------------------------------------------ */
+
+typedef struct gcfg_opt {
+ char *opt;
+ char *key;
+ bool is_bool;
+} gcfg_opt;
+
+typedef enum gcfg_bool {
+ GCFG_BOOL_UNSET = -1,
+ GCFG_BOOL_FALSE = 0,
+ GCFG_BOOL_TRUE = 1,
+} gcfg_bool;
+
+const gcfg_opt *gcfg_opt_find(const gcfg_opt *opts, int nopts,
+ char *arg);
+void gcfg_set(GKeyFile *cfg, char *key, char *value);
+char *gcfg_get(GKeyFile *cfg, const char *key);
+gcfg_bool gcfg_get_bool(GKeyFile *cfg, const char *key);