[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gEDA-dev: Patch to fix file-choosers after closing save dialogwith "Escape"
On Tue, 2006-09-05 at 17:57 +0100, Peter Clifton wrote:
> Attached is a patch against CVS HEAD (before my other two patches to
> x_fileselect.c), which fixes a bug where the file-choosers fail to work
> after closing a file-saveas chooser with the "Escape" key.
>
> When you close a file-chooser with "Escape", the
> GTK_RESPONSE_DELETE_EVENT signal was being sent (which is odd, since
> from reading the GTK+ sourcecode, I expected it to be sending the
> default GTK_RESPONSE_CANCEL event). This wasn't caught in the response
> code switch statement.
>
> I've added a default catch to the switch statement which handles the
> saveas choosers, so that any unidentified return code will act as
> "Cancel". I left the "case GTK_RESPONSE_CANCEL:" and added a "case
> GTK_RESPONSE_DELETE_EVENT:" for clarity.
>
> The file-open chooser catches unknown response codes with an "else".
>
> Regards
>
> Peter Clifton
Just noticed that I'd left a TODO in that... sorry.
The gtk file choosers don't appear to return with an empty filename, so
the "else" should never get executed, but still... if by some means it
did, we need to call x_fileselect_close( NULL, f_current ).
See latest patch attached.
Peter C.
Index: x_fileselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_fileselect.c,v
retrieving revision 1.24
diff -U3 -p -r1.24 x_fileselect.c
--- x_fileselect.c 22 Aug 2006 03:01:21 -0000 1.24
+++ x_fileselect.c 5 Sep 2006 17:02:45 -0000
@@ -728,6 +728,7 @@ void x_fileselect_saveas(GtkWidget *w, F
/* do nothing if SAVEAS_NONE */
} else {
+ x_fileselect_close (NULL, f_current);
s_log_message(_("Specify a Filename!\n"));
}
if (string != NULL) {
@@ -2367,9 +2368,6 @@ void x_fileselect_setup (TOPLEVEL *w_cur
g_free (filename);
}
break;
- case GTK_RESPONSE_CANCEL:
- x_fileselect_close (NULL, f_current);
- break;
case GTK_RESPONSE_REJECT:
x_fileselect_close (NULL, f_current);
@@ -2378,6 +2376,14 @@ void x_fileselect_setup (TOPLEVEL *w_cur
w_current->page_current->CHANGED = 0;
i_callback_page_close (w_current, 0, NULL);
break;
+
+ /* Catch any cancel, and any mechanisms which close the dialog,
+ * e.g. "Escape" key which returns GTK_RESPONSE_DELETE_EVENT */
+ case GTK_RESPONSE_CANCEL:
+ case GTK_RESPONSE_DELETE_EVENT:
+ default:
+ x_fileselect_close (NULL, f_current);
+ break;
}
g_free (title);
_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev