[glom] Choices Combo: Fix a warning.



commit 643d08c00928d4285a40753aa13b6a0d5ee67564
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 19 11:25:16 2010 +0200

    Choices Combo: Fix a warning.
    
    * glom/mode_data/datawidget/combo.cc: set_choices_fixed(),
    set_choices_related(): Do not try to re-pack the existing cell.

 ChangeLog                          |    7 +++++++
 glom/mode_data/datawidget/combo.cc |   25 +++++++++++++------------
 2 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bf83286..8358532 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-10-19  Murray Cumming  <murrayc murrayc com>
 
+	Choices Combo: Fix a warning.
+
+	* glom/mode_data/datawidget/combo.cc: set_choices_fixed(),
+	set_choices_related(): Do not try to re-pack the existing cell.
+
+2010-10-19  Murray Cumming  <murrayc murrayc com>
+
 	Choices Combo: Fix a segfault.
 
 	* glom/mode_data/datawidget/combo.cc: set_choices_fixed(),
diff --git a/glom/mode_data/datawidget/combo.cc b/glom/mode_data/datawidget/combo.cc
index 10c2319..9f86217 100644
--- a/glom/mode_data/datawidget/combo.cc
+++ b/glom/mode_data/datawidget/combo.cc
@@ -98,16 +98,14 @@ void ComboGlom::set_choices_fixed(const FieldFormatting::type_list_values& list_
   const guint columns_count = model->get_n_columns();
   for(guint i = 0; i < columns_count; ++i)
   {
-    Gtk::CellRendererText* cell = 0;
+
 
     //set_entry_text_column() adds its own CellRenderer,
     //which we cannot replace without confusing (and crashing) GtkComboBox.
     if(i == 0 && get_has_entry())
-      cell = dynamic_cast<Gtk::CellRendererText*>(get_first_cell());
-
-    if(!cell)
-      cell = Gtk::manage(new Gtk::CellRendererText);
+      continue;
 
+    Gtk::CellRendererText* cell = Gtk::manage(new Gtk::CellRendererText);
     cell->property_xalign() = 0.0f;
 
     //Use the renderer:
@@ -165,17 +163,20 @@ void ComboGlom::set_choices_related(const Document* document, const sharedptr<co
   {
     const sharedptr<const LayoutItem> layout_item = *iter;
     if(!layout_item) //column_info.m_visible)
+    {
+      ++model_column_index;
       continue;
-
-    Gtk::CellRenderer* cell = 0;
+    }
 
     //set_entry_text_column() adds its own CellRenderer,
     //which we cannot replace without confusing (and crashing) GtkComboBox.
     if(model_column_index == 0 && get_has_entry())
-      cell = get_first_cell();
+    {
+       ++model_column_index;
+      continue;
+    }
 
-    if(!cell)
-      cell  = create_cell(layout_item, m_table_name, document, get_fixed_cell_height(*this));
+    Gtk::CellRenderer* cell = create_cell(layout_item, m_table_name, document, get_fixed_cell_height(*this));
 
     //Add the ViewColumn:
     if(cell)
@@ -187,9 +188,9 @@ void ComboGlom::set_choices_related(const Document* document, const sharedptr<co
       pack_start(*cell, false);
 
       cell_connect_cell_data_func(this, cell, model_column_index);
-
-      ++model_column_index;
     }
+
+     ++model_column_index;
   } //for
 }
 



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