From afcfda5e2e193982ef6375b448dd2e084faceaeb Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Tue, 25 Mar 2014 21:43:39 -0400 Subject: [PATCH] Replace gnome function to display XML help Now using external browser using pre-generated HTML documentation. Note: sections links in HTML document don't work yet. --- src/Makefile.am | 1 + src/grip.c | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index f61b266..3f12495 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,6 +9,7 @@ AM_CPPFLAGS = \ -DPREFIX=\""$(prefix)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DDATADIR=\""$(datadir)"\" \ + -DDOCDIR=\""$(docdir)"\" \ -DLIBDIR=\""$(libdir)"\" bin_PROGRAMS = grip diff --git a/src/grip.c b/src/grip.c index fb680b2..1183d87 100644 --- a/src/grip.c +++ b/src/grip.c @@ -53,6 +53,7 @@ static void DoLoadConfig(GripInfo *ginfo); void DoSaveConfig(GripInfo *ginfo); #define GRIP_URL "http://www.hugovil.com/hvgrip" +#define GRIP_HTML_DOC_URL "file://"DOCDIR"/grip.html" #define BASE_CFG_ENTRIES \ {"grip_version",CFG_ENTRY_STRING,256,ginfo->version},\ @@ -479,12 +480,23 @@ void LogStatus(GripInfo *ginfo,char *fmt,...) static void DoHelp(GtkWidget *widget,gpointer data) { char *section; + char *uri; section=(char *)data; -#ifdef CONVERSION_GNOME_TO_GTK - gnome_help_display("grip.xml",section,NULL); -#endif + if (section) { + /* + * This doesn't work for the moment: the "#section" seems to be + * ignored by g_app_info_launch_default_for_uri(). + */ + uri = g_strdup_printf("%s#%s", GRIP_HTML_DOC_URL, section); + } + else { + uri = g_strdup_printf("%s", GRIP_HTML_DOC_URL); + } + + g_app_info_launch_default_for_uri(uri, NULL, NULL); + g_free (uri); } static void MakeHelpPage(GripInfo *ginfo) -- 2.20.1