Re: How to use GtkTreeSortable.



On Tue, 2002-10-22 at 14:22, Johan wrote:
On Tue, 22 Oct 2002 10:08:34 +0300
Olexiy Avramchenko <ath beast stu cn ua> wrote:

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

Hello.
I have a file size column of type G_TYPE_STRING and displays the
file size like 3.3 MB, 454 Kb, 544 B etc.

I am currently using gtk_tree_view_set_sort_column_id, but the sort
function sorts the size in alphabetic order, which is incorect
for this column.

I need to build my own method to sort this column. Do you know
how gtk_tree_sortable_set_sort_func() works?


I have a better idea.
What you do is have 2 columns.  Use the "visible" feature to make a
column in bytes and make the bytes (which is a GUINT) invisible.  Create
a second column with the string value and make that visible.  When
creating the second column sort by the first column.

Regards,

Martyn

/Johan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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