Re: GtkListStore: forcing a sort



On Sat, 2003-04-12 at 04:32, Mattperry wrote:
I have looked through the API reference and mailing lists, and I can't
seem to find an answer to this somewhat simple question.  I have a
GtkTreeView which uses a GtkListStore model.  The list store is
populated with a struct (ie, store = gtk_list_store_new(1, G_TYPE_POINTER);
I add many columns and use gtk_tree_view_column_set_cell_data_func() to
display various records of my structure in the columns in different
ways.  Now, this works very well, as I only have one copy of the data,
and any change takes effect immediately.  However, I would like to sort
the list after any change has been made to the data.

I have found the automatic sorting features unsatisfactory for two
reasons.  First, I need to sort based on 2 columns simultaneously (one
has priority), and it doesn't seem like I can do this.  Second, I want
to be able to issue a sort command whenever I want, rather than wait for
the user to click on the title of one of the columns.  It seems like
such a sort function would be fairly standard.  Where can I find this
functionality?

Note that, if a list store has a sort function, it's _always_ sorted;
there is no concept of sorting it.

gtk_tree_sortable_set_sort_func() and
gtk_tree_sortable_set_default_sort_func() let you sort with whatever
functions you want.

Regards,
                                        Owen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]