[glom] Avoid runtime warnings about 0 size TreeViewColumn.



commit 91c51937b0af002802b8358476b9089dbf2f7ac9
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 27 18:59:35 2009 +0100

    Avoid runtime warnings about 0 size TreeViewColumn.
    
    * glom/utility_widgets/db_adddel/db_adddel.cc: construct_specified_columns(),
    treeview_append_column(): Avoid calling TreeViewColumn::set_fixed_width()
    with a 0 size, avoiding a runtime assertion.

 ChangeLog                                   |    8 ++++++++
 glom/mode_data/box_data_portal.cc           |    2 +-
 glom/utility_widgets/db_adddel/db_adddel.cc |    8 ++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c22cad7..ab55361 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,14 @@
 
 2009-10-27  Murray Cumming  <murrayc murrayc com>
 
+  Avoid runtime warnings about 0 size TreeViewColumn.
+  
+	* glom/utility_widgets/db_adddel/db_adddel.cc: construct_specified_columns(), 
+	treeview_append_column(): Avoid calling TreeViewColumn::set_fixed_width() 
+	with a 0 size, avoiding a runtime assertion.
+
+2009-10-27  Murray Cumming  <murrayc murrayc com>
+
   Fix some warnings.
   
 	* glom/dialog_existing_or_new.cc: get_service_info(): Replace a 0 with 
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 6f03248..feef1a2 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -314,7 +314,7 @@ bool Box_Data_Portal::init_db_details(const Glib::ustring& parent_table, bool sh
 bool Box_Data_Portal::refresh_data_from_database_with_foreign_key(const Gnome::Gda::Value& foreign_key_value)
 {
   m_key_value = foreign_key_value;
-  std::cout << "DEBUG: Box_Data_Portal::refresh_data_from_database_with_foreign_key(): m_key_value=" << m_key_value.to_string() << std::endl;
+  //std::cout << "DEBUG: Box_Data_Portal::refresh_data_from_database_with_foreign_key(): m_key_value=" << m_key_value.to_string() << std::endl;
   
 
   if(m_key_field && m_portal)
diff --git a/glom/utility_widgets/db_adddel/db_adddel.cc b/glom/utility_widgets/db_adddel/db_adddel.cc
index 7fe90cb..155767b 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel.cc
@@ -1055,7 +1055,9 @@ void DbAddDel::construct_specified_columns()
     // the spacing property of the treeviewcolumn.
     int horizontal_separator = 0;
     m_TreeView.get_style_property("horizontal-separator", horizontal_separator);
-    m_treeviewcolumn_button->set_fixed_width(width + horizontal_separator*2);
+    const int button_width = width + horizontal_separator*2;
+    if(button_width > 0) //Otherwise an assertion fails.
+      m_treeviewcolumn_button->set_fixed_width(button_width);
 
     m_treeviewcolumn_button->set_visible(m_allow_view_details);
 
@@ -2012,7 +2014,9 @@ guint DbAddDel::treeview_append_column(const Glib::ustring& title, Gtk::CellRend
   #ifdef GLOM_ENABLE_MAEMO
   cellrenderer.set_property("width", (int)column_width);
   #else
-  pViewColumn->set_fixed_width((int)column_width); //This is the only way to set the width, so we need to set it as resizable again immediately afterwards.
+  if(column_width > 0) //Otherwise there's an assertion fails.
+    pViewColumn->set_fixed_width((int)column_width); //This is the only way to set the width, so we need to set it as resizable again immediately afterwards.
+    
   pViewColumn->set_resizable();
   //This property is read only: pViewColumn->property_width() = (int)column_width;
 



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