Piping stdout/stderr to a textview widget
- From: Tony Freeman <tony freeman insightbb com>
- To: gtk-app-devel-list gnome org
- Subject: Piping stdout/stderr to a textview widget
- Date: Tue, 09 Nov 2004 23:37:56 -0500
I have this code:
-----------------------------------------------------------------------
/* Run rar stuff */
if (rarString != NULL) {
gchar *rar2command = g_strconcat("rar e -y ", rarString, NULL);
g_print("rar2command: %s\n", rar2command);
if ((p = popen(rar2command, "r")) == NULL) {
quick_message(window1, "Damn! Popen call failed to run rar stuff.\n");
}
}
-----------------------------------------------------------------------
How does one pipe the stdout/stderr from the popen command to a textview
widget? Here is my widget as defined in "interface.c" file:
-----------------------------------------------------------------------
textview1 = gtk_text_view_new ();
gtk_widget_set_name (textview1, "textview1");
gtk_widget_show (textview1);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), textview1);
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview1), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview1), GTK_WRAP_WORD);
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (textview1), 1);
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (textview1), 1);
gtk_text_view_set_pixels_inside_wrap (GTK_TEXT_VIEW (textview1), 1);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview1), 1);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (textview1), 1);
-----------------------------------------------------------------------
-- Tony Freeman <tony freeman insightbb com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]