[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/ui/gui menu-actions.c
From: |
John Darrington |
Subject: |
[Pspp-cvs] pspp/src/ui/gui menu-actions.c |
Date: |
Sat, 29 Jul 2006 08:49:59 +0000 |
CVSROOT: /sources/pspp
Module name: pspp
Changes by: John Darrington <jmd> 06/07/29 08:49:59
Modified files:
src/ui/gui : menu-actions.c
Log message:
Fixed bug where psppire tried to save a file even after Cancel had been
clicked.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/menu-actions.c?cvsroot=pspp&r1=1.14&r2=1.15
Patches:
Index: menu-actions.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/menu-actions.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- menu-actions.c 29 Jul 2006 05:57:26 -0000 1.14
+++ menu-actions.c 29 Jul 2006 08:49:59 -0000 1.15
@@ -262,9 +262,10 @@
/* Re initialise HANDLE, by interrogating the user for a new file name */
-static void
+static gboolean
recreate_save_handle(struct file_handle **handle)
{
+ gint response;
GtkWidget *dialog;
GtkWidget *data_editor = get_widget_assert(xml, "data_editor");
@@ -276,7 +277,9 @@
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ if (response == GTK_RESPONSE_ACCEPT)
{
char *file_name = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER (dialog));
@@ -285,7 +288,8 @@
if ( *handle )
fh_free(*handle);
- *handle = fh_create_file (handle_name, file_name,
fh_default_properties());
+ *handle = fh_create_file (handle_name, file_name,
+ fh_default_properties());
psppire_set_window_title(basename(file_name));
@@ -293,6 +297,8 @@
}
gtk_widget_destroy (dialog);
+
+ return ( response == GTK_RESPONSE_ACCEPT ) ;
}
void
@@ -303,7 +309,10 @@
PsppireDataStore *data_store ;
if ( ! psppire_handle )
- recreate_save_handle(&psppire_handle);
+ {
+ if ( ! recreate_save_handle(&psppire_handle) )
+ return;
+ }
data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet"));
data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet));
@@ -321,7 +330,9 @@
GtkSheet *data_sheet ;
PsppireDataStore *data_store ;
- recreate_save_handle(&psppire_handle);
+ if ( ! recreate_save_handle(&psppire_handle) )
+ return ;
+
if ( ! psppire_handle )
return ;