[glom] offer_new_or_existing(): Add Gtk::Builder error handling .



commit 6658483a94243e23ea89413540c4e4b5ff16bc97
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Sep 5 01:45:23 2009 +0200

    offer_new_or_existing(): Add Gtk::Builder error handling .
    
    * glom/application.cc: offer_new_or_existing(): Add error handling to
    show how GtkBuilder complains about Atk objects in .glade files on
    Maemo, and actually fails.

 ChangeLog           |    8 ++++++++
 glom/application.cc |   23 +++++++++++++++++++----
 2 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 15a2696..94cc416 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-09-05  Murray Cumming  <murrayc murrayc com>
 
+	offer_new_or_existing(): Add Gtk::Builder error handling .
+
+	* glom/application.cc: offer_new_or_existing(): Add error handling to 
+	show how GtkBuilder complains about Atk objects in .glade files on 
+	Maemo, and actually fails.
+
+2009-09-05  Murray Cumming  <murrayc murrayc com>
+
 	* glom/print_layout/canvas_print_layout.cc:
 	* glom/utility_widgets/imageglom.cc: Fix the build when -fno-exceptions 
 	is used.
diff --git a/glom/application.cc b/glom/application.cc
index cfd8ed6..36fb434 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -1259,12 +1259,27 @@ Glib::RefPtr<Gtk::UIManager> App_Glom::get_ui_manager()
 bool App_Glom::offer_new_or_existing()
 {
   //Offer to load an existing document, or start a new one.
+  const Glib::ustring glade_path = Utils::get_glade_file_path("glom.glade");
+  Glib::RefPtr<Gtk::Builder> refXml;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_existing_or_new");
+  try
+  {
+    refXml = Gtk::Builder::create_from_file(glade_path, "dialog_existing_or_new");
+  }
+  catch(const Glib::Error& ex)
+  {
+    std::cerr << "App_Glom::offer_new_or_existing(): Gtk::Builder::create_from_file() failed: " << ex.what() << std::endl;
+  }
 #else
-  std::auto_ptr<Glib::Error> error;
-  Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_existing_or_new", error);
-#endif      
+  std::auto_ptr<Glib::Error> ex;
+  refXml = Gtk::Builder::create_from_file(glade_path, "dialog_existing_or_new", ex);
+  if(ex.get())
+  {
+    std::cerr << "App_Glom::offer_new_or_existing(): Gtk::Builder::create_from_file() failed:" << ex->what() << std::endl;
+  }
+#endif
+
+  g_assert(refXml);
 
   Dialog_ExistingOrNew* dialog_raw = 0;
   refXml->get_widget_derived("dialog_existing_or_new", dialog_raw);



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