Added a callback to the dialog help buttons, and a handler to call
[pspp-builds.git] / src / ui / gui / help-menu.c
index 58a19bb7f2584233c8a28c7227211504cddac886..733580770bbea035a38432e35768b1665a1a18b5 100644 (file)
@@ -85,12 +85,19 @@ about_new (GtkMenuItem *m, GtkWindow *parent)
   gtk_widget_hide (about);
 }
 
-
-static void
-reference_manual (GtkMenuItem *menu, gpointer data)
+/* Open the manual at PAGE */
+void
+online_help (const char *page)
 {
   GError *err = NULL;
-  gchar *cmd = g_strdup_printf ("yelp file://%s", relocate (DOCDIR "/pspp.xml"));
+  gchar *cmd = NULL;
+
+  if (page == NULL)
+    cmd = g_strdup_printf ("yelp file://%s", relocate (DOCDIR "/pspp.xml"));
+  else
+    cmd = g_strdup_printf ("yelp file://%s#%s", relocate (DOCDIR "/pspp.xml"), page);
+
+  g_print ("%s\n",cmd);
 
   if ( ! g_spawn_command_line_async (cmd, &err) )
     {
@@ -104,6 +111,14 @@ reference_manual (GtkMenuItem *menu, gpointer data)
   g_clear_error (&err);
 }
 
+static void
+reference_manual (GtkMenuItem *menu, gpointer data)
+{
+  online_help (NULL);
+}
+
+
+
 void
 merge_help_menu (GtkUIManager *uim)
 {