]> Pileus Git - ~andy/gtk/commitdiff
Use property system to coerce model data to G_TYPE_STRING
authorChristian Dywan <christian@twotoasts.de>
Fri, 15 Oct 2010 14:29:30 +0000 (16:29 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 15 Oct 2010 21:00:13 +0000 (17:00 -0400)
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=423201
gtk/gtkcombobox.c

index d01791ec90f3395d00a0af0c6fe34bb4292768c9..a3888e9fbba50a72a8bf4d8d1a70ab00b2be7273 100644 (file)
@@ -5670,7 +5670,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))
     {
@@ -5678,17 +5677,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,