]> saetta.ns0.it Git - zakconfi/gui/commitdiff
Deleting keys.
authorAndrea Zagli <azagli@libero.it>
Wed, 28 Sep 2016 20:19:10 +0000 (22:19 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 1 Oct 2016 08:23:54 +0000 (10:23 +0200)
src/main.c

index 1a75d96341835f71fb007cfd47ba9a42af7e3b76..a4fba8c43a1e4e9a4b45c23d24890c1743da2149 100644 (file)
@@ -1048,25 +1048,25 @@ on_mnuKeysDelete_activate (GtkMenuItem *menuitem,
                                                                                  GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                                                  GTK_MESSAGE_QUESTION,
                                                                                  GTK_BUTTONS_YES_NO,
-                                                                                 "Are you sure you want to delete the selected key from database?");
+                                                                                 "Are you sure you want to delete the selected key?");
                                        if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_YES)
                                                {
                                                        ZakConfi *confi;
 
-                                                       GtkTreeIter iterConfig;
-                                                       gtk_tree_model_get_iter (GTK_TREE_MODEL (storeFolders), &iterConfig,
-                                                                                gtk_tree_path_new_from_indices (gtk_tree_path_get_indices (path)[0], -1));
+                                                       ZakConfiKey *ck;
 
-                                                       gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iterConfig,
-                                                                           -1);
+                                                       ck = g_new0 (ZakConfiKey, 1);
 
-                                                       if (ZAK_IS_CONFI (confi))
-                                                               {
-                                                                       ZakConfiKey *ck;
+                                                       gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter,
+                                                                                               FOLDERS_COL_CONFIG, &ck->config,
+                                                                                               FOLDERS_COL_PATH, &ck->path,
+                                                                                               FOLDERS_COL_KEY, &ck->key,
+                                                                                               -1);
 
-                                                                       gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter,
-                                                                                           -1);
+                                                       confi = zak_confi_new (g_strdup_printf ("%s;CONFI_NAME=%s", cnc_string, ck->config));
 
+                                                       if (confi != NULL)
+                                                               {
                                                                        if (zak_confi_remove_path (confi, g_strconcat (ck->path, "/", ck->key, NULL)))
                                                                                {
                                                                                        gtk_tree_store_remove (storeFolders, &iter);