using System; namespace zero { namespace netboot { public partial class AddDownloadWindow : Gtk.Window { public bool debug; public string base_path="/tmp/"; protected virtual void OnAcceptButtonClicked (object sender, System.EventArgs e) { if (urlEntry.Text.StartsWith("http://") || urlEntry.Text.StartsWith("ftp://")) { dprint("Adding " + urlEntry.Text); zero.netboot.DownloadInfo info=new zero.netboot.DownloadInfo(); int index=urlEntry.Text.LastIndexOf("/"); string file=urlEntry.Text.Substring(index+1); info.newDownload(base_path + file, urlEntry.Text); zero.netboot.Core core=zero.netboot.Core.getCore(); core.sqlman.insert_download(info); info.id=core.sqlman.get_last_download_id(); core.downList.Add(info); core.downwidget.populateDownloads(); } this.Visible=false; } public AddDownloadWindow () : base(Gtk.WindowType.Toplevel) { this.Build (); debug=zero.netboot.Core.getCore().debug; } protected virtual void OnCancelButtonClicked (object sender, System.EventArgs e) { this.Visible=false; } public void dprint(string txt) { if (debug) { Console.WriteLine("[AddDownloadWindow] {0}",txt); } } } } }