Creating a Sortable Filter
| From: | Jake Cobb | Date: | Thu, 19 Apr 2007 18:34:51 +0000 |
| Subject: | Creating a Sortable Filter | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-3802@lists.php.net to get a copy of this message | ||
Hello,
This picks up where I left off in the thread "cannot create gtksourcestylesheme interface".
I'll briefly restate:
I was using a GtkTreeView with a GtkListStore data model. I wrapped the GtkListStore in
a GtkTreeModelFilter to use the filtering capabilities but this lost the sorting ability because
GtkTreeModelFilter does not implement the GtkTreeSortable interface. I wrote a simple class
that extends GtkTreeModelFilter and implements GtkTreeSortable and simply calls the underlying
model's (in my case GtkListStore) GtkTreeSortable methods.
Gtk+ does not recognize my new class as sortable although I implement GtkTreeSortable and
implement all of its methods. I get the following errors when an attempt at sorting is initiated:
----------
Gtk-CRITICAL **: gtk_tree_sortable_get_sort_column_id: assertion `GTK_IS_TREE_SORTABLE (sortable)' failed
Gtk-CRITICAL **: gtk_tree_sortable_has_default_sort_func: assertion `GTK_IS_TREE_SORTABLE (sortable)' failed
Gtk-CRITICAL **: gtk_tree_sortable_set_sort_column_id: assertion `GTK_IS_TREE_SORTABLE (sortable)' failed
----------
These are the same errors I get if my model is a GtkTreeModelFilter object (or I imagine any model
that does not implement GtkTreeSortable).
The filtering behavior is unchanged and Gtk+ does not balk at the new object for purposes
of GtkTreeModel behavior. So, it appears to extend GtkTreeModelFilter in the manner I
would expect but does not gain the GtkTreeSortable properties.
So, are there any requirements for passing the GTK_IS_TREE_SORTABLE assertion besides
implementing the GtkTreeSortable interface? Maybe more to the point, can I truly implement
the interface in PHP in a way that C will recognize?
Is the successful recognition of my new class as a GtkTreeModel because that interface was
already implemented by it (equivalently, I realize C is not object-oriented) in C?
Thanks for your time.
-Jake Cobb