Tree View Sorting (Inital sort on display)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Tree View Sorting (Inital sort on display)

Keith Maika

   I'm developing a simple file browsing application (mostly for some
programming experience in GTK) and have things setup pretty well so far,
but I've hit a couple snags with regards to sorting a tree view and
would appricate some guidence.

The first issue that I have come across is that It doesn't look like GTK
is using my defined sort function for setting the sort on the tree view.
  I setup my sort function using these lines:




--
Keith Maika
http://kicken.mine.nu:8008/  - Personal Site.
http://wiser.kicks-ass.org:8008/  - Long-term Project.
http://www.gnu.org/philosophy/can-you-trust.html - Can you trust your
computer?
http://www.gnu.org/philosophy/no-word-attachments.html - Support Open
Communication.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Tree View Sorting (Inital sort on display) (corrected post)

Keith Maika
   (Sorry about the previous post, I accident hit the Send hot key while
typeing)

   I'm developing a simple file browsing application (mostly for some
programming experience in GTK) and have things setup pretty well so far,
but I've hit a couple snags with regards to sorting a tree view and
would appricate some guidence.

   The first issue that I have come across is that It doesn't look like GTK
is using my defined sort function for setting the sort on the tree view.
I setup my sort function using these lines:
-=-
     gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(fileListStore),
SORT_NAME, filelist_sort, GUINT_TO_POINTER(SORT_NAME), NULL);
     gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(fileListStore),
SORT_SIZE, filelist_sort, GUINT_TO_POINTER(SORT_SIZE), NULL);
     gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(fileListStore),
SORT_DATE, filelist_sort, GUINT_TO_POINTER(SORT_DATE), NULL);
-=-

     fileListStore is a GtkListStore which (at this point has nothing)
will contain the files that will be displayed in the tree, and their
associated information.  filelist_sort is my sorting function.

After I setup the sorting functions, I set the inital sort on the name
column using these lines:

-=-
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(fileListStore),
SORT_NAME, GTK_SORT_ASCENDING);
        treeColumn = gtk_tree_view_get_column(GTK_TREE_VIEW(fileList), 1);
        gtk_tree_view_column_set_sort_indicator(treeColumn, TRUE);
        gtk_tree_view_column_set_sort_order(treeColumn, GTK_SORT_ASCENDING);
-=-

I did setup the sort id's on the columns when I created them, and using
this function call seems to work.  The items are sorted correctly, and I
can see my debugging printf() output from the filelist_sort function.

I have the tree view setup so that the header's are visible and
clickable so that I can change the sort order by clicking the header,
but it doesn't work right.  When I click the header, the list is
resorted, but it seems to use GTK's default function or something,
instead of mine.  The sort order is not how I want it, and the printf()
statements can't be seen in the output console.

The complete code for the application is here:
http://www.aoeex.com:8008/extras/GtkSSH/

filelist_pane.c is the file which contains the code for the tree view
and it's sorting function.

Any help is appricated.

--
Keith Maika
http://kicken.mine.nu:8008/  - Personal Site.
http://wiser.kicks-ass.org:8008/  - Long-term Project.
http://www.gnu.org/philosophy/can-you-trust.html - Can you trust your
computer?
http://www.gnu.org/philosophy/no-word-attachments.html - Support Open
Communication.
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list