Re: Sorting GtkListStore date column

2006-03-13 Thread Axel Simon
On Sun, 2006-03-12 at 21:39 -0500, Guy Rouillier wrote:

 I'll use the approach of storing the time_t corresponding to each 
 displayed date in a hidden column, and use that hidden column as the 
 sort column for the date column.  Out of curiosity, would it also be 
 possible to do this in a single column by storing just the time_t, and 
 using a custom renderer to transform the time_t value into a displayable 
 string?  Is sorting done on the rendered text or on the underlying data?

Yes, you can do this with  gtk_cell_layout_set_cell_data_func.

Axel.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Sorting GtkListStore date column

2006-03-12 Thread Guy Rouillier
I'm fairly new to GTK programming, and I'm helping out on an open source 
GTK-based project (gcvs, part of the cvsgui project.)  We have a 
GtkListStore with a column containing date.  The column is specified as 
G_TYPE_STRING.  When sorted, it does an alphanumeric sort, so in English 
it puts all the Fridays together first, followed by all the Mondays, 
Saturdays, Sundays, etc.


Obviously, I want to sort this in date sequence.  How do I accomplish 
this?  I searched the archives before posting and couldn't find anything 
applicable.  Thanks.


--
Guy Rouillier
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Sorting GtkListStore date column

2006-03-12 Thread Chris Vine
On Sunday 12 March 2006 19:30, Chris Vine wrote:
 On Sunday 12 March 2006 09:11, Guy Rouillier wrote:
  I'm fairly new to GTK programming, and I'm helping out on an open source
  GTK-based project (gcvs, part of the cvsgui project.)  We have a
  GtkListStore with a column containing date.  The column is specified as
  G_TYPE_STRING.  When sorted, it does an alphanumeric sort, so in English
  it puts all the Fridays together first, followed by all the Mondays,
  Saturdays, Sundays, etc.
 
  Obviously, I want to sort this in date sequence.  How do I accomplish
  this?  I searched the archives before posting and couldn't find anything
  applicable.  Thanks.

 You can sort on a hidden column in the list store (that is, one not
 displayed in a tree view) which has, say, this format:  MMDDSS

Sorry, that should of course be MMDDHHMMSS (expressed numerically).

Chris

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Sorting GtkListStore date column

2006-03-12 Thread Guy Rouillier

Chris Vine wrote:


Obviously, I want to sort this in date sequence.  How do I accomplish
this?  I searched the archives before posting and couldn't find anything
applicable.  Thanks.


You can sort on a hidden column in the list store (that is, one not
displayed in a tree view) which has, say, this format:  MMDDSS



Sorry, that should of course be MMDDHHMMSS (expressed numerically).


Thanks, Chris and Fredderic for the suggestions.  Fredderic, gCvs is is 
a desktop GUI to manage CVS repositories, so the date range for listed 
files can span multiple years.  Hence, a day-of-the-week approach won't 
work.


I'll use the approach of storing the time_t corresponding to each 
displayed date in a hidden column, and use that hidden column as the 
sort column for the date column.  Out of curiosity, would it also be 
possible to do this in a single column by storing just the time_t, and 
using a custom renderer to transform the time_t value into a displayable 
string?  Is sorting done on the rendered text or on the underlying data?


--
Guy Rouillier
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list