move check for gimp and firefox to when needed, to allow soft require
authorGuillaume Cottenceau <gcottenc@gmail.com>
Fri, 11 Jul 2008 16:05:14 +0000 (18:05 +0200)
committerGuillaume Cottenceau <gcottenc@gmail.com>
Fri, 11 Jul 2008 16:05:14 +0000 (18:05 +0200)
INSTALL
bin/booh
lib/booh/booh-lib.rb

diff --git a/INSTALL b/INSTALL
index 30fbd46..2bf6ba6 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -20,7 +20,9 @@ And for runtime:
 - identify (from ImageMagick) - for photos captions
 - exif - to show full formatted EXIF information from photos
 - mplayer - for videos thumbnails generation
-- gimp - for photos editing
+- gimp - for photos editing (may not be a hard require)
+- mozilla-firefox - for showing albums in browser, and going on the
+  web for tutorials (may not be a hard require)
 
 
         Compiling and Installing Quick Start
index 02512af..ead6871 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -166,6 +166,9 @@ Problem was: '%s' is not an executable file.
 Hint: don't forget to specify the full path to the executable,
 e.g. '/usr/bin/mplayer' is correct but 'mplayer' only is not.") % viewer_binary), { :pos_centered => true, :not_transient => true })
     end
+end
+
+def check_image_editor
     image_editor_binary = $config['image-editor'].split.first
     if image_editor_binary && !File.executable?(image_editor_binary)
         show_popup($main_window, utf8(_("The configured image editor seems to be unavailable.
@@ -174,13 +177,9 @@ You should fix this in Edit/Preferences so that you can edit photos externally.
 Problem was: '%s' is not an executable file.
 Hint: don't forget to specify the full path to the executable,
 e.g. '/usr/bin/gimp-remote' is correct but 'gimp-remote' only is not.") % image_editor_binary), { :pos_centered => true, :not_transient => true })
-    end
-    browser_binary = $config['browser'].split.first
-    if browser_binary && !File.executable?(browser_binary)
-        show_popup($main_window, utf8(_("The configured browser seems to be unavailable.
-You should fix this in Edit/Preferences so that you can open URLs.
-
-Problem was: '%s' is not an executable file.") % browser_binary), { :pos_centered => true, :not_transient => true })
+        return false
+    else
+        return true
     end
 end
 
@@ -1033,9 +1032,11 @@ def popup_thumbnail_menu(event, optionals, fullpath, type, xmldir, attributes_pr
         menu.append(editexternally = Gtk::ImageMenuItem.new(utf8(_("Edit image"))))
         editexternally.image = Gtk::Image.new("#{$FPATH}/images/stock-tool-ink-16.png")
         editexternally.signal_connect('activate') {
-            cmd = from_utf8($config['image-editor']).gsub('%f', "'#{fullpath}'")
-            msg 2, cmd
-            system(cmd)
+            if check_image_editor
+                cmd = from_utf8($config['image-editor']).gsub('%f', "'#{fullpath}'")
+                msg 2, cmd
+                system(cmd)
+            end
         }
     end
     menu.append(refresh_item = Gtk::ImageMenuItem.new(Gtk::Stock::REFRESH))
index 0235647..13e63c4 100644 (file)
@@ -529,10 +529,25 @@ module Booh
         ios.close
     end
 
+    def check_browser
+        browser_binary = $config['browser'].split.first
+        if browser_binary && !File.executable?(browser_binary)
+            show_popup($main_window, utf8(_("The configured browser seems to be unavailable.
+You should fix this in Edit/Preferences so that you can open URLs.
+
+Problem was: '%s' is not an executable file.") % browser_binary), { :pos_centered => true, :not_transient => true })
+            return false
+        else
+            return true
+        end
+    end
+
     def open_url(url)
-        cmd = $config['browser'].gsub('%f', "'#{url}'") + ' &'
-        msg 2, cmd
-        system(cmd)
+        if check_browser
+            cmd = $config['browser'].gsub('%f', "'#{url}'") + ' &'
+            msg 2, cmd
+            system(cmd)
+        end
     end
 
     def get_license