add "remove all captions" capability
authorgc <gc>
Sat, 28 May 2005 17:21:53 +0000 (17:21 +0000)
committergc <gc>
Sat, 28 May 2005 17:21:53 +0000 (17:21 +0000)
bin/booh
data/booh/images/stock-tool-eraser-16.png [new file with mode: 0644]

index eceec8079a33d5eefcfbbe04601741d90175e4a8..5dbc4bcb097fe39f35262bef64884262897c69e3 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -1230,6 +1230,28 @@ def save_changes(*forced)
     }
 end
 
+def remove_all_captions
+    $modified = true
+    texts = {}
+    $autotable.current_order.each { |path|
+        texts[File.basename(path) ] = $name2widgets[File.basename(path)][:textview].buffer.text
+        $name2widgets[File.basename(path)][:textview].buffer.text = ''
+    }
+    save_undo(_("remove all captions"),
+              Proc.new { |texts|
+                  texts.each_key { |key|
+                      $name2widgets[key][:textview].buffer.text = texts[key]
+                  }
+                  $notebook.set_page(1)
+                  Proc.new {
+                      texts.each_key { |key|
+                          $name2widgets[key][:textview].buffer.text = ''
+                      }
+                      $notebook.set_page(1)
+                  }
+              }, texts)
+end
+
 def change_dir
     $autotable.clear
     $vbox2textview = {}
@@ -1685,7 +1707,7 @@ def open_file(filename)
     if $config['last-opens'][-1] != utf8(filename)
         $config['last-opens'] << utf8(filename)
     end
-    $save.sensitive = $save_as.sensitive = $merge_current.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 = $remove_all_captions.sensitive = true
     return nil
 end
 
@@ -2238,10 +2260,16 @@ def create_menu_and_toolbar
     editsubmenu.append($undo_mb = Gtk::ImageMenuItem.new(Gtk::Stock::UNDO).set_sensitive(false))
     editsubmenu.append($redo_mb = Gtk::ImageMenuItem.new(Gtk::Stock::REDO).set_sensitive(false))
     editsubmenu.append(           Gtk::SeparatorMenuItem.new)
+    editsubmenu.append($remove_all_captions = Gtk::ImageMenuItem.new(utf8(_("Remove all captions in this sub-album"))).set_sensitive(false))
+    $remove_all_captions.image = Gtk::Image.new("#{$FPATH}/images/stock-tool-eraser-16.png")
+    tooltips.set_tip($remove_all_captions, utf8(_("Mainly useful when you don't want to type any caption, that will remove default captions made of filenames")), nil)
+    editsubmenu.append(           Gtk::SeparatorMenuItem.new)
     editsubmenu.append(prefs    = Gtk::ImageMenuItem.new(Gtk::Stock::PREFERENCES))
     editmenu.set_submenu(editsubmenu)
     mb.append(editmenu)
 
+    $remove_all_captions.signal_connect('activate') { remove_all_captions }
+
     prefs.signal_connect('activate') { preferences }
 
     helpmenu = Gtk::MenuItem.new(utf8(_("_Help")))
diff --git a/data/booh/images/stock-tool-eraser-16.png b/data/booh/images/stock-tool-eraser-16.png
new file mode 100644 (file)
index 0000000..94d7f79
Binary files /dev/null and b/data/booh/images/stock-tool-eraser-16.png differ