On Wed, Aug 24, 2011 at 03:50:46PM +0200, Michal Suchanek wrote: > I have a list which I want to display in two treeviews and prevent > selecting the same item in both. > > The idea is that the user selects an item in the first list, then the > second list is shown, and it should not contain the item selected in > the first list (or the item should be inactive or whatever). > > I tried using a model filter to this end. It has an option to set > custom filter callback and in this callback I fetch the selection of > the first list (if any) and return false if the filtered item is the > same as selected.
I would just render the item as inactive using cell renderer's "sensitive" property and prevent it from being selected using gtk_tree_selection_set_select_function(). You need to remember the current selection but otherwise it is pretty cheap: if the selected row changes only two rows have to receive "row-changed" to update the other treeview: the previously selected one (becomes selectable) and the newly selected one (becomes unselectable). Also, depending on the application this might be visually preferrable to appearing and disappearing rows. Yeti _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list