glom r1456 - in trunk: . glom glom/utility_widgets



Author: murrayc
Date: Thu Mar 13 11:11:50 2008
New Revision: 1456
URL: http://svn.gnome.org/viewvc/glom?rev=1456&view=rev

Log:
2008-03-13  Murray Cumming  <murrayc murrayc com>

Bug 521992 â Pressing Escape on Initial dialog does not close 
application properly.
(Pavel MlÄoch)

* glom/dialog_database_preferences.cc load_from_document():
Do not crash if the Gda::DataModel is empty.

* glom/application.cc ui_file_select_save(), on_document_load(),
  offer_new_or_existing():
* glom/frame_glom.cc on_menu_file_export():
* glom/utility_widgets/imageglom.cc
  on_menupopup_activate_select_file(): Check for 
Gtk::RESPONSE_DELETE_EVENT instead of just Gtk::RESPONSE_CANCEL, so 
that we treat pressing Escape the same as pressing Cancel. When we 
just ignore this then we can leave the application in an unexpected 
state.

Modified:
   trunk/ChangeLog
   trunk/glom/application.cc
   trunk/glom/dialog_database_preferences.cc
   trunk/glom/frame_glom.cc
   trunk/glom/utility_widgets/imageglom.cc

Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc	(original)
+++ trunk/glom/application.cc	Thu Mar 13 11:11:50 2008
@@ -904,7 +904,7 @@
 
         const int response = dialog.run();
         dialog.hide();
-        if(response == Gtk::RESPONSE_CANCEL)
+        if((response == Gtk::RESPONSE_CANCEL)  || (response == Gtk::RESPONSE_DELETE_EVENT))
           return false;
       }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
@@ -1223,7 +1223,7 @@
     }
   }
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  if(response_id == 3) //Open Example
+  else if(response_id == 3) //Open Example
   {
     //Based on on_menu_file_open();
 
@@ -1350,7 +1350,7 @@
     }
   }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
-  else if(response_id == Gtk::RESPONSE_CANCEL)
+  else if((response_id == Gtk::RESPONSE_CANCEL)  || (response_id == Gtk::RESPONSE_DELETE_EVENT))
   {
     return false; //close the window to close the application, because they need to choose a new or existing document.
   }
@@ -2045,7 +2045,7 @@
 
   const int response_id = fileChooser_Open.run();
   fileChooser_Open.hide();
-  if(response_id != Gtk::RESPONSE_CANCEL)
+  if((response_id != Gtk::RESPONSE_CANCEL) || (response_id != Gtk::RESPONSE_DELETE_EVENT)
   {
     if(response_id == GLOM_RESPONSE_BROWSE_NETWORK)
     {
@@ -2187,7 +2187,7 @@
 
     const int response_id = fileChooser_Save->run();
     fileChooser_Save->hide();
-    if(response_id != Gtk::RESPONSE_CANCEL)
+    if((response_id != Gtk::RESPONSE_CANCEL) && (response_id != Gtk::RESPONSE_DELETE_EVENT))
     {
       const Glib::ustring uri_chosen = fileChooser_Save->get_uri();
 

Modified: trunk/glom/dialog_database_preferences.cc
==============================================================================
--- trunk/glom/dialog_database_preferences.cc	(original)
+++ trunk/glom/dialog_database_preferences.cc	Thu Mar 13 11:11:50 2008
@@ -145,6 +145,12 @@
   NumericFormat numeric_format; //ignored
 
   Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute(sql_query, this);
+  if(!datamodel)
+  {
+    std::cerr << "Dialog_Database_Preferences::load_from_document(): Gda::DataModel is NULL." << std::endl;
+    return;
+  }
+
   guint count = datamodel->get_n_rows();
   for(guint i = 0; i < count; ++i)
   {

Modified: trunk/glom/frame_glom.cc
==============================================================================
--- trunk/glom/frame_glom.cc	(original)
+++ trunk/glom/frame_glom.cc	Thu Mar 13 11:11:50 2008
@@ -529,7 +529,7 @@
   const int response = dialog.run();
   dialog.hide();
 
-  if(response == Gtk::RESPONSE_CANCEL)
+  if((response == Gtk::RESPONSE_CANCEL) || (response == Gtk::RESPONSE_DELETE_EVENT))
     return;
 
   const std::string filepath = dialog.get_filename();

Modified: trunk/glom/utility_widgets/imageglom.cc
==============================================================================
--- trunk/glom/utility_widgets/imageglom.cc	(original)
+++ trunk/glom/utility_widgets/imageglom.cc	Thu Mar 13 11:11:50 2008
@@ -392,7 +392,7 @@
   int response = dialog.run();
   dialog.hide();
 
-  if(response != Gtk::RESPONSE_CANCEL)
+  if((response != Gtk::RESPONSE_CANCEL) && (response != Gtk::RESPONSE_DELETE_EVENT))
   {
     const std::string filepath = dialog.get_filename();
     if(!filepath.empty())



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