Re: Sorting Integer value treeview column
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: Sorting Integer value treeview column
- Date: Sat, 5 May 2007 15:41:41 +0200
On Sat, May 05, 2007 at 09:11:20PM +0800, Jason Brisbane wrote:
Every time I used G_TYPE_INT in the gtk_list_store_new function the
value returned wasnt the INT as expected. The value shown was an 8 digit
number that didnt have any relation to the int as shown in the mysql
client. I believe it was a pointer.
I must confess I didn't originally read your code. Looking
at it now, MYSQL_ROW is an array of (lenght-counted)
strings. So
gtk_list_store_set(list_store, &iter, 0, db_row[0],
1, db_row[1],
2, db_row[2],
3, db_row[3],
4, db_row[4],
5, db_row[5],
6, db_row[6],
7, db_row[7],
8, db_row[8], -1);
of course stores these strings (== some pointers). To get
integers you have to use atoi() or a similar function...
So I tried one last version...Typeing with INT64... (G_TYPE_INT64)
and hooking the database value returned with the function:
2, g_ascii_strtoull(db_row[2], NULL, 10 ),
...such as g_ascii_strtoull(), althgough using 64bit numbers
is a bit of overkill if the numbers are not really that
large. My example program did this because file sizes can
be that large.
It may be also useful to look at libgda and libgnomedb if
you haven't yet...
Yeti
--
http://gwyddion.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]