views:

22

answers:

1

How can I print (for example in a label) the text into a GtkTextView? For GtkLabel and GtkEntry there are gtk_label_get_text() and gtk_entry_get_text(), but for GtkTextView?

A: 

You can:

GtkTextIter start, end;
GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
gchar *text;

gtk_text_buffer_get_bounds (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);

Don't forget to g_free (text) when no longer needed.

doublep
If I use char *text?
stdio
`gchar` is the same as `char`, so you can use `char*` just as well.
doublep