#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) {
printf("launch_tear with uri '%s'\n", uri);
status = system("pidof tear > /dev/null");
- if (!WIFEXITED(status))
- exit(1);
- if (!WEXITSTATUS(status)) {
+ if (WIFEXITED(status) && !WEXITSTATUS(status)) {
if (!tear_proxy)
tear_proxy = dbus_g_proxy_new_for_name(ctx->session_bus,
"com.nokia.tear", "/com/nokia/tear",
uri = "new_window";
status = system("pidof /usr/sbin/browserd > /dev/null");
- if (!WIFEXITED(status))
- exit(1);
- if (WEXITSTATUS(status)) {
+ if (WIFEXITED(status) && WEXITSTATUS(status)) {
kill_browserd = 1;
system("/usr/sbin/browserd -d");
}
/* Move the string after the ', including the \0,
over two chars */
- memmove(quote+3, quote+1, strlen(quote)+1);
+ memmove(quote+3, quote+1, strlen(quote));
memcpy(quote, "%27", 3);
quote = quote + 3;
}
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;
}