X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=blobdiff_plain;f=browser-switchboard;h=e922ceebb8d3ea043249e0123d21a9193e3153f0;hp=5299cc646f177a3ea3fe890049dde0d7b0331c72;hb=025acd684c44fc640b792c7bfb565261193ea875;hpb=e0583c53d0edc5239fafc98f11519f6c630769ce diff --git a/browser-switchboard b/browser-switchboard index 5299cc6..e922cee 100755 --- a/browser-switchboard +++ b/browser-switchboard @@ -38,12 +38,13 @@ def setconfigdefaults(): global continuous_mode, default_browser, other_browser_cmd # continuous_mode: 0 -- close after handling a request; 1 -- run - # continuously in the background + # continuously in the background continuous_mode = 0 # default_browser: "tear", "microb", "fennec", "midori", or "other" - default_browser = "tear" + # empty string is handled specially -- see below + default_browser = "" # If default browser is "other", what program to run (%s will be replaced - # by URI) + # by URI) other_browser_cmd = "" class BrowserLauncher: @@ -126,6 +127,13 @@ class BrowserLauncher: else: print "default_browser is 'other', but no other_browser_cmd set -- using default" self.LaunchBrowser = self.LaunchTear + elif default_browser == "": + # If default_browser is empty, use Tear as the default if + # installed, otherwise use MicroB + if os.access("/usr/bin/tear", os.X_OK): + self.LaunchBrowser = self.LaunchTear + else: + self.LaunchBrowser = self.LaunchMicroB else: print "Unknown default_browser %s, using default" % default_browser self.LaunchBrowser = self.LaunchTear @@ -183,10 +191,14 @@ def readconfigfile(signalnum=None, frame=None): # read configuration from the config file, if available try: execfile(os.getenv("HOME", "/home/user") + "/.config/browser-switchboard", globals()) - launcher.UpdateDefaultBrowser() except: - # No valid config file available - pass + # Try the legacy config file location + try: + execfile(os.getenv("HOME", "/home/user") + "/.config/browser-proxy", globals()) + except: + # No valid config file available + pass + launcher.UpdateDefaultBrowser() setconfigdefaults()