support gimp 2.6 doesn't have gimp-remote anymore, and a few related improvements...
[booh] / lib / booh / booh-lib.rb
index 6b55ce4e0265fe5aea5e090b69c936466310c789..9c4a41db0189cdc8b73eecd75c8406678fc46975 100644 (file)
@@ -540,13 +540,24 @@ module Booh
         }
     end
 
+    def check_multi_binaries(input)
+        #- e.g. check at least one binary from '/usr/bin/gimp-remote %f || /usr/bin/gimp %f' is available
+        for attempts in input.split('||')
+            binary = attempts.split.first
+            if binary && File.executable?(binary)
+                return nil
+            end
+        end
+        #- return last tried binary for error message
+        return binary
+    end
+
     def check_browser
-        browser_binary = $config['browser'].split.first
-        if browser_binary && !File.executable?(browser_binary)
+        if last_failed_binary = check_multi_binaries($config['browser'])
             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 })
+Problem was: '%s' is not an executable file.") % last_failed_binary), { :pos_centered => true, :not_transient => true })
             return false
         else
             return true