Re: gtktextview with gdkpixbuf saving into file



anyone know a way to save a gtktextview/gtktextbuffer with embedded
gdkpixbuf into a file.

A correction to the suggested solution:
In the procedure

void open_gtb (GtkTextView *textView, const gchar *srcFileName)

delete the call:

gtk_text_buffer_deserialize_set_can_create_tags (
 buffer, grtDeserializeFormat, TRUE);

I thought that only the tags which do not exist will be created,
but in the reality if a tag with the same name allready exist,
the deserialize procedure changes the name of the inserted tag
by adding "-1" at the end of the name.

Another possibility would be to retain the enabling of the inserting
and after the deleting of the content by the call

gtk_text_buffer_delete (buffer, &startIter, &endIter);

to add the deleting of all tags this way:

gtk_text_tag_table_foreach (
 textTagTable,
 remove_tag_foreach,
 textTagTable // gpointer data
);

where the callback funcion "remove_tag_foreach" is defined:

void remove_tag_foreach (GtkTextTag *tag, gpointer data) {
gtk_text_tag_table_remove (
 data, // GtkTextTagTable *table,
 tag
);
}

But this variant cannot be used if there are other buffers sharing the same tag table, because the markup in them would be lost.

     P.A.




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