add unlabelled items
authorgc <gc>
Fri, 24 Aug 2007 18:43:02 +0000 (18:43 +0000)
committergc <gc>
Fri, 24 Aug 2007 18:43:02 +0000 (18:43 +0000)
bin/booh-classifier

index 130c702b25cbf1ed4e4dd49c8e0a837781d6cd29..cfa5fbfa1c563c947f2e47ceb94a3cdeeb629fc1 100644 (file)
@@ -884,6 +884,7 @@ def real_show_entry(entry, tooltips, grab_focus)
         if grab_focus
             entry.button.grab_focus
         end
+        update_visibility(entry)
     })
 end
 
@@ -1232,6 +1233,10 @@ def execute
 end
 
 def update_visibility(entry)
+    if ! entry.button
+        #- not yet loaded
+        return
+    end
     if entry.labeled
         if entry.labeled.button.active?
             entry.button.show
@@ -1244,6 +1249,12 @@ def update_visibility(entry)
         else
             entry.button.hide
         end
+    else
+        if $unlabelled_button.active?
+            entry.button.show
+        else
+            entry.button.hide
+        end
     end
 end
         
@@ -1252,16 +1263,15 @@ def update_all_visibilities
         update_visibility(entry)
     }
     shown = $mainview.get_shown_entry
-    while ! shown.button.visible? && shown != $allentries.last
-        $mainview.show_next_entry(shown)
-        shown = $mainview.get_shown_entry
+    while shown.button && ! shown.button.visible? && shown != $allentries.last
+        shown = $allentries[$allentries.index(shown) + 1]
     end 
-    if shown && shown.button.visible?
+    if shown.button && shown.button.visible?
         shown.button.grab_focus
         return
     end
     $allentries.reverse.each { |entry|
-        if entry.button.visible?
+        if entry.button && entry.button.visible?
             entry.button.grab_focus
             return
         end
@@ -1421,6 +1431,10 @@ def reset_labels
     end
     $labels_vbox.pack_start(Gtk::Label.new(utf8(_("Labels list:"))).set_justify(Gtk::Justification::CENTER), false, false).show_all
     $labels = {}
+    lbl = Gtk::Label.new.set_markup(utf8(_("<i>unlabelled</i>")))
+    $labels_vbox.pack_start($unlabelled_button = Gtk::CheckButton.new.add(Gtk::EventBox.new.add(lbl)).show_all)
+    $unlabelled_button.active = true
+    $unlabelled_button.signal_connect('toggled') { update_all_visibilities }
     lbl = Gtk::Label.new.set_markup(utf8(_("<i>to remove</i>")))
     $labels_vbox.pack_start($toremove_button = Gtk::CheckButton.new.add(evt = Gtk::EventBox.new.add(lbl)).show_all)
     $toremove_button.active = true