display video on video thumbnail double click
authorgc <gc>
Fri, 3 Aug 2007 21:47:33 +0000 (21:47 +0000)
committergc <gc>
Fri, 3 Aug 2007 21:47:33 +0000 (21:47 +0000)
bin/booh-classifier

index 9436cedd424e3169bdf3415d240537225f54bf4f..ac5d036f83034fc358a28ee118ea823647cff662 100644 (file)
@@ -670,6 +670,12 @@ def show_popup(parent, msg, *options)
     end
 end
 
     end
 end
 
+def video_view(entry)
+    cmd = from_utf8($config['video-viewer']).gsub('%f', "'#{entry.path}'") + ' &'
+    msg 2, cmd
+    system(cmd)
+end
+
 def thumbnail_keypressed(entry, event)
     if event.state & Gdk::Window::MOD1_MASK != 0
         #- ALT pressed: Alt-Left and Alft-Right rotate
 def thumbnail_keypressed(entry, event)
     if event.state & Gdk::Window::MOD1_MASK != 0
         #- ALT pressed: Alt-Left and Alft-Right rotate
@@ -745,9 +751,7 @@ def thumbnail_keypressed(entry, event)
                       })
 
         elsif event.keyval == Gdk::Keyval::GDK_Return && entry.type == 'video'
                       })
 
         elsif event.keyval == Gdk::Keyval::GDK_Return && entry.type == 'video'
-            cmd = from_utf8($config['video-viewer']).gsub('%f', "'#{entry.path}'") + ' &'
-            msg 2, cmd
-            system(cmd)
+            video_view(entry)
 
         else
             char = [ Gdk::Keyval.to_unicode(event.keyval) ].pack("C*")
 
         else
             char = [ Gdk::Keyval.to_unicode(event.keyval) ].pack("C*")
@@ -847,6 +851,11 @@ def real_show_entry(entry, tooltips, grab_focus)
                 last_shown.nil? or last_shown.alignment.set(0.5, 1, 0, 0)
             end
         }
                 last_shown.nil? or last_shown.alignment.set(0.5, 1, 0, 0)
             end
         }
+        entry.button.signal_connect('button-press-event') { |w, event|
+            if entry.type == 'video' && event.event_type == Gdk::Event::BUTTON2_PRESS
+                video_view(entry)
+            end
+        }
         entry.button.signal_connect('focus-in-event') { entry.button.clicked; autoscroll_if_needed(entry.button) }
         entry.button.signal_connect('key-press-event') { |w, e| thumbnail_keypressed(entry, e) }
         if grab_focus
         entry.button.signal_connect('focus-in-event') { entry.button.clicked; autoscroll_if_needed(entry.button) }
         entry.button.signal_connect('key-press-event') { |w, e| thumbnail_keypressed(entry, e) }
         if grab_focus