From: Steven Luo Date: Tue, 15 Dec 2009 06:07:28 +0000 (-0800) Subject: Launch MicroB if default_browser not set and Tear isn't installed X-Git-Tag: v3.0rc1~20 X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=commitdiff_plain;h=20b61c36b9d9d871a80caf35c18a4be5f72035f0 Launch MicroB if default_browser not set and Tear isn't installed Change the handling of default_browser == NULL in update_default_browser() to check for the presence of Tear before setting it as the default browser, and to use MicroB as the default otherwise. --- diff --git a/launcher.c b/launcher.c index 24dff0a..e77e965 100644 --- a/launcher.c +++ b/launcher.c @@ -32,6 +32,7 @@ #include "launcher.h" #include "dbus-server-bindings.h" +#define DEFAULT_BROWSER "/usr/bin/tear" #define LAUNCH_DEFAULT_BROWSER launch_tear static void launch_tear(struct swb_context *ctx, char *uri) { @@ -206,7 +207,12 @@ void update_default_browser(struct swb_context *ctx, char *default_browser) { return; if (!default_browser) { - ctx->default_browser_launcher = LAUNCH_DEFAULT_BROWSER; + /* No default_browser configured -- use DEFAULT_BROWSER if + installed, otherwise launch MicroB */ + if (!access(DEFAULT_BROWSER, X_OK)) + ctx->default_browser_launcher = LAUNCH_DEFAULT_BROWSER; + else + ctx->default_browser_launcher = launch_microb; return; }