/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007, 2010, 2011 Free Software Foundation
+ Copyright (C) 2007, 2010, 2011, 2012 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
PSPPIRE_BUTTON_GOTO_MASK = (1 << PSPPIRE_BUTTON_GOTO),
PSPPIRE_BUTTON_CONTINUE_MASK = (1 << PSPPIRE_BUTTON_CONTINUE),
PSPPIRE_BUTTON_CANCEL_MASK = (1 << PSPPIRE_BUTTON_CANCEL),
+ PSPPIRE_BUTTON_CLOSE_MASK = (1 << PSPPIRE_BUTTON_CLOSE),
PSPPIRE_BUTTON_HELP_MASK = (1 << PSPPIRE_BUTTON_HELP),
PSPPIRE_BUTTON_RESET_MASK = (1 << PSPPIRE_BUTTON_RESET),
PSPPIRE_BUTTON_PASTE_MASK = (1 << PSPPIRE_BUTTON_PASTE)
psppire_dialog_close (dialog);
}
+static gboolean
+is_acceptable (GtkWidget *w)
+{
+ GtkWidget *toplevel = gtk_widget_get_toplevel (w);
+
+ return (PSPPIRE_IS_DIALOG (toplevel)
+ && psppire_dialog_is_acceptable (PSPPIRE_DIALOG (toplevel)));
+}
static void
close_dialog (GtkWidget *w, gpointer data)
static void
continue_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, PSPPIRE_RESPONSE_CONTINUE);
+ if (is_acceptable (w))
+ close_and_respond (w, PSPPIRE_RESPONSE_CONTINUE);
}
static void
ok_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, GTK_RESPONSE_OK);
+ if (is_acceptable (w))
+ close_and_respond (w, GTK_RESPONSE_OK);
}
static void
paste_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, PSPPIRE_RESPONSE_PASTE);
+ if (is_acceptable (w))
+ close_and_respond (w, PSPPIRE_RESPONSE_PASTE);
}
static void
goto_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, PSPPIRE_RESPONSE_GOTO);
+ if (is_acceptable (w))
+ close_and_respond (w, PSPPIRE_RESPONSE_GOTO);
}
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_CANCEL]);
g_object_set (bb->button[PSPPIRE_BUTTON_CANCEL], "no-show-all", TRUE, NULL);
+ bb->button[PSPPIRE_BUTTON_CLOSE] = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ g_signal_connect (bb->button[PSPPIRE_BUTTON_CLOSE], "clicked",
+ G_CALLBACK (close_dialog), NULL);
+ psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_CLOSE]);
+ g_object_set (bb->button[PSPPIRE_BUTTON_CLOSE], "no-show-all", TRUE, NULL);
+
bb->button[PSPPIRE_BUTTON_RESET] = gtk_button_new_from_stock ("pspp-stock-reset");
g_signal_connect (bb->button[PSPPIRE_BUTTON_RESET], "clicked",
{ PSPPIRE_BUTTON_GOTO_MASK, "PSPPIRE_BUTTON_GOTO_MASK", "Goto case/variable" },
{ PSPPIRE_BUTTON_CONTINUE_MASK,"PSPPIRE_BUTTON_CONTINUE_MASK", "Accept and close the subdialog" },
{ PSPPIRE_BUTTON_CANCEL_MASK, "PSPPIRE_BUTTON_CANCEL_MASK", "Close dialog and discard settings" },
+ { PSPPIRE_BUTTON_CLOSE_MASK, "PSPPIRE_BUTTON_CLOSE_MASK", "Close dialog" },
{ PSPPIRE_BUTTON_HELP_MASK, "PSPPIRE_BUTTON_HELP_MASK", "Invoke context sensitive help" },
{ PSPPIRE_BUTTON_RESET_MASK, "PSPPIRE_BUTTON_RESET_MASK", "Restore dialog to its default settings" },
{ PSPPIRE_BUTTON_PASTE_MASK, "PSPPIRE_BUTTON_PASTE_MASK", "Accept dialog and paste syntax" },