[glom] ComboEntry: Actually show the text value in the drop-down.



commit bf6f71487c68d16c66fc6184abba74de0d1f5b6d
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Oct 4 16:45:22 2010 +0200

    ComboEntry: Actually show the text value in the drop-down.
    
    * glom/mode_data/datawidget/treemodel_db_withextratext.cc:
    get_value_vfunc(): Use m_column_index_key instead of get_value_key() because
    that is not set, because we do not call set_value_key() for each row. I
    will try to remove that maybe-unused API.
    * glom/mode_data/datawidget/comboentry.cc: set_choices_related():
    Set up a cell_data_func for the automaticaly-added cell when we
    repack it, because calling clear() (to unpack it) disconnects the
    model-view association for that cell.

 ChangeLog                                          |   13 +++++++++++++
 glom/mode_data/datawidget/comboentry.cc            |    1 +
 .../datawidget/treemodel_db_withextratext.cc       |   13 +++++++++----
 3 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 201e3ee..0a61cff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,19 @@
 
 2010-10-04  Murray Cumming  <murrayc murrayc com>
 
+	ComboEntry: Actually show the text value in the drop-down.
+
+	* glom/mode_data/datawidget/treemodel_db_withextratext.cc:
+	get_value_vfunc(): Use m_column_index_key instead of get_value_key() because 
+	that is not set, because we do not call set_value_key() for each row. I 
+	will try to remove that maybe-unused API.
+	* glom/mode_data/datawidget/comboentry.cc: set_choices_related():
+	Set up a cell_data_func for the automaticaly-added cell when we 
+	repack it, because calling clear() (to unpack it) disconnects the 
+	model-view association for that cell.
+
+2010-10-04  Murray Cumming  <murrayc murrayc com>
+
 	TreeModelDbWithExtraText: Fix the use of Glib::Value.
 
 	* glom/mode_data/datawidget/treemodel_db.cc: Intialize m_column_index_key 
diff --git a/glom/mode_data/datawidget/comboentry.cc b/glom/mode_data/datawidget/comboentry.cc
index c043b72..54176eb 100644
--- a/glom/mode_data/datawidget/comboentry.cc
+++ b/glom/mode_data/datawidget/comboentry.cc
@@ -183,6 +183,7 @@ void ComboEntry::set_choices_related(const Document* document, const sharedptr<c
         clear();
         pack_start(*cell, false);
         cell->unreference();
+        cell_connect_cell_data_func(this, cell, i);
       }
     }
     else
diff --git a/glom/mode_data/datawidget/treemodel_db_withextratext.cc b/glom/mode_data/datawidget/treemodel_db_withextratext.cc
index e59bb67..b410458 100644
--- a/glom/mode_data/datawidget/treemodel_db_withextratext.cc
+++ b/glom/mode_data/datawidget/treemodel_db_withextratext.cc
@@ -85,16 +85,21 @@ void DbTreeModelWithExtraText::get_value_vfunc(const TreeModel::iterator& iter,
   {
     Glib::ustring text;
     
-    if(!m_item_key)
+    if(m_column_index_key == -1)
     {
-      std::cerr << G_STRFUNC << ": m_item_key is null." << std::endl;
+      std::cerr << G_STRFUNC << ": m_column_index_key is not set." << std::endl;
     }
     else
     {
-      const DbValue dbvalue = get_key_value(iter);
+      Glib::Value<Gnome::Gda::Value> value_db;
+      get_value_vfunc(iter, m_column_index_key, value_db);
+      const DbValue dbvalue = value_db.get();
+      
       text =
         Conversions::get_text_for_gda_value(m_item_key->get_glom_type(), dbvalue, m_item_key->get_formatting_used().m_numeric_format);
-      
+      //std::cout << "debug: text=" << text << std::endl;
+      //std::cout << "  debug: m_item_key name=" << m_item_key->get_name() << std::endl;
+      //std::cout << "  debug: dbvalue=" << dbvalue.to_string() << std::endl;
     }
   
     type_value_string value_specific;



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