2004-01-17 23:47:35 +01:00
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
using Gnome;
|
|
|
|
using Vte;
|
|
|
|
|
|
|
|
class T
|
|
|
|
{
|
|
|
|
static void Main (string[] args)
|
|
|
|
{
|
|
|
|
new T (args);
|
|
|
|
}
|
|
|
|
|
|
|
|
T (string[] args)
|
|
|
|
{
|
2004-04-04 23:18:56 +02:00
|
|
|
Program program = new Program ("vte-sharp-test", "0.0", Modules.UI, args);
|
|
|
|
App app = new App ("vte-sharp-test", "Test for vte widget");
|
2004-01-17 23:47:35 +01:00
|
|
|
app.SetDefaultSize (600, 450);
|
|
|
|
app.DeleteEvent += new DeleteEventHandler (OnAppDelete);
|
|
|
|
|
|
|
|
ScrolledWindow sw = new ScrolledWindow ();
|
|
|
|
Terminal term = new Terminal ();
|
2004-01-29 02:08:46 +01:00
|
|
|
term.EncodingChanged += new EventHandler (OnEncodingChanged);
|
2004-01-17 23:47:35 +01:00
|
|
|
term.CursorBlinks = true;
|
2004-01-18 01:54:08 +01:00
|
|
|
term.MouseAutohide = true;
|
|
|
|
term.ScrollOnKeystroke = true;
|
2004-01-29 02:08:46 +01:00
|
|
|
term.DeleteBinding = TerminalEraseBinding.Auto;
|
2004-04-04 23:18:56 +02:00
|
|
|
term.BackspaceBinding = TerminalEraseBinding.Auto;
|
2004-01-17 23:47:35 +01:00
|
|
|
term.Encoding = "UTF-8";
|
2004-04-04 23:18:56 +02:00
|
|
|
term.FontFromString = "Monospace 12";
|
2004-01-29 02:08:46 +01:00
|
|
|
term.TextDeleted += new EventHandler (OnTextDeleted);
|
2004-04-04 23:18:56 +02:00
|
|
|
term.ChildExited += new EventHandler (OnChildExited);
|
2004-01-29 02:08:46 +01:00
|
|
|
|
|
|
|
Gdk.Color white = new Gdk.Color ();
|
|
|
|
Gdk.Color.Parse ("white", ref white);
|
2004-04-04 23:18:56 +02:00
|
|
|
// FIXME: following line is broken
|
|
|
|
//term.ColorBackground = white;
|
|
|
|
|
|
|
|
Gdk.Color black = new Gdk.Color ();
|
|
|
|
Gdk.Color.Parse ("black", ref black);
|
|
|
|
// FIXME: following line is broken
|
|
|
|
//term.ColorForeground = black;
|
|
|
|
term.SetColors (black, white, white, 16);
|
2004-01-17 23:47:35 +01:00
|
|
|
|
|
|
|
Console.WriteLine (term.UsingXft);
|
|
|
|
Console.WriteLine (term.Encoding);
|
|
|
|
Console.WriteLine (term.StatusLine);
|
2004-01-18 01:54:08 +01:00
|
|
|
|
2004-04-04 23:18:56 +02:00
|
|
|
string[] argv = Environment.GetCommandLineArgs ();
|
2004-01-18 01:54:08 +01:00
|
|
|
|
2004-04-04 23:18:56 +02:00
|
|
|
string[] envv = new string[] {""};
|
2004-01-18 01:54:08 +01:00
|
|
|
// FIXME: send the env vars to ForkCommand
|
|
|
|
Console.WriteLine (Environment.GetEnvironmentVariables ().Count);
|
2004-01-29 02:08:46 +01:00
|
|
|
Console.WriteLine (Environment.CurrentDirectory);
|
2004-01-18 01:54:08 +01:00
|
|
|
|
2004-04-04 23:18:56 +02:00
|
|
|
int pid = term.ForkCommand ("/bin/bash", argv, envv, Environment.CurrentDirectory, false, true, true);
|
|
|
|
Console.WriteLine ("Child pid: " + pid);
|
2004-01-18 23:10:03 +01:00
|
|
|
|
2004-01-17 23:47:35 +01:00
|
|
|
sw.AddWithViewport (term);
|
|
|
|
|
|
|
|
app.Contents = sw;
|
|
|
|
app.ShowAll ();
|
|
|
|
program.Run ();
|
|
|
|
}
|
2004-01-29 02:08:46 +01:00
|
|
|
|
|
|
|
private void OnTextDeleted (object o, EventArgs args)
|
|
|
|
{
|
|
|
|
Console.WriteLine ("text deleted");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnEncodingChanged (object o, EventArgs args)
|
|
|
|
{
|
|
|
|
Console.WriteLine ("encoding changed");
|
|
|
|
}
|
2004-01-17 23:47:35 +01:00
|
|
|
|
|
|
|
private void OnTextInserted (object o, EventArgs args)
|
|
|
|
{
|
2004-04-04 23:18:56 +02:00
|
|
|
Console.WriteLine ("text inserted");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnChildExited (object o, EventArgs args)
|
|
|
|
{
|
|
|
|
// optionally we could just reset instead of quitting
|
|
|
|
Console.WriteLine ("child exited");
|
|
|
|
Application.Quit ();
|
2004-01-17 23:47:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void OnAppDelete (object o, DeleteEventArgs args)
|
|
|
|
{
|
2004-04-04 23:18:56 +02:00
|
|
|
Application.Quit ();
|
2004-01-17 23:47:35 +01:00
|
|
|
}
|
|
|
|
}
|