Re: How to use GtkTreeSortable.



Johan wrote:
Hello,
I have created a tree store to list files and need to
write my own function to sort the filenames in order
by size. I have read the api for GtkTreeSortable, but
it doesn't explain very well how to do this.

How can I use GtkTreeSortable to sort my column?
As I think there's a file size column in your tree model (of type G_TYPE_INT
or so). All you need is to call gtk_tree_view_column_set_sort_column_id()
on that column.

enum {
<skipped>
  COLUMN_FILE_SIZE,
<skipped>
};

<skipped>

{
GtkTreeViewColumn *column;
<skipped>
    column = gtk_tree_view_column_new_with_attributes(...);
    gtk_tree_view_column_set_sort_column_id (column, COLUMN_FILE_SIZE)
<skipped>
}

Olexiy



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