*** empty log message ***
authorgc <gc>
Sat, 23 Feb 2008 22:57:52 +0000 (22:57 +0000)
committergc <gc>
Sat, 23 Feb 2008 22:57:52 +0000 (22:57 +0000)
bin/booh
bin/booh-classifier

index 4cc0f8858e41532952033fc29e69a538a289a4c9..c1e1fca895cf79684af4a6fde45d882d02b4e6e6 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -875,7 +875,7 @@ def popup_thumbnail_menu(event, optionals, fullpath, type, xmldir, attributes_pr
             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(`exif -m #{fullpath}`),
+                                                         utf8(`exif -m '#{fullpath}'`),
                                                          { :title => utf8(_("EXIF data of %s") % File.basename(fullpath)), :nomarkup => true, :scrolled => true }) }
             menu.append(Gtk::SeparatorMenuItem.new)
         end
@@ -4282,6 +4282,7 @@ end
 
 handle_options
 
+
 #- rexml sanity check (bugs in ruby 1.8.4, ruby 1.8.6)
 xmldoc = Document.new("<test/>")
 xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, "UTF-8")
@@ -4308,6 +4309,26 @@ if sanity1 != sanity2
 end
 
 
+#- rexml sanity check again (bug in ruby 1.8.6-p111)
+xmldoc = Document.new "<booh/>"
+xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, 'UTF-8')
+elem = xmldoc.root.add_element('elem')
+elem.add_text('cdata')
+tmp = Tempfile.new("sanitytemp")
+tmp.close!
+ios = File.open(sanity_filename = tmp.path, File::RDWR|File::CREAT|File::EXCL)
+xmldoc.write(ios, 0)
+ios.close
+
+xmldoc = Document.new(File.new(sanity_filename))
+File.delete(sanity_filename)
+if xmldoc.root.elements['elem'].get_text.value != 'cdata'
+    puts _("REXML sanity check failed (this is normal with unpatched ruby-1.8.6-p111, which ships a broken REXML). For safeness, won't proceed.")
+    puts "Notice for bug reporting: REXML has version: #{REXML::VERSION} at date: #{REXML::DATE}."
+    exit 1
+end
+
+
 Thread.abort_on_exception = true
 
 read_config
index 9a9e7ef6a646d4678dd36e5b7ff6aa34b576ffdf..5b545abcdaa561f85f9a953c240f0b997a0459f6 100644 (file)
@@ -139,6 +139,9 @@ def check_config
         show_popup($main_window, utf8(_("The following program(s) are needed to handle videos: '%s'. Videos will be ignored.") % missing.join(', ')), { :pos_centered => true })
     end
 
+    if !system("which exif >/dev/null 2>/dev/null")
+        show_popup($main_window, utf8(_("The program 'exif' is needed to view EXIF data. Please install it.")), { :pos_centered => true })
+    end
     viewer_binary = $config['video-viewer'].split.first
     if viewer_binary && ! File.executable?(viewer_binary)
         show_popup($main_window, utf8(_("The configured video viewer seems to be unavailable.
@@ -770,10 +773,16 @@ def show_popup(parent, msg, *options)
     end
 end
 
-def video_view(entry)
-    cmd = from_utf8($config['video-viewer']).gsub('%f', "'#{entry.path}'") + ' &'
-    msg 2, cmd
-    system(cmd)
+def view_entry(entry)
+    if entry.type == 'image'
+        show_popup($main_window,
+                   utf8(`exif -m '#{entry.path}'`),
+                   { :title => utf8(_("EXIF data of %s") % File.basename(entry.path)), :nomarkup => true, :scrolled => true, :not_transient => true })
+    else
+        cmd = from_utf8($config['video-viewer']).gsub('%f', "'#{entry.path}'") + ' &'
+        msg 2, cmd
+        system(cmd)
+    end
 end
 
 def thumbnail_keypressed(entry, event)
@@ -860,8 +869,8 @@ def thumbnail_keypressed(entry, event)
                           }
                       })
 
-        elsif event.keyval == Gdk::Keyval::GDK_Return && entry.type == 'video'
-            video_view(entry)
+        elsif event.keyval == Gdk::Keyval::GDK_Return
+            view_entry(entry)
 
         else
             char = [ Gdk::Keyval.to_unicode(event.keyval) ].pack("C*")