From a23cadbc6f43018297f2b32a015074f72fab1b56 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 28 Sep 2016 20:03:06 +0200 Subject: [PATCH] Filled keys columns info config and path. --- data/zak-confi-gui/ui/zak-confi-gui.ui | 2 +- src/main.c | 30 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/data/zak-confi-gui/ui/zak-confi-gui.ui b/data/zak-confi-gui/ui/zak-confi-gui.ui index f09a7db..2e37ba5 100644 --- a/data/zak-confi-gui/ui/zak-confi-gui.ui +++ b/data/zak-confi-gui/ui/zak-confi-gui.ui @@ -709,7 +709,7 @@ True False start - Parent + Path 0 diff --git a/src/main.c b/src/main.c index 97da1c2..a1ceb73 100644 --- a/src/main.c +++ b/src/main.c @@ -123,15 +123,43 @@ fill_trFolders_Keys (GNode *node, GtkTreeIter parent) GtkTreeIter child; ZakConfiKey *ck; + GtkTreePath *tpath; + + gchar *config; + gchar *path; + gchar *parent_name; + if (node == NULL) return; + tpath = gtk_tree_model_get_path (GTK_TREE_MODEL (storeFolders), &parent); + node = node->children; while (node != NULL) { ck = (ZakConfiKey *)node->data; + gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &parent, + FOLDERS_COL_CONFIG, &config, + FOLDERS_COL_PATH, &path, + FOLDERS_COL_KEY, &parent_name, + -1); + + + if (gtk_tree_path_get_depth (tpath) == 0 + || g_strcmp0 (path, "") == 0) + { + g_free (path); + path = g_strdup ("/"); + } + else + { + path = g_strdup_printf ("%s%s/", path, parent_name); + } + gtk_tree_store_append (storeFolders, &child, &parent); gtk_tree_store_set (storeFolders, &child, + FOLDERS_COL_CONFIG, config, + FOLDERS_COL_PATH, path, FOLDERS_COL_KEY, ck->key, FOLDERS_COL_DESCRIPTION, ck->description, FOLDERS_COL_VALUE, ck->value, @@ -165,6 +193,8 @@ fill_trFolders (const gchar *filter) gtk_tree_store_append (storeFolders, &iter, NULL); gtk_tree_store_set (storeFolders, &iter, + FOLDERS_COL_CONFIG, conficonfi->name, + FOLDERS_COL_PATH, "", FOLDERS_COL_KEY, conficonfi->name, FOLDERS_COL_DESCRIPTION, conficonfi->description, -1); -- 2.49.0