+/* Try to open html documentation uri via the default
+ browser on the operating system */
+#ifdef __APPLE__
+#define HTMLOPENAPP "open"
+#elif _WIN32
+#define HTMLOPENAPP "wscript"
+#else
+#define HTMLOPENAPP "xdg-open"
+#endif
+
+static const gchar *artists[] = { "Bastián Díaz", "Hugo Alejandro", NULL};
+
+/* Opening the htmluri in windows via cmd /start uri opens
+ the windows command shell for a moment. The alternative is
+ to start a script via wscript. This will not be visible*/
+#ifdef _WIN32
+static gboolean
+open_windows_help (const gchar *helpuri, GError **err)
+{
+ SHELLEXECUTEINFOA info;
+ memset (&info, 0, sizeof (info));
+
+ info.cbSize = sizeof (info);
+ info.fMask = SEE_MASK_FLAG_NO_UI;
+ info.lpVerb = "open";
+ info.lpFile = helpuri;
+ info.nShow = SW_SHOWNORMAL;
+
+ BOOL ret = ShellExecuteExA (&info);
+
+ if (ret)
+ return TRUE;
+
+ /* Contrary to what the microsoft documentation indicates, ShellExecuteExA does
+ not seem to setLastError. So we have to deal with errors ourselves here. */
+ const char *msg = 0;
+ switch (GPOINTER_TO_INT (info.hInstApp))
+ {
+ case SE_ERR_FNF:
+ msg = "File not found";
+ break;
+ case SE_ERR_PNF:
+ msg = "Path not found";
+ break;
+ case SE_ERR_ACCESSDENIED:
+ msg = "Access denied";
+ break;
+ case SE_ERR_OOM:
+ msg = "Out of memory";
+ break;
+ case SE_ERR_DLLNOTFOUND:
+ msg = "Dynamic-link library not found";
+ break;
+ case SE_ERR_SHARE:
+ msg = "Cannot share an open file";
+ break;
+ case SE_ERR_ASSOCINCOMPLETE:
+ msg = "File association information not complete";
+ break;
+ case SE_ERR_DDETIMEOUT:
+ msg = "DDE operation timed out";
+ break;
+ case SE_ERR_DDEFAIL:
+ msg = "DDE operation failed";
+ break;
+ case SE_ERR_DDEBUSY:
+ msg = "DDE operation is busy";
+ break;
+ case SE_ERR_NOASSOC:
+ msg = "File association not available";
+ break;
+ default:
+ msg = "Unknown error";
+ break;
+ }
+
+ *err = g_error_new_literal (g_quark_from_static_string ("pspp-help-error"),
+ 0,
+ msg);
+
+ return FALSE;
+}
+
+static gboolean
+on_activate_link (GtkAboutDialog *label,
+ gchar *uri,
+ gpointer user_data)
+{
+ return open_windows_help (uri, NULL);
+}
+#endif