/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2009 Free Software Foundation
+ Copyright (C) 2008, 2009, 2010 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
#include <gtk/gtksignal.h>
#include <gtk/gtkbox.h>
-#include "helper.h"
-
-#include "text-data-import-dialog.h"
-
-
-#include <ui/syntax-gen.h>
-#include <language/syntax-string-source.h>
-#include <libpspp/message.h>
#include <stdlib.h>
-#include <data/procedure.h>
-
-#include "psppire-data-window.h"
-#include "psppire-syntax-window.h"
-
-#include "about.h"
-
-#include "goto-case-dialog.h"
-#include "weight-cases-dialog.h"
-#include "split-file-dialog.h"
-#include "transpose-dialog.h"
-#include "sort-cases-dialog.h"
-#include "select-cases-dialog.h"
-#include "compute-dialog.h"
-#include "find-dialog.h"
-#include "rank-dialog.h"
-#include "recode-dialog.h"
-#include "comments-dialog.h"
-#include "variable-info-dialog.h"
-#include "descriptives-dialog.h"
-#include "crosstabs-dialog.h"
-#include "frequencies-dialog.h"
-#include "examine-dialog.h"
-#include "dict-display.h"
-#include "regression-dialog.h"
-#include "oneway-anova-dialog.h"
-#include "t-test-independent-samples-dialog.h"
-#include "t-test-one-sample.h"
-#include "t-test-paired-samples.h"
-
+#include "data/any-reader.h"
+#include "data/procedure.h"
+#include "language/syntax-string-source.h"
+#include "libpspp/message.h"
+#include "ui/gui/about.h"
+#include "ui/gui/comments-dialog.h"
+#include "ui/gui/compute-dialog.h"
+#include "ui/gui/correlation-dialog.h"
+#include "ui/gui/crosstabs-dialog.h"
+#include "ui/gui/descriptives-dialog.h"
+#include "ui/gui/examine-dialog.h"
+#include "ui/gui/executor.h"
+#include "ui/gui/factor-dialog.h"
+#include "ui/gui/find-dialog.h"
+#include "ui/gui/frequencies-dialog.h"
+#include "ui/gui/goto-case-dialog.h"
+#include "ui/gui/helper.h"
+#include "ui/gui/oneway-anova-dialog.h"
+#include "ui/gui/psppire-data-window.h"
+#include "ui/gui/psppire-syntax-window.h"
+#include "ui/gui/psppire-window.h"
+#include "ui/gui/psppire.h"
+#include "ui/gui/rank-dialog.h"
+#include "ui/gui/recode-dialog.h"
+#include "ui/gui/regression-dialog.h"
+#include "ui/gui/reliability-dialog.h"
+#include "ui/gui/roc-dialog.h"
+#include "ui/gui/select-cases-dialog.h"
+#include "ui/gui/sort-cases-dialog.h"
+#include "ui/gui/split-file-dialog.h"
+#include "ui/gui/t-test-independent-samples-dialog.h"
+#include "ui/gui/t-test-one-sample.h"
+#include "ui/gui/t-test-paired-samples.h"
+#include "ui/gui/text-data-import-dialog.h"
+#include "ui/gui/transpose-dialog.h"
+#include "ui/gui/variable-info-dialog.h"
+#include "ui/gui/weight-cases-dialog.h"
+#include "ui/syntax-gen.h"
#include <gettext.h>
#define _(msgid) gettext (msgid)
static void psppire_data_window_init (PsppireDataWindow *data_editor);
+static void psppire_data_window_iface_init (PsppireWindowIface *iface);
+
+
GType
psppire_data_window_get_type (void)
{
(GInstanceInitFunc) psppire_data_window_init,
};
+ static const GInterfaceInfo window_interface_info =
+ {
+ (GInterfaceInitFunc) psppire_data_window_iface_init,
+ NULL,
+ NULL
+ };
+
psppire_data_window_type =
- g_type_register_static (PSPPIRE_WINDOW_TYPE, "PsppireDataWindow",
+ g_type_register_static (PSPPIRE_TYPE_WINDOW, "PsppireDataWindow",
&psppire_data_window_info, 0);
+
+
+ g_type_add_interface_static (psppire_data_window_type,
+ PSPPIRE_TYPE_WINDOW_MODEL,
+ &window_interface_info);
}
return psppire_data_window_type;
extern struct dataset *the_dataset;
extern PsppireDataStore *the_data_store ;
+extern GtkRecentManager *the_recent_mgr;
static void
set_paste_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
{
- GObject *edit_paste = get_object_assert (de->builder, "edit_paste");
+ GtkAction *edit_paste = get_action_assert (de->builder, "edit_paste");
- gtk_action_set_sensitive (GTK_ACTION (edit_paste), x);
+ gtk_action_set_sensitive (edit_paste, x);
}
static void
set_cut_copy_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
{
- GObject *edit_copy = get_object_assert (de->builder, "edit_copy");
- GObject *edit_cut = get_object_assert (de->builder, "edit_cut");
+ GtkAction *edit_copy = get_action_assert (de->builder, "edit_copy");
+ GtkAction *edit_cut = get_action_assert (de->builder, "edit_cut");
- gtk_action_set_sensitive (GTK_ACTION (edit_copy), x);
- gtk_action_set_sensitive (GTK_ACTION (edit_cut), x);
+ gtk_action_set_sensitive (edit_copy, x);
+ gtk_action_set_sensitive (edit_cut, x);
}
/* Run the EXECUTE command. */
{
PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
- GtkUIManager *uim =
- GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1"));
+ GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
GtkWidget *menuitem =
gtk_ui_manager_get_widget (uim,"/ui/menubar/transform/transform_run-pending");
else
{
PsppireVarStore *vs = NULL;
+ PsppireDict *dict = NULL;
struct variable *var ;
gchar *text ;
g_object_get (de->data_editor, "var-store", &vs, NULL);
+ g_object_get (vs, "dictionary", &dict, NULL);
- var = psppire_dict_get_variable (vs->dict, filter_index);
+ var = psppire_dict_get_variable (dict, filter_index);
text = g_strdup_printf (_("Filter by %s"), var_get_name (var));
{
struct variable *var ;
PsppireVarStore *vs = NULL;
+ PsppireDict *dict = NULL;
gchar *text;
g_object_get (de->data_editor, "var-store", &vs, NULL);
-
- var = psppire_dict_get_variable (vs->dict, weight_index);
+ g_object_get (vs, "dictionary", &dict, NULL);
+
+ var = psppire_dict_get_variable (dict, weight_index);
text = g_strdup_printf (_("Weight by %s"), var_get_name (var));
}
}
-/* Puts FILE_NAME into the recent list.
- If it's already in the list, it moves it to the top
-*/
+#if 0
static void
-add_most_recent (const char *file_name)
+dump_rm (GtkRecentManager *rm)
{
-#if RECENT_LISTS_AVAILABLE
+ GList *items = gtk_recent_manager_get_items (rm);
- GtkRecentManager *manager = gtk_recent_manager_get_default();
- gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
+ GList *i;
- gtk_recent_manager_remove_item (manager, uri, NULL);
+ g_print ("Recent Items:\n");
+ for (i = items; i; i = i->next)
+ {
+ GtkRecentInfo *ri = i->data;
- if ( ! gtk_recent_manager_add_item (manager, uri))
- g_warning ("Could not add item %s to recent list\n",uri);
+ g_print ("Item: %s (Mime: %s) (Desc: %s) (URI: %s)\n",
+ gtk_recent_info_get_short_name (ri),
+ gtk_recent_info_get_mime_type (ri),
+ gtk_recent_info_get_description (ri),
+ gtk_recent_info_get_uri (ri)
+ );
- g_free (uri);
-#endif
+
+ gtk_recent_info_unref (ri);
+ }
+
+ g_list_free (items);
}
+#endif
+
-void
-psppire_data_window_load_file (PsppireDataWindow *de,
- const gchar *file_name)
+static gboolean
+load_file (PsppireWindow *de, const gchar *file_name)
{
+ gchar *native_file_name;
struct getl_interface *sss;
struct string filename;
ds_init_empty (&filename);
- syntax_gen_string (&filename, ss_cstr (file_name));
+
+ native_file_name =
+ convert_glib_filename_to_system_filename (file_name, NULL);
+
+ syntax_gen_string (&filename, ss_cstr (native_file_name));
+
+ g_free (native_file_name);
sss = create_syntax_string_source ("GET FILE=%s.",
ds_cstr (&filename));
+
ds_destroy (&filename);
if (execute_syntax (sss) )
- {
- psppire_window_set_filename (PSPPIRE_WINDOW (de), file_name);
- add_most_recent (file_name);
- }
-
- psppire_window_set_unsaved (PSPPIRE_WINDOW (de), FALSE);
- free (de->file_name);
+ return TRUE;
- de->file_name = g_strdup (file_name);
+ return FALSE;
}
-
-/* Callback for the data_open action.
- Prompts for a filename and opens it */
-static void
-open_data_dialog (GtkAction *action, PsppireDataWindow *de)
+static GtkWidget *
+sysfile_chooser_dialog (PsppireWindow *toplevel)
{
GtkWidget *dialog =
gtk_file_chooser_dialog_new (_("Open"),
- GTK_WINDOW (de),
+ GTK_WINDOW (toplevel),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- GtkFileFilter *filter = gtk_file_filter_new ();
+ GtkFileFilter *filter;
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Data and Syntax Files"));
+ gtk_file_filter_add_pattern (filter, "*.sav");
+ gtk_file_filter_add_pattern (filter, "*.SAV");
+ gtk_file_filter_add_pattern (filter, "*.por");
+ gtk_file_filter_add_pattern (filter, "*.POR");
+ gtk_file_filter_add_pattern (filter, "*.sps");
+ gtk_file_filter_add_pattern (filter, "*.SPS");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+ filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
gtk_file_filter_add_pattern (filter, "*.sav");
gtk_file_filter_add_pattern (filter, "*.SAV");
gtk_file_filter_add_pattern (filter, "*.POR");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Syntax Files (*.sps) "));
+ gtk_file_filter_add_pattern (filter, "*.sps");
+ gtk_file_filter_add_pattern (filter, "*.SPS");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All Files"));
gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+ {
+ gchar *dir_name;
+ gchar *filename = NULL;
+ g_object_get (toplevel, "filename", &filename, NULL);
- if (de->file_name)
- {
- gchar *dir_name = g_path_get_dirname (de->file_name);
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
- dir_name);
- free (dir_name);
- }
+ if ( ! g_path_is_absolute (filename))
+ {
+ gchar *path =
+ g_build_filename (g_get_current_dir (), filename, NULL);
+ dir_name = g_path_get_dirname (path);
+ g_free (path);
+ }
+ else
+ {
+ dir_name = g_path_get_dirname (filename);
+ }
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
+ dir_name);
+ free (dir_name);
+ }
+
+ return dialog;
+}
+
+/* Callback for the data_open action.
+ Prompts for a filename and opens it */
+static void
+open_window (GtkAction *action, PsppireWindow *de)
+{
+ GtkWidget *dialog = sysfile_chooser_dialog (de);
switch (gtk_dialog_run (GTK_DIALOG (dialog)))
{
gchar *name =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- psppire_data_window_load_file (de, name);
+ if (any_reader_may_open (name))
+ psppire_window_load (de, name);
+ else
+ open_syntax_window (name);
g_free (name);
}
}
-/* Append SUFFIX to the filename of DE */
+/* Save DE to file */
static void
-append_filename_suffix (PsppireDataWindow *de, const gchar *suffix)
+save_file (PsppireWindow *w)
{
- if ( ! name_has_suffix (de->file_name))
+ gchar *native_file_name = NULL;
+ gchar *file_name = NULL;
+ GString *fnx;
+ struct getl_interface *sss;
+ struct string filename ;
+ PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (w);
+
+ g_object_get (w, "filename", &file_name, NULL);
+
+ fnx = g_string_new (file_name);
+
+ if ( ! name_has_suffix (fnx->str))
{
- gchar *s = de->file_name;
- de->file_name = g_strconcat (de->file_name, suffix, NULL);
- g_free (s);
+ if ( de->save_as_portable)
+ g_string_append (fnx, ".por");
+ else
+ g_string_append (fnx, ".sav");
}
-}
-/* Save DE to file */
-static void
-save_file (PsppireDataWindow *de)
-{
- struct getl_interface *sss;
- struct string file_name ;
+ ds_init_empty (&filename);
+
+ native_file_name =
+ convert_glib_filename_to_system_filename (fnx->str, NULL);
- g_assert (de->file_name);
+ g_string_free (fnx, TRUE);
- ds_init_empty (&file_name);
- syntax_gen_string (&file_name, ss_cstr (de->file_name));
+ syntax_gen_string (&filename, ss_cstr (native_file_name));
+ g_free (native_file_name);
if ( de->save_as_portable )
{
- append_filename_suffix (de, ".por");
sss = create_syntax_string_source ("EXPORT OUTFILE=%s.",
- ds_cstr (&file_name));
+ ds_cstr (&filename));
}
else
{
- append_filename_suffix (de, ".sav");
sss = create_syntax_string_source ("SAVE OUTFILE=%s.",
- ds_cstr (&file_name));
+ ds_cstr (&filename));
}
- ds_destroy (&file_name);
+ ds_destroy (&filename);
execute_syntax (sss);
-
- psppire_window_set_unsaved (PSPPIRE_WINDOW (de), FALSE);
}
insert_case (GtkAction *action, gpointer data)
{
PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (data);
-
psppire_data_editor_insert_case (dw->data_editor);
}
static void
on_insert_variable (GtkAction *action, gpointer data)
{
- PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
- psppire_data_editor_insert_variable (de);
+ PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (data);
+ psppire_data_editor_insert_variable (dw->data_editor);
+}
+
+
+static void
+display_dict (PsppireDataWindow *de)
+{
+
+ struct getl_interface *sss =
+ create_syntax_string_source ("DISPLAY DICTIONARY.");
+
+ execute_syntax (sss);
+}
+
+static void
+sysfile_info (PsppireDataWindow *de)
+{
+ GtkWidget *dialog = sysfile_chooser_dialog (PSPPIRE_WINDOW (de));
+
+ if ( GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog)))
+ {
+ struct string filename;
+ struct getl_interface *sss;
+ gchar *file_name =
+ gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+
+ gchar *native_file_name =
+ convert_glib_filename_to_system_filename (file_name, NULL);
+
+ ds_init_empty (&filename);
+
+ syntax_gen_string (&filename, ss_cstr (native_file_name));
+
+ g_free (native_file_name);
+
+ sss = create_syntax_string_source ("SYSFILE INFO %s.",
+ ds_cstr (&filename));
+ execute_syntax (sss);
+ }
+
+ gtk_widget_destroy (dialog);
}
(gtk_radio_button_get_group (GTK_RADIO_BUTTON(button_sys)),
_("Portable File"));
- gtk_box_pack_start_defaults (GTK_BOX (vbox), button_sys);
- gtk_box_pack_start_defaults (GTK_BOX (vbox), button_por);
+ psppire_box_pack_start_defaults (GTK_BOX (vbox), button_sys);
+ psppire_box_pack_start_defaults (GTK_BOX (vbox), button_por);
gtk_widget_show_all (vbox);
{
case GTK_RESPONSE_ACCEPT:
{
- g_free (de->file_name);
-
- de->file_name =
- gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ GString *filename =
+ g_string_new
+ (
+ gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog))
+ );
de->save_as_portable =
! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_sys));
- if ( de->save_as_portable)
- append_filename_suffix (de, ".por");
- else
- append_filename_suffix (de, ".sav");
+ if ( ! name_has_suffix (filename->str))
+ {
+ if ( de->save_as_portable)
+ g_string_append (filename, ".por");
+ else
+ g_string_append (filename, ".sav");
+ }
+
+ psppire_window_set_filename (PSPPIRE_WINDOW (de), filename->str);
- save_file (de);
+ save_file (PSPPIRE_WINDOW (de));
- psppire_window_set_filename (PSPPIRE_WINDOW (de), de->file_name);
+ g_string_free (filename, TRUE);
}
break;
default:
/* Callback for data_save action.
- If there's an existing file name, then just save,
- otherwise prompt for a file name, then save */
+ */
static void
-data_save (PsppireDataWindow *de)
+data_save (PsppireWindow *de)
{
- if (de->file_name)
- save_file (de);
+ const gchar *fn = psppire_window_get_filename (de);
+
+ if ( NULL != fn)
+ psppire_window_save (de);
else
- data_save_as_dialog (de);
+ data_save_as_dialog (PSPPIRE_DATA_WINDOW (de));
}
execute_syntax (sss);
- g_free (de->file_name);
- de->file_name = NULL;
-
psppire_window_set_filename (PSPPIRE_WINDOW (de), NULL);
}
fonts_activate (GtkMenuItem *menuitem, gpointer data)
{
PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
+ GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (de));
PangoFontDescription *current_font;
gchar *font_name;
GtkWidget *dialog =
g_free (font_name);
gtk_window_set_transient_for (GTK_WINDOW (dialog),
- GTK_WINDOW (get_widget_assert (de->builder,
- "data_editor")));
+ GTK_WINDOW (toplevel));
+
if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) )
{
const gchar *font = gtk_font_selection_dialog_get_font_name
Give the user the opportunity to save any unsaved data.
*/
g_object_unref (the_data_store);
- gtk_main_quit ();
-}
-
-
-
-static GtkWidget *
-create_data_sheet_variable_popup_menu (PsppireDataWindow *de)
-{
- GtkWidget *menu = gtk_menu_new ();
-
- GtkWidget *sort_ascending =
- gtk_action_create_menu_item (gtk_action_new ("sort-up",
- _("Sort Ascending"),
- NULL,
- "gtk-sort-ascending"));
-
- GtkWidget *sort_descending =
- gtk_action_create_menu_item (gtk_action_new ("sort-down",
- _("Sort Descending"),
- NULL,
- "gtk-sort-descending"));
-
- GtkWidget *insert_variable =
- gtk_menu_item_new_with_label (_("Insert Variable"));
-
- GtkWidget *clear_variable =
- gtk_menu_item_new_with_label (_("Clear"));
-
-
- gtk_action_connect_proxy (de->delete_variables,
- clear_variable );
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu),
- gtk_separator_menu_item_new ());
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), clear_variable);
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu),
- gtk_separator_menu_item_new ());
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_ascending);
-
-
- g_signal_connect_swapped (G_OBJECT (sort_ascending), "activate",
- G_CALLBACK (psppire_data_editor_sort_ascending),
- de->data_editor);
-
- g_signal_connect_swapped (G_OBJECT (sort_descending), "activate",
- G_CALLBACK (psppire_data_editor_sort_descending),
- de->data_editor);
-
- g_signal_connect_swapped (G_OBJECT (insert_variable), "activate",
- G_CALLBACK (gtk_action_activate),
- de->insert_variable);
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_descending);
-
- gtk_widget_show_all (menu);
- return menu;
+ psppire_quit ();
}
gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
- g_signal_connect_swapped (G_OBJECT (insert_case), "activate",
+ g_signal_connect_swapped (insert_case, "activate",
G_CALLBACK (gtk_action_activate),
de->insert_case);
}
-static GtkWidget *
-create_var_sheet_variable_popup_menu (PsppireDataWindow *de)
-{
- GtkWidget *menu = gtk_menu_new ();
-
- GtkWidget *insert_variable =
- gtk_menu_item_new_with_label (_("Insert Variable"));
-
- GtkWidget *delete_variable =
- gtk_menu_item_new_with_label (_("Clear"));
-
-
- gtk_action_connect_proxy (de->delete_variables,
- delete_variable);
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
-
- g_signal_connect_swapped (G_OBJECT (insert_variable), "activate",
- G_CALLBACK (gtk_action_activate),
- de->insert_variable);
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu),
- gtk_separator_menu_item_new ());
-
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_variable);
-
-
- gtk_widget_show_all (menu);
-
- return menu;
-}
-
-
-#if RECENT_LISTS_AVAILABLE
static void
-on_recent_data_select (GtkMenuShell *menushell, gpointer user_data)
+on_recent_data_select (GtkMenuShell *menushell,
+ PsppireWindow *window)
{
gchar *file;
- PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (user_data);
gchar *uri =
gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
g_free (uri);
- psppire_data_window_load_file (de, file);
+ psppire_window_load (window, file);
g_free (file);
}
se = psppire_syntax_window_new ();
- psppire_syntax_window_load_from_file (PSPPIRE_SYNTAX_WINDOW (se), file, NULL);
- gtk_widget_show (se);
+ if ( psppire_window_load (PSPPIRE_WINDOW (se), file) )
+ gtk_widget_show (se);
+ else
+ gtk_widget_destroy (se);
g_free (file);
}
-#endif
static void
enable_delete_cases (GtkWidget *w, gint case_num, gpointer data)
{
PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (user_data);
- GtkUIManager *uim =
- GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1"));
+ GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
GtkWidget *view_data =
gtk_ui_manager_get_widget (uim,"/ui/menubar/view/view_data");
}
-static GtkAction *
-resolve_action (GtkBuilder *builder, const gchar *action, const gchar *proxy)
-{
- GObject *pr = NULL;
- GObject *act = get_object_assert (builder, action);
- g_assert (GTK_IS_ACTION (act));
-
- if ( proxy )
- {
- pr = get_object_assert (builder, proxy);
- g_assert (GTK_IS_WIDGET (pr));
- }
-
- if ( pr )
- gtk_action_connect_proxy (GTK_ACTION (act), GTK_WIDGET (pr));
-
- return GTK_ACTION (act);
-}
-
static void
set_unsaved (gpointer w)
{
- psppire_window_set_unsaved (PSPPIRE_WINDOW (w), TRUE);
+ psppire_window_set_unsaved (PSPPIRE_WINDOW (w));
}
-/* Callback for the "delete" action (clicking the x on the top right
- hand corner of the window) */
-static gboolean
-on_delete (GtkWidget *w, GdkEvent *event, gpointer user_data)
-{
- PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (user_data);
-
- return FALSE;
-}
-
-
static void
psppire_data_window_init (PsppireDataWindow *de)
{
PsppireVarStore *vs;
+ PsppireDict *dict = NULL;
GtkWidget *menubar;
GtkWidget *hb ;
GtkWidget *sb ;
- GtkUIManager *uim;
-
GtkWidget *box = gtk_vbox_new (FALSE, 0);
de->builder = builder_new ("data-editor.ui");
hb = get_widget_assert (de->builder, "handlebox1");
sb = get_widget_assert (de->builder, "status-bar");
- de->file_name = NULL;
-
de->data_editor =
PSPPIRE_DATA_EDITOR (psppire_data_editor_new (the_var_store, the_data_store));
connect_help (de->builder);
- g_object_ref (menubar);
- gtk_widget_unparent (menubar);
-
- g_object_ref (hb);
- gtk_widget_unparent (hb);
-
- g_object_ref (sb);
- gtk_widget_unparent (sb);
-
gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), hb, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (de->data_editor), TRUE, TRUE, 0);
g_assert(vs); /* Traps a possible bug in w32 build */
- g_signal_connect (vs->dict, "weight-changed",
+ g_object_get (vs, "dictionary", &dict, NULL);
+
+ g_signal_connect (dict, "weight-changed",
G_CALLBACK (on_weight_change),
de);
- g_signal_connect (vs->dict, "filter-changed",
+ g_signal_connect (dict, "filter-changed",
G_CALLBACK (on_filter_change),
de);
- g_signal_connect (vs->dict, "split-changed",
+ g_signal_connect (dict, "split-changed",
G_CALLBACK (on_split_change),
de);
- g_signal_connect (get_object_assert (de->builder, "edit_copy"),
+ g_signal_connect (get_action_assert (de->builder, "edit_copy"),
"activate",
G_CALLBACK (on_edit_copy), de);
- g_signal_connect (get_object_assert (de->builder, "edit_cut"),
+ g_signal_connect (get_action_assert (de->builder, "edit_cut"),
"activate",
G_CALLBACK (on_edit_cut), de);
- {
- GtkAction *action_data_open =
- resolve_action (de->builder, "file_open_data", "button-open");
-
- g_object_set (action_data_open,
- "tooltip", _("Open a data file"),
- "stock-id", "gtk-open",
- NULL);
-
- g_signal_connect (action_data_open, "activate",
- G_CALLBACK (open_data_dialog), de);
- }
-
{
GtkAction *action_data_new =
- resolve_action (de->builder, "file_new_data", NULL);
-
- g_object_set (action_data_new,
- "tooltip", _("New data file"),
- "stock-id", "gtk-new",
- NULL);
+ get_action_assert (de->builder, "file_new_data");
g_signal_connect (action_data_new, "activate",
G_CALLBACK (new_file), de);
{
GtkAction *invoke_text_import_assistant =
- resolve_action (de->builder, "file_import-text", NULL);
-
- g_object_set (invoke_text_import_assistant,
- "tooltip", _("Import text data file"),
- "stock-id", "gtk-convert",
- NULL);
+ get_action_assert (de->builder, "file_import-text");
g_signal_connect (invoke_text_import_assistant, "activate",
G_CALLBACK (text_data_import_assistant), de);
{
- GtkAction *action_data_save =
- resolve_action (de->builder, "file_save", "button-save");
-
-
- g_object_set (action_data_save,
- "tooltip", _("Save data to file"),
- "stock-id", "gtk-save",
- NULL);
+ GtkAction *action_data_save = get_action_assert (de->builder, "file_save");
g_signal_connect_swapped (action_data_save, "activate",
- G_CALLBACK (data_save), de);
+ G_CALLBACK (data_save), de);
}
+ {
+ GtkAction *action_data_open = get_action_assert (de->builder, "file_open");
+ g_signal_connect (action_data_open, "activate",
+ G_CALLBACK (open_window), de);
+ }
{
GtkAction *action_data_save_as =
- resolve_action (de->builder, "file_save_as", NULL);
-
- g_object_set (action_data_save_as,
- "label", _("Save As"),
- "tooltip", _("Save data to file"),
- "stock-id", "gtk-save-as",
- NULL);
+ get_action_assert (de->builder, "file_save_as");
g_signal_connect_swapped (action_data_save_as, "activate",
G_CALLBACK (data_save_as_dialog), de);
}
+ {
+ GtkAction *action_info_working_file =
+ get_action_assert (de->builder, "file_information_working-file");
+
+
+ g_signal_connect_swapped (action_info_working_file, "activate",
+ G_CALLBACK (display_dict), de);
+ }
+
{
- GtkAction *value_labels_action =
- resolve_action (de->builder,
- "view_value-labels", "togglebutton-value-labels");
+ GtkAction *action_info_external_file =
+ get_action_assert (de->builder, "file_information_external-file");
- g_object_set (value_labels_action,
- "tooltip", _("Show/hide value labels"),
- "stock-id", "pspp-value-labels",
- NULL);
- g_signal_connect (value_labels_action, "toggled",
- G_CALLBACK (toggle_value_labels), de);
+ g_signal_connect_swapped (action_info_external_file, "activate",
+ G_CALLBACK (sysfile_info), de);
}
- g_signal_connect (get_object_assert (de->builder, "edit_paste"), "activate",
+
+
+ g_signal_connect (get_action_assert (de->builder, "edit_paste"), "activate",
G_CALLBACK (on_edit_paste),
de);
{
- de->delete_cases =
- resolve_action (de->builder, "edit_clear-cases", NULL);
+ de->insert_case = get_action_assert (de->builder, "edit_insert-case");
+ g_signal_connect (de->insert_case, "activate",
+ G_CALLBACK (insert_case),
+ de);
+
+ }
+ {
+ de->insert_variable = get_action_assert (de->builder, "action_insert-variable");
+
+ g_signal_connect (de->insert_variable, "activate",
+ G_CALLBACK (on_insert_variable),
+ de);
+
+
+ }
+
+ de->invoke_goto_dialog = get_action_assert (de->builder, "edit_goto-case");
+ g_signal_connect (de->invoke_goto_dialog, "activate", G_CALLBACK (goto_case_dialog), de);
+
+
+ {
+ GtkAction *value_labels_action = get_action_assert (de->builder, "view_value-labels");
+ g_signal_connect (value_labels_action, "toggled",
+ G_CALLBACK (toggle_value_labels), de);
+ }
+
+ {
+ de->delete_cases =
+ get_action_assert (de->builder, "edit_clear-cases");
- g_object_set (de->delete_cases,
- "label", _("Clear"),
- "tooltip", _("Delete the cases at the selected position(s)"),
- "stock-id", "gtk-clear",
- NULL);
g_signal_connect_swapped (de->delete_cases, "activate",
G_CALLBACK (psppire_data_editor_delete_cases),
{
de->delete_variables =
- resolve_action (de->builder, "edit_clear-variables", NULL);
-
- g_object_set (de->delete_variables,
- "label", _("Clear"),
- "tooltip", _("Delete the variables at the selected position(s)"),
- "stock-id", "gtk-clear",
- NULL);
-
+ get_action_assert (de->builder, "edit_clear-variables");
g_signal_connect_swapped (de->delete_variables, "activate",
G_CALLBACK (psppire_data_editor_delete_variables),
}
- de->insert_variable =
- resolve_action (de->builder, "edit_insert-variable",
- "button-insert-variable");
-
- g_object_set (de->insert_variable,
- "tooltip", _("Create a new variable at the current position"),
- "stock-id", "pspp-insert-variable",
- NULL);
-
- g_signal_connect (de->insert_variable, "activate",
- G_CALLBACK (on_insert_variable), de->data_editor);
-
-
-
-
-
- de->insert_case =
- resolve_action (de->builder, "edit_insert-case", "button-insert-case");
-
- g_object_set (de->insert_case,
- "tooltip", _("Create a new case at the current position"),
- "stock-id", "pspp-insert-case",
- NULL);
-
- g_signal_connect (de->insert_case, "activate",
- G_CALLBACK (insert_case), de);
-
-
-
-
-
- de->invoke_goto_dialog =
- resolve_action (de->builder, "edit_goto-case", "button-goto-case");
-
-
- g_object_set (de->invoke_goto_dialog,
- "tooltip", _("Jump to a Case in the Data Sheet"),
- "stock-id", "gtk-jump-to",
- NULL);
-
- g_signal_connect (de->invoke_goto_dialog, "activate",
- G_CALLBACK (goto_case_dialog), de);
-
-
{
- GtkAction *invoke_weight_cases_dialog =
- resolve_action (de->builder, "data_weight-cases", "button-weight-cases");
-
+ GtkAction *invoke_transpose_dialog =
+ get_action_assert (de->builder, "data_transpose");
- g_object_set (invoke_weight_cases_dialog,
- "stock-id", "pspp-weight-cases",
- "tooltip", _("Weight cases by variable"),
- NULL);
- g_signal_connect (invoke_weight_cases_dialog, "activate",
- G_CALLBACK (weight_cases_dialog), de);
+ g_signal_connect (invoke_transpose_dialog, "activate",
+ G_CALLBACK (transpose_dialog), de);
}
{
- GtkAction *invoke_transpose_dialog =
- resolve_action (de->builder, "data_transpose", NULL);
-
+ GtkAction *invoke_sort_cases_dialog =
+ get_action_assert (de->builder, "data_sort-cases");
- g_object_set (invoke_transpose_dialog,
- "tooltip", _("Transpose the cases with the variables"),
- "stock-id", "pspp-transpose",
- NULL);
- g_signal_connect (invoke_transpose_dialog, "activate",
- G_CALLBACK (transpose_dialog), de);
+ g_signal_connect (invoke_sort_cases_dialog, "activate",
+ G_CALLBACK (sort_cases_dialog), de);
}
- {
- GtkAction *invoke_split_file_dialog =
- resolve_action (de->builder, "data_split-file", "button-split-file");
- g_object_set (invoke_split_file_dialog,
- "tooltip", _("Split the active file"),
- "stock-id", "pspp-split-file",
- NULL);
+ {
+ GtkAction *invoke_compute_dialog =
+ get_action_assert (de->builder, "transform_compute");
- g_signal_connect (invoke_split_file_dialog, "activate",
- G_CALLBACK (split_file_dialog), de);
+ g_signal_connect (invoke_compute_dialog, "activate",
+ G_CALLBACK (compute_dialog), de);
}
-
{
- GtkAction *invoke_sort_cases_dialog =
- resolve_action (de->builder, "data_sort-cases", NULL);
+ GtkAction *invoke_find_dialog = get_action_assert (de->builder, "edit_find");
+ g_signal_connect (invoke_find_dialog, "activate",
+ G_CALLBACK (find_dialog), de);
+ }
- g_object_set (invoke_sort_cases_dialog,
- "tooltip", _("Sort cases in the active file"),
- "stock-id", "gtk-sort-ascending",
- NULL);
+
+ {
+ GtkAction *invoke_split_file_dialog = get_action_assert (de->builder, "data_split-file");
- g_signal_connect (invoke_sort_cases_dialog, "activate",
- G_CALLBACK (sort_cases_dialog), de);
+ g_signal_connect (invoke_split_file_dialog, "activate",
+ G_CALLBACK (split_file_dialog), de);
}
{
- GtkAction *invoke_select_cases_dialog =
- resolve_action (de->builder, "data_select-cases", "button-select-cases");
-
- g_object_set (invoke_select_cases_dialog,
- "tooltip", _("Select cases from the active file"),
- "stock-id", "pspp-select-cases",
- NULL);
+ GtkAction *invoke_weight_cases_dialog = get_action_assert (de->builder, "data_weight-cases");
- g_signal_connect (invoke_select_cases_dialog, "activate",
- G_CALLBACK (select_cases_dialog), de);
+ g_signal_connect (invoke_weight_cases_dialog, "activate",
+ G_CALLBACK (weight_cases_dialog), de);
}
- {
- GtkAction *invoke_compute_dialog =
- resolve_action (de->builder, "transform_compute", NULL);
- g_object_set (invoke_compute_dialog,
- "tooltip", _("Compute new values for a variable"),
- "stock-id", "pspp-compute",
- NULL);
+ {
+ GtkAction *invoke_variable_info_dialog = get_action_assert (de->builder, "utilities_variables");
- g_signal_connect (invoke_compute_dialog, "activate",
- G_CALLBACK (compute_dialog), de);
+ g_signal_connect (invoke_variable_info_dialog, "activate",
+ G_CALLBACK (variable_info_dialog), de);
}
+
{
GtkAction *invoke_oneway_anova_dialog =
- resolve_action (de->builder, "oneway-anova", NULL);
-
- g_object_set (invoke_oneway_anova_dialog,
- "tooltip", _("Perform one way analysis of variance"),
- NULL);
+ get_action_assert (de->builder, "oneway-anova");
g_signal_connect (invoke_oneway_anova_dialog, "activate",
G_CALLBACK (oneway_anova_dialog), de);
{
GtkAction *invoke_t_test_independent_samples_dialog =
- resolve_action (de->builder, "indep-t-test", NULL);
+ get_action_assert (de->builder, "indep-t-test");
- g_object_set (invoke_t_test_independent_samples_dialog,
- "tooltip",
- _("Calculate T Test for samples from independent groups"),
- NULL);
-
g_signal_connect (invoke_t_test_independent_samples_dialog, "activate",
G_CALLBACK (t_test_independent_samples_dialog), de);
}
{
GtkAction *invoke_t_test_paired_samples_dialog =
- resolve_action (de->builder, "paired-t-test", NULL);
-
- g_object_set (invoke_t_test_paired_samples_dialog,
- "tooltip",
- _("Calculate T Test for paired samples"),
- NULL);
+ get_action_assert (de->builder, "paired-t-test");
g_signal_connect (invoke_t_test_paired_samples_dialog, "activate",
G_CALLBACK (t_test_paired_samples_dialog), de);
{
GtkAction *invoke_t_test_one_sample_dialog =
- resolve_action (de->builder, "one-sample-t-test", NULL);
-
- g_object_set (invoke_t_test_one_sample_dialog,
- "tooltip",
- _("Calculate T Test for sample from a single distribution"),
- NULL);
+ get_action_assert (de->builder, "one-sample-t-test");
g_signal_connect (invoke_t_test_one_sample_dialog, "activate",
G_CALLBACK (t_test_one_sample_dialog), de);
{
GtkAction *invoke_comments_dialog =
- resolve_action (de->builder, "utilities_comments", NULL);
+ get_action_assert (de->builder, "utilities_comments");
- g_object_set (invoke_comments_dialog,
- "tooltip",
- _("Commentary text for the data file"),
- NULL);
-
g_signal_connect (invoke_comments_dialog, "activate",
G_CALLBACK (comments_dialog), de);
}
- {
- GtkAction *invoke_find_dialog =
- resolve_action (de->builder, "edit_find", "button-find");
-
- g_object_set (invoke_find_dialog, "stock-id", "gtk-find", NULL);
-
- g_signal_connect (invoke_find_dialog, "activate",
- G_CALLBACK (find_dialog), de);
- }
-
-
{
GtkAction *invoke_rank_dialog =
- resolve_action (de->builder, "transform_rank", NULL);
-
- g_object_set (invoke_rank_dialog,
- "stock-id", "pspp-rank-cases",
- "tooltip", _("Rank Cases"),
- NULL);
+ get_action_assert (de->builder, "transform_rank");
g_signal_connect (invoke_rank_dialog, "activate",
G_CALLBACK (rank_dialog), de);
{
GtkAction *invoke_recode_same_dialog =
- resolve_action (de->builder, "transform_recode-same", NULL);
-
- g_object_set (invoke_recode_same_dialog,
- "stock-id", "pspp-recode-same",
- "tooltip", _("Recode values into the same variables"),
- NULL);
+ get_action_assert (de->builder, "transform_recode-same");
g_signal_connect (invoke_recode_same_dialog, "activate",
G_CALLBACK (recode_same_dialog), de);
{
GtkAction *invoke_recode_different_dialog =
- resolve_action (de->builder, "transform_recode-different", NULL);
+ get_action_assert (de->builder, "transform_recode-different");
- g_object_set (invoke_recode_different_dialog,
- "stock-id", "pspp-recode-different",
- "tooltip", _("Recode values into different variables"),
- NULL);
g_signal_connect (invoke_recode_different_dialog, "activate",
G_CALLBACK (recode_different_dialog), de);
}
- {
- GtkAction *invoke_variable_info_dialog =
- resolve_action (de->builder, "utilities_variables", "button-goto-variable");
-
- g_object_set (invoke_variable_info_dialog,
- "stock-id", "pspp-goto-variable",
- "tooltip", _("Jump to variable"),
- NULL);
-
- g_signal_connect (invoke_variable_info_dialog, "activate",
- G_CALLBACK (variable_info_dialog), de);
- }
-
-
{
GtkAction *invoke_descriptives_dialog =
- resolve_action (de->builder, "analyze_descriptives", NULL);
-
- g_object_set (invoke_descriptives_dialog,
- "tooltip", _("Calculate descriptive statistics (mean, variance, ...)"),
- "stock-id", "pspp-descriptives",
- NULL);
+ get_action_assert (de->builder, "analyze_descriptives");
g_signal_connect (invoke_descriptives_dialog, "activate",
G_CALLBACK (descriptives_dialog), de);
{
GtkAction *invoke_frequencies_dialog =
- resolve_action (de->builder, "analyze_frequencies", NULL);
+ get_action_assert (de->builder, "analyze_frequencies");
- g_object_set (invoke_frequencies_dialog,
- "tooltip", _("Generate frequency statistics"),
- "stock-id", "pspp-frequencies",
- NULL);
g_signal_connect (invoke_frequencies_dialog, "activate",
G_CALLBACK (frequencies_dialog), de);
{
GtkAction *invoke_crosstabs_dialog =
- resolve_action (de->builder, "crosstabs", NULL);
+ get_action_assert (de->builder, "crosstabs");
- g_object_set (invoke_crosstabs_dialog,
- "tooltip", _("Generate crosstabulations"),
- "stock-id", "pspp-crosstabs",
- NULL);
g_signal_connect (invoke_crosstabs_dialog, "activate",
G_CALLBACK (crosstabs_dialog), de);
{
GtkAction *invoke_examine_dialog =
- resolve_action (de->builder, "analyze_explore", NULL);
+ get_action_assert (de->builder, "analyze_explore");
- g_object_set (invoke_examine_dialog,
- "tooltip", _("Examine Data by Factors"),
- "stock-id", "pspp-examine",
- NULL);
g_signal_connect (invoke_examine_dialog, "activate",
G_CALLBACK (examine_dialog), de);
{
GtkAction *invoke_regression_dialog =
- resolve_action (de->builder, "linear-regression", NULL);
+ get_action_assert (de->builder, "linear-regression");
- g_object_set (invoke_regression_dialog,
- "tooltip", _("Estimate parameters of the linear model"),
- "stock-id", "pspp-regression",
- NULL
- );
g_signal_connect (invoke_regression_dialog, "activate",
G_CALLBACK (regression_dialog), de);
}
+ {
+ GtkAction *invoke_reliability_dialog =
+ get_action_assert (de->builder, "reliability");
+
+ g_signal_connect (invoke_reliability_dialog, "activate",
+ G_CALLBACK (reliability_dialog), de);
+ }
-#if RECENT_LISTS_AVAILABLE && 0
{
- GtkRecentManager *rm = gtk_recent_manager_get_default ();
- GtkWidget *recent_data = get_object_assert (de->builder, "file_recent-data");
- GtkWidget *recent_files = get_object_assert (de->builder, "file_recent-files");
- GtkWidget *recent_separator = get_object_assert (de->builder, "file_separator1");
+ GtkAction *invoke_roc_dialog =
+ get_action_assert (de->builder, "roc-curve");
- GtkWidget *menu = gtk_recent_chooser_menu_new_for_manager (rm);
- GtkRecentFilter *filter = gtk_recent_filter_new ();
+ g_signal_connect (invoke_roc_dialog, "activate",
+ G_CALLBACK (roc_dialog), de);
+ }
- gtk_widget_show (recent_data);
- gtk_widget_show (recent_files);
- gtk_widget_show (recent_separator);
+ {
+ GtkAction *invoke_correlation_dialog =
+ get_action_assert (de->builder, "correlation");
- gtk_recent_filter_add_pattern (filter, "*.sav");
- gtk_recent_filter_add_pattern (filter, "*.SAV");
- gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+ g_signal_connect (invoke_correlation_dialog, "activate",
+ G_CALLBACK (correlation_dialog), de);
+ }
- gtk_widget_set_sensitive (recent_data, TRUE);
- g_signal_connect (menu, "selection-done",
- G_CALLBACK (on_recent_data_select), de);
+ {
+ GtkAction *invoke_factor_dialog =
+ get_action_assert (de->builder, "factor-analysis");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu);
+ g_signal_connect (invoke_factor_dialog, "activate",
+ G_CALLBACK (factor_dialog), de);
+ }
+
+
+ {
+ GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
+ GtkWidget *recent_data =
+ gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-data");
- filter = gtk_recent_filter_new ();
- menu = gtk_recent_chooser_menu_new_for_manager (rm);
+ GtkWidget *recent_files =
+ gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-files");
- gtk_recent_filter_add_pattern (filter, "*.sps");
- gtk_recent_filter_add_pattern (filter, "*.SPS");
- gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+ GtkWidget *menu_data =
+ gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
+
+ GtkWidget *menu_files =
+ gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
+
+ {
+ GtkRecentFilter *filter = gtk_recent_filter_new ();
- gtk_widget_set_sensitive (recent_files, TRUE);
- g_signal_connect (menu, "selection-done",
- G_CALLBACK (on_recent_files_select), de);
+ gtk_recent_filter_add_pattern (filter, "*.sav");
+ gtk_recent_filter_add_pattern (filter, "*.SAV");
+ gtk_recent_filter_add_pattern (filter, "*.por");
+ gtk_recent_filter_add_pattern (filter, "*.POR");
+
+ gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_data), GTK_RECENT_SORT_MRU);
+
+ gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_data), filter);
+ }
+
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu_data);
+
+
+ g_signal_connect (menu_data, "selection-done",
+ G_CALLBACK (on_recent_data_select),
+ de);
+
+ {
+ GtkRecentFilter *filter = gtk_recent_filter_new ();
+
+ gtk_recent_filter_add_pattern (filter, "*.sps");
+ gtk_recent_filter_add_pattern (filter, "*.SPS");
+
+ gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_files), GTK_RECENT_SORT_MRU);
+
+ gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_files), filter);
+ }
+
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu_files);
+
+ g_signal_connect (menu_files, "selection-done",
+ G_CALLBACK (on_recent_files_select),
+ de);
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu);
}
-#endif
- g_signal_connect (get_object_assert (de->builder,"file_new_syntax"),
+ g_signal_connect (get_action_assert (de->builder,"file_new_syntax"),
"activate",
G_CALLBACK (create_syntax_window),
NULL);
- g_signal_connect (get_object_assert (de->builder,"file_open_syntax"),
- "activate",
- G_CALLBACK (open_syntax_window),
- de);
{
- GObject *abt = get_object_assert (de->builder, "help_about");
- g_object_set (abt, "stock-id", "gtk-about", NULL);
+ GtkAction *abt = get_action_assert (de->builder, "help_about");
+
g_signal_connect (abt,
"activate",
G_CALLBACK (about_new),
}
- g_signal_connect (get_object_assert (de->builder,"help_reference"),
+ g_signal_connect (get_action_assert (de->builder,"help_reference"),
"activate",
G_CALLBACK (reference_manual),
de);
de);
- g_signal_connect (GTK_NOTEBOOK (de->data_editor),
+ g_signal_connect (de->data_editor,
"switch-page",
G_CALLBACK (on_switch_sheet), de);
gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
- g_signal_connect (get_object_assert (de->builder, "view_statusbar"),
+ g_signal_connect (get_action_assert (de->builder, "view_statusbar"),
"activate",
G_CALLBACK (status_bar_activate), de);
- g_signal_connect (get_object_assert (de->builder, "view_gridlines"),
+ g_signal_connect (get_action_assert (de->builder, "view_gridlines"),
"activate",
G_CALLBACK (grid_lines_activate), de);
- g_signal_connect (get_object_assert (de->builder, "view_data"),
+ g_signal_connect (get_action_assert (de->builder, "view_data"),
"activate",
G_CALLBACK (data_view_activate), de);
- g_signal_connect (get_object_assert (de->builder, "view_variables"),
+ g_signal_connect (get_action_assert (de->builder, "view_variables"),
"activate",
G_CALLBACK (variable_view_activate), de);
{
- GtkAction *font_action =
- resolve_action (de->builder, "view_fonts", NULL);
-
- g_object_set (font_action,
- "stock-id", "gtk-select-font",
- NULL);
+ GtkAction *font_action = get_action_assert (de->builder, "view_fonts");
g_signal_connect (font_action,
"activate",
- g_signal_connect (get_object_assert (de->builder, "file_quit"),
+ g_signal_connect (get_action_assert (de->builder, "file_quit"),
"activate",
G_CALLBACK (file_quit), de);
- g_signal_connect (get_object_assert (de->builder, "transform_run-pending"),
+ g_signal_connect (get_action_assert (de->builder, "transform_run-pending"),
"activate",
G_CALLBACK (execute), de);
- g_signal_connect (get_object_assert (de->builder, "windows_minimise_all"),
+ g_signal_connect (get_action_assert (de->builder, "windows_minimise_all"),
"activate",
G_CALLBACK (psppire_window_minimise_all), NULL);
{
GtkAction *split_window_action =
- resolve_action (de->builder, "windows_split", NULL);
+ get_action_assert (de->builder, "windows_split");
- g_object_set (split_window_action,
- "tooltip", _("Split the window vertically and horizontally"),
- "stock-id", "pspp-split-window",
- NULL);
g_signal_connect (split_window_action, "toggled",
G_CALLBACK (toggle_split_window),
de);
}
- de->data_sheet_variable_popup_menu =
- GTK_MENU (create_data_sheet_variable_popup_menu (de));
-
- de->var_sheet_variable_popup_menu =
- GTK_MENU (create_var_sheet_variable_popup_menu (de));
+ {
+ GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
- de->data_sheet_cases_popup_menu =
- GTK_MENU (create_data_sheet_cases_popup_menu (de));
+ PSPPIRE_WINDOW (de)->menu =
+ GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar/windows/windows_minimise_all")->parent);
+ }
- uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1"));
+ {
+ GtkMenu *data_sheet_variable_popup_menu = get_widget_assert (de->builder,
+ "datasheet-variable-popup");
- PSPPIRE_WINDOW (de)->menu =
- GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar/windows/windows_minimise_all")->parent);
+ g_signal_connect_swapped (get_action_assert (de->builder, "sort-up"), "activate",
+ G_CALLBACK (psppire_data_editor_sort_ascending),
+ de->data_editor);
+ g_signal_connect_swapped (get_action_assert (de->builder, "sort-down"), "activate",
+ G_CALLBACK (psppire_data_editor_sort_descending),
+ de->data_editor);
- g_object_set (de->data_editor,
- "datasheet-column-menu", de->data_sheet_variable_popup_menu,
- "datasheet-row-menu", de->data_sheet_cases_popup_menu,
- "varsheet-row-menu", de->var_sheet_variable_popup_menu,
- NULL);
+ GtkMenu *var_sheet_variable_popup_menu = get_widget_assert (de->builder,
+ "varsheet-variable-popup");
- g_signal_connect (de, "delete-event", G_CALLBACK (on_delete), de);
+ GtkMenu *data_sheet_cases_popup_menu =
+ GTK_MENU (create_data_sheet_cases_popup_menu (de));
+ g_object_set (de->data_editor,
+ "datasheet-column-menu", data_sheet_variable_popup_menu,
+ "datasheet-row-menu", data_sheet_cases_popup_menu,
+ "varsheet-row-menu", var_sheet_variable_popup_menu,
+ NULL);
+ }
gtk_widget_show (GTK_WIDGET (de->data_editor));
gtk_widget_show (box);
NULL));
}
+
+
+
+\f
+
+static void
+psppire_data_window_iface_init (PsppireWindowIface *iface)
+{
+ iface->save = save_file;
+ iface->load = load_file;
+}