[gtk-server] Automatic numerical sorting in ListStores

  • From: Erik Winkels <euqirea@xxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Tue, 2 Sep 2008 15:58:59 +0200

Hi Peter,

First of all, thanks for your reply.

Secondly, thanks for writing gtk-server.  It's a really good tool to use
GTK from.  (I'm using it with CLISP.)

> Date: Mon, 01 Sep 2008 15:21:47 +0200
> From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
> Subject: [gtk-server] Re: Glade & comboboxes
> Please let me know if this works for you,
I eventually went with just creating the whole GUI from code since I wasn't
able to add a combobox created from code in the Glade created UI.

I have got another question now which I haven't been able to solve with
Googling or checking the examples on gtk-server.org:

I've made a list-store with three columns.  The first column contains a name,
the second and the third some kind of numerical id.  I've turned on sorting
for each column with gtk_tree_view_column_set_sort_column_id.

If I create the list-store like this:

    gtk_list_store_new 3 G_TYPE_STRING G_TYPE_STRING G_TYPE_STRING

Everything works alright except the second and third columns are sorted as
strings while they ought to be sorted numerically, so I thought creating the
list-store like this would solve it:

    gtk_list_store_new 3 G_TYPE_STRING G_TYPE_LONG G_TYPE_LONG

But it doesn't (I also tried G_TYPE_INT and G_TYPE_FLOAT).  Worse yet,
the second and third columns don't even display the correct values anymore.
(Actually they now display what look like widget ids).

Have you got any idea how to turn on numerical sorting for specific columns?


Other related posts: