Mercurial > geeqie.yaz
diff src/window.c @ 884:ff16ed0d2c8a
Improve ways to specify html browser (used for help, see bug 2015099).
Two new rc file options were added:
- helpers.html_browser.command_name
- helpers.html_browser.command_line
These are checked first before trying common browser locations.
If these do not lead to a valid browser, then geeqie will
search for geeqie_html_browser script in the path, then
it will try various common browsers.
author | zas_ |
---|---|
date | Sun, 13 Jul 2008 14:50:07 +0000 |
parents | 391a9e3336db |
children | 6ca2c5fd7b13 |
line wrap: on
line diff
--- a/src/window.c Sun Jul 13 13:51:23 2008 +0000 +++ b/src/window.c Sun Jul 13 14:50:07 2008 +0000 @@ -77,7 +77,7 @@ /* *----------------------------------------------------------------------------- - * Open browser with the help Documentation + * Open browser with the help Documentation *----------------------------------------------------------------------------- */ @@ -85,13 +85,13 @@ { gchar *result = NULL; FILE *f; - char buf[2048]; - int l; + gchar buf[2048]; + gint l; - if (!binary) return NULL; + if (!binary || binary[0] == '\0') return NULL; if (!file_in_path(binary)) return NULL; - if (!command) return g_strdup(binary); + if (!command || command[0] == '\0') return g_strdup(binary); if (command[0] == '!') return g_strdup(command + 1); f = popen(command, "r"); @@ -101,7 +101,7 @@ { if (!result) { - int n = 0; + gint n = 0; while (n < l && buf[n] != '\n' && buf[n] != '\r') n++; if (n > 0) result = g_strndup(buf, n); @@ -157,6 +157,8 @@ */ static gchar *html_browsers[] = { + /* Our specific script */ + GQ_APPNAME_LC "_html_browser", NULL, /* Redhat has a nifty htmlview script to start the user's preferred browser */ "htmlview", NULL, /* Debian has even better approach with alternatives */ @@ -175,9 +177,11 @@ static void help_browser_run(void) { - gchar *result = NULL; + gchar *result; gint i; + result = command_result(options->helpers.html_browser.command_name, options->helpers.html_browser.command_line); + i = 0; while (!result && html_browsers[i]) {