add refresh feature suggested by coni
authorgc <gc>
Sun, 29 Jan 2006 17:13:47 +0000 (17:13 +0000)
committergc <gc>
Sun, 29 Jan 2006 17:13:47 +0000 (17:13 +0000)
bin/booh

index cd6f1b4e46191cc6c1038707a4de50b87589e04a..5e893308216912a5f0e5e269369944e5e7a76beb 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -871,8 +871,14 @@ def popup_thumbnail_menu(event, optionals, fullpath, type, xmldir, attributes_pr
             end
         end
         menu.append(               Gtk::SeparatorMenuItem.new)
             end
         end
         menu.append(               Gtk::SeparatorMenuItem.new)
+        menu.append(refresh_item = Gtk::ImageMenuItem.new(Gtk::Stock::REFRESH))
+        refresh_item.signal_connect('activate') { distribute_multiple_call.call(:refresh) }
         menu.append(delete_item  = Gtk::ImageMenuItem.new(Gtk::Stock::DELETE))
         delete_item.signal_connect('activate') { distribute_multiple_call.call(:delete) }
         menu.append(delete_item  = Gtk::ImageMenuItem.new(Gtk::Stock::DELETE))
         delete_item.signal_connect('activate') { distribute_multiple_call.call(:delete) }
+    else
+        menu.append(               Gtk::SeparatorMenuItem.new)
+        menu.append(refresh_item = Gtk::ImageMenuItem.new(Gtk::Stock::REFRESH))
+        refresh_item.signal_connect('activate') { distribute_multiple_call.call(:refresh) }
     end
     menu.show_all
     menu.popup(nil, nil, event.button, event.time)
     end
     menu.show_all
     menu.popup(nil, nil, event.button, event.time)
@@ -985,6 +991,11 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
 
     }
 
 
     }
 
+    refresh = proc {
+        cleanup_all_thumbnails.call
+        my_gen_real_thumbnail.call
+    }
     rotate_and_cleanup = proc { |angle|
         rotate(angle, thumbnail_img, img, $xmldir.elements["*[@filename='#{filename}']"], '', $default_thumbnails[:x], $default_thumbnails[:y])
         cleanup_all_thumbnails.call
     rotate_and_cleanup = proc { |angle|
         rotate(angle, thumbnail_img, img, $xmldir.elements["*[@filename='#{filename}']"], '', $default_thumbnails[:x], $default_thumbnails[:y])
         cleanup_all_thumbnails.call
@@ -1225,7 +1236,7 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
 
     $name2closures[filename] = { :rotate => rotate_and_cleanup, :enhance => enhance_and_cleanup, :delete => delete, :cut => cut,
                                  :color_swap => color_swap_and_cleanup, :frame_offset => change_frame_offset_and_cleanup_real,
 
     $name2closures[filename] = { :rotate => rotate_and_cleanup, :enhance => enhance_and_cleanup, :delete => delete, :cut => cut,
                                  :color_swap => color_swap_and_cleanup, :frame_offset => change_frame_offset_and_cleanup_real,
-                                 :whitebalance => whitebalance_and_cleanup_real, :pano => change_pano_amount_and_cleanup_real }
+                                 :whitebalance => whitebalance_and_cleanup_real, :pano => change_pano_amount_and_cleanup_real, :refresh => refresh }
 
     textview.signal_connect('key-press-event') { |w, event|
         propagate = true
 
     textview.signal_connect('key-press-event') { |w, event|
         propagate = true
@@ -1344,7 +1355,7 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
                                      { :rotate => rotate_and_cleanup, :move => move, :color_swap => color_swap_and_cleanup, :enhance => enhance_and_cleanup,
                                        :frame_offset => change_frame_offset_and_cleanup, :delete => delete, :whitebalance => whitebalance_and_cleanup,
                                        :cut => cut, :paste => paste, :view => proc { view_element(filename, { :delete => delete }) },
                                      { :rotate => rotate_and_cleanup, :move => move, :color_swap => color_swap_and_cleanup, :enhance => enhance_and_cleanup,
                                        :frame_offset => change_frame_offset_and_cleanup, :delete => delete, :whitebalance => whitebalance_and_cleanup,
                                        :cut => cut, :paste => paste, :view => proc { view_element(filename, { :delete => delete }) },
-                                       :pano => change_pano_amount_and_cleanup })
+                                       :pano => change_pano_amount_and_cleanup, :refresh => refresh })
             end
             $ignore_next_release = false
             $gesture_press = nil
             end
             $ignore_next_release = false
             $gesture_press = nil
@@ -2158,6 +2169,11 @@ def change_dir
             fc.destroy
         }
 
             fc.destroy
         }
 
+        refresh = proc {
+            system("rm -f '#{thumbnail_file}'")
+            my_gen_real_thumbnail.call
+        }
+
         rotate_and_cleanup = proc { |angle|
             rotate(angle, thumbnail_file, img, xmldir, "#{infotype}-", $default_albums_thumbnails[:x], $default_albums_thumbnails[:y])
             system("rm -f '#{thumbnail_file}'")
         rotate_and_cleanup = proc { |angle|
             rotate(angle, thumbnail_file, img, xmldir, "#{infotype}-", $default_albums_thumbnails[:x], $default_albums_thumbnails[:y])
             system("rm -f '#{thumbnail_file}'")
@@ -2304,7 +2320,8 @@ def change_dir
                                        :can_up => counter > 1, :can_down => counter > 0 && counter < subalbums_counter,
                                        :can_top => counter > 1, :can_bottom => counter > 0 && counter < subalbums_counter },
                                      { :change => change_image, :move => move, :rotate => rotate_and_cleanup, :enhance => enhance_and_cleanup,
                                        :can_up => counter > 1, :can_down => counter > 0 && counter < subalbums_counter,
                                        :can_top => counter > 1, :can_bottom => counter > 0 && counter < subalbums_counter },
                                      { :change => change_image, :move => move, :rotate => rotate_and_cleanup, :enhance => enhance_and_cleanup,
-                                       :color_swap => color_swap_and_cleanup, :frame_offset => change_frame_offset_and_cleanup, :whitebalance => whitebalance_and_cleanup })
+                                       :color_swap => color_swap_and_cleanup, :frame_offset => change_frame_offset_and_cleanup, :whitebalance => whitebalance_and_cleanup,
+                                       :refresh => refresh })
             end
             if event.event_type == Gdk::Event::BUTTON2_PRESS && event.button == 1
                 change_image.call
             end
             if event.event_type == Gdk::Event::BUTTON2_PRESS && event.button == 1
                 change_image.call