freezing window
- From: Alessandro <ale barbato gmail com>
- To: gtk-app-devel-list gnome org
- Subject: freezing window
- Date: Fri, 07 Apr 2006 17:18:57 +0200
Hello all,
I have a problem while redirect the output of a spawned process to a
gtkTextView.
The problem is that: when I run the process the window freezing, until
the process end.
Can anyone help me?
I add the code used for spawn the process:
void launch_script(char command[10][100], GtkTextBuffer *OutputBuffer,
GtkWidget *TextView ) {
gint std_in;
gint std_out;
gint std_err;
static gchar buf[1024*8];
static gchar *buffer_utf8;
char *argv1[] = { command[0],
command[1],command[2],command[3],command[4],command[5],command[6],command[7],command[8],command[9],
NULL };
if( g_spawn_async_with_pipes("./", // gchar *working_directory
argv1, //gchar **argv,
NULL, //gchar **envp,
G_SPAWN_SEARCH_PATH, //GSpawnFlags flags,
NULL, //GSpawnChildSetupFunc child_setup,
NULL, //gpointer user_data,
NULL, //GPid *child_pid,
&std_in, // gint *standard_input,
&std_out, //gint *standard_output,
&std_err, //gint *standard_error,
NULL /*GError **error*/)
) {
if(&std_out){
GIOChannel* output = g_io_channel_unix_new(std_out);
g_io_channel_read_chars (output, // GIOChannel *channel
buf, // gchar *buf
-1, // gsize count
NULL, // gsize *bytes_read,
NULL //GError **error
);
}
else if(&std_err) {
GIOChannel* output = g_io_channel_unix_new(std_err);
g_io_channel_read_chars (output, // GIOChannel *channel
buf, // gchar *buf
-1, // gsize count
NULL, // gsize *bytes_read,
NULL //GError **error
);
}
}
else {
sprintf(buf, "Impossible to run program\n");
}
OutputBuffer = gtk_text_buffer_new (NULL);
buffer_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
gtk_text_buffer_insert_at_cursor(OutputBuffer,buffer_utf8,-1);
g_free (buffer_utf8);
gtk_text_view_set_buffer (GTK_TEXT_VIEW(TextView),OutputBuffer);
}
Thanks to all, bye
Alessandro
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]