X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire.c;h=dbba57b69d6d0063866ba3b295eceba1f0fb0a62;hb=55077868a3eb1776432bcb46a3627cc8e0ee54db;hp=bdd5ad5332f4062d4b0bf6927a42ea2b57223d30;hpb=8953baa61127d6d3b91f763663ea647bf3e4e793;p=pspp-builds.git diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index bdd5ad53..dbba57b6 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -27,6 +27,7 @@ #include "psppire-data-window.h" #include "psppire.h" +#include "widgets.h" #include #include @@ -44,7 +45,6 @@ #include #include -#include #include "psppire-dict.h" #include "psppire-var-store.h" #include "psppire-data-store.h" @@ -52,7 +52,7 @@ #include "message-dialog.h" #include - +#include "psppire-window-register.h" #include "psppire-output-window.h" #include @@ -60,6 +60,7 @@ #include +GtkRecentManager *the_recent_mgr = 0; PsppireDataStore *the_data_store = 0; PsppireVarStore *the_var_store = 0; @@ -95,7 +96,7 @@ initialize (struct command_line_processor *clp, int argc, char **argv) bindtextdomain (PACKAGE, locale_dir); - glade_init (); + preregister_widgets (); gsl_set_error_handler_off (); fn_init (); @@ -147,6 +148,9 @@ initialize (struct command_line_processor *clp, int argc, char **argv) journal_enable (); textdomain (PACKAGE); + + the_recent_mgr = gtk_recent_manager_get_default (); + the_data_window = psppire_data_window_new (); command_line_processor_replace_aux (clp, &post_init_argp, the_source_stream); @@ -170,6 +174,24 @@ de_initialize (void) } +static void +func (gpointer key, gpointer value, gpointer data) +{ + gboolean rv; + PsppireWindow *window = PSPPIRE_WINDOW (value); + + g_signal_emit_by_name (window, "delete-event", 0, &rv); +} + +void +psppire_quit (void) +{ + PsppireWindowRegister *reg = psppire_window_register_new (); + psppire_window_register_foreach (reg, func, NULL); + + gtk_main_quit (); +} + struct icon_info { @@ -257,46 +279,8 @@ parse_non_options (int key, char *arg, struct argp_state *state) { case ARGP_KEY_ARG: { - struct string syntax; - FILE *fp = fopen (arg, "r"); - if (NULL == fp) - { - const int errnum = errno; - fprintf (state->err_stream, _("Cannot open %s: %s.\n"), - arg, strerror (errnum)); - return 0; - } - if ( sfm_detect (fp)) - { - ds_init_cstr (&syntax, "GET FILE="); - goto close; - } - rewind (fp); - if (pfm_detect (fp)) - { - ds_init_cstr (&syntax, "IMPORT FILE="); - goto close; - } - - fclose (fp); - msg (ME, _("%s is neither a system nor portable file"), arg); - break; - - close: - fclose (fp); - - syntax_gen_string (&syntax, ss_cstr (arg)); - ds_put_cstr (&syntax, "."); - - getl_append_source (ss, - create_syntax_string_source (ds_cstr (&syntax)), - GETL_BATCH, - ERRMODE_CONTINUE); - - ds_destroy (&syntax); - - psppire_window_set_filename (the_data_window, arg); - + psppire_data_window_load_file (PSPPIRE_DATA_WINDOW (the_data_window), + arg); break; } default: