#include <gtk/gtk.h>
-#include <libpspp/copyleft.h>
-#include <libpspp/version.h>
-#include "help-menu.h"
-#include <libpspp/message.h>
+#include "libpspp/cast.h"
+#include "libpspp/copyleft.h"
+#include "libpspp/message.h"
+#include "libpspp/version.h"
+#include "ui/gui/help-menu.h"
#include "gl/configmake.h"
#include "gl/relocatable.h"
/* Try to open html documentation uri via the default
browser on the operating system */
#ifdef __APPLE__
-#define HTMLOPENARGV {"open", 0, 0}
+#define HTMLOPENAPP "open"
#elif _WIN32
-#define HTMLOPENARGV {"wscript", 0, 0}
+#define HTMLOPENAPP "wscript"
#else
-#define HTMLOPENARGV {"xdg-open", 0, 0}
+#define HTMLOPENAPP "xdg-open"
#endif
static const gchar *artists[] = { "Bastián Díaz", "Hugo Alejandro", NULL};
if (!result)
goto error;
- gchar *argv[] = {"wscript",vbsfilename,0};
+ gchar *argv[] = {CONST_CAST (gchar *, "wscript"), vbsfilename, 0};
result = g_spawn_async (NULL, argv,
NULL, G_SPAWN_SEARCH_PATH,
online_help (const char *page)
{
GError *htmlerr = NULL;
- gchar *htmlargv[3] = HTMLOPENARGV;
gchar *htmlfilename = NULL;
gchar *htmlfullname = NULL;
gchar *htmluri = NULL;
htmlfilename);
g_free (htmlfullname);
g_free (htmlfilename);
- htmlargv[1] = htmluri;
/* The following **SHOULD** work but it does not on 28.5.2016
g_app_info_launch_default_for_uri (htmluri, NULL, &err);
osx: wine is started to launch the uri...
windows: not so bad, but the first access does not work*/
- if (! (
#ifdef _WIN32
- open_windows_help (htmluri, &htmlerr))
+ bool ok = open_windows_help (htmluri, &htmlerr);
#else
- g_spawn_async (NULL, htmlargv,
- NULL, G_SPAWN_SEARCH_PATH,
- NULL, NULL, NULL, &htmlerr))
+ gchar *htmlargv[3] = {CONST_CAST (char *, HTMLOPENAPP), htmluri, 0};
+ bool ok = g_spawn_async (NULL, htmlargv,
+ NULL, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, &htmlerr);
#endif
-)
+ if (!ok)
{
msg (ME, _("Cannot open via html: %s "
"with uri: %s "
gtk_widget_show_all (menuitem);
+ g_object_unref (accel_group);
+
return menuitem;
}