summaryrefslogtreecommitdiff
path: root/src/glibext/configuration.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-03-12 21:31:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-03-12 21:31:35 (GMT)
commitda22d42c9644de808dfc3484352c444ee4176bee (patch)
tree67d1533baad0a80cc9f435c781c5d094243fa425 /src/glibext/configuration.h
parent491e9837f33831f94747a6063f709ba2c5d2703e (diff)
Loaded all custom parameters storing positions of panels divisions.
Diffstat (limited to 'src/glibext/configuration.h')
-rw-r--r--src/glibext/configuration.h59
1 files changed, 57 insertions, 2 deletions
diff --git a/src/glibext/configuration.h b/src/glibext/configuration.h
index 84d494f..016a382 100644
--- a/src/glibext/configuration.h
+++ b/src/glibext/configuration.h
@@ -71,7 +71,7 @@ typedef struct _GCfgParam GCfgParam;
typedef struct _GCfgParamClass GCfgParamClass;
-/* Indique le type défini par la GLib pour les configurations géénriques. */
+/* Indique le type défini par la GLib pour les configurations génériques. */
GType g_config_param_get_type(void);
/* Crée un paramètre de configuration. */
@@ -106,6 +106,32 @@ void g_config_param_get_value(GCfgParam *, ...);
+/* --------------------- PARTIES IMPREVISIBLES DE CONFIGURATION --------------------- */
+
+
+#define G_TYPE_CFG_GROUP (g_config_group_get_type())
+#define G_CFG_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_CFG_GROUP, GCfgGroup))
+#define G_IS_CFG_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_CFG_GROUP))
+#define G_CFG_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_CFG_GROUP, GCfgGroupClass))
+#define G_IS_CFG_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_CFG_GROUP))
+#define G_CFG_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_CFG_GROUP, GCfgGroupClass))
+
+
+/* Groupe de paramètres non fixés à l'avance (instance) */
+typedef struct _GCfgGroup GCfgGroup;
+
+/* Groupe de paramètres non fixés à l'avance (classe) */
+typedef struct _GCfgGroupClass GCfgGroupClass;
+
+
+/* Indique le type défini par la GLib pour les groupes de paramètres non prévisibiles. */
+GType g_config_group_get_type(void);
+
+/* Crée un groupe de paramètres de configuration. */
+GCfgGroup *g_config_group_new(const char *, ConfigParamType);
+
+
+
/* ----------------------- GESTION GENERIQUE DE CONFIGURATION ----------------------- */
@@ -150,6 +176,18 @@ bool g_generic_config_read(GGenConfig *);
/* Ecrit la configuration dans un fichier. */
bool g_generic_config_write(GGenConfig *);
+/* Ajoute la définition d'un groupe à une configuration. */
+void g_generic_config_add_group(GGenConfig *, GCfgGroup *);
+
+
+#define g_generic_config_create_group(c, p, t) \
+ ({ \
+ GCfgGroup *__group; \
+ __group = g_config_group_new(p, t); \
+ g_generic_config_add_group(c, __group); \
+ })
+
+
/* Retrouve un élément de configuration par son chemin. */
GCfgParam *_g_generic_config_search(GGenConfig *, const char *, bool);
@@ -176,9 +214,11 @@ GCfgParam *_g_generic_config_search(GGenConfig *, const char *, bool);
/* Ajoute un paramètre à une configuration. */
-GCfgParam *g_generic_config_add_param(GGenConfig *, GCfgParam *);
+GCfgParam *_g_generic_config_add_param(GGenConfig *, GCfgParam *, bool);
+#define g_generic_config_add_param(c, p) _g_generic_config_add_param(c, p, true)
+
#define g_generic_config_create_param(c, p, t, ...) \
({ \
GCfgParam *__result; \
@@ -188,6 +228,21 @@ GCfgParam *g_generic_config_add_param(GGenConfig *, GCfgParam *);
})
+#define g_generic_config_create_or_udpdate_param(c, p, t, ...) \
+ ({ \
+ GCfgParam *__param; \
+ __param = g_generic_config_search(c, p); \
+ if (__param == NULL) \
+ { \
+ __param = g_config_param_new(p, t, __VA_ARGS__); \
+ __param = g_generic_config_add_param(c, __param); \
+ } \
+ if (__param != NULL) \
+ g_config_param_set_value(__param, __VA_ARGS__); \
+ __param != NULL ? true : false; \
+ })
+
+
/* Retire un paramètre d'une configuration. */
void g_generic_config_delete_param(GGenConfig *, const char *);