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) )
{
g_clear_error (&err);
}
+static void
+reference_manual (GtkMenuItem *menu, gpointer data)
+{
+ online_help (NULL);
+}
+
+
+
void
merge_help_menu (GtkUIManager *uim)
{
GtkWidget *
get_widget_assert (GtkBuilder *builder, const gchar *name)
{
- return GTK_WIDGET (get_object_assert (builder, name, GTK_TYPE_WIDGET));
+ GtkWidget *w = GTK_WIDGET (get_object_assert (builder, name, GTK_TYPE_WIDGET));
+
+ g_object_set (w, "name", name, NULL);
+
+ return w;
}
/* This function must be used whenever a filename generated by glib,
+static void
+help_clicked (GtkWidget *w, gpointer data)
+{
+ GtkWidget *toplevel = gtk_widget_get_toplevel (w);
+ PsppireDialog *dialog;
+
+ if ( ! PSPPIRE_IS_DIALOG (toplevel))
+ return;
+
+ dialog = PSPPIRE_DIALOG (toplevel);
+
+ psppire_dialog_help (dialog);
+}
+
+
+
static void
on_validity_change (GtkWidget *toplevel, gboolean valid, gpointer data)
{
bb->button[PSPPIRE_BUTTON_HELP] = gtk_button_new_from_stock (GTK_STOCK_HELP);
+ g_signal_connect (bb->button[PSPPIRE_BUTTON_HELP], "clicked",
+ G_CALLBACK (help_clicked), NULL);
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_HELP]);
g_object_set (bb->button[PSPPIRE_BUTTON_HELP], "no-show-all", TRUE, NULL);
{
static const GFlagsValue values[] =
{
- { PSPPIRE_BUTTON_OK_MASK, "PSPPIRE_BUTTON_OK_MASK", N_("OK") },
- { PSPPIRE_BUTTON_GOTO_MASK, "PSPPIRE_BUTTON_GOTO_MASK", N_("Go To") },
+ { PSPPIRE_BUTTON_OK_MASK, "PSPPIRE_BUTTON_OK_MASK", N_("OK") },
+ { PSPPIRE_BUTTON_GOTO_MASK, "PSPPIRE_BUTTON_GOTO_MASK", N_("Go To") },
{ PSPPIRE_BUTTON_CONTINUE_MASK,"PSPPIRE_BUTTON_CONTINUE_MASK", N_("Continue") },
- { PSPPIRE_BUTTON_CANCEL_MASK, "PSPPIRE_BUTTON_CANCEL_MASK", N_("Cancel") },
- { PSPPIRE_BUTTON_HELP_MASK, "PSPPIRE_BUTTON_HELP_MASK", N_("Help") },
- { PSPPIRE_BUTTON_RESET_MASK, "PSPPIRE_BUTTON_RESET_MASK", N_("Reset") },
- { PSPPIRE_BUTTON_PASTE_MASK, "PSPPIRE_BUTTON_PASTE_MASK", N_("Paste") },
+ { PSPPIRE_BUTTON_CANCEL_MASK, "PSPPIRE_BUTTON_CANCEL_MASK", N_("Cancel") },
+ { PSPPIRE_BUTTON_HELP_MASK, "PSPPIRE_BUTTON_HELP_MASK", N_("Help") },
+ { PSPPIRE_BUTTON_RESET_MASK, "PSPPIRE_BUTTON_RESET_MASK", N_("Reset") },
+ { PSPPIRE_BUTTON_PASTE_MASK, "PSPPIRE_BUTTON_PASTE_MASK", N_("Paste") },
{ 0, NULL, NULL }
};
#include "psppire-conf.h"
#include <string.h>
#include "helper.h"
+#include "help-menu.h"
static void psppire_dialog_class_init (PsppireDialogClass *);
static void psppire_dialog_init (PsppireDialog *);
enum {DIALOG_REFRESH,
VALIDITY_CHANGED,
+ DIALOG_HELP,
n_SIGNALS};
static guint signals [n_SIGNALS];
FALSE,
G_PARAM_CONSTRUCT_ONLY |G_PARAM_READWRITE);
-
-
object_class->set_property = psppire_dialog_set_property;
object_class->get_property = psppire_dialog_get_property;
PROP_SLIDING,
sliding_spec);
-
-
signals [DIALOG_REFRESH] =
g_signal_new ("refresh",
G_TYPE_FROM_CLASS (class),
G_TYPE_BOOLEAN);
+ signals [DIALOG_HELP] =
+ g_signal_new ("help",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+
+
object_class->finalize = psppire_dialog_finalize;
}
if ( PSPPIRE_IS_BUTTONBOX (w))
return;
-
-
if ( GTK_IS_CONTAINER (w))
{
gtk_container_foreach (GTK_CONTAINER (w),
}
+void
+psppire_dialog_help (PsppireDialog *dialog)
+{
+ char *name = NULL;
+ g_object_get (dialog, "name", &name, NULL);
+
+ online_help (name);
+
+ g_signal_emit (dialog, signals [DIALOG_HELP], 0, name);
+}
GType