[gtk+/gtk-2-24] Use property system to coerce model data to G_TYPE_STRING



commit d942045c10c7a0514a8813860565e77deb068225
Author: Christian Dywan <christian twotoasts de>
Date:   Fri Oct 15 16:29:30 2010 +0200

    Use property system to coerce model data to G_TYPE_STRING
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=423201

 gtk/gtkcombobox.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 2daa469..2e2ca7a 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -5688,7 +5688,6 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
   GtkComboBoxPrivate *priv = combo_box->priv;
   GtkTreeModel *model;
   GtkTreeIter iter;
-  gchar *str = NULL;
 
   if (gtk_combo_box_get_active_iter (combo_box, &iter))
     {
@@ -5696,17 +5695,18 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
 
       if (entry)
 	{
+          GValue value = {0,};
+
 	  g_signal_handlers_block_by_func (entry,
 					   gtk_combo_box_entry_contents_changed,
 					   combo_box);
 
 	  model = gtk_combo_box_get_model (combo_box);
 
-	  gtk_tree_model_get (model, &iter,
-			      priv->text_column, &str,
-			      -1);
-	  gtk_entry_set_text (entry, str);
-	  g_free (str);
+          gtk_tree_model_get_value (model, &iter,
+                                    priv->text_column, &value);
+          g_object_set_property (G_OBJECT (entry), "text", &value);
+          g_value_unset (&value);
 
 	  g_signal_handlers_unblock_by_func (entry,
 					     gtk_combo_box_entry_contents_changed,



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