From 8802a479f37dde99f2709af50cf15e595e32b47e Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 13 May 2016 22:25:08 +0200 Subject: Handled positions for both sides of paned widgets. --- ChangeLog | 8 ++++++++ src/glibext/configuration.c | 2 +- src/gui/editor.c | 14 ++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8e7ef8..df700b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 16-05-13 Cyrille Bagard + * src/glibext/configuration.c: + Replace a fixed hardcoded key when loading values group. + + * src/gui/editor.c: + Handle positions for both sides of paned widgets. + +16-05-13 Cyrille Bagard + * src/format/format.c: * src/format/format.h: Fix a lot of compilation warnings. diff --git a/src/glibext/configuration.c b/src/glibext/configuration.c index a8f8af3..29d6f49 100644 --- a/src/glibext/configuration.c +++ b/src/glibext/configuration.c @@ -1020,7 +1020,7 @@ static void g_config_group_load(GCfgGroup *group, GGenConfig *config, xmlXPathCo for (i = 0; i < XPATH_OBJ_NODES_COUNT(xpathObj); i++) { - asprintf(&key, "gui.panels.positions.%s", NODE_FROM_PATH_OBJ(xpathObj, i)->name); + asprintf(&key, "%s.%s", group->root, NODE_FROM_PATH_OBJ(xpathObj, i)->name); param = g_config_param_new(key, CPT_INTEGER, -1); _g_generic_config_add_param(config, param, false); diff --git a/src/gui/editor.c b/src/gui/editor.c index f29ffe7..22c6df9 100644 --- a/src/gui/editor.c +++ b/src/gui/editor.c @@ -152,7 +152,7 @@ static void switch_panel_node_into_paned(panel_node *, bool, bool); static void attach_panel_node_to_paned(panel_node *, panel_node *, bool); /* Met à jour en cascade les chemins d'accès aux noeuds. */ -static void update_path_of_paned_nodes(panel_node *, const char *); +static void update_path_of_paned_nodes(panel_node *, const char *, const char *); /* Détermine la plus grande longueur commune entre éléments. */ static size_t compute_path_common_length(const panel_node *, const char *); @@ -641,7 +641,7 @@ static void attach_panel_node_to_paned(panel_node *parent, panel_node *node, boo { gtk_container_add(GTK_CONTAINER(_support), node->widget); - update_path_of_paned_nodes(node, ""); + update_path_of_paned_nodes(node, "", "R"); } @@ -665,7 +665,7 @@ static void attach_panel_node_to_paned(panel_node *parent, panel_node *node, boo /* Mise à jour des chemins */ - update_path_of_paned_nodes(node, parent->path); + update_path_of_paned_nodes(node, parent->path, first ? "1" : "2"); } @@ -676,6 +676,7 @@ static void attach_panel_node_to_paned(panel_node *parent, panel_node *node, boo * * * Paramètres : node = noeud dont le chemin est à mettre à jour. * * root = chemin menant au niveau précédent. * +* sub = sous-chemin vers lequel l'orientation penche. * * * * Description : Met à jour en cascade les chemins d'accès aux noeuds. * * * @@ -685,7 +686,7 @@ static void attach_panel_node_to_paned(panel_node *parent, panel_node *node, boo * * ******************************************************************************/ -static void update_path_of_paned_nodes(panel_node *node, const char *root) +static void update_path_of_paned_nodes(panel_node *node, const char *root, const char *sub) { GtkOrientation orientation; /* Orientation du support */ char *key; /* Clef d'accès à un paramètre */ @@ -699,6 +700,7 @@ static void update_path_of_paned_nodes(panel_node *node, const char *root) free(node->path); node->path = strdup(root); + node->path = stradd(node->path, sub); orientation = gtk_orientable_get_orientation(GTK_ORIENTABLE(node->paned)); @@ -719,10 +721,10 @@ static void update_path_of_paned_nodes(panel_node *node, const char *root) /* Propagation de la mise à jour */ if (node->first) - update_path_of_paned_nodes(node->first, node->path); + update_path_of_paned_nodes(node->first, node->path, "1"); if (node->second != NULL) - update_path_of_paned_nodes(node->second, node->path); + update_path_of_paned_nodes(node->second, node->path, "2"); } -- cgit v0.11.2-87-g4458