[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gEDA-dev: Patch to fix file-choosers after closing save dialog with"Escape"



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

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 16:52:16 -0000
@@ -715,6 +715,7 @@ void x_fileselect_saveas(GtkWidget *w, F
       i_update_toolbar(w_current);
     }
 
+// TODO: THIS x_fileselect_close NEEDS TO BE RUN IN _EVERY_ CASE
     x_fileselect_close (NULL, f_current);
     if (f_current->filesel_type == SAVEAS_QUIT) {
       x_window_close(w_current);
@@ -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