let merge new/removed images/videos only in one specified directory (in current direc...
[booh] / bin / booh
index d42b71b5197abc37ddfed247881731ceaaefd621..de57cba5bef91fcdffc4a6c0562be4827d598971 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -1510,7 +1510,7 @@ def open_file(filename)
     if $config['last-opens'][-1] != utf8(filename)
         $config['last-opens'] << utf8(filename)
     end
-    $save.sensitive = $save_as.sensitive = $merge.sensitive = $merge_subalbums.sensitive = $generate.sensitive = $properties.sensitive = true
+    $save.sensitive = $save_as.sensitive = $merge_current.sensitive = $merge.sensitive = $merge_subalbums.sensitive = $generate.sensitive = $properties.sensitive = true
     return nil
 end
 
@@ -1878,6 +1878,20 @@ def properties
     end
 end
 
+def merge_current
+    save_current_file
+
+    sel = $albums_tv.selection.selected_rows
+
+    perform_in_background("booh-backend --merge-config-onedir '#{$filename}' --dir '#{from_utf8($current_path)}' --for-gui " +
+                              "--verbose-level #{$verbose_level} #{additional_booh_options}",
+                          utf8(_("Please wait while scanning source directory...")),
+                          { :closure_after => proc {
+                                  open_file($filename)
+                                  $albums_tv.selection.select_path(sel[0])
+                              } })
+end
+
 def merge
     save_current_file
 
@@ -1985,12 +1999,16 @@ def create_menu_and_toolbar
     filesubmenu.append($save_as  = Gtk::ImageMenuItem.new(Gtk::Stock::SAVE_AS).set_sensitive(false))
     filesubmenu.append(            Gtk::SeparatorMenuItem.new)
     tooltips = Gtk::Tooltips.new
-    filesubmenu.append($merge_subalbums = Gtk::ImageMenuItem.new(utf8(_("Merge new subalbums"))).set_sensitive(false))
+    filesubmenu.append($merge_current = Gtk::ImageMenuItem.new(utf8(_("Merge new/removed images/videos in current subalbum"))).set_sensitive(false))
+    $merge_current.image = Gtk::Image.new("#{$FPATH}/images/stock-reset-16.png")
+    tooltips.set_tip($merge_current, utf8(_("Take into account new/removed images/videos in currently viewed subalbum")), nil)
+    filesubmenu.append($merge_subalbums = Gtk::ImageMenuItem.new(utf8(_("Scan source directory to merge new subalbums"))).set_sensitive(false))
     $merge_subalbums.image = Gtk::Image.new("#{$FPATH}/images/stock-reset-16.png")
-    tooltips.set_tip($merge_subalbums, utf8(_("Take into account new/removed subalbums (subdirectories) in the source directory")), nil)
-    filesubmenu.append($merge    = Gtk::ImageMenuItem.new(utf8(_("Merge new subalbums and new/removed images/videos"))).set_sensitive(false))
+    tooltips.set_tip($merge_subalbums, utf8(_("Take into account new/removed subalbums (subdirectories) in the source directory (but don't touch existing subalbums)")), nil)
+    filesubmenu.append($merge    = Gtk::ImageMenuItem.new(utf8(_("Scan source directory to merge new subalbums and new/removed images/videos"))).set_sensitive(false))
     $merge.image = Gtk::Image.new("#{$FPATH}/images/stock-reset-16.png")
-    tooltips.set_tip($merge, utf8(_("Take into account new/removed subalbums (subdirectories) and new/removed images/videos in existing subalbums in the source directory")), nil)
+    tooltips.set_tip($merge, utf8(_("Take into account new/removed subalbums (subdirectories) and new/removed images/videos in existing subalbums")), nil)
+    filesubmenu.append(            Gtk::SeparatorMenuItem.new)
     filesubmenu.append($generate = Gtk::ImageMenuItem.new(utf8(_("Generate web-album"))).set_sensitive(false))
     $generate.image = Gtk::Image.new("#{$FPATH}/images/stock-web-16.png")
     tooltips.set_tip($generate, utf8(_("(Re)generate web-album from latest changes into the destination directory")), nil)
@@ -2006,6 +2024,7 @@ def create_menu_and_toolbar
     open.signal_connect('activate') { open_file_popup }
     $save.signal_connect('activate') { save_current_file }
     $save_as.signal_connect('activate') { save_as_do }
+    $merge_current.signal_connect('activate') { merge_current }
     $merge.signal_connect('activate') { merge }
     $merge_subalbums.signal_connect('activate') { merge_subalbums }
     $generate.signal_connect('activate') {