static void AddDialog ()
{
int cols = (int) (Application.Cols * 0.7);
Dialog d = new Dialog (cols, 8, "Add");
Entry e;
string name = null;
d.Add (new Label (1, 0, "Torrent file:"));
e = new Entry (1, 1, cols - 6, Environment.CurrentDirectory);
d.Add (e);
// buttons
Button b = new Button ("Ok", true);
b.Clicked += delegate {
b.Container.Running = false;
name = e.Text;
};
d.AddButton (b);
b = new Button ("Cancel");
b.Clicked += delegate {
b.Container.Running = false;
};
d.AddButton (b);
Application.Run (d);
if (name != null){
if (!File.Exists (name)){
Application.Error ("Missing File", "Torrent file:\n" + name + "\ndoes not exist");
return;
}
torrent_list.Add (name);
}
}