- fixed clean rule
[FaRetSys.git] / FatalError.cs
blob28fe3e0cc5476baaa6497d912adbe9ce7c39bcb6
1 using System;
2 using Gtk;
3 using Glade;
4 using Mono.Unix;
6 namespace Eithne
8 class FatalError
10 [Widget] Window FatalErrorWindow;
11 [Widget] Image StopImage;
12 [Widget] Button CloseButton;
13 [Widget] Label ErrorText;
14 [Widget] Label LabelUpper;
15 [Widget] Label LabelLower;
16 [Widget] TextView FullErrorText;
18 private MainWindow mw;
20 public FatalError(Exception e, MainWindow mw)
22 this.mw = mw;
24 Glade.XML gxml = new Glade.XML("FatalError.glade", "FatalErrorWindow");
25 gxml.BindFields(this);
27 FatalErrorWindow.IconList = new Gdk.Pixbuf[2] {new Gdk.Pixbuf(null, "dialog-error.png"), new Gdk.Pixbuf(null, "dialog-error-16.png")};
29 FatalErrorWindow.DeleteEvent += CloseWindow;
30 CloseButton.Clicked += CloseWindow;
32 StopImage.FromPixbuf = new Gdk.Pixbuf(null, "dialog-error.png");
34 ErrorText.Text = e.Message;
35 TextBuffer buf = new TextBuffer(null);
36 buf.Text = e.ToString();
37 FullErrorText.Buffer = buf;
39 LabelUpper.Text = String.Format(Catalog.GetString("<big><big><b>{0} has encountered a fatal error and cannot work correctly anymore.</b></big></big>"), About.Name);
40 LabelUpper.UseMarkup = true;
41 LabelLower.Text = String.Format(Catalog.GetString("{0} will try to do a rescue save of system schematic to <i>rescue.xml</i>"), About.Name);
42 LabelLower.UseMarkup = true;
44 FatalErrorWindow.ShowAll();
46 Application.Run();
49 private void CloseWindow(object o, EventArgs args)
51 FatalErrorWindow.Destroy();
52 Application.Quit();
54 if(mw != null)
55 mw.EmergencySave();