[glom] Trying to ignore unwanted column resize signals.



commit ec10bf2a257ffb3d5e74b61e356cec403419e915
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 27 19:26:10 2009 +0100

    Trying to ignore unwanted column resize signals.
    
    * glom/utility_widgets/db_adddel/db_adddel.[h|cc]:
    Removed unused set_column_width().
    construct_specified_columns_cellrenderer(): Added an InnerIgnore, though
    we already use one in construct_specified_columns().
    on_treeview_column_resized(): Check if we should ignore signals.
    Do not cast an int size to a guint, because it could be -1.

 ChangeLog                                   |   11 +++++++++++
 glom/utility_widgets/db_adddel/db_adddel.cc |   20 ++++++++++++--------
 glom/utility_widgets/db_adddel/db_adddel.h  |    3 ---
 3 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ab55361..acf43c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,17 @@
 
 2009-10-27  Murray Cumming  <murrayc murrayc com>
 
+  Trying to ignore unwanted column resize signals.
+  
+	* glom/utility_widgets/db_adddel/db_adddel.[h|cc]: 
+	Removed unused set_column_width().
+	construct_specified_columns_cellrenderer(): Added an InnerIgnore, though 
+	we already use one in construct_specified_columns().
+	on_treeview_column_resized(): Check if we should ignore signals.
+	Do not cast an int size to a guint, because it could be -1.
+
+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(), 
diff --git a/glom/utility_widgets/db_adddel/db_adddel.cc b/glom/utility_widgets/db_adddel/db_adddel.cc
index 155767b..a52f056 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel.cc
@@ -667,6 +667,8 @@ int DbAddDel::get_fixed_cell_height()
 
 Gtk::CellRenderer* DbAddDel::construct_specified_columns_cellrenderer(const sharedptr<LayoutItem>& layout_item, int model_column_index, int data_model_column_index)
 {
+  InnerIgnore innerIgnore(this); //see comments for InnerIgnore class
+
   Gtk::CellRenderer* pCellRenderer = 0;
 
   //Create the appropriate cellrenderer type:
@@ -1445,13 +1447,6 @@ void DbAddDel::set_allow_only_one_related_record(bool val)
   m_allow_only_one_related_record = val;
 }
 
-
-void DbAddDel::set_column_width(guint /* col */, guint /*width*/)
-{
-//  if( col < (guint)m_Sheet.get_columns_count())
-//    m_Sheet.set_column_width(col, width);
-}
-
 void DbAddDel::finish_editing()
 {
 //  bool bIgnoreSheetSignals = get_ignore_treeview_signals(); //The deactivate signals seems to cause the current cell to revert to it's previsous value.
@@ -1843,6 +1838,10 @@ void DbAddDel::on_treeview_column_resized(int model_column_index, DbTreeViewColu
 {
   if(!view_column)
     return;
+  
+  //Ignore this property change signal handler if we are setting the size in code:
+  if(m_bIgnoreTreeViewSignals)
+    return;
 
   //We do not save the column width if this is the last column, 
   //because that must always be automatic, 
@@ -1854,9 +1853,12 @@ void DbAddDel::on_treeview_column_resized(int model_column_index, DbTreeViewColu
 
   DbAddDelColumnInfo& column_info = m_ColumnTypes[model_column_index];
 
-  const guint width = (guint)view_column->get_width();
+  const int width = view_column->get_width();
   //std::cout << "  DbAddDel::on_treeview_column_resized(): width=" << width << std::endl;
 
+  if(width == -1) //Means automatic.
+    return;
+    
   if(column_info.m_item)
       column_info.m_item->set_display_width(width);
 }
@@ -1959,6 +1961,8 @@ bool DbAddDel::get_column_to_expand(guint& column_to_expand) const
 
 guint DbAddDel::treeview_append_column(const Glib::ustring& title, Gtk::CellRenderer& cellrenderer, int model_column_index, int data_model_column_index, bool expand)
 {
+  InnerIgnore innerIgnore(this); //see comments for InnerIgnore class
+
   #ifndef GLOM_ENABLE_MAEMO 
   DbTreeViewColumnGlom* pViewColumn = Gtk::manage( new DbTreeViewColumnGlom(Utils::string_escape_underscores(title), cellrenderer) );
   pViewColumn->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); //Need by fixed-height mode.
diff --git a/glom/utility_widgets/db_adddel/db_adddel.h b/glom/utility_widgets/db_adddel/db_adddel.h
index 03a5848..6924d55 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.h
+++ b/glom/utility_widgets/db_adddel/db_adddel.h
@@ -191,9 +191,6 @@ public:
   type_vec_strings get_columns_order() const;
 
   void remove_all_columns();
-  //virtual void set_columns_count(guint count);
-  //virtual void set_column_title(guint col, const Glib::ustring& strText);
-  void set_column_width(guint col, guint width);
 
   /// For popup cells.
   void set_column_choices(guint col, const type_vec_strings& vecStrings);



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