- fixed clean rule
[FaRetSys.git] / PluginAbout.cs
blobd41c25846f84fc0c57a538c621046b68e1435ced
1 using System;
2 using Gtk;
3 using Glade;
4 using Mono.Unix;
6 namespace Eithne
8 public class PluginAbout
10 [Widget] Window PluginAboutWindow;
11 [Widget] Label Name;
12 [Widget] Label Author;
13 [Widget] Label Desc;
14 [Widget] Label Type;
15 [Widget] Button CloseButton;
16 [Widget] TreeView MatchIn;
17 [Widget] TreeView MatchOut;
19 private void CommonTasks(IInfo info, string type)
21 Glade.XML gxml = new Glade.XML("PluginAbout.glade", "PluginAboutWindow");
22 gxml.BindFields(this);
24 PluginAboutWindow.DeleteEvent += CloseWindow;
25 CloseButton.Clicked += CloseWindow;
27 PluginAboutWindow.Title = String.Format(Catalog.GetString("About plugin {0}"), info.Name);
28 PluginAboutWindow.IconList = new Gdk.Pixbuf[2] {new Gdk.Pixbuf(null, "plugin-48.png"), new Gdk.Pixbuf(null, "plugin-16.png")};
30 Name.Text = "<big><big><big><b>" + info.Name + " " + info.Version + "</b></big></big></big>";
31 Name.UseMarkup = true;
32 Author.Text = Catalog.GetString("Author: ") + info.Author;
33 Author.UseMarkup = true;
34 Desc.Text = "<small>" + info.Description + "</small>";
35 Desc.UseMarkup = true;
37 Type.Text = "<small>" + type + "</small>";
38 Type.UseMarkup = true;
40 PluginAboutWindow.ShowAll();
43 private void FillMatchInfo(IPlugin p)
45 MatchIn.Model = new ListStore(typeof(string));
46 MatchOut.Model = new ListStore(typeof(string));
48 MatchIn.AppendColumn(Catalog.GetString("Input matches"), new CellRendererText(), "text", 0);
49 MatchOut.AppendColumn(Catalog.GetString("Output matches"), new CellRendererText(), "text", 0);
51 if(p.MatchIn != null)
52 foreach(string s in p.MatchIn)
53 (MatchIn.Model as ListStore).AppendValues(s);
55 if(p.MatchOut != null)
56 foreach(string s in p.MatchOut)
57 (MatchOut.Model as ListStore).AppendValues(s);
60 public PluginAbout(IPlugin p)
62 string type;
64 if(p is IInPlugin)
65 type = Catalog.GetString("Input");
66 else if (p is IOutPlugin)
67 type = Catalog.GetString("Output");
68 else if (p is IImgProcPlugin)
69 type = Catalog.GetString("Image processing");
70 else if (p is IResProcPlugin)
71 type = Catalog.GetString("Result processing");
72 else if (p is IComparatorPlugin)
73 type = Catalog.GetString("Comparator");
74 else
75 type = Catalog.GetString("Other");
77 CommonTasks(p.Info, type);
78 FillMatchInfo(p);
81 public PluginAbout(IFactory f)
83 string type = null;
85 switch(f.Type)
87 case IType.In:
88 type = Catalog.GetString("Input");
89 break;
91 case IType.Out:
92 type = Catalog.GetString("Output");
93 break;
95 case IType.ImgProc:
96 type = Catalog.GetString("Image processing");
97 break;
99 case IType.ResProc:
100 type = Catalog.GetString("Result processing");
101 break;
103 case IType.Comparator:
104 type = Catalog.GetString("Comparator");
105 break;
107 case IType.Other:
108 type = Catalog.GetString("Other");
109 break;
112 CommonTasks(f.Info, type);
114 IPlugin tmp = f.Create();
115 FillMatchInfo(tmp);
118 private void CloseWindow(object o, EventArgs args)
120 PluginAboutWindow.Destroy();