gtk_tree_view_set_model (GTK_TREE_VIEW (trFolders), GTK_TREE_MODEL (storeFolders));
+ const gchar *show_all_columns = g_getenv ("SHOW_ALL_COLUMNS");
+
+ if (show_all_columns != NULL)
+ {
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Config",
+ renderer,
+ "text", FOLDERS_COL_CONFIG,
+ NULL);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (trFolders), column);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Path",
+ renderer,
+ "text", FOLDERS_COL_PATH,
+ NULL);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (trFolders), column);
+ }
+
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Key",
renderer,
-1);
- if (gtk_tree_path_get_depth (tpath) == 0
- || g_strcmp0 (path, "") == 0)
+ if (gtk_tree_path_get_depth (tpath) == 1)
{
- g_free (path);
- path = g_strdup ("/");
+ path = g_strdup ("");
}
else
{
- path = g_strdup_printf ("%s%s/", path, parent_name);
+ path = g_strdup_printf ("%s/%s", path, parent_name);
}
gtk_tree_store_append (storeFolders, &child, &parent);
if (path != NULL)
{
ZakConfi *confi;
- ZakConfiKey *ck;
GError *error = NULL;
+
gtk_builder_add_objects_from_file (glaMain,
uifilename,
g_strsplit_set ("wKey", "|", -1),
&error);
GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaMain, "wKey"));
- GtkWidget *txtIDConfig = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtIDConfig"));
+
GtkWidget *txtConfig = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtConfig"));
- GtkWidget *txtID = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtID"));
- GtkWidget *txtIDParent = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtIDParent"));
GtkWidget *txtParent = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtParent"));
- GtkWidget *txtName = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtName"));
- GtkWidget *txtValue = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtValue"));
- GtkWidget *txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtvDescription"));
- GtkTreeIter iterConfi;
- gint id_config;
- gchar *name;
- gchar *keyPath = "";
- if (gtk_tree_path_get_depth (path) == 1)
- {
- iterConfi = iter;
- gtk_entry_set_text (GTK_ENTRY (txtIDParent), "0");
- }
- else
- {
- gtk_tree_model_get_iter (GTK_TREE_MODEL (storeFolders), &iterConfi,
- gtk_tree_path_new_from_indices (gtk_tree_path_get_indices (path)[0], -1));
+ gchar *config;
+ gchar *path;
+ gchar *parent_name;
- gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter,
- -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter,
+ FOLDERS_COL_CONFIG, &config,
+ FOLDERS_COL_PATH, &path,
+ FOLDERS_COL_KEY, &parent_name,
+ -1);
- keyPath = g_strjoin (NULL, ck->path, "/", ck->key, NULL);
- gtk_entry_set_text (GTK_ENTRY (txtIDParent), ck->path);
- gtk_entry_set_text (GTK_ENTRY (txtParent), ck->key);
+ if (g_strcmp0 (path, "") != 0)
+ {
+ path = g_strdup_printf ("%s/%s", path, parent_name);
}
- gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iterConfi,
- -1);
-
- g_object_get (G_OBJECT (confi),
- "id_config", &id_config,
- "name", &name,
- NULL);
-
- gtk_entry_set_text (GTK_ENTRY (txtIDConfig), g_strdup_printf ("%d", id_config));
- gtk_entry_set_text (GTK_ENTRY (txtConfig), name);
+ gtk_entry_set_text (GTK_ENTRY (txtConfig), config);
+ gtk_entry_set_text (GTK_ENTRY (txtParent), path);
if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_OK)
{
+ ZakConfiKey *ck;
+
GtkTextIter iter1, iter2;
GtkTreeIter parent = iter;
+ GtkWidget *txtName = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtName1"));
+ GtkWidget *txtValue = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtValue"));
+ GtkWidget *txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtvDescription1"));
+
gchar *name = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtName));
gchar *value = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtValue));
gchar *description;
gtk_text_buffer_get_bounds (buffer, &iter1, &iter2);
description = gtk_text_buffer_get_text (buffer, &iter1, &iter2, FALSE);
- ck = zak_confi_add_key (confi, keyPath, name, NULL);
- if (ck != NULL)
+ confi = zak_confi_new (g_strdup_printf ("%s;CONFI_NAME=%s", cnc_string, config));
+
+ if (confi != NULL)
{
- ck->value = value;
- ck->description = description;
- zak_confi_key_set_key (confi, ck);
+ ck = zak_confi_add_key (confi, path, name, NULL);
+ if (ck != NULL)
+ {
+ ck->value = g_strdup (value);
+ ck->description = g_strdup (description);
+ zak_confi_key_set_key (confi, ck);
+
+ gtk_tree_store_append (storeFolders, &iter, &parent);
+ gtk_tree_store_set (storeFolders, &iter,
+ FOLDERS_COL_CONFIG, config,
+ FOLDERS_COL_PATH, path,
+ FOLDERS_COL_KEY, name,
+ FOLDERS_COL_VALUE, value,
+ FOLDERS_COL_DESCRIPTION, description,
+ -1);
+ }
- gtk_tree_store_append (storeFolders, &iter, &parent);
- gtk_tree_store_set (storeFolders, &iter,
- FOLDERS_COL_KEY, name,
- FOLDERS_COL_VALUE, value,
- FOLDERS_COL_DESCRIPTION, description,
- -1);
+ g_object_unref (confi);
}
}
&error);
GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaMain, "wKey"));
- GtkWidget *txtIDConfig = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtIDConfig"));
GtkWidget *txtConfig = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtConfig"));
- GtkWidget *txtID = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtID"));
- GtkWidget *txtIDParent = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtIDParent"));
GtkWidget *txtParent = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtParent"));
- GtkWidget *txtName = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtName"));
+ GtkWidget *txtName = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtName1"));
GtkWidget *txtValue = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtValue"));
- GtkWidget *txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtvDescription"));
+ GtkWidget *txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaMain, "txtvDescription1"));
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvDescription));
ZakConfiKey *ck;
if (ck != NULL)
{
- gtk_entry_set_text (GTK_ENTRY (txtIDConfig), ck->config);
- gtk_entry_set_text (GTK_ENTRY (txtID), ck->key);
- gtk_entry_set_text (GTK_ENTRY (txtIDParent), ck->path);
gtk_entry_set_text (GTK_ENTRY (txtName), ck->key);
gtk_entry_set_text (GTK_ENTRY (txtValue), ck->value);
gtk_text_buffer_set_text (buffer, ck->description, strlen (ck->description));