Merge pull request #577 from DanielVenturini/undo_mark_delete

Undo marked to delete
This commit is contained in:
Tony George 2020-11-16 18:08:41 +05:30 committed by GitHub
commit 04ee126ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -564,9 +564,11 @@ public class Snapshot : GLib.Object{
if (!file_exists(delete_trigger_file)){
file_write(delete_trigger_file, "");
marked_for_deletion = true;
} else {
file_delete(delete_trigger_file);
marked_for_deletion = false;
}
marked_for_deletion = true;
}
public void parse_log_file(){

View File

@ -616,6 +616,7 @@ class MainWindow : Gtk.Window{
var store = (Gtk.ListStore) snapshot_list_box.treeview.model;
bool iterExists = store.get_iter_first (out iter);
bool marked = false;
while (iterExists && is_success) {
@ -625,14 +626,19 @@ class MainWindow : Gtk.Window{
store.get (iter, 0, out bak);
// mark for deletion
bak.mark_for_deletion();
// have any snapshots been marked?
marked = marked || bak.marked_for_deletion;
}
iterExists = store.iter_next (ref iter);
}
App.repo.load_snapshots();
gtk_messagebox(_("Marked for deletion"),
_("Snapshots will be removed during the next scheduled run"),
string title = (marked ? "Marked " : "Unchecked ") + "for deletion";
string message = (marked ? "Snapshots will " : "Snapshots will not ") + "be removed during the next scheduled run";
gtk_messagebox(_(title),
_(message),
this, false);
snapshot_list_box.refresh();

View File

@ -326,7 +326,7 @@ class SnapshotListBox : Gtk.Box{
mi_remove = item;
// mi_mark
item = new ImageMenuItem.with_label(_("Mark for Deletion"));
item = new ImageMenuItem.with_label(_("Mark/Uncheck for Deletion"));
item.image = IconManager.lookup_image("edit-delete", 16);
item.activate.connect(()=> { mark_selected(); });
menu_snapshots.append(item);