glom r1455 - in branches/glom-1-6: . glom glom/utility_widgets



Author: murrayc
Date: Thu Mar 13 11:04:10 2008
New Revision: 1455
URL: http://svn.gnome.org/viewvc/glom?rev=1455&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:
   branches/glom-1-6/ChangeLog
   branches/glom-1-6/glom/application.cc
   branches/glom-1-6/glom/dialog_database_preferences.cc
   branches/glom-1-6/glom/frame_glom.cc
   branches/glom-1-6/glom/utility_widgets/imageglom.cc

Modified: branches/glom-1-6/glom/application.cc
==============================================================================
--- branches/glom-1-6/glom/application.cc	(original)
+++ branches/glom-1-6/glom/application.cc	Thu Mar 13 11:04:10 2008
@@ -657,7 +657,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();
 
@@ -906,7 +906,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
@@ -1137,13 +1137,15 @@
   Gtk::Frame* recent_frame = NULL;
   refXml->get_widget("existing_or_new_recentchooser_frame", recent_frame);
 
-  // Hide the recent chooser when they are not any recently used files
-  if(recent_chooser->get_items().empty()) recent_frame->hide();
+  // Hide the recent chooser when there are no recently used files
+  if(recent_chooser->get_items().empty())
+    recent_frame->hide();
+
   recent_chooser->signal_item_activated().connect(sigc::bind(sigc::mem_fun(*dialog, &Gtk::Dialog::response), 1)); // Open
 
 #ifdef GLOM_ENABLE_CLIENT_ONLY
-  // Don't offer the user to create a new document, because without
-  // developer mode he couldn't do anything useful without it, anyway.
+  // Don't offer the user the choice to create a new document, because without
+  // developer mode he couldn't do anything useful with it anyway:
   Gtk::Button* new_button;
   refXml->get_widget("existing_or_new_button_new", new_button);
   new_button->hide();
@@ -1170,7 +1172,7 @@
 #endif
 
   const int response_id = dialog->run();
-  Glib::ustring selected_uri = recent_chooser->get_current_uri();
+  const Glib::ustring selected_uri = recent_chooser->get_current_uri();
 
   delete dialog;
   dialog = 0;
@@ -1309,7 +1311,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.
   }

Modified: branches/glom-1-6/glom/dialog_database_preferences.cc
==============================================================================
--- branches/glom-1-6/glom/dialog_database_preferences.cc	(original)
+++ branches/glom-1-6/glom/dialog_database_preferences.cc	Thu Mar 13 11:04:10 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: branches/glom-1-6/glom/frame_glom.cc
==============================================================================
--- branches/glom-1-6/glom/frame_glom.cc	(original)
+++ branches/glom-1-6/glom/frame_glom.cc	Thu Mar 13 11:04:10 2008
@@ -646,7 +646,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: branches/glom-1-6/glom/utility_widgets/imageglom.cc
==============================================================================
--- branches/glom-1-6/glom/utility_widgets/imageglom.cc	(original)
+++ branches/glom-1-6/glom/utility_widgets/imageglom.cc	Thu Mar 13 11:04:10 2008
@@ -391,7 +391,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]