From: Ben Pfaff Date: Mon, 9 May 2011 04:52:08 +0000 (-0700) Subject: gui: Make File|Recently Used Data behave like File|Open. X-Git-Tag: v0.7.9~305 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c969e0cddd76560ea7020acdc6037fe7b426502f;p=pspp-builds.git gui: Make File|Recently Used Data behave like File|Open. File|Open opens a new dataset if the current one is non-empty. Due to an oversight, File|Recently Used Data always replaced the current dataset. This commit makes File|Recently Used Data work just like File|Open. --- diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index c3886e1d..3698a7af 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -748,7 +748,7 @@ on_recent_data_select (GtkMenuShell *menushell, g_free (uri); - psppire_window_load (window, file); + open_data_window (window, file); g_free (file); } @@ -1347,3 +1347,18 @@ create_data_window (void) { gtk_widget_show (psppire_data_window_new (NULL)); } + +void +open_data_window (PsppireWindow *victim, const char *file_name) +{ + GtkWidget *window; + + if (PSPPIRE_IS_DATA_WINDOW (victim) + && psppire_data_window_is_empty (PSPPIRE_DATA_WINDOW (victim))) + window = GTK_WIDGET (victim); + else + window = psppire_data_window_new (NULL); + + psppire_window_load (PSPPIRE_WINDOW (window), file_name); + gtk_widget_show (window); +} diff --git a/src/ui/gui/psppire-data-window.h b/src/ui/gui/psppire-data-window.h index 64fe076d..93b51b0c 100644 --- a/src/ui/gui/psppire-data-window.h +++ b/src/ui/gui/psppire-data-window.h @@ -89,6 +89,7 @@ PsppireDataWindow *psppire_data_window_for_dataset (struct dataset *); bool psppire_data_window_is_empty (PsppireDataWindow *); void create_data_window (void); +void open_data_window (PsppireWindow *victim, const char *file_name); G_END_DECLS diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c index f2943645..a2bf672e 100644 --- a/src/ui/gui/psppire-window.c +++ b/src/ui/gui/psppire-window.c @@ -821,18 +821,7 @@ psppire_window_open (PsppireWindow *de) gchar *sysname = convert_glib_filename_to_system_filename (name, NULL); if (any_reader_may_open (sysname)) - { - PsppireWindow *window; - - if (PSPPIRE_IS_DATA_WINDOW (de) - && psppire_data_window_is_empty (PSPPIRE_DATA_WINDOW (de))) - window = de; - else - window = PSPPIRE_WINDOW (psppire_data_window_new (NULL)); - - psppire_window_load (window, name); - gtk_widget_show (GTK_WIDGET (window)); - } + open_data_window (de, name); else open_syntax_window (name);