Re: GtkTreeModelFilter and GtkTreeSortable
- From: Matías Alejandro Torres <torresmat gmail com>
- To: Andrew Cowie <andrew operationaldynamics com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GtkTreeModelFilter and GtkTreeSortable
- Date: Sat, 29 Sep 2007 13:14:56 -0300
Andrew Cowie escribió:
On Fri, 2007-09-28 at 23:49 -0300, Matías Alejandro Torres wrote:
My problem is that GtkTreeModelFilter does not implements the
GtkTreeSortable interface and I lost the sorting capabilities that I
used to have.
It's been a while since I worked on the code in question, but I had a
GtkTreeView that had both GtkTreeModelSort and GtkTreeModelFilter going
on at the same time. You nest them. Something like:
listStore = gtk_list_store_new(...);
filteredStore = gtk_tree_model_filter_new(listStore, NULL);
sortedStore = gtk_tree_model_sort_new_with_model(filteredStore);
view = gtk_tree_view_new_with_model(sortedStore);
Thank you both for your reply.
I'm working on python, and I can't find functions to add the sortable
functions to an instance of a GtkTreeModel.
Let's say I have a method that receives a GtkListStore that is sortable:
/* This funcion calls set_model */
def database_changed_cb (self, ccontroller, db, patients):
self.db = db
self.patients = patients
if patients:
model = gui.patientsmodel.PatientsModel (patients)
model.set_sortable (True) /* Adds the sort_funcs */
self.set_model (model)
else:
self.set_model (None)
/* This one receives the model and update the GUI */
def set_model (self, model):
if model:
self.filter = model.filter_new ()
self.filter.set_visible_func (self.patient_filter_callback)
self.patientsBox.tree_view.set_model (self.filter)
self.unblock_signals ()
self.patient_selected_callback ()
self.patientsBox.set_sensitive (True)
else:
self.filter = None
self.patientsBox.tree_view.set_model (None)
self.patientsBox.set_sensitive (False)
self.patient_selected_callback ()
self.block_signals ()
I append these functions to make clear what i'm trying to do. hope this
help you to help me :P, thanks.
Matias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]