summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-12-08 23:27:45 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-12-08 23:27:45 (GMT)
commit70243bca0f6b77c6861a98a014f68f74d7a415fd (patch)
treecf53aba857a32aa5cbf91d192d817f36d6fb0405 /src/glibext
parentda97f9c3b608a238a5862bd67992f65866e1df4f (diff)
Fixed registered signals for ephemeral panels.
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/configuration.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/glibext/configuration.c b/src/glibext/configuration.c
index c19f7ef..7fd9a98 100644
--- a/src/glibext/configuration.c
+++ b/src/glibext/configuration.c
@@ -166,6 +166,10 @@ struct _GGenConfigClass
{
GObjectClass parent; /* A laisser en premier */
+ /* Signaux */
+
+ void (* modified) (GGenConfig *, GCfgParam *);
+
};
@@ -181,6 +185,9 @@ static void g_generic_config_dispose(GGenConfig *);
/* Procède à la libération totale de la mémoire. */
static void g_generic_config_finalize(GGenConfig *);
+/* Réagit à un changement de valeur pour un paramètre. */
+static void on_config_param_modified(GCfgParam *, GGenConfig *);
+
/* ---------------------------------------------------------------------------------- */
@@ -1183,6 +1190,13 @@ static void g_generic_config_class_init(GGenConfigClass *klass)
object->dispose = (GObjectFinalizeFunc/* ! */)g_generic_config_dispose;
object->finalize = (GObjectFinalizeFunc)g_generic_config_finalize;
+ g_signal_new("modified",
+ G_TYPE_GEN_CONFIG,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(GGenConfigClass, modified),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_OBJECT);
}
@@ -1546,6 +1560,8 @@ GCfgParam *_g_generic_config_add_param(GGenConfig *config, GCfgParam *param, boo
config->params = g_list_append(config->params, param);
+ g_signal_connect(param, "modified", G_CALLBACK(on_config_param_modified), config);
+
exit:
if (lock)
@@ -1558,6 +1574,26 @@ GCfgParam *_g_generic_config_add_param(GGenConfig *config, GCfgParam *param, boo
/******************************************************************************
* *
+* Paramètres : param = instance dont le contenu a évolué. *
+* config = configuration globalement mise à jour. *
+* *
+* Description : Réagit à un changement de valeur pour un paramètre. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_config_param_modified(GCfgParam *param, GGenConfig *config)
+{
+ g_signal_emit_by_name(config, "modified", param);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : config = configuration à mettre à jour. *
* path = chemin d'accès au paramètre visé. *
* *
@@ -1577,9 +1613,13 @@ void g_generic_config_delete_param(GGenConfig *config, const char *path)
old = _g_generic_config_search(config, path, false);
+ g_signal_handlers_disconnect_by_func(old, G_CALLBACK(on_config_param_modified), config);
+
if (old != NULL)
config->params = g_list_remove(config->params, old);
+ g_object_unref(G_OBJECT(old));
+
g_generic_config_wunlock(config);
}