Re: GtkTextBuffer serialize/deserialize

I think the args are actually like this:

- The GtkTextIter is not filled by the function but you must supply it. GtkTextIter is usually a stack-allocated type, like TreeIter, so you pass &text_iter to it, which must point to a valid iter within the content_buffer (the buffer to deserialize into)

- As for the format buffer, maybe check out  "gtk_text_buffer_register_deserialize_format ()", i think this API is a little weird but what it basically means is that the first TextBuffer contains the data in a particular format (the format which the GdkAtom here specifies), and the target (content_buffer) will contain the rich text "deserlizied" into a "standard GTK+ TextBuffer" with normal GtkTextTags, etc.

On 7/18/06, Murray Cumming <murrayc murrayc com> wrote:
I'm trying to wrap the gtktextbufferrichtext.h API, but I can't figure
out from the documentation how it's supposed to work. For instance in
the documentation below, I don't understand why there's one buffer that
has a format, and another buffer that's going to be filled with the

Also, as far as I can tell, iter will be set by the function, but what
determines that iter? How can the data know where it should be inserted?

* gtk_text_buffer_deserialize:
* @register_buffer: the #GtkTextBuffer %format is registered with
* @content_buffer: the #GtkTextBuffer to deserialize into
* @format: the rich text format to use for deserializing
* @iter: insertion point for the deserialized text
* @data: data to deserialize
* @length: length of %data
* @error: return loaction for a #GError
* This function deserializes rich text in format %format and inserts
* it at %iter.
* %format<!-- -->s to be used must be registered using
* gtk_text_buffer_register_deserialize_format() or
* gtk_text_buffer_register_deserialize_tagset() beforehand.
* Return value: %TRUE on success, %FALSE otherwise.
* Since: 2.10
gtk_text_buffer_deserialize (GtkTextBuffer  *register_buffer,
                             GtkTextBuffer  *content_buffer,
                             GdkAtom         format,
                             GtkTextIter    *iter,
                             const guint8   *data,
                             gsize           length,
                             GError        **error)

Murray Cumming
murrayc murrayc com

gtk-devel-list mailing list
gtk-devel-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]