summaryrefslogtreecommitdiff
path: root/src/gui/panels/regedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/panels/regedit.c')
-rw-r--r--src/gui/panels/regedit.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c
index 585cc22..47bbfa9 100644
--- a/src/gui/panels/regedit.c
+++ b/src/gui/panels/regedit.c
@@ -53,6 +53,8 @@ struct _GRegeditPanel
{
GPanelItem parent; /* A laisser en premier */
+ GGenConfig *config; /* Configuration à afficher */
+
regex_t *filter; /* Filtre appliqué ou NULL */
GtkMenu *menu; /* Menu contextuel pour param. */
@@ -109,10 +111,10 @@ static char *g_regedit_panel_class_get_path(const GRegeditPanelClass *);
/* Recharge une configuration donnée à l'affichage. */
-static void reload_config_into_treeview(GRegeditPanel *, GGenConfig *);
+static void reload_config_into_treeview(GRegeditPanel *);
/* Actualise l'affichage des données d'un paramètre modifié. */
-static void on_config_param_modified(GCfgParam *, GRegeditPanel *);
+static void on_configuration_param_modified(GGenConfig *, GCfgParam *, GRegeditPanel *);
/* Actualise la valeur affichée d'un paramètre de configuration. */
static void update_config_param_value(GtkListStore *, GtkTreeIter *);
@@ -233,6 +235,9 @@ static void g_regedit_panel_init(GRegeditPanel *panel)
_("Configuration parameters"),
PANEL_REGEDIT_ID));
+ panel->config = get_main_configuration();
+ g_object_ref(G_OBJECT(panel->config));
+
/* Représentation graphique */
builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget));
@@ -279,7 +284,9 @@ static void g_regedit_panel_init(GRegeditPanel *panel)
/* Actualisation du contenu du panneau */
- reload_config_into_treeview(panel, get_main_configuration());
+ reload_config_into_treeview(panel);
+
+ g_signal_connect(panel->config, "modified", G_CALLBACK(on_configuration_param_modified), panel);
}
@@ -298,6 +305,11 @@ static void g_regedit_panel_init(GRegeditPanel *panel)
static void g_regedit_panel_dispose(GRegeditPanel *panel)
{
+ if (panel->config != NULL)
+ g_signal_handlers_disconnect_by_func(panel->config, G_CALLBACK(on_configuration_param_modified), panel);
+
+ g_clear_object(&panel->config);
+
G_OBJECT_CLASS(g_regedit_panel_parent_class)->dispose(G_OBJECT(panel));
}
@@ -405,8 +417,7 @@ GPanelItem *g_regedit_panel_new(void)
/******************************************************************************
* *
-* Paramètres : panel = panneau d'affichage de paramètres de configuration. *
-* config = configuration à présenter à l'écran. *
+* Paramètres : panel = panneau d'affichage de paramètres de configuration. *
* *
* Description : Recharge une configuration donnée à l'affichage. *
* *
@@ -416,7 +427,7 @@ GPanelItem *g_regedit_panel_new(void)
* *
******************************************************************************/
-static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config)
+static void reload_config_into_treeview(GRegeditPanel *panel)
{
GtkBuilder *builder; /* Constructeur utilisé */
GtkListStore *store; /* Modèle de gestion */
@@ -432,9 +443,9 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config
gtk_list_store_clear(store);
- g_generic_config_rlock(config);
+ g_generic_config_rlock(panel->config);
- params = g_generic_config_list_params(config);
+ params = g_generic_config_list_params(panel->config);
for (p = g_list_first(params); p != NULL; p = g_list_next(p))
{
@@ -480,11 +491,9 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config
update_config_param_value(store, &iter);
- g_signal_connect(param, "modified", G_CALLBACK(on_config_param_modified), panel);
-
}
- g_generic_config_runlock(config);
+ g_generic_config_runlock(panel->config);
g_object_unref(G_OBJECT(builder));
@@ -493,8 +502,9 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config
/******************************************************************************
* *
-* Paramètres : param = instance dont le contenu a évolué. *
-* panel = panneau d'affichage de paramètres à mettre à jour. *
+* Paramètres : config = configuration changée dans son ensemble. *
+* param = instance dont le contenu a évolué. *
+* panel = panneau d'affichage de paramètres à mettre à jour. *
* *
* Description : Actualise l'affichage des données d'un paramètre modifié. *
* *
@@ -504,7 +514,7 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config
* *
******************************************************************************/
-static void on_config_param_modified(GCfgParam *param, GRegeditPanel *panel)
+static void on_configuration_param_modified(GGenConfig *config, GCfgParam *param, GRegeditPanel *panel)
{
GtkBuilder *builder; /* Constructeur utilisé */
GtkTreeView *treeview; /* Affichage de la liste */
@@ -876,7 +886,7 @@ static void on_param_search_changed(GtkSearchEntry *entry, GRegeditPanel *panel)
gtk_style_context_remove_class(context, "filter-error");
- reload_config_into_treeview(panel, get_main_configuration());
+ reload_config_into_treeview(panel);
}