add ability to hide images/videos marked for deletion
authorgc <gc>
Sun, 5 Aug 2007 18:04:53 +0000 (18:04 +0000)
committergc <gc>
Sun, 5 Aug 2007 18:04:53 +0000 (18:04 +0000)
bin/booh-classifier

index 6b61a95732586707cce0e89f4c16be00afc5d952..733b255dada92ee5bb564733a37006025b418170 100644 (file)
@@ -723,18 +723,27 @@ def thumbnail_keypressed(entry, event)
             entry.labeled = nil
             entry.show_bg
             $mainview.show_next_entry(entry)
+            if $hide_todel.active?
+                entry.button.hide
+            end
 
             save_undo(_("set for removal"),
                       proc {
                           entry.removed = removed_before
                           entry.labeled = label_before
                           entry.show_bg
-                          $mainview.set_shown_entry(entry)
+                          if ! $hide_todel.active? && ! entry.removed
+                              entry.button.show
+                              $mainview.set_shown_entry(entry)
+                          end
                           proc {
                               entry.removed = true
                               entry.labeled = nil
                               entry.show_bg
                               $mainview.set_shown_entry(entry)
+                              if $hide_todel.active?
+                                  entry.button.hide
+                              end
                           }
                       })
 
@@ -954,6 +963,7 @@ def open_dir(path)
     $workingdir = path
     show_entries
     $execute.sensitive = true
+    $hide_todel.sensitive = true
     return nil
 end
 
@@ -1202,6 +1212,19 @@ def execute
     end
 end
 
+def hide_todel
+    active = $hide_todel.active?
+    $allentries.each { |entry|
+        if entry.removed
+            if active
+                entry.button.hide
+            else
+                entry.button.show
+            end
+        end
+    }
+end
+
 def preferences
     dialog = Gtk::Dialog.new(utf8(_("Edit preferences")),
                              $main_window,
@@ -1320,15 +1343,18 @@ def create_menubar
 
     editmenu = Gtk::MenuItem.new(utf8(_("_Edit")))
     editsubmenu = Gtk::Menu.new
-    editsubmenu.append($undo_mb = Gtk::ImageMenuItem.new(Gtk::Stock::UNDO).set_sensitive(false))
-    editsubmenu.append($redo_mb = Gtk::ImageMenuItem.new(Gtk::Stock::REDO).set_sensitive(false))
-    editsubmenu.append(           Gtk::SeparatorMenuItem.new)
-    editsubmenu.append(prefs    = Gtk::ImageMenuItem.new(Gtk::Stock::PREFERENCES))
+    editsubmenu.append($undo_mb    = Gtk::ImageMenuItem.new(Gtk::Stock::UNDO).set_sensitive(false))
+    editsubmenu.append($redo_mb    = Gtk::ImageMenuItem.new(Gtk::Stock::REDO).set_sensitive(false))
+    editsubmenu.append(              Gtk::SeparatorMenuItem.new)
+    editsubmenu.append($hide_todel = Gtk::CheckMenuItem.new(utf8(_("Hide images/videos marked for deletion"))).set_sensitive(false))
+    editsubmenu.append(              Gtk::SeparatorMenuItem.new)
+    editsubmenu.append(prefs       = Gtk::ImageMenuItem.new(Gtk::Stock::PREFERENCES))
     editmenu.set_submenu(editsubmenu)
     mb.append(editmenu)
 
     $undo_mb.signal_connect('activate') { perform_undo }
     $redo_mb.signal_connect('activate') { perform_redo }
+    $hide_todel.signal_connect('activate') { hide_todel }
     prefs.signal_connect('activate') { preferences }
     
     helpmenu = Gtk::MenuItem.new(utf8(_("_Help")))