2 PSPPIRE --- A Graphical User Interface for PSPP
3 Copyright (C) 2007 Free Software Foundation
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #include <gtk/gtksignal.h>
24 #include "psppire-buttonbox.h"
25 #include "psppire-dialog.h"
27 static void psppire_buttonbox_class_init (PsppireButtonBoxClass *);
28 static void psppire_buttonbox_init (PsppireButtonBox *);
32 psppire_button_box_get_type (void)
34 static GType buttonbox_type = 0;
38 static const GTypeInfo buttonbox_info =
40 sizeof (PsppireButtonBoxClass),
42 NULL, /* base_finalize */
43 (GClassInitFunc) psppire_buttonbox_class_init,
44 NULL, /* class_finalize */
45 NULL, /* class_data */
46 sizeof (PsppireButtonBox),
48 (GInstanceInitFunc) psppire_buttonbox_init,
51 buttonbox_type = g_type_register_static (GTK_TYPE_VBUTTON_BOX,
52 "PsppireButtonBox", &buttonbox_info, 0);
55 return buttonbox_type;
58 static GObjectClass *parent_class = NULL;
62 psppire_buttonbox_class_init (PsppireButtonBoxClass *class)
67 close_dialog (GtkWidget *w, gpointer data)
69 PsppireDialog *dialog;
71 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
73 dialog->response = GTK_RESPONSE_CANCEL;
75 psppire_dialog_close (dialog);
79 ok_button_clicked (GtkWidget *w, gpointer data)
81 PsppireDialog *dialog;
83 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
85 dialog->response = GTK_RESPONSE_OK;
87 psppire_dialog_close (dialog);
92 refresh_clicked (GtkWidget *w, gpointer data)
94 PsppireDialog *dialog;
96 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
98 psppire_dialog_reload (dialog, data);
103 psppire_buttonbox_init (PsppireButtonBox *buttonbox)
107 button = gtk_button_new_from_stock (GTK_STOCK_OK);
108 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
109 g_signal_connect (button, "clicked", G_CALLBACK (ok_button_clicked), NULL);
110 gtk_widget_show (button);
112 button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
113 g_signal_connect (button, "clicked", G_CALLBACK (close_dialog), NULL);
114 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
115 gtk_widget_show (button);
117 button = gtk_button_new_from_stock (GTK_STOCK_REFRESH);
118 g_signal_connect (button, "clicked", G_CALLBACK (refresh_clicked), NULL);
119 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
120 gtk_widget_show (button);
122 button = gtk_button_new_from_stock (GTK_STOCK_HELP);
123 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
124 gtk_widget_show (button);
126 gtk_widget_show (buttonbox);
131 psppire_buttonbox_new (void)
133 PsppireButtonBox *buttonbox ;
135 buttonbox = g_object_new (psppire_button_box_get_type (), NULL);
137 return GTK_WIDGET (buttonbox) ;