From ef8144bd71be1ec815248686c5f3cecbca917777 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 2 Aug 2008 04:42:36 +0000 Subject: [PATCH] Add an example to the docs svn path=/trunk/; revision=20935 --- ChangeLog | 9 +++++++++ gtk/gtktreemodelfilter.c | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index a75a871c05..f5e352ec89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-08-02 Matthias Clasen + + Bug 523950 – GtkTreeModelFilter's visible function may get an empty + row + + * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_set_visible_func): + Explain and show how iterators pointing to empty rows should be + handled in the visible function. Patch by Björn Lindqvist + 2008-08-02 Matthias Clasen Bug 539733 – No way to control treeview separator height diff --git a/gtk/gtktreemodelfilter.c b/gtk/gtktreemodelfilter.c index 6d7116d57a..1116cb0290 100644 --- a/gtk/gtktreemodelfilter.c +++ b/gtk/gtktreemodelfilter.c @@ -2884,6 +2884,29 @@ gtk_tree_model_filter_get_model (GtkTreeModelFilter *filter) * gtk_tree_model_filter_refilter() to keep the visibility information of * the model uptodate. * + * Note that @func is called whenever a row is inserted, when it may still be + * empty. The visible function should therefore take special care of empty + * rows, like in the example below. + * + * + * static gboolean + * visible_func (GtkTreeModel *model, + * GtkTreeIter *iter, + * gpointer data) + * { + * /* Visible if row is non-empty and first column is "HI" */ + * gchar *str; + * gboolean visible = FALSE; + * + * gtk_tree_model_get (model, iter, 0, &str, -1); + * if (str && strcmp (str, "HI") == 0) + * visible = TRUE; + * g_free (str); + * + * return visible; + * } + * + * * Since: 2.4 */ void