mark older documents as dirty when version is increased
authorgc <gc>
Sat, 30 Jul 2005 12:51:38 +0000 (12:51 +0000)
committergc <gc>
Sat, 30 Jul 2005 12:51:38 +0000 (12:51 +0000)
bin/booh
bin/booh-backend

index f224876f104883a9e6a6b07cc94694dd214f7969..ca4b0b5b56a408e95a1bf62e62836ff3178e1c23 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -1316,6 +1316,12 @@ def save_current_file_user
     $filename = save_tempfilename
 end
 
+def mark_document_as_dirty
+    $xmldoc.elements.each('//dir') { |elem|
+        elem.delete_attribute('already-generated')
+    }
+end
+
 #- ret: true => ok  false => cancel
 def ask_save_modifications(msg1, msg2, *options)
     ret = true
@@ -1350,9 +1356,7 @@ def ask_save_modifications(msg1, msg2, *options)
                 if $generated_outofline
                     begin
                         $xmldoc = REXML::Document.new File.new($orig_filename)
-                        $xmldoc.elements.each('//dir') { |elem|
-                            elem.delete_attribute('already-generated')
-                        }
+                        mark_document_as_dirty
                         ios = File.open($orig_filename, "w")
                         $xmldoc.write(ios, 0)
                         ios.close
@@ -2086,6 +2090,12 @@ def open_file(filename)
         return utf8(_("Corrupted booh file..."))
     end
 
+    if $xmldoc.root.attributes['version'] != $VERSION
+        msg 2, _("File's version %s, booh version now #{$VERSION}, marking dirty") % [ $xmldoc.root.attributes['version'], $VERSION ]
+        mark_document_as_dirty
+        $xmldoc.root.add_attribute('version', $VERSION)
+    end
+
     limit_sizes = $xmldoc.root.attributes['limit-sizes']
     optimizefor32 = !$xmldoc.root.attributes['optimize-for-32'].nil?
     nperrow = $xmldoc.root.attributes['thumbnails-per-row']
@@ -2538,9 +2548,7 @@ def properties
     dialog.destroy
 
     if ok && (save_theme != theme || save_limit_sizes != limit_sizes || save_opt432 != opt432 || save_nperrow != nperrow)
-        $xmldoc.elements.each('//dir') { |elem|
-            elem.delete_attribute('already-generated')
-        }
+        mark_document_as_dirty
         save_current_file
         call_backend("booh-backend --use-config '#{$filename}' --for-gui --verbose-level #{$verbose_level} " +
                      "--thumbnails-per-row #{save_nperrow} --theme #{theme} --sizes #{save_limit_sizes.join(',')} " +
index 6bc3e2268940f5a0002d1dbb11d5631a5b4e2eb4..a5d70e2df1b9ae205949396976257fa0865e2ce2 100755 (executable)
@@ -254,6 +254,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") %
 
     if $mode == 'merge_config' || $mode == 'use_config_changetheme'
         $xmldoc.root.add_attribute('theme', $theme)
+        $xmldoc.root.add_attribute('version', $VERSION)
         if $limit_sizes
             $xmldoc.root.add_attribute('limit-sizes', $limit_sizes)
         else