correctly handle completely removed subalbums
authorgc <gc>
Sun, 8 May 2005 17:52:43 +0000 (17:52 +0000)
committergc <gc>
Sun, 8 May 2005 17:52:43 +0000 (17:52 +0000)
bin/booh

index 416bf2a2f32e2f39b86d89e38b0fd3b283cffae5..f2962996ceec4e7d2b93b7dd01c380fa8cce1cf1 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -595,8 +595,6 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
             
             perform_delete.call
 
-            puts "delete performed, after is #{after}"
-
             if !after
                 if $xmldir.elements['dir']
                     $xmldir.delete_attribute('thumbnails-caption')
@@ -604,8 +602,7 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
                 else
                     $xmldir.remove
                 end
-                puts "saving changes"
-                save_changes
+                save_changes('forced')
                 populate_subalbums_treeview
             else
                 save_undo(_("delete"),
@@ -908,8 +905,8 @@ def perform_in_background(cmd, waitmsg, params)
     }
 end
 
-def save_changes
-    if !$current_path || !$undo_tb.sensitive?
+def save_changes(*forced)
+    if forced.empty? && (!$current_path || !$undo_tb.sensitive?)
         return
     end
 
@@ -943,12 +940,10 @@ def save_changes
             cpt += 1
         end
     }
-    puts "save_changes: #{$xmldir.name}:#{from_utf8($xmldir.attributes['path'])} old, #{cpt} elements"
     $autotable.current_order.each { |path|
         chld = $xmldir.add_element save_types[path], save_attributes[path]
         chld.add_attribute('caption', $name2widgets[File.basename(path)][:textview].buffer.text)
     }
-    puts "save_changes: new, #{$autotable.current_order.size} elements"
 end
 
 def change_dir