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
25 #include <gtk/gtksignal.h>
26 #include "psppire-buttonbox.h"
27 #include "psppire-dialog.h"
31 #define _(msgid) gettext (msgid)
32 #define N_(msgid) msgid
35 static void psppire_buttonbox_class_init (PsppireButtonBoxClass *);
36 static void psppire_buttonbox_init (PsppireButtonBox *);
40 psppire_button_box_get_type (void)
42 static GType buttonbox_type = 0;
46 static const GTypeInfo buttonbox_info =
48 sizeof (PsppireButtonBoxClass),
50 NULL, /* base_finalize */
51 (GClassInitFunc) psppire_buttonbox_class_init,
52 NULL, /* class_finalize */
53 NULL, /* class_data */
54 sizeof (PsppireButtonBox),
56 (GInstanceInitFunc) psppire_buttonbox_init,
59 buttonbox_type = g_type_register_static (GTK_TYPE_VBUTTON_BOX,
60 "PsppireButtonBox", &buttonbox_info, 0);
63 return buttonbox_type;
67 psppire_buttonbox_class_init (PsppireButtonBoxClass *class)
72 close_dialog (GtkWidget *w, gpointer data)
74 PsppireDialog *dialog;
76 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
78 dialog->response = GTK_RESPONSE_CANCEL;
80 psppire_dialog_close (dialog);
84 ok_button_clicked (GtkWidget *w, gpointer data)
86 PsppireDialog *dialog;
88 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
90 dialog->response = GTK_RESPONSE_OK;
92 psppire_dialog_close (dialog);
97 paste_button_clicked (GtkWidget *w, gpointer data)
99 PsppireDialog *dialog;
101 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
103 dialog->response = PSPPIRE_RESPONSE_PASTE;
105 psppire_dialog_close (dialog);
110 refresh_clicked (GtkWidget *w, gpointer data)
112 PsppireDialog *dialog;
114 dialog = PSPPIRE_DIALOG (gtk_widget_get_toplevel (w));
116 psppire_dialog_reload (dialog, data);
121 psppire_buttonbox_init (PsppireButtonBox *buttonbox)
125 button = gtk_button_new_from_stock (GTK_STOCK_OK);
126 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
127 g_signal_connect (button, "clicked", G_CALLBACK (ok_button_clicked), NULL);
128 gtk_widget_show (button);
130 button = gtk_button_new_with_mnemonic (_("_Paste"));
131 g_signal_connect (button, "clicked", G_CALLBACK (paste_button_clicked),
133 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
134 gtk_widget_show (button);
136 button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
137 g_signal_connect (button, "clicked", G_CALLBACK (close_dialog), NULL);
138 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
139 gtk_widget_show (button);
141 button = gtk_button_new_from_stock (GTK_STOCK_REFRESH);
142 g_signal_connect (button, "clicked", G_CALLBACK (refresh_clicked), NULL);
143 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
144 gtk_widget_show (button);
146 button = gtk_button_new_from_stock (GTK_STOCK_HELP);
147 gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
148 gtk_widget_show (button);
150 gtk_widget_show (GTK_WIDGET (buttonbox));
155 psppire_buttonbox_new (void)
157 PsppireButtonBox *buttonbox ;
159 buttonbox = g_object_new (psppire_button_box_get_type (), NULL);
161 return GTK_WIDGET (buttonbox) ;