glom r1515 - in branches/glom-1-6: . glom



Author: murrayc
Date: Wed Apr  2 12:09:53 2008
New Revision: 1515
URL: http://svn.gnome.org/viewvc/glom?rev=1515&view=rev

Log:
2008-04-02  Murray Cumming  <murrayc murrayc com>

* glom/application.h 
* glom/application.cc added a Bakery::App::add_ui_from_string() override, 
so we can workaround a problem with UTF8 in the UI description in 
gtkmm < 2.12.7.
Bug #525718 (Pavel MlÄoch)


Modified:
   branches/glom-1-6/ChangeLog
   branches/glom-1-6/glom/application.cc
   branches/glom-1-6/glom/application.h

Modified: branches/glom-1-6/glom/application.cc
==============================================================================
--- branches/glom-1-6/glom/application.cc	(original)
+++ branches/glom-1-6/glom/application.cc	Wed Apr  2 12:09:53 2008
@@ -42,6 +42,8 @@
 #include <hildon/hildon-window.h>
 #endif // GLOM_ENABLE_MAEMO
 
+#include <gtk/gtkuimanager.h>
+
 #ifdef GLOM_ENABLE_MAEMO
 namespace {
 	HildonWindow* turn_gtk_window_into_hildon_window(GtkWindow* cobject)
@@ -230,6 +232,22 @@
 */
 }
 
+//gtkmm <2.12.7 has a bug that stops this working with non-ASCII text,
+//so we use the C function instead.
+//We could put this in Bakery instead, but it's hard enough just getting updates 
+//into Ubuntu, so we override this Bakery::App method here.
+//TODO: Remove this when gtkmm 2.12.7 is distributed widely-enough.
+void App_Glom::add_ui_from_string(const Glib::ustring& ui_description)
+{
+  GError* error = 0;
+  gtk_ui_manager_add_ui_from_string(m_refUIManager->gobj(), ui_description.c_str(), ui_description.bytes(), &error);
+  if(error)
+  {
+    std::cerr << "App_Glom::add_ui_from_string(): exception: " << error->message << std::endl;
+    g_clear_error(&error);
+  }
+}
+
 void App_Glom::init_menus_file()
 {
   //Overridden to remove the Save and Save-As menu items,
@@ -1680,7 +1698,8 @@
   {
     const Glib::Error& ex = *error.get();
 #endif // GLIBMM_EXCEPTIONS_ENABLED
-    std::cerr << " App_Glom::fill_menu_tables(): building menus failed: " <<  ex.what();
+    std::cerr << " App_Glom::fill_menu_tables(): building menus failed: " <<  ex.what() << std::endl;
+    std::cerr << "   The ui_description was: " <<  ui_description << std::endl;
   }
 }
 

Modified: branches/glom-1-6/glom/application.h
==============================================================================
--- branches/glom-1-6/glom/application.h	(original)
+++ branches/glom-1-6/glom/application.h	Wed Apr  2 12:09:53 2008
@@ -78,6 +78,8 @@
   virtual void init_toolbars(); //override
   virtual void init_create_document(); //override
   virtual bool on_document_load(); //override.
+  
+  virtual void add_ui_from_string(const Glib::ustring& ui_description);
 
   virtual bool offer_new_or_existing();
 



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