don't ask for actions for 'empty' labels
authorgc <gc>
Mon, 5 May 2008 18:43:32 +0000 (18:43 +0000)
committergc <gc>
Mon, 5 May 2008 18:43:32 +0000 (18:43 +0000)
bin/booh-classifier

index 26160ec..835115c 100644 (file)
@@ -1275,6 +1275,10 @@ def execute
         table.attach(Gtk::Label.new(counter.to_s).set_justify(Gtk::Justification::CENTER), 1, 2, row, row + 1, 0, 0, 5, 5)
         table.attach(examples, 2, 3, row, row + 1, Gtk::FILL, Gtk::FILL, 5, 5)
 
+        if counter == 0
+            return {}
+        end
+
         combostore = Gtk::ListStore.new(Gdk::Pixbuf, String)
         iter = combostore.append
         if normal
@@ -1368,7 +1372,7 @@ def execute
                 $labels.values.each { |label| label2entries[label] = [] }
                 $allentries.each { |entry| entry.labeled and label2entries[entry.labeled] << entry }
                 stuff.keys.each { |key|
-                    if key.is_a?(Label) && stuff[key][:combo].active <= 1
+                    if key.is_a?(Label) && stuff[key][:combo] && stuff[key][:combo].active <= 1
                         destination = stuff[key][:pathlabel].text
                         if destination[0] != ?/
                             show_popup(dialog, utf8(_("You have not selected a directory where to move/copy %s.") % key.name))
@@ -1410,7 +1414,7 @@ def execute
                         moved = 0
                         copied = 0
                         stuff.keys.each { |key|
-                            if key.is_a?(Label) && stuff[key][:combo].active <= 1
+                            if key.is_a?(Label) && stuff[key][:combo] && stuff[key][:combo].active <= 1
                                 destination = stuff[key][:pathlabel].text
                                 label2entries[key].each { |entry|
                                     if stuff[key][:combo].active == 0
@@ -1424,7 +1428,7 @@ def execute
                             end
                         }
                         removed = 0
-                        if stuff['toremove'][:combo].active == 0
+                        if stuff['toremove'][:combo] && stuff['toremove'][:combo].active == 0
                             $allentries.each { |entry|
                                 if entry.removed
                                     File.delete(entry.path)