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"
29 #define _(msgid) gettext (msgid)
30 #define N_(msgid) msgid
33 static void psppire_buttonbox_class_init (PsppireButtonBoxClass *);
34 static void psppire_buttonbox_init (PsppireButtonBox *);
38 psppire_button_box_get_type (void)
40 static GType buttonbox_type = 0;
44 static const GTypeInfo buttonbox_info =
46 sizeof (PsppireButtonBoxClass),
48 NULL, /* base_finalize */
49 (GClassInitFunc) psppire_buttonbox_class_init,
50 NULL, /* class_finalize */
51 NULL, /* class_data */
52 sizeof (PsppireButtonBox),
54 (GInstanceInitFunc) psppire_buttonbox_init,
57 buttonbox_type = g_type_register_static (GTK_TYPE_VBUTTON_BOX,
58 "PsppireButtonBox", &buttonbox_info, 0);
61 return buttonbox_type;
65 psppire_buttonbox_class_init (PsppireButtonBoxClass *class)
70 close_dialog (GtkWidget *w, gpointer data)
72 PsppireDialog *dialog;
74 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
76 dialog->response = GTK_RESPONSE_CANCEL;
78 psppire_dialog_close (dialog);
82 ok_button_clicked (GtkWidget *w, gpointer data)
84 PsppireDialog *dialog;
86 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
88 dialog->response = GTK_RESPONSE_OK;
90 psppire_dialog_close (dialog);
95 paste_button_clicked (GtkWidget *w, gpointer data)
97 PsppireDialog *dialog;
99 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
101 dialog->response = PSPPIRE_RESPONSE_PASTE;
103 psppire_dialog_close (dialog);
108 refresh_clicked (GtkWidget *w, gpointer data)
110 PsppireDialog *dialog;
112 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
114 psppire_dialog_reload (dialog, data);
119 psppire_buttonbox_init (PsppireButtonBox *buttonbox)
123 button = gtk_button_new_from_stock (GTK_STOCK_OK);
124 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
125 g_signal_connect (button, "clicked", G_CALLBACK (ok_button_clicked), NULL);
126 gtk_widget_show (button);
128 button = gtk_button_new_with_mnemonic (_("_Paste"));
129 g_signal_connect (button, "clicked", G_CALLBACK (paste_button_clicked),
131 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
132 gtk_widget_show (button);
134 button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
135 g_signal_connect (button, "clicked", G_CALLBACK (close_dialog), NULL);
136 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
137 gtk_widget_show (button);
139 button = gtk_button_new_from_stock (GTK_STOCK_REFRESH);
140 g_signal_connect (button, "clicked", G_CALLBACK (refresh_clicked), NULL);
141 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
142 gtk_widget_show (button);
144 button = gtk_button_new_from_stock (GTK_STOCK_HELP);
145 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
146 gtk_widget_show (button);
148 gtk_widget_show (GTK_WIDGET (buttonbox));
153 psppire_buttonbox_new (void)
155 PsppireButtonBox *buttonbox ;
157 buttonbox = g_object_new (psppire_button_box_get_type (), NULL);
159 return GTK_WIDGET (buttonbox) ;