#include #include #include GtkWidget *xvte; static void f_connect( GtkWidget *widget, gpointer data) { // xusername = gtk_entry_get_text(GTK_ENTRY(xentry)); gtk_widget_grab_focus (xvte); gtk_widget_show(xvte); // const char cmd = "ls"; pid_t xpid; // char vargs[25] = {'-';'l'}; // s printf( vargs, "-l"); // char *a[]= {"localhost"}; // strcpy(a, "-l"); **argv = *argv[] char **a; a = g_new(char *, 5); a[1] = g_strdup ("localhost"); xpid = vte_terminal_fork_command(VTE_TERMINAL(xvte), ("/bin/ping"), a, NULL ); // ("/usr/bin/ssh -l mtech llhost"), NULL, NULL); /* old version of vte, newer version needs NULL, FALSE, FALSE, FALSE); */ g_print("Pressed"); } static void callback( GtkWidget *widget, gpointer data ) { g_print ("Hello again - %s was pressed\n", (gchar *) data); } /* another callback */ static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit (); return FALSE; } int main( int argc, char *argv[] ) { GtkWidget *xwindow; GtkWidget *xicon_connect, *xicon_disconnect, *xicon_pref, *xicon_help; GtkWidget *xbutton_connect, *xbutton_disconnect, *xbutton_pref, *xbutton_help; GtkWidget *xtoolbar; GtkWidget *xvbox; gtk_init (&argc, &argv); xwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (xwindow), "xwintelnet"); g_signal_connect (G_OBJECT (xwindow), "delete_event", G_CALLBACK (delete_event), NULL); gtk_container_set_border_width (GTK_CONTAINER (xwindow), 10); xvte = vte_terminal_new(); vte_terminal_set_size(VTE_TERMINAL(xvte),10,5); vte_terminal_set_audible_bell(VTE_TERMINAL(xvte), TRUE); vte_terminal_set_visible_bell(VTE_TERMINAL(xvte), TRUE); // vte_terminal_set_color_background xvbox = gtk_vbox_new (FALSE, 0); xicon_connect = gtk_image_new_from_file("/usr/share/pixmaps/keyring.png"); xicon_disconnect = gtk_image_new_from_file("/usr/share/pixmaps/no.xpm"); xicon_pref = gtk_image_new_from_file("/usr/share/pixmaps/gnome-util.png"); xicon_help = gtk_image_new_from_file("/usr/share/pixmaps/gnome-question.png"); xtoolbar = gtk_toolbar_new (); gtk_toolbar_set_orientation(GTK_TOOLBAR(xtoolbar), GTK_ORIENTATION_HORIZONTAL); xbutton_connect = gtk_toolbar_append_item(GTK_TOOLBAR (xtoolbar), "Connect", "Initiate telnet Session", "Private", xicon_connect, GTK_SIGNAL_FUNC(f_connect), NULL); xbutton_disconnect = gtk_toolbar_append_item(GTK_TOOLBAR (xtoolbar), "Disonnect", "Terminate telnet Session", "Private", xicon_disconnect, GTK_SIGNAL_FUNC(delete_event), NULL); xbutton_pref = gtk_toolbar_append_item(GTK_TOOLBAR (xtoolbar), "Preferences", "Settings", "Private", xicon_pref, GTK_SIGNAL_FUNC(delete_event), NULL); xbutton_help = gtk_toolbar_append_item(GTK_TOOLBAR (xtoolbar), "Help", "Solve Problems", "Private", xicon_help, GTK_SIGNAL_FUNC(delete_event), NULL); gtk_toolbar_append_space(GTK_TOOLBAR(xtoolbar)); g_signal_connect (G_OBJECT (xbutton_connect), "clicked", G_CALLBACK (f_connect), (gpointer) "button 1"); g_signal_connect (G_OBJECT (xbutton_disconnect), "clicked", G_CALLBACK (callback), (gpointer) "button 2"); gtk_box_pack_start(GTK_BOX (xvbox), xtoolbar, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX (xvbox), xvte, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (xwindow), xvbox); gtk_widget_show_all(xwindow); gtk_main (); return 0; } /* $gcc `pkg-config --cflags --libs gtk+-2.0` -lvte v1.c gcc -Wall -g helloworld.c -o helloworld `pkg-config --cflags gtk+-2.0` \ `pkg-config --libs gtk+-2.0` */