X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=blobdiff_plain;f=launcher.c;h=fe57eb94b7640de4f80443d340d5b02101e3871b;hp=e042f7896fef91383a888d1d758876f6e824d767;hb=7bfa2858f0a4c938bf4c9ad205f67e96052aff6e;hpb=f80c0225d95f310c24a8a69bedf97069f2859636 diff --git a/launcher.c b/launcher.c index e042f78..fe57eb9 100644 --- a/launcher.c +++ b/launcher.c @@ -51,6 +51,7 @@ struct browser_launcher { char *name; void (*launcher)(struct swb_context *, char *); char *other_browser_cmd; + char *binary; }; #ifdef FREMANTLE @@ -602,12 +603,12 @@ static void launch_other_browser(struct swb_context *ctx, char *uri) { /* The list of known browsers and how to launch them */ static struct browser_launcher browser_launchers[] = { - { "microb", launch_microb, NULL }, /* First entry is the default! */ - { "tear", launch_tear, NULL }, - { "fennec", NULL, "fennec %s" }, - { "opera", NULL, "opera %s" }, - { "midori", NULL, "midori %s" }, - { NULL, NULL, NULL }, + { "microb", launch_microb, NULL, NULL }, /* First entry is the default! */ + { "tear", launch_tear, NULL, "/usr/bin/tear" }, + { "fennec", NULL, "fennec %s", "/usr/bin/fennec" }, + { "opera", NULL, "opera %s", "/usr/bin/opera" }, + { "midori", NULL, "midori %s", "/usr/bin/midori" }, + { NULL, NULL, NULL, NULL }, }; static void use_launcher_as_default(struct swb_context *ctx, @@ -653,8 +654,15 @@ void update_default_browser(struct swb_context *ctx, char *default_browser) { it matches */ for (browser = browser_launchers; browser->name; ++browser) if (!strcmp(default_browser, browser->name)) { - use_launcher_as_default(ctx, browser); - return; + /* Make sure the user's choice is installed on the + system */ + if (browser->binary && access(browser->binary, X_OK)) { + log_msg("%s appears not to be installed\n", + default_browser); + } else { + use_launcher_as_default(ctx, browser); + return; + } } /* Deal with default_browser = "other" */