From dc76c521195010287b183f08034e0756ad8eb2f9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 12 Nov 2011 15:06:23 -0800 Subject: [PATCH] gui: Speed up initial file load with many columns This makes a huge difference in startup time when there are hundreds of columns, by setting up the data sheet before showing the window that contains it. Files opened from File|Open were already opened this way. I was a little surprised that File|Open was so much faster than specifying a file on the command line until I figured out the difference. --- src/ui/gui/psppire.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index be095248a9..8bd6b6fe5e 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011, 2012 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 @@ -74,8 +74,6 @@ static gchar *local_to_filename_encoding (const char *fn); void initialize (const char *data_file) { - PsppireDataWindow *data_window; - i18n_init (); preregister_widgets (); @@ -100,8 +98,6 @@ initialize (const char *data_file) psppire_selector_set_default_selection_func (PSPPIRE_VAR_VIEW_TYPE, insert_source_row_into_tree_view); psppire_selector_set_default_selection_func (GTK_TYPE_TREE_VIEW, insert_source_row_into_tree_view); - data_window = psppire_default_data_window (); - if (data_file) { gchar *filename = local_to_filename_encoding (data_file); @@ -109,12 +105,17 @@ initialize (const char *data_file) /* Check to see if the file is a .sav or a .por file. If not assume that it is a syntax file */ if ( any_reader_may_open (filename)) - psppire_window_load (PSPPIRE_WINDOW (data_window), filename); + open_data_window (NULL, filename); else - open_syntax_window (filename, NULL); + { + create_data_window (); + open_syntax_window (filename, NULL); + } g_free (filename); } + else + create_data_window (); } -- 2.30.2