csv (comma separated value) file

2009-08-03 Thread Andrea Zagli

i didn't find nothing about to manage (read/write) csv files with glib

do you know about something that i didn't find?

otherwise i might develop it

thanks in advance

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


Re: csv (comma separated value) file

2009-08-03 Thread Tristan Van Berkom
On Mon, Aug 3, 2009 at 12:03 PM, Andrea Zagliaza...@inwind.it wrote:
 i didn't find nothing about to manage (read/write) csv files with glib

 do you know about something that i didn't find?


Currently its pretty easy using g_file_get_contents()/g_strsplit() if you
can have it all in ram, or using GIO and again, g_strsplit() on a per line
basis if you need to stream it.

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


Re: csv (comma separated value) file

2009-08-03 Thread Andrea Zagli

Il giorno lun 03 ago 2009 18:45:28 CEST, Tristan Van Berkom ha scritto:

On Mon, Aug 3, 2009 at 12:03 PM, Andrea Zagliaza...@inwind.it wrote:

i didn't find nothing about to manage (read/write) csv files with glib

do you know about something that i didn't find?


Currently its pretty easy using g_file_get_contents()/g_strsplit() if you
can have it all in ram, or using GIO and again, g_strsplit() on a per line
basis if you need to stream it.


yet in fact i developed like this for a very small project. but i  
wanted to recycle the code by putting/found it in a library


and with a more accurate parsing; for example i cannot split by ,  
beacause , can be inside string fields


then i thought to make a more accurate function with some parameters  
(ex. the character separating the fields, if the first line of the  
file are the names of the fields, etc.)


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


Re: csv (comma separated value) file

2009-08-03 Thread Paolo Bacchilega

Tristan Van Berkom ha scritto:

On Mon, Aug 3, 2009 at 12:03 PM, Andrea Zagliaza...@inwind.it wrote:
  

i didn't find nothing about to manage (read/write) csv files with glib

do you know about something that i didn't find?




Currently its pretty easy using g_file_get_contents()/g_strsplit() if you
can have it all in ram, or using GIO and again, g_strsplit() on a per line
basis if you need to stream it.

Cheers,
 -Tristan
  

it's not so easy, for example the following csv file:

a;b;c

has only two columns, you cannot handle this case with a simple 
g_strsplit call


- Paolo


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


treeview with compact indentation?

2009-08-03 Thread Allin Cottrell
I wonder if there's a way to produce a more compact layout for a
treeview with expanders?  I'd like this for a case where the
treeview is in a left-hand pane, alongside stuff that the tree
represents.

I mean, the default looks something like this, with heading 1
expanded:

heading 1
   item 1
   item 2

But the effect I'm looking for is like:

heading 1
  item 1
  item 2

with the children tucked under their parent.

I noticed the existence of gtk_tree_view_set_level_indentation(),
but this doesn't accept a negative argument.

Thanks for any suggestions.

-- 
Allin Cottrell
Department of Economics
Wake Forest University

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


Re: csv (comma separated value) file

2009-08-03 Thread Liam R E Quin
On Mon, 2009-08-03 at 12:45 -0400, Tristan Van Berkom wrote:
[...]
 Currently its pretty easy using g_file_get_contents()/g_strsplit() 

CSV files are not just comma separated, and in some cases can have
column headers and other metadata.  There's also escaping.

a,b,c\d,e
a,b,c,d,e
a;b;c,d;e

You also have to deal with differing line ending conventions.

It's enough of a mess that both MS Office and most other
office programs today seem o use XML instead :-)

Probably gnumeric has code for this, though.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

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


Re: treeview with compact indentation?

2009-08-03 Thread Allin Cottrell
On Mon, 3 Aug 2009, Allin Cottrell wrote:

 I wonder if there's a way to produce a more compact layout for a
 treeview with expanders?  I'd like this for a case where the
 treeview is in a left-hand pane, alongside stuff that the tree
 represents.

 I mean, the default looks something like this, with heading 1
 expanded:

 heading 1
item 1
item 2

 But the effect I'm looking for is like:

 heading 1
   item 1
   item 2

 with the children tucked under their parent.

Duh, sorry for the noise: I just had to _not_ put the headings
into a separate first column in the treeview.

Allin Cottrell


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


Re: csv (comma separated value) file

2009-08-03 Thread Tristan Van Berkom
On Mon, Aug 3, 2009 at 1:21 PM, Liam R E Quinl...@holoweb.net wrote:
 On Mon, 2009-08-03 at 12:45 -0400, Tristan Van Berkom wrote:
 [...]
 Currently its pretty easy using g_file_get_contents()/g_strsplit()

 CSV files are not just comma separated, and in some cases can have
 column headers and other metadata.  There's also escaping.

 a,b,c\d,e
 a,b,c,d,e
 a;b;c,d;e


I see that was an uneducated comment on my part ;-)
(I have been doing alot of *simple* csv parsing with glib lately
that doesnt have these kind of requirements).

Sorry for the noise ;-)

Dont have much of an opinion if it should be in glib, we have
GKeyFile wich does similar high-levelish stuff already so it
might be a suitable addition.

Cheers,
  -Tristan

(interestingly my own use-case, would be a mix of both - a
fixed length keyfile like header, with variable length trailing
csv data).


 You also have to deal with differing line ending conventions.

 It's enough of a mess that both MS Office and most other
 office programs today seem o use XML instead :-)

 Probably gnumeric has code for this, though.

 Liam


 --
 Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
 Pictures from old books: http://fromoldbooks.org/
 Ankh: irc.sorcery.net irc.gnome.org www.advogato.org


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


Re: csv (comma separated value) file

2009-08-03 Thread Joshua Lock
Hi

2009/8/3 Andrea Zagli aza...@inwind.it:
 i didn't find nothing about to manage (read/write) csv files with glib

 do you know about something that i didn't find?

GSF (GNOME Structured File Library)[1], which Gnumeric uses, does CSV:

http://library.gnome.org/devel/gsf/stable/gsf-Text.html


 otherwise i might develop it

1. http://library.gnome.org/devel/gsf/stable/index.html

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


Re: csv (comma separated value) file

2009-08-03 Thread Liam R E Quin
On Mon, 2009-08-03 at 14:23 -0400, Tristan Van Berkom wrote:
 On Mon, Aug 3, 2009 at 1:21 PM, Liam R E Quinl...@holoweb.net wrote:
  On Mon, 2009-08-03 at 12:45 -0400, Tristan Van Berkom wrote:
[...]
 I see that was an uneducated comment on my part ;-)
My reply wasn't meant as a criticism, hope it didn't appear this.

[...]

 Dont have much of an opinion if it should be in glib, we have
 GKeyFile wich does similar high-levelish stuff already so it
 might be a suitable addition.

I'd rather steer people towards XML for new stuff, and for
old stuff, maybe a csv library split off from gnumeric
might be possible?

Liam




-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

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