Ok, there's a few things that I would like to point out. First, the GtkText widget is depreciated and should _never_ be used in a new program. Instead, use the GtkTextView widget.
With that said, the following code created a GtkTextView widget and appends text to it. It is added to a GtkScrolledWindow widget so that it will not resize when text goes beyond the bounds of the text view. (Also, I did not text this code, so you might have to fix a syntax error or two):
Code:
GtkWidget *textview, *swin;
GtkTextBuffer *buffer;
GtkTextIter iter;
/* Create a GtkScrolledWindow and only show scrollbars if necessary. */
swin = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
/* Create a new text view widget. */
textview = gtk_text_view_new ();
/* Retrieve the buffer that was created for the text view. */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
/* Retrieve the last position in the buffer. */
gtk_text_buffer_get_end_iter (buffer, &iter);
/* Append the text to the end of the text buffer. */
gtk_text_buffer_insert (buffer, &iter, "Message", -1);
/* Add the text view as the scrolled window's child. */
gtk_container_add (GTK_CONTAINER (swin), textview);
You should send the text view widget to any function that needs to output data. Then, you can retrieve the buffer and follow the procedure above to insert text at the end. You can use the \n character to insert a new line.