[gtk+] Allow NULL iter in gtk_combo_box_set_active_iter to unset
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Allow NULL iter in gtk_combo_box_set_active_iter to unset
- Date: Fri, 8 Jan 2010 18:49:30 +0000 (UTC)
commit e18ac2a617818a8b16aec512a053d212df4bb9d1
Author: Christian Persch <chpe gnome org>
Date: Wed Jan 6 18:46:37 2010 +0100
Allow NULL iter in gtk_combo_box_set_active_iter to unset
Bug #606230.
gtk/gtkcombobox.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 2cb2daf..f4459f4 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -5001,10 +5001,12 @@ gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
/**
* gtk_combo_box_set_active_iter:
* @combo_box: A #GtkComboBox
- * @iter: The #GtkTreeIter
+ * @iter: The #GtkTreeIter, or %NULL
*
- * Sets the current active item to be the one referenced by @iter.
- * @iter must correspond to a path of depth one.
+ * Sets the current active item to be the one referenced by @iter, or
+ * unsets the active item if @iter is %NULL.
+ *
+ * @iter must correspond to a path of depth one, or be %NULL.
*
* Since: 2.4
*/
@@ -5012,11 +5014,13 @@ void
gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter)
{
- GtkTreePath *path;
+ GtkTreePath *path = NULL;
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
- path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo_box), iter);
+ if (iter)
+ path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo_box), iter);
+
gtk_combo_box_set_active_internal (combo_box, path);
gtk_tree_path_free (path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]