Re: sub window for shell script



For getting the output of the shell script - you might want to look at "popen"

(You may need to popen("/bin/sh scriptname","r") if its a shell script.

I have an app with has a 'console window' for debugging purposes, something 
like :

void
A4GL_create_console (void)
{
  GtkWidget *scroll;

  console = (GtkWindow *) gtk_window_new (GTK_WINDOW_TOPLEVEL);
  scroll = gtk_scrolled_window_new (NULL, NULL);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  gtk_widget_show (scroll);

  console_list = gtk_clist_new (1);     /* 1 column for now.... */

  gtk_clist_set_selection_mode (GTK_CLIST (console_list),
                                GTK_SELECTION_SINGLE);
  gtk_clist_set_shadow_type (GTK_CLIST (console_list), GTK_SHADOW_IN);

  gtk_container_add (GTK_CONTAINER (scroll), console_list);
  gtk_container_add (GTK_CONTAINER (console), scroll);
  gtk_widget_show (console_list);
  gtk_window_set_title (console, "4GL Console");

  gdk_window_set_functions ((GdkWindow *) console,
                            GDK_FUNC_RESIZE + GDK_FUNC_MOVE +
                            GDK_FUNC_MINIMIZE + GDK_FUNC_MAXIMIZE);
}


And support functions :

/**
 * Append a string to the console list widget.
 */
void
A4GL_add_to_console (char *s)
{
  gtk_clist_append (GTK_CLIST (console_list), &s);
}

/**
 * Clear the data showed n the console.
 */
void
A4GL_clear_console (char *s)
{
  gtk_clist_clear (GTK_CLIST (console_list));
}



This may be complete bunk - but it works for my app..

HTH


On Tuesday 14 October 2003 5:25 am, Dave Mason wrote:
I'm trying to have my app create a sub window, where I will call a shell
script, whose output will go in that window.  When the script finishes, I
want the window to close.

Should I use GdkWindow?  If so, how do I go about calling the shell script?

Thanks,
Dave

_________________________________________________________________
Send instant messages to anyone on your contact list with  MSN Messenger
6.0.  Try it now FREE!  http://msnmessenger-download.com

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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