GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun May 19, 2013 5:01 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: GtkTextView Load/Save
PostPosted: Wed Apr 29, 2009 8:14 am 
Coding Colleagues...

Does anyone know if there's some code out there that I can bolt onto a GtkTextView to enable formatted save and load? XML would be nice, ODT even better, even RTF (Save) would do. It would save me the arduous task of re-inventing the wheel!

Will


Top
  
 
 Post subject:
PostPosted: Wed Apr 29, 2009 8:58 am 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hello.

Formated save and load are called serializing and deserializing a text buffer. Unfortunately, there is no predefined (de)serialize functions for XML, ODT or RTF (there is an internal format called "tagset", which is able to save text and pixbufs into XML-ish format, but it's only useful if you only intend to save/load files from your application).

One problem with creating XML export is the fact that XML only holds references to images while GtkTextBuffer doesn't hold any information where source image for pixbuf came from and how it has been transformed (stretched, rotated ...). But if your data doesn't contain images, things should be pretty straight forward to implement.

See tagset serialization functions that come with gtk for inspiration: http://git.gnome.org/cgit/gtk+/tree/gtk/gtktextbufferserialize.c.

Other topics related to this problem:
  1. http://gtkforums.com/viewtopic.php?t=2300
  2. http://gtkforums.com/viewtopic.php?t=2417
  3. http://gtkforums.com/viewtopic.php?t=3200
Hope this information helps.


Top
 Profile  
 
 Post subject: Load Save
PostPosted: Wed Apr 29, 2009 9:41 am 
Excellent, I'll follow-up these leads.

Will


Top
  
 
 Post subject: Feature Implemented
PostPosted: Wed Apr 29, 2009 9:38 pm 
Tadeboro

Thanks for the pointers. Y'know, sometimes I wonder if the Gtk docs are written in English or Gnomish. The number of times that I've scanned those pages and not picked up the implications!

Well, its done now and Gnocl has rich text load/save as well as the plain old text.

Ta ever so...

Will


Top
  
 
 Post subject: Re: GtkTextView Load/Save
PostPosted: Wed Aug 31, 2011 12:55 pm 
Offline
GTK+ Guru

Joined: Sun Jan 17, 2010 6:48 pm
Posts: 100
Following up on this rather old thread.

There is a module which will serialize/deserialize a GtkTextBuffer into rtf format.

http://sourceforge.net/apps/trac/osxcart/wiki

WJG

_________________
"If you don't stand for something, then you'll fall for anything."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group