summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-10-16 08:16:55 -0400
committerMatthias Clasen <mclasen@redhat.com>2010-10-16 08:16:55 -0400
commita62e1b95bc2d210ac8f49ed9e1519d98b6f97fd2 (patch)
treea7ad5c5447a5e01e2799ac3004e88b1cc6ad5f7c
parent098d23c096109aabda61ea26116e5be69696e2ca (diff)
downloadgtk+-a62e1b95bc2d210ac8f49ed9e1519d98b6f97fd2.tar.gz
Fix some GtkComboBoxText problems
-rw-r--r--gtk/gtkcombobox.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index a3888e9fbb..1a86277fe8 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -6176,13 +6176,16 @@ gtk_combo_box_get_has_entry (GtkComboBox *combo_box)
/**
* gtk_combo_box_set_entry_text_column:
- * @combo_box: A #GtkComboBox.
- * @text_column: A column in @model to get the strings from for the internal entry.
+ * @combo_box: A #GtkComboBox
+ * @text_column: A column in @model to get the strings from for
+ * the internal entry
*
* Sets the model column which @combo_box should use to get strings from
- * to be @text_column.
+ * to be @text_column. The column @text_column in the model of @combo_box
+ * must be of type %G_TYPE_STRING.
*
- * @combo_box must be created with GtkComboBox:has-entry as %TRUE.
+ * This is only relevant if @combo_box has been created with
+ * #GtkComboBox:has-entry as %TRUE.
*
* Since: 2.24
*/
@@ -6190,22 +6193,23 @@ void
gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box,
gint text_column)
{
+ GtkComboBoxPrivate *priv = combo_box->priv;
GtkTreeModel *model;
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
- g_return_if_fail (combo_box->priv->has_entry != FALSE);
model = gtk_combo_box_get_model (combo_box);
g_return_if_fail (text_column >= 0);
g_return_if_fail (model == NULL || text_column < gtk_tree_model_get_n_columns (model));
- combo_box->priv->text_column = text_column;
+ priv->text_column = text_column;
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box),
- combo_box->priv->text_renderer,
- "text", text_column,
- NULL);
+ if (priv->text_renderer != NULL)
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box),
+ priv->text_renderer,
+ "text", text_column,
+ NULL);
}
/**