Search Bar
Geoffrey Antos
geoffrey.antos at gmail.com
Tue Dec 18 22:33:21 EST 2007
Sadrul Habib Chowdhury wrote:
> * Stephen Eilert had this to say on [18 Dec 2007, 19:26:08 -0300]:
> [snip]
>
>> In any case, I think this feature could be a plugin, as long as the
>> necessary plumbing is in place.
>>
>>
>
> Someone should play with GtkTreeModelFilter to see if it can help us
> with the filtering (it's GTK+ 2.4 and above). ;)
>
> Sadrul
>
GtkTreeModelFilter can in fact be used in this case. I've started
writing a plugin
to implement this functionality, but
The biggest problem I'm finding is that there are now two separate "tree
models" to
deal with. The GtkTreeView's model is set to the GtkTreeModelFilter, but any
modifications to the treeview's contents need to go to the original
GtkTreeStore.
Mixing these up makes iterators not valid, causes assertions, and
ultimately crashes Pidgin.
Furthermore, gtk_tree_model_filter_set_visible_func only allows
individual rows to be tested
at a time. If a group is matched, none of the children elements are
shown, or if a contact matches,
the associated buddy may not be shown. The best way to approach this is
to add a column to
underlying the tree-store for to add a visibility column, and use
gtk_tree_model_filter_set_visible_column to do the filtering, allowing a
match's ancestors and
descendants to be shown as well, but this requires an additional
GtkTreeStore column to be
added in the core.
It looks like buddylist filtering could be done with GtkTreeModelFilter,
but at the very least,
everything dealing with GtkTreeIter and GtkTreePath may have to be
modified to deal with
the separate "tree models".
More information about the Devel
mailing list