2004-01-17 22:47:35 +00:00
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
using Gnome;
|
|
|
|
using Vte;
|
|
|
|
|
|
|
|
class T
|
|
|
|
{
|
|
|
|
Program program;
|
|
|
|
|
|
|
|
static void Main (string[] args)
|
|
|
|
{
|
|
|
|
new T (args);
|
|
|
|
}
|
|
|
|
|
|
|
|
T (string[] args)
|
|
|
|
{
|
|
|
|
program = new Program ("test", "0.0", Modules.UI, args);
|
|
|
|
App app = new App ("test", "Test for vte widget");
|
|
|
|
app.SetDefaultSize (600, 450);
|
|
|
|
app.DeleteEvent += new DeleteEventHandler (OnAppDelete);
|
|
|
|
|
|
|
|
ScrolledWindow sw = new ScrolledWindow ();
|
|
|
|
Terminal term = new Terminal ();
|
2004-01-29 01:08:46 +00:00
|
|
|
term.EncodingChanged += new EventHandler (OnEncodingChanged);
|
2004-01-17 22:47:35 +00:00
|
|
|
term.CursorBlinks = true;
|
2004-01-18 00:54:08 +00:00
|
|
|
term.MouseAutohide = true;
|
|
|
|
term.ScrollOnKeystroke = true;
|
2004-01-29 01:08:46 +00:00
|
|
|
term.DeleteBinding = TerminalEraseBinding.Auto;
|
2004-01-17 22:47:35 +00:00
|
|
|
term.Encoding = "UTF-8";
|
2004-01-29 01:08:46 +00:00
|
|
|
term.FontFromString = "Monospace";
|
2004-02-10 20:35:40 +00:00
|
|
|
term.Commit += new Vte.CommitHandler (OnCommit);
|
2004-01-29 01:08:46 +00:00
|
|
|
term.TextDeleted += new EventHandler (OnTextDeleted);
|
|
|
|
|
|
|
|
Gdk.Color white = new Gdk.Color ();
|
|
|
|
Gdk.Color.Parse ("white", ref white);
|
|
|
|
term.ColorBackground = white;
|
2004-01-17 22:47:35 +00:00
|
|
|
|
|
|
|
Console.WriteLine (term.UsingXft);
|
|
|
|
Console.WriteLine (term.Encoding);
|
|
|
|
Console.WriteLine (term.StatusLine);
|
2004-01-18 00:54:08 +00:00
|
|
|
|
|
|
|
string argv = Environment.GetCommandLineArgs () [0];
|
|
|
|
|
|
|
|
string envv = "";
|
|
|
|
// FIXME: send the env vars to ForkCommand
|
|
|
|
Console.WriteLine (Environment.GetEnvironmentVariables ().Count);
|
2004-01-29 01:08:46 +00:00
|
|
|
Console.WriteLine (Environment.CurrentDirectory);
|
2004-01-18 00:54:08 +00:00
|
|
|
|
2004-01-29 01:08:46 +00:00
|
|
|
//int pid = term.ForkCommand ("/bin/bash", argv, envv, Environment.CurrentDirectory, false, true, true);
|
|
|
|
//Console.WriteLine ("Child pid: " + pid);
|
2004-01-18 22:10:03 +00:00
|
|
|
|
2004-01-17 22:47:35 +00:00
|
|
|
sw.AddWithViewport (term);
|
|
|
|
|
|
|
|
app.Contents = sw;
|
|
|
|
app.ShowAll ();
|
|
|
|
program.Run ();
|
|
|
|
}
|
2004-01-29 01:08:46 +00:00
|
|
|
|
2004-02-10 20:35:40 +00:00
|
|
|
private void OnCommit (object o, Vte.CommitArgs args)
|
2004-01-29 01:08:46 +00:00
|
|
|
{
|
|
|
|
Terminal term = (Terminal) o;
|
2004-02-03 21:21:57 +00:00
|
|
|
if (args.P0 == "\r")
|
|
|
|
{
|
|
|
|
//FIXME: maybe a setting somewhere
|
|
|
|
term.Feed ("\r\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-01-29 01:08:46 +00:00
|
|
|
term.Feed (args.P0);
|
|
|
|
}
|
|
|
|
|
|
|
|
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 22:47:35 +00:00
|
|
|
|
|
|
|
private void OnTextInserted (object o, EventArgs args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnAppDelete (object o, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
program.Quit ();
|
|
|
|
}
|
|
|
|
}
|