Mercurial > hg > forks > geeqie
changeset 2571:6b6f18504950
Prelim: display README in html format
If README.html exists, it is displayed in the default browser in
preference to README.md in text format.
Still requires the automake files to be modified for markdown (or some
other command) to generate the README.html file.
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Sun, 06 Aug 2017 19:25:07 +0100 |
parents | aaca094d2f32 |
children | 31c6e3c9163e |
files | src/window.c |
diffstat | 1 files changed, 21 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/window.c Sat Aug 05 17:36:05 2017 +0100 +++ b/src/window.c Sun Aug 06 19:25:07 2017 +0100 @@ -188,11 +188,10 @@ NULL, NULL }; -static void help_browser_run(const gchar *section) +static void help_browser_run(const gchar *path) { gchar *name = options->helpers.html_browser.command_name; gchar *cmd = options->helpers.html_browser.command_line; - gchar *path = g_build_filename("file://", GQ_HTMLDIR, section, NULL); gchar *result = NULL; gint i; @@ -223,7 +222,6 @@ return; } - g_free(path); g_free(result); } @@ -246,7 +244,9 @@ if (key && strstr(key, ".html") != 0) { - help_browser_run(key); + gchar *path = g_build_filename("file://", GQ_HTMLDIR, key, NULL); + help_browser_run(path); + g_free(path); return; } @@ -257,12 +257,24 @@ return; } - path = g_build_filename(GQ_HELPDIR, "README.md", NULL); - help_window = help_window_new(_("Help"), "help", path, key); - g_free(path); + path = g_build_filename(GQ_HELPDIR, "README.html", NULL); + if (isfile(path)) + { + g_free(path); + path = g_build_filename("file://", GQ_HELPDIR, "README.html", NULL); + help_browser_run(path); + g_free(path); + } + else + { + g_free(path); + path = g_build_filename(GQ_HELPDIR, "README.md", NULL); + help_window = help_window_new(_("Help"), "help", path, key); + g_free(path); - g_signal_connect(G_OBJECT(help_window), "destroy", - G_CALLBACK(help_window_destroy_cb), NULL); + g_signal_connect(G_OBJECT(help_window), "destroy", + G_CALLBACK(help_window_destroy_cb), NULL); + } } /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */