add ability to view exif data
authorgc <gc>
Sat, 5 Nov 2005 19:07:20 +0000 (19:07 +0000)
committergc <gc>
Sat, 5 Nov 2005 19:07:20 +0000 (19:07 +0000)
bin/booh
data/booh/images/stock-list-16.png [new file with mode: 0644]

index ccd221743207865c420f46dde1a1760f24a7b4d9..ce5ba1ef47485ab59a293958666033cbd8999160 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -702,7 +702,7 @@ def gen_real_thumbnail(type, origfile, destfile, xmldir, size, img, infotype)
     }
 end
 
-def popup_thumbnail_menu(event, optionals, type, xmldir, attributes_prefix, possible_actions, closures)
+def popup_thumbnail_menu(event, optionals, fullpath, type, xmldir, attributes_prefix, possible_actions, closures)
     distribute_multiple_call = Proc.new { |action, arg|
         $selected_elements.each_key { |path|
             $name2widgets[path][:img].pixbuf = $selected_elements[path][:pixbuf]
@@ -728,7 +728,6 @@ def popup_thumbnail_menu(event, optionals, type, xmldir, attributes_prefix, poss
             menu.append(view = Gtk::ImageMenuItem.new(utf8(_("View larger"))))
             view.image = Gtk::Image.new("#{$FPATH}/images/stock-view-16.png")
             view.signal_connect('activate') { closures[:view].call }
-            menu.append(               Gtk::SeparatorMenuItem.new)
         else
             menu.append(view = Gtk::ImageMenuItem.new(utf8(_("Play video"))))
             view.image = Gtk::Image.new("#{$FPATH}/images/stock-video-16.png")
@@ -736,6 +735,14 @@ def popup_thumbnail_menu(event, optionals, type, xmldir, attributes_prefix, poss
             menu.append(               Gtk::SeparatorMenuItem.new)
         end
     end
+    if type == 'image'
+        menu.append(exif = Gtk::ImageMenuItem.new(utf8(_("View EXIF data"))))
+        exif.image = Gtk::Image.new("#{$FPATH}/images/stock-list-16.png")
+        exif.signal_connect('activate') { show_popup($main_window,
+                                                     utf8(`identify -format "%[EXIF:*]" #{fullpath}`.sub(/MakerNote.*\n/, '')),
+                                                     { :title => utf8(_("EXIF data of %s") % File.basename(fullpath)), :nomarkup => true, :scrolled => true }) }
+        menu.append(               Gtk::SeparatorMenuItem.new)
+    end
     menu.append(r90 = Gtk::ImageMenuItem.new(utf8(_("Rotate clockwise"))))
     r90.image = Gtk::Image.new("#{$FPATH}/images/stock-rotate-90-16.png")
     r90.signal_connect('activate') { distribute_multiple_call.call(:rotate, 90) }
@@ -1247,7 +1254,7 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
             if !$ignore_next_release
                 x, y = autotable.get_current_pos(vbox)
                 next_ = autotable.get_next_widget(vbox)
-                popup_thumbnail_menu(event, ['delete'], type, $xmldir.elements["*[@filename='#{filename}']"], '',
+                popup_thumbnail_menu(event, ['delete'], fullpath, type, $xmldir.elements["*[@filename='#{filename}']"], '',
                                      { :can_left => x > 0, :can_right => next_ && autotable.get_current_pos(next_)[0] > x,
                                        :can_up => y > 0, :can_down => y < autotable.get_max_y, :can_multiple => true, :can_panorama => true },
                                      { :rotate => rotate_and_cleanup, :move => move, :color_swap => color_swap_and_cleanup, :enhance => enhance_and_cleanup,
@@ -1557,9 +1564,17 @@ end
 
 def show_popup(parent, msg, *options)
     dialog = Gtk::Dialog.new
-    dialog.title = utf8(_("Booh message"))
+    if options[0] && options[0][:title]
+        dialog.title = options[0][:title]
+    else
+        dialog.title = utf8(_("Booh message"))
+    end
     lbl = Gtk::Label.new
-    lbl.markup = msg
+    if options[0] && options[0][:nomarkup]
+        lbl.text = msg
+    else
+        lbl.markup = msg
+    end
     if options[0] && options[0][:centered]
         lbl.set_justify(Gtk::Justification::CENTER)
     end
@@ -1569,13 +1584,21 @@ def show_popup(parent, msg, *options)
     if options[0] && options[0][:topwidget]
         dialog.vbox.add(options[0][:topwidget])
     end
-    dialog.vbox.add(lbl)
+    if options[0] && options[0][:scrolled]
+        sw = Gtk::ScrolledWindow.new(nil, nil)
+        sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
+        sw.add_with_viewport(lbl)
+        dialog.vbox.add(sw)
+        dialog.set_default_size(400, 500)
+    else
+        dialog.vbox.add(lbl)
+        dialog.set_default_size(200, 120)
+    end
     if options[0] && options[0][:okcancel]
         dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
     end
     dialog.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK)
 
-    dialog.set_default_size(200, 120)
     if options[0] && options[0][:pos_centered]
         dialog.window_position = Gtk::Window::POS_CENTER
     else
@@ -2076,7 +2099,7 @@ def change_dir
                 end
             end
             if event.event_type == Gdk::Event::BUTTON_PRESS && event.button == 3
-                popup_thumbnail_menu(event, ['change_image'], entry2type(captionfile), xmldir, "#{infotype}-",
+                popup_thumbnail_menu(event, ['change_image'], captionfile, entry2type(captionfile), xmldir, "#{infotype}-",
                                      { :forbid_left => true, :forbid_right => true,
                                        :can_up => counter > 1, :can_down => counter > 0 && counter < subalbums_counter },
                                      { :change => change_image, :move => move, :rotate => rotate_and_cleanup, :enhance => enhance_and_cleanup,
diff --git a/data/booh/images/stock-list-16.png b/data/booh/images/stock-list-16.png
new file mode 100644 (file)
index 0000000..4a0ea65
Binary files /dev/null and b/data/booh/images/stock-list-16.png differ