1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2008, 2009 Free Software Foundation
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include <gtk/gtksignal.h>
20 #include <gtk/gtkbox.h>
24 #include "text-data-import-dialog.h"
27 #include <ui/syntax-gen.h>
28 #include <language/syntax-string-source.h>
29 #include <libpspp/message.h>
32 #include <data/procedure.h>
35 #include "psppire-window.h"
36 #include "psppire-data-window.h"
37 #include "psppire-syntax-window.h"
41 #include "goto-case-dialog.h"
42 #include "weight-cases-dialog.h"
43 #include "split-file-dialog.h"
44 #include "transpose-dialog.h"
45 #include "sort-cases-dialog.h"
46 #include "select-cases-dialog.h"
47 #include "compute-dialog.h"
48 #include "find-dialog.h"
49 #include "rank-dialog.h"
50 #include "recode-dialog.h"
51 #include "comments-dialog.h"
52 #include "variable-info-dialog.h"
53 #include "descriptives-dialog.h"
54 #include "crosstabs-dialog.h"
55 #include "frequencies-dialog.h"
56 #include "examine-dialog.h"
57 #include "regression-dialog.h"
58 #include "reliability-dialog.h"
59 #include "oneway-anova-dialog.h"
60 #include "t-test-independent-samples-dialog.h"
61 #include "t-test-one-sample.h"
62 #include "t-test-paired-samples.h"
66 #define _(msgid) gettext (msgid)
67 #define N_(msgid) msgid
71 static void psppire_data_window_base_finalize (PsppireDataWindowClass *, gpointer);
72 static void psppire_data_window_base_init (PsppireDataWindowClass *class);
73 static void psppire_data_window_class_init (PsppireDataWindowClass *class);
74 static void psppire_data_window_init (PsppireDataWindow *data_editor);
77 static void psppire_data_window_iface_init (PsppireWindowIface *iface);
81 psppire_data_window_get_type (void)
83 static GType psppire_data_window_type = 0;
85 if (!psppire_data_window_type)
87 static const GTypeInfo psppire_data_window_info =
89 sizeof (PsppireDataWindowClass),
90 (GBaseInitFunc) psppire_data_window_base_init,
91 (GBaseFinalizeFunc) psppire_data_window_base_finalize,
92 (GClassInitFunc)psppire_data_window_class_init,
93 (GClassFinalizeFunc) NULL,
95 sizeof (PsppireDataWindow),
97 (GInstanceInitFunc) psppire_data_window_init,
100 static const GInterfaceInfo window_interface_info =
102 (GInterfaceInitFunc) psppire_data_window_iface_init,
107 psppire_data_window_type =
108 g_type_register_static (PSPPIRE_TYPE_WINDOW, "PsppireDataWindow",
109 &psppire_data_window_info, 0);
112 g_type_add_interface_static (psppire_data_window_type,
113 PSPPIRE_TYPE_WINDOW_MODEL,
114 &window_interface_info);
117 return psppire_data_window_type;
120 static GObjectClass *parent_class ;
123 psppire_data_window_finalize (GObject *object)
125 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (object);
127 g_object_unref (de->builder);
129 if (G_OBJECT_CLASS (parent_class)->finalize)
130 (*G_OBJECT_CLASS (parent_class)->finalize) (object);
135 psppire_data_window_class_init (PsppireDataWindowClass *class)
137 parent_class = g_type_class_peek_parent (class);
142 psppire_data_window_base_init (PsppireDataWindowClass *class)
144 GObjectClass *object_class = G_OBJECT_CLASS (class);
146 object_class->finalize = psppire_data_window_finalize;
152 psppire_data_window_base_finalize (PsppireDataWindowClass *class,
161 extern PsppireVarStore *the_var_store;
162 extern struct dataset *the_dataset;
163 extern PsppireDataStore *the_data_store ;
165 extern GtkRecentManager *the_recent_mgr;
168 set_paste_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
170 GtkAction *edit_paste = get_action_assert (de->builder, "edit_paste");
172 gtk_action_set_sensitive (edit_paste, x);
176 set_cut_copy_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
178 GtkAction *edit_copy = get_action_assert (de->builder, "edit_copy");
179 GtkAction *edit_cut = get_action_assert (de->builder, "edit_cut");
181 gtk_action_set_sensitive (edit_copy, x);
182 gtk_action_set_sensitive (edit_cut, x);
185 /* Run the EXECUTE command. */
187 execute (GtkMenuItem *mi, gpointer data)
189 struct getl_interface *sss = create_syntax_string_source ("EXECUTE.");
191 execute_syntax (sss);
195 transformation_change_callback (bool transformations_pending,
198 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
200 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
202 GtkWidget *menuitem =
203 gtk_ui_manager_get_widget (uim,"/ui/menubar/transform/transform_run-pending");
205 GtkWidget *status_label =
206 get_widget_assert (de->builder, "case-counter-area");
208 gtk_widget_set_sensitive (menuitem, transformations_pending);
211 if ( transformations_pending)
212 gtk_label_set_text (GTK_LABEL (status_label),
213 _("Transformations Pending"));
215 gtk_label_set_text (GTK_LABEL (status_label), "");
218 /* Callback for when the dictionary changes its filter variable */
220 on_filter_change (GObject *o, gint filter_index, gpointer data)
222 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
224 GtkWidget *filter_status_area =
225 get_widget_assert (de->builder, "filter-use-status-area");
227 if ( filter_index == -1 )
229 gtk_label_set_text (GTK_LABEL (filter_status_area), _("Filter off"));
233 PsppireVarStore *vs = NULL;
234 PsppireDict *dict = NULL;
235 struct variable *var ;
238 g_object_get (de->data_editor, "var-store", &vs, NULL);
239 g_object_get (vs, "dictionary", &dict, NULL);
241 var = psppire_dict_get_variable (dict, filter_index);
243 text = g_strdup_printf (_("Filter by %s"), var_get_name (var));
245 gtk_label_set_text (GTK_LABEL (filter_status_area), text);
251 /* Callback for when the dictionary changes its split variables */
253 on_split_change (PsppireDict *dict, gpointer data)
255 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
257 size_t n_split_vars = dict_get_split_cnt (dict->dict);
259 GtkWidget *split_status_area =
260 get_widget_assert (de->builder, "split-file-status-area");
262 if ( n_split_vars == 0 )
264 gtk_label_set_text (GTK_LABEL (split_status_area), _("No Split"));
270 const struct variable *const * split_vars =
271 dict_get_split_vars (dict->dict);
273 text = g_string_new (_("Split by "));
275 for (i = 0 ; i < n_split_vars - 1; ++i )
277 g_string_append_printf (text, "%s, ", var_get_name (split_vars[i]));
279 g_string_append (text, var_get_name (split_vars[i]));
281 gtk_label_set_text (GTK_LABEL (split_status_area), text->str);
283 g_string_free (text, TRUE);
290 /* Callback for when the dictionary changes its weights */
292 on_weight_change (GObject *o, gint weight_index, gpointer data)
294 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
296 GtkWidget *weight_status_area =
297 get_widget_assert (de->builder, "weight-status-area");
299 if ( weight_index == -1 )
301 gtk_label_set_text (GTK_LABEL (weight_status_area), _("Weights off"));
305 struct variable *var ;
306 PsppireVarStore *vs = NULL;
307 PsppireDict *dict = NULL;
310 g_object_get (de->data_editor, "var-store", &vs, NULL);
311 g_object_get (vs, "dictionary", &dict, NULL);
313 var = psppire_dict_get_variable (dict, weight_index);
315 text = g_strdup_printf (_("Weight by %s"), var_get_name (var));
317 gtk_label_set_text (GTK_LABEL (weight_status_area), text);
325 dump_rm (GtkRecentManager *rm)
327 GList *items = gtk_recent_manager_get_items (rm);
331 g_print ("Recent Items:\n");
332 for (i = items; i; i = i->next)
334 GtkRecentInfo *ri = i->data;
336 g_print ("Item: %s (Mime: %s) (Desc: %s) (URI: %s)\n",
337 gtk_recent_info_get_short_name (ri),
338 gtk_recent_info_get_mime_type (ri),
339 gtk_recent_info_get_description (ri),
340 gtk_recent_info_get_uri (ri)
344 gtk_recent_info_unref (ri);
353 load_file (PsppireWindow *de, const gchar *file_name)
355 gchar *native_file_name;
356 struct getl_interface *sss;
357 struct string filename;
359 ds_init_empty (&filename);
362 convert_glib_filename_to_system_filename (file_name, NULL);
364 syntax_gen_string (&filename, ss_cstr (native_file_name));
366 g_free (native_file_name);
368 sss = create_syntax_string_source ("GET FILE=%s.",
369 ds_cstr (&filename));
371 ds_destroy (&filename);
373 if (execute_syntax (sss) )
380 sysfile_chooser_dialog (PsppireWindow *toplevel)
383 gtk_file_chooser_dialog_new (_("Open"),
384 GTK_WINDOW (toplevel),
385 GTK_FILE_CHOOSER_ACTION_OPEN,
386 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
387 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
390 GtkFileFilter *filter = gtk_file_filter_new ();
391 gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
392 gtk_file_filter_add_pattern (filter, "*.sav");
393 gtk_file_filter_add_pattern (filter, "*.SAV");
394 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
396 filter = gtk_file_filter_new ();
397 gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
398 gtk_file_filter_add_pattern (filter, "*.por");
399 gtk_file_filter_add_pattern (filter, "*.POR");
400 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
402 filter = gtk_file_filter_new ();
403 gtk_file_filter_set_name (filter, _("All Files"));
404 gtk_file_filter_add_pattern (filter, "*");
405 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
409 gchar *filename = NULL;
410 g_object_get (toplevel, "filename", &filename, NULL);
412 if ( ! g_path_is_absolute (filename))
415 g_build_filename (g_get_current_dir (), filename, NULL);
416 dir_name = g_path_get_dirname (path);
421 dir_name = g_path_get_dirname (filename);
423 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
431 /* Callback for the data_open action.
432 Prompts for a filename and opens it */
434 open_data_dialog (GtkAction *action, PsppireWindow *de)
436 GtkWidget *dialog = sysfile_chooser_dialog (de);
438 switch (gtk_dialog_run (GTK_DIALOG (dialog)))
440 case GTK_RESPONSE_ACCEPT:
443 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
445 psppire_window_load (de, name);
454 gtk_widget_destroy (dialog);
457 /* Returns true if NAME has a suffix which might denote a PSPP file */
459 name_has_suffix (const gchar *name)
461 if ( g_str_has_suffix (name, ".sav"))
463 if ( g_str_has_suffix (name, ".SAV"))
465 if ( g_str_has_suffix (name, ".por"))
467 if ( g_str_has_suffix (name, ".POR"))
474 /* Save DE to file */
476 save_file (PsppireWindow *w)
478 gchar *native_file_name = NULL;
479 gchar *file_name = NULL;
481 struct getl_interface *sss;
482 struct string filename ;
483 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (w);
485 g_object_get (w, "filename", &file_name, NULL);
487 fnx = g_string_new (file_name);
489 if ( ! name_has_suffix (fnx->str))
491 if ( de->save_as_portable)
492 g_string_append (fnx, ".por");
494 g_string_append (fnx, ".sav");
497 ds_init_empty (&filename);
500 convert_glib_filename_to_system_filename (fnx->str, NULL);
502 g_string_free (fnx, TRUE);
504 syntax_gen_string (&filename, ss_cstr (native_file_name));
505 g_free (native_file_name);
507 if ( de->save_as_portable )
509 sss = create_syntax_string_source ("EXPORT OUTFILE=%s.",
510 ds_cstr (&filename));
514 sss = create_syntax_string_source ("SAVE OUTFILE=%s.",
515 ds_cstr (&filename));
518 ds_destroy (&filename);
520 execute_syntax (sss);
525 insert_case (GtkAction *action, gpointer data)
527 PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (data);
528 psppire_data_editor_insert_case (dw->data_editor);
532 on_insert_variable (GtkAction *action, gpointer data)
534 PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
535 psppire_data_editor_insert_variable (de);
540 display_dict (PsppireDataWindow *de)
543 struct getl_interface *sss =
544 create_syntax_string_source ("DISPLAY DICTIONARY.");
546 execute_syntax (sss);
550 sysfile_info (PsppireDataWindow *de)
552 GtkWidget *dialog = sysfile_chooser_dialog (PSPPIRE_WINDOW (de));
554 if ( GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog)))
556 struct string filename;
557 struct getl_interface *sss;
559 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
561 gchar *native_file_name =
562 convert_glib_filename_to_system_filename (file_name, NULL);
564 ds_init_empty (&filename);
566 syntax_gen_string (&filename, ss_cstr (native_file_name));
568 g_free (native_file_name);
570 sss = create_syntax_string_source ("SYSFILE INFO %s.",
571 ds_cstr (&filename));
572 execute_syntax (sss);
575 gtk_widget_destroy (dialog);
579 /* Callback for data_save_as action. Prompt for a filename and save */
581 data_save_as_dialog (PsppireDataWindow *de)
583 GtkWidget *button_sys;
585 gtk_file_chooser_dialog_new (_("Save"),
587 GTK_FILE_CHOOSER_ACTION_SAVE,
588 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
589 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
592 GtkFileFilter *filter = gtk_file_filter_new ();
593 gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
594 gtk_file_filter_add_pattern (filter, "*.sav");
595 gtk_file_filter_add_pattern (filter, "*.SAV");
596 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
598 filter = gtk_file_filter_new ();
599 gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
600 gtk_file_filter_add_pattern (filter, "*.por");
601 gtk_file_filter_add_pattern (filter, "*.POR");
602 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
604 filter = gtk_file_filter_new ();
605 gtk_file_filter_set_name (filter, _("All Files"));
606 gtk_file_filter_add_pattern (filter, "*");
607 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
610 GtkWidget *button_por;
611 GtkWidget *vbox = gtk_vbox_new (TRUE, 5);
613 gtk_radio_button_new_with_label (NULL, _("System File"));
616 gtk_radio_button_new_with_label
617 (gtk_radio_button_get_group (GTK_RADIO_BUTTON(button_sys)),
620 gtk_box_pack_start_defaults (GTK_BOX (vbox), button_sys);
621 gtk_box_pack_start_defaults (GTK_BOX (vbox), button_por);
623 gtk_widget_show_all (vbox);
625 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), vbox);
628 switch (gtk_dialog_run (GTK_DIALOG (dialog)))
630 case GTK_RESPONSE_ACCEPT:
635 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog))
638 de->save_as_portable =
639 ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_sys));
641 if ( ! name_has_suffix (filename->str))
643 if ( de->save_as_portable)
644 g_string_append (filename, ".por");
646 g_string_append (filename, ".sav");
649 psppire_window_set_filename (PSPPIRE_WINDOW (de), filename->str);
651 save_file (PSPPIRE_WINDOW (de));
653 g_string_free (filename, TRUE);
660 gtk_widget_destroy (dialog);
664 /* Callback for data_save action.
667 data_save (PsppireWindow *de)
669 const gchar *fn = psppire_window_get_filename (de);
672 psppire_window_save (de);
674 data_save_as_dialog (PSPPIRE_DATA_WINDOW (de));
678 /* Callback for data_new action.
679 Performs the NEW FILE command */
681 new_file (GtkAction *action, PsppireDataWindow *de)
683 struct getl_interface *sss =
684 create_syntax_string_source ("NEW FILE.");
686 execute_syntax (sss);
688 psppire_window_set_filename (PSPPIRE_WINDOW (de), NULL);
694 on_edit_paste (GtkAction *a, gpointer data)
696 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
698 psppire_data_editor_clip_paste (de->data_editor);
702 on_edit_copy (GtkMenuItem *m, gpointer data)
704 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
706 psppire_data_editor_clip_copy (de->data_editor);
712 on_edit_cut (GtkMenuItem *m, gpointer data)
714 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
716 psppire_data_editor_clip_cut (de->data_editor);
721 status_bar_activate (GtkToggleAction *action, gpointer data)
723 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
724 GtkWidget *statusbar = get_widget_assert (de->builder, "status-bar");
726 if ( gtk_toggle_action_get_active (action) )
727 gtk_widget_show (statusbar);
729 gtk_widget_hide (statusbar);
734 grid_lines_activate (GtkToggleAction *action, gpointer data)
736 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
737 const gboolean grid_visible = gtk_toggle_action_get_active (action);
739 psppire_data_editor_show_grid (de->data_editor, grid_visible);
743 data_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
745 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
747 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
752 variable_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
754 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
756 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
761 fonts_activate (GtkMenuItem *menuitem, gpointer data)
763 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
764 GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (de));
765 PangoFontDescription *current_font;
768 gtk_font_selection_dialog_new (_("Font Selection"));
771 current_font = GTK_WIDGET(de->data_editor)->style->font_desc;
772 font_name = pango_font_description_to_string (current_font);
774 gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (dialog), font_name);
778 gtk_window_set_transient_for (GTK_WINDOW (dialog),
779 GTK_WINDOW (toplevel));
781 if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) )
783 const gchar *font = gtk_font_selection_dialog_get_font_name
784 (GTK_FONT_SELECTION_DIALOG (dialog));
786 PangoFontDescription* font_desc =
787 pango_font_description_from_string (font);
789 psppire_data_editor_set_font (de->data_editor, font_desc);
792 gtk_widget_hide (dialog);
797 /* Callback for the value labels action */
799 toggle_value_labels (GtkToggleAction *ta, gpointer data)
801 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
803 g_object_set (de->data_editor, "value-labels", gtk_toggle_action_get_active (ta), NULL);
807 toggle_split_window (GtkToggleAction *ta, gpointer data)
809 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
811 psppire_data_editor_split_window (de->data_editor,
812 gtk_toggle_action_get_active (ta));
817 file_quit (GtkCheckMenuItem *menuitem, gpointer data)
819 /* FIXME: Need to be more intelligent here.
820 Give the user the opportunity to save any unsaved data.
822 g_object_unref (the_data_store);
830 create_data_sheet_variable_popup_menu (PsppireDataWindow *de)
832 GtkWidget *menu = gtk_menu_new ();
834 GtkWidget *sort_ascending =
835 gtk_action_create_menu_item (gtk_action_new ("sort-up",
838 "gtk-sort-ascending"));
840 GtkWidget *sort_descending =
841 gtk_action_create_menu_item (gtk_action_new ("sort-down",
842 _("Sort Descending"),
844 "gtk-sort-descending"));
846 GtkWidget *insert_variable =
847 gtk_menu_item_new_with_label (_("Insert Variable"));
849 GtkWidget *clear_variable =
850 gtk_menu_item_new_with_label (_("Clear"));
853 gtk_action_connect_proxy (de->delete_variables,
857 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
860 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
861 gtk_separator_menu_item_new ());
864 gtk_menu_shell_append (GTK_MENU_SHELL (menu), clear_variable);
867 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
868 gtk_separator_menu_item_new ());
871 gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_ascending);
874 g_signal_connect_swapped (sort_ascending, "activate",
875 G_CALLBACK (psppire_data_editor_sort_ascending),
878 g_signal_connect_swapped (sort_descending, "activate",
879 G_CALLBACK (psppire_data_editor_sort_descending),
882 g_signal_connect_swapped (insert_variable, "activate",
883 G_CALLBACK (gtk_action_activate),
884 de->insert_variable);
887 gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_descending);
889 gtk_widget_show_all (menu);
896 create_data_sheet_cases_popup_menu (PsppireDataWindow *de)
898 GtkWidget *menu = gtk_menu_new ();
900 GtkWidget *insert_case =
901 gtk_menu_item_new_with_label (_("Insert Case"));
903 GtkWidget *delete_case =
904 gtk_menu_item_new_with_label (_("Clear"));
907 gtk_action_connect_proxy (de->delete_cases,
911 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
913 g_signal_connect_swapped (insert_case, "activate",
914 G_CALLBACK (gtk_action_activate),
918 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
919 gtk_separator_menu_item_new ());
922 gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_case);
925 gtk_widget_show_all (menu);
932 create_var_sheet_variable_popup_menu (PsppireDataWindow *de)
934 GtkWidget *menu = gtk_menu_new ();
936 GtkWidget *insert_variable =
937 gtk_menu_item_new_with_label (_("Insert Variable"));
939 GtkWidget *delete_variable =
940 gtk_menu_item_new_with_label (_("Clear"));
943 gtk_action_connect_proxy (de->delete_variables,
947 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
949 g_signal_connect_swapped (insert_variable, "activate",
950 G_CALLBACK (gtk_action_activate),
951 de->insert_variable);
954 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
955 gtk_separator_menu_item_new ());
958 gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_variable);
961 gtk_widget_show_all (menu);
968 on_recent_data_select (GtkMenuShell *menushell,
969 PsppireWindow *window)
974 gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
976 file = g_filename_from_uri (uri, NULL, NULL);
980 psppire_window_load (window, file);
986 on_recent_files_select (GtkMenuShell *menushell, gpointer user_data)
993 gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
995 file = g_filename_from_uri (uri, NULL, NULL);
999 se = psppire_syntax_window_new ();
1001 if ( psppire_window_load (PSPPIRE_WINDOW (se), file) )
1002 gtk_widget_show (se);
1004 gtk_widget_destroy (se);
1011 enable_delete_cases (GtkWidget *w, gint case_num, gpointer data)
1013 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
1015 gtk_action_set_visible (de->delete_cases, case_num != -1);
1020 enable_delete_variables (GtkWidget *w, gint var, gpointer data)
1022 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
1024 gtk_action_set_visible (de->delete_variables, var != -1);
1027 /* Callback for when the datasheet/varsheet is selected */
1029 on_switch_sheet (GtkNotebook *notebook,
1030 GtkNotebookPage *page,
1034 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (user_data);
1036 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1038 GtkWidget *view_data =
1039 gtk_ui_manager_get_widget (uim,"/ui/menubar/view/view_data");
1041 GtkWidget *view_variables =
1042 gtk_ui_manager_get_widget (uim,"/ui/menubar/view/view_variables");
1046 case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
1047 gtk_widget_hide (view_variables);
1048 gtk_widget_show (view_data);
1049 gtk_action_set_sensitive (de->insert_variable, TRUE);
1050 gtk_action_set_sensitive (de->insert_case, FALSE);
1051 gtk_action_set_sensitive (de->invoke_goto_dialog, FALSE);
1053 case PSPPIRE_DATA_EDITOR_DATA_VIEW:
1054 gtk_widget_show (view_variables);
1055 gtk_widget_hide (view_data);
1056 gtk_action_set_sensitive (de->invoke_goto_dialog, TRUE);
1057 gtk_action_set_sensitive (de->insert_case, TRUE);
1060 g_assert_not_reached ();
1065 update_paste_menuitem (de, page_num);
1071 resolve_action (GtkBuilder *builder, const gchar *action, const gchar *proxy)
1073 GtkWidget *pr = NULL;
1074 GtkAction *act = get_action_assert (builder, action);
1075 g_assert (GTK_IS_ACTION (act));
1078 pr = get_widget_assert (builder, proxy);
1081 gtk_action_connect_proxy (act, pr);
1088 set_unsaved (gpointer w)
1090 psppire_window_set_unsaved (PSPPIRE_WINDOW (w));
1094 psppire_data_window_init (PsppireDataWindow *de)
1096 PsppireVarStore *vs;
1097 PsppireDict *dict = NULL;
1103 GtkWidget *box = gtk_vbox_new (FALSE, 0);
1104 de->builder = builder_new ("data-editor.ui");
1106 menubar = get_widget_assert (de->builder, "menubar");
1107 hb = get_widget_assert (de->builder, "handlebox1");
1108 sb = get_widget_assert (de->builder, "status-bar");
1111 PSPPIRE_DATA_EDITOR (psppire_data_editor_new (the_var_store, the_data_store));
1113 g_signal_connect_swapped (the_data_store, "case-changed",
1114 G_CALLBACK (set_unsaved), de);
1116 g_signal_connect_swapped (the_data_store, "case-inserted",
1117 G_CALLBACK (set_unsaved), de);
1119 g_signal_connect_swapped (the_data_store, "cases-deleted",
1120 G_CALLBACK (set_unsaved), de);
1122 dataset_set_callback (the_dataset, set_unsaved, de);
1124 connect_help (de->builder);
1126 gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0);
1127 gtk_box_pack_start (GTK_BOX (box), hb, FALSE, TRUE, 0);
1128 gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (de->data_editor), TRUE, TRUE, 0);
1129 gtk_box_pack_start (GTK_BOX (box), sb, FALSE, TRUE, 0);
1131 gtk_container_add (GTK_CONTAINER (de), box);
1133 set_cut_copy_menuitem_sensitivity (de, FALSE);
1135 g_signal_connect_swapped (de->data_editor, "data-selection-changed",
1136 G_CALLBACK (set_cut_copy_menuitem_sensitivity), de);
1139 set_paste_menuitem_sensitivity (de, FALSE);
1141 g_signal_connect_swapped (de->data_editor, "data-available-changed",
1142 G_CALLBACK (set_paste_menuitem_sensitivity), de);
1144 dataset_add_transform_change_callback (the_dataset,
1145 transformation_change_callback,
1151 g_assert(vs); /* Traps a possible bug in w32 build */
1153 g_object_get (vs, "dictionary", &dict, NULL);
1155 g_signal_connect (dict, "weight-changed",
1156 G_CALLBACK (on_weight_change),
1159 g_signal_connect (dict, "filter-changed",
1160 G_CALLBACK (on_filter_change),
1163 g_signal_connect (dict, "split-changed",
1164 G_CALLBACK (on_split_change),
1168 g_signal_connect (get_action_assert (de->builder, "edit_copy"),
1170 G_CALLBACK (on_edit_copy), de);
1172 g_signal_connect (get_action_assert (de->builder, "edit_cut"),
1174 G_CALLBACK (on_edit_cut), de);
1179 GtkWidget *toolbarbutton = get_widget_assert (de->builder, "button-open");
1181 GtkAction *action_data_open =
1182 resolve_action (de->builder, "file_open_data", NULL);
1184 g_object_set (action_data_open,
1185 "tooltip", _("Open a data file"),
1186 "stock-id", "gtk-open",
1189 g_signal_connect (action_data_open, "activate",
1190 G_CALLBACK (open_data_dialog), de);
1192 g_signal_connect_swapped (toolbarbutton, "clicked",
1193 G_CALLBACK (gtk_action_activate), action_data_open);
1199 GtkAction *action_data_new =
1200 resolve_action (de->builder, "file_new_data", NULL);
1202 g_object_set (action_data_new,
1203 "tooltip", _("New data file"),
1204 "stock-id", "gtk-new",
1207 g_signal_connect (action_data_new, "activate",
1208 G_CALLBACK (new_file), de);
1214 GtkAction *invoke_text_import_assistant =
1215 resolve_action (de->builder, "file_import-text", NULL);
1217 g_object_set (invoke_text_import_assistant,
1218 "tooltip", _("Import text data file"),
1219 "stock-id", "gtk-convert",
1222 g_signal_connect (invoke_text_import_assistant, "activate",
1223 G_CALLBACK (text_data_import_assistant), de);
1229 GtkAction *action_data_save =
1230 resolve_action (de->builder, "file_save", "button-save");
1233 g_object_set (action_data_save,
1234 "tooltip", _("Save data to file"),
1235 "stock-id", "gtk-save",
1238 g_signal_connect_swapped (action_data_save, "activate",
1239 G_CALLBACK (data_save), de);
1246 GtkAction *action_data_save_as =
1247 resolve_action (de->builder, "file_save_as", NULL);
1249 g_object_set (action_data_save_as,
1250 "label", _("Save As"),
1251 "tooltip", _("Save data to file"),
1252 "stock-id", "gtk-save-as",
1255 g_signal_connect_swapped (action_data_save_as, "activate",
1256 G_CALLBACK (data_save_as_dialog), de);
1261 GtkAction *action_info_working_file =
1262 resolve_action (de->builder,
1263 "file_information_working-file", NULL);
1266 g_signal_connect_swapped (action_info_working_file, "activate",
1267 G_CALLBACK (display_dict), de);
1272 GtkAction *action_info_external_file =
1273 resolve_action (de->builder,
1274 "file_information_external-file", NULL);
1277 g_signal_connect_swapped (action_info_external_file, "activate",
1278 G_CALLBACK (sysfile_info), de);
1284 GtkAction *value_labels_action =
1285 resolve_action (de->builder,
1286 "view_value-labels", "togglebutton-value-labels");
1288 g_object_set (value_labels_action,
1289 "tooltip", _("Show/hide value labels"),
1290 "stock-id", "pspp-value-labels",
1293 g_signal_connect (value_labels_action, "toggled",
1294 G_CALLBACK (toggle_value_labels), de);
1298 g_signal_connect (get_action_assert (de->builder, "edit_paste"), "activate",
1299 G_CALLBACK (on_edit_paste),
1304 resolve_action (de->builder, "edit_clear-cases", NULL);
1307 g_object_set (de->delete_cases,
1308 "label", _("Clear"),
1309 "tooltip", _("Delete the cases at the selected position(s)"),
1310 "stock-id", "gtk-clear",
1313 g_signal_connect_swapped (de->delete_cases, "activate",
1314 G_CALLBACK (psppire_data_editor_delete_cases),
1317 gtk_action_set_visible (de->delete_cases, FALSE);
1322 de->delete_variables =
1323 resolve_action (de->builder, "edit_clear-variables", NULL);
1325 g_object_set (de->delete_variables,
1326 "label", _("Clear"),
1327 "tooltip", _("Delete the variables at the selected position(s)"),
1328 "stock-id", "gtk-clear",
1332 g_signal_connect_swapped (de->delete_variables, "activate",
1333 G_CALLBACK (psppire_data_editor_delete_variables),
1336 gtk_action_set_visible (de->delete_variables, FALSE);
1340 de->insert_variable =
1341 resolve_action (de->builder, "edit_insert-variable",
1342 "button-insert-variable");
1344 g_object_set (de->insert_variable,
1345 "tooltip", _("Create a new variable at the current position"),
1346 "stock-id", "pspp-insert-variable",
1349 g_signal_connect (de->insert_variable, "activate",
1350 G_CALLBACK (on_insert_variable), de->data_editor);
1357 resolve_action (de->builder, "edit_insert-case", "button-insert-case");
1359 g_object_set (de->insert_case,
1360 "tooltip", _("Create a new case at the current position"),
1361 "stock-id", "pspp-insert-case",
1364 g_signal_connect (de->insert_case, "activate",
1365 G_CALLBACK (insert_case), de);
1371 de->invoke_goto_dialog =
1372 resolve_action (de->builder, "edit_goto-case", "button-goto-case");
1375 g_object_set (de->invoke_goto_dialog,
1376 "tooltip", _("Jump to a Case in the Data Sheet"),
1377 "stock-id", "gtk-jump-to",
1380 g_signal_connect (de->invoke_goto_dialog, "activate",
1381 G_CALLBACK (goto_case_dialog), de);
1386 GtkAction *invoke_weight_cases_dialog =
1387 resolve_action (de->builder, "data_weight-cases", "button-weight-cases");
1390 g_object_set (invoke_weight_cases_dialog,
1391 "stock-id", "pspp-weight-cases",
1392 "tooltip", _("Weight cases by variable"),
1395 g_signal_connect (invoke_weight_cases_dialog, "activate",
1396 G_CALLBACK (weight_cases_dialog), de);
1401 GtkAction *invoke_transpose_dialog =
1402 resolve_action (de->builder, "data_transpose", NULL);
1405 g_object_set (invoke_transpose_dialog,
1406 "tooltip", _("Transpose the cases with the variables"),
1407 "stock-id", "pspp-transpose",
1410 g_signal_connect (invoke_transpose_dialog, "activate",
1411 G_CALLBACK (transpose_dialog), de);
1416 GtkAction *invoke_split_file_dialog =
1417 resolve_action (de->builder, "data_split-file", "button-split-file");
1419 g_object_set (invoke_split_file_dialog,
1420 "tooltip", _("Split the active file"),
1421 "stock-id", "pspp-split-file",
1424 g_signal_connect (invoke_split_file_dialog, "activate",
1425 G_CALLBACK (split_file_dialog), de);
1430 GtkAction *invoke_sort_cases_dialog =
1431 resolve_action (de->builder, "data_sort-cases", NULL);
1434 g_object_set (invoke_sort_cases_dialog,
1435 "tooltip", _("Sort cases in the active file"),
1436 "stock-id", "gtk-sort-ascending",
1439 g_signal_connect (invoke_sort_cases_dialog, "activate",
1440 G_CALLBACK (sort_cases_dialog), de);
1445 GtkAction *invoke_select_cases_dialog =
1446 resolve_action (de->builder, "data_select-cases", "button-select-cases");
1448 g_object_set (invoke_select_cases_dialog,
1449 "tooltip", _("Select cases from the active file"),
1450 "stock-id", "pspp-select-cases",
1453 g_signal_connect (invoke_select_cases_dialog, "activate",
1454 G_CALLBACK (select_cases_dialog), de);
1459 GtkAction *invoke_compute_dialog =
1460 resolve_action (de->builder, "transform_compute", NULL);
1462 g_object_set (invoke_compute_dialog,
1463 "tooltip", _("Compute new values for a variable"),
1464 "stock-id", "pspp-compute",
1467 g_signal_connect (invoke_compute_dialog, "activate",
1468 G_CALLBACK (compute_dialog), de);
1473 GtkAction *invoke_oneway_anova_dialog =
1474 resolve_action (de->builder, "oneway-anova", NULL);
1476 g_object_set (invoke_oneway_anova_dialog,
1477 "tooltip", _("Perform one way analysis of variance"),
1480 g_signal_connect (invoke_oneway_anova_dialog, "activate",
1481 G_CALLBACK (oneway_anova_dialog), de);
1486 GtkAction *invoke_t_test_independent_samples_dialog =
1487 resolve_action (de->builder, "indep-t-test", NULL);
1490 g_object_set (invoke_t_test_independent_samples_dialog,
1492 _("Calculate T Test for samples from independent groups"),
1495 g_signal_connect (invoke_t_test_independent_samples_dialog, "activate",
1496 G_CALLBACK (t_test_independent_samples_dialog), de);
1501 GtkAction *invoke_t_test_paired_samples_dialog =
1502 resolve_action (de->builder, "paired-t-test", NULL);
1504 g_object_set (invoke_t_test_paired_samples_dialog,
1506 _("Calculate T Test for paired samples"),
1509 g_signal_connect (invoke_t_test_paired_samples_dialog, "activate",
1510 G_CALLBACK (t_test_paired_samples_dialog), de);
1515 GtkAction *invoke_t_test_one_sample_dialog =
1516 resolve_action (de->builder, "one-sample-t-test", NULL);
1518 g_object_set (invoke_t_test_one_sample_dialog,
1520 _("Calculate T Test for sample from a single distribution"),
1523 g_signal_connect (invoke_t_test_one_sample_dialog, "activate",
1524 G_CALLBACK (t_test_one_sample_dialog), de);
1529 GtkAction *invoke_comments_dialog =
1530 resolve_action (de->builder, "utilities_comments", NULL);
1533 g_object_set (invoke_comments_dialog,
1535 _("Commentary text for the data file"),
1538 g_signal_connect (invoke_comments_dialog, "activate",
1539 G_CALLBACK (comments_dialog), de);
1545 GtkAction *invoke_find_dialog =
1546 resolve_action (de->builder, "edit_find", "button-find");
1548 g_object_set (invoke_find_dialog, "stock-id", "gtk-find", NULL);
1550 g_signal_connect (invoke_find_dialog, "activate",
1551 G_CALLBACK (find_dialog), de);
1556 GtkAction *invoke_rank_dialog =
1557 resolve_action (de->builder, "transform_rank", NULL);
1559 g_object_set (invoke_rank_dialog,
1560 "stock-id", "pspp-rank-cases",
1561 "tooltip", _("Rank Cases"),
1564 g_signal_connect (invoke_rank_dialog, "activate",
1565 G_CALLBACK (rank_dialog), de);
1570 GtkAction *invoke_recode_same_dialog =
1571 resolve_action (de->builder, "transform_recode-same", NULL);
1573 g_object_set (invoke_recode_same_dialog,
1574 "stock-id", "pspp-recode-same",
1575 "tooltip", _("Recode values into the same variables"),
1578 g_signal_connect (invoke_recode_same_dialog, "activate",
1579 G_CALLBACK (recode_same_dialog), de);
1584 GtkAction *invoke_recode_different_dialog =
1585 resolve_action (de->builder, "transform_recode-different", NULL);
1587 g_object_set (invoke_recode_different_dialog,
1588 "stock-id", "pspp-recode-different",
1589 "tooltip", _("Recode values into different variables"),
1592 g_signal_connect (invoke_recode_different_dialog, "activate",
1593 G_CALLBACK (recode_different_dialog), de);
1598 GtkAction *invoke_variable_info_dialog =
1599 resolve_action (de->builder, "utilities_variables", "button-goto-variable");
1601 g_object_set (invoke_variable_info_dialog,
1602 "stock-id", "pspp-goto-variable",
1603 "tooltip", _("Jump to variable"),
1606 g_signal_connect (invoke_variable_info_dialog, "activate",
1607 G_CALLBACK (variable_info_dialog), de);
1612 GtkAction *invoke_descriptives_dialog =
1613 resolve_action (de->builder, "analyze_descriptives", NULL);
1615 g_object_set (invoke_descriptives_dialog,
1616 "tooltip", _("Calculate descriptive statistics (mean, variance, ...)"),
1617 "stock-id", "pspp-descriptives",
1620 g_signal_connect (invoke_descriptives_dialog, "activate",
1621 G_CALLBACK (descriptives_dialog), de);
1626 GtkAction *invoke_frequencies_dialog =
1627 resolve_action (de->builder, "analyze_frequencies", NULL);
1629 g_object_set (invoke_frequencies_dialog,
1630 "tooltip", _("Generate frequency statistics"),
1631 "stock-id", "pspp-frequencies",
1634 g_signal_connect (invoke_frequencies_dialog, "activate",
1635 G_CALLBACK (frequencies_dialog), de);
1640 GtkAction *invoke_crosstabs_dialog =
1641 resolve_action (de->builder, "crosstabs", NULL);
1643 g_object_set (invoke_crosstabs_dialog,
1644 "tooltip", _("Generate crosstabulations"),
1645 "stock-id", "pspp-crosstabs",
1648 g_signal_connect (invoke_crosstabs_dialog, "activate",
1649 G_CALLBACK (crosstabs_dialog), de);
1655 GtkAction *invoke_examine_dialog =
1656 resolve_action (de->builder, "analyze_explore", NULL);
1658 g_object_set (invoke_examine_dialog,
1659 "tooltip", _("Examine Data by Factors"),
1660 "stock-id", "pspp-examine",
1663 g_signal_connect (invoke_examine_dialog, "activate",
1664 G_CALLBACK (examine_dialog), de);
1669 GtkAction *invoke_regression_dialog =
1670 resolve_action (de->builder, "linear-regression", NULL);
1672 g_object_set (invoke_regression_dialog,
1673 "tooltip", _("Estimate parameters of the linear model"),
1674 "stock-id", "pspp-regression",
1678 g_signal_connect (invoke_regression_dialog, "activate",
1679 G_CALLBACK (regression_dialog), de);
1683 GtkAction *invoke_reliability_dialog =
1684 resolve_action (de->builder, "reliability", NULL);
1686 g_object_set (invoke_reliability_dialog,
1687 "tooltip", _("Reliability Analysis"),
1688 "stock-id", "pspp-reliability",
1692 g_signal_connect (invoke_reliability_dialog, "activate",
1693 G_CALLBACK (reliability_dialog), de);
1698 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1700 GtkWidget *recent_data =
1701 gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-data");
1703 GtkWidget *recent_files =
1704 gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-files");
1707 GtkWidget *menu_data =
1708 gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
1710 GtkWidget *menu_files =
1711 gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
1714 GtkRecentFilter *filter = gtk_recent_filter_new ();
1716 gtk_recent_filter_add_pattern (filter, "*.sav");
1717 gtk_recent_filter_add_pattern (filter, "*.SAV");
1718 gtk_recent_filter_add_pattern (filter, "*.por");
1719 gtk_recent_filter_add_pattern (filter, "*.POR");
1721 gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_data), GTK_RECENT_SORT_MRU);
1723 gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_data), filter);
1726 gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu_data);
1729 g_signal_connect (menu_data, "selection-done",
1730 G_CALLBACK (on_recent_data_select),
1734 GtkRecentFilter *filter = gtk_recent_filter_new ();
1736 gtk_recent_filter_add_pattern (filter, "*.sps");
1737 gtk_recent_filter_add_pattern (filter, "*.SPS");
1739 gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_files), GTK_RECENT_SORT_MRU);
1741 gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_files), filter);
1744 gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu_files);
1746 g_signal_connect (menu_files, "selection-done",
1747 G_CALLBACK (on_recent_files_select),
1752 g_signal_connect (get_action_assert (de->builder,"file_new_syntax"),
1754 G_CALLBACK (create_syntax_window),
1757 g_signal_connect (get_action_assert (de->builder,"file_open_syntax"),
1759 G_CALLBACK (open_syntax_window),
1763 GtkAction *abt = get_action_assert (de->builder, "help_about");
1764 g_object_set (abt, "stock-id", "gtk-about", NULL);
1765 g_signal_connect (abt,
1767 G_CALLBACK (about_new),
1772 g_signal_connect (get_action_assert (de->builder,"help_reference"),
1774 G_CALLBACK (reference_manual),
1778 g_signal_connect (de->data_editor,
1780 G_CALLBACK (enable_delete_cases),
1783 g_signal_connect (de->data_editor,
1784 "variables-selected",
1785 G_CALLBACK (enable_delete_variables),
1789 g_signal_connect (de->data_editor,
1791 G_CALLBACK (on_switch_sheet), de);
1793 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
1794 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
1796 g_signal_connect (get_action_assert (de->builder, "view_statusbar"),
1798 G_CALLBACK (status_bar_activate), de);
1801 g_signal_connect (get_action_assert (de->builder, "view_gridlines"),
1803 G_CALLBACK (grid_lines_activate), de);
1807 g_signal_connect (get_action_assert (de->builder, "view_data"),
1809 G_CALLBACK (data_view_activate), de);
1811 g_signal_connect (get_action_assert (de->builder, "view_variables"),
1813 G_CALLBACK (variable_view_activate), de);
1817 GtkAction *font_action =
1818 resolve_action (de->builder, "view_fonts", NULL);
1820 g_object_set (font_action,
1821 "stock-id", "gtk-select-font",
1824 g_signal_connect (font_action,
1826 G_CALLBACK (fonts_activate), de);
1831 g_signal_connect (get_action_assert (de->builder, "file_quit"),
1833 G_CALLBACK (file_quit), de);
1835 g_signal_connect (get_action_assert (de->builder, "transform_run-pending"),
1837 G_CALLBACK (execute), de);
1840 g_signal_connect (get_action_assert (de->builder, "windows_minimise_all"),
1842 G_CALLBACK (psppire_window_minimise_all), NULL);
1846 GtkAction *split_window_action =
1847 resolve_action (de->builder, "windows_split", NULL);
1849 g_object_set (split_window_action,
1850 "tooltip", _("Split the window vertically and horizontally"),
1851 "stock-id", "pspp-split-window",
1854 g_signal_connect (split_window_action, "toggled",
1855 G_CALLBACK (toggle_split_window),
1860 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1862 PSPPIRE_WINDOW (de)->menu =
1863 GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar/windows/windows_minimise_all")->parent);
1867 GtkMenu *data_sheet_variable_popup_menu =
1868 GTK_MENU (create_data_sheet_variable_popup_menu (de));
1870 GtkMenu *var_sheet_variable_popup_menu =
1871 GTK_MENU (create_var_sheet_variable_popup_menu (de));
1873 GtkMenu *data_sheet_cases_popup_menu =
1874 GTK_MENU (create_data_sheet_cases_popup_menu (de));
1876 g_object_set (de->data_editor,
1877 "datasheet-column-menu", data_sheet_variable_popup_menu,
1878 "datasheet-row-menu", data_sheet_cases_popup_menu,
1879 "varsheet-row-menu", var_sheet_variable_popup_menu,
1883 gtk_widget_show (GTK_WIDGET (de->data_editor));
1884 gtk_widget_show (box);
1889 psppire_data_window_new (void)
1891 return GTK_WIDGET (g_object_new (psppire_data_window_get_type (),
1892 "description", _("Data Editor"),
1902 psppire_data_window_iface_init (PsppireWindowIface *iface)
1904 iface->save = save_file;
1905 iface->load = load_file;