- cosmetics
[FaRetSys.git] / PluginList.cs
blob7fe99691831830139ee85657d613866f451a644f
1 using System;
2 using System.Collections;
3 using Gtk;
4 using Glade;
5 using Mono.Unix;
7 namespace Eithne
9 public class PluginListContent : TextBuffer
11 public PluginListContent() : base(null)
13 SetupTags();
15 TextIter iter = EndIter;
17 InsertWithTagsByName(ref iter, "\n", "spacer");
18 InsertWithTagsByName(ref iter, Catalog.GetString("Input plugins\n"), "category");
19 Append(ref iter, PluginDB.In);
21 InsertWithTagsByName(ref iter, Catalog.GetString("\nImage processing plugins\n"), "category");
22 Append(ref iter, PluginDB.ImgProc);
24 InsertWithTagsByName(ref iter, Catalog.GetString("\nComparator plugins\n"), "category");
25 Append(ref iter, PluginDB.Comparator);
27 InsertWithTagsByName(ref iter, Catalog.GetString("\nResult processing plugins\n"), "category");
28 Append(ref iter, PluginDB.ResProc);
30 InsertWithTagsByName(ref iter, Catalog.GetString("\nOutput plugins\n"), "category");
31 Append(ref iter, PluginDB.Out);
33 InsertWithTagsByName(ref iter, Catalog.GetString("\nOther plugins\n"), "category");
34 Append(ref iter, PluginDB.Other);
37 private void SetupTags()
39 TextTag tag = new TextTag("category");
40 tag.Weight = Pango.Weight.Bold;
41 tag.Scale = 1.5;
42 tag.Background = "#ddd";
43 tag.BackgroundFullHeight = true;
44 TagTable.Add(tag);
46 tag = new TextTag("name");
47 tag.Weight = Pango.Weight.Bold;
48 tag.Scale = 1.3;
49 tag.LeftMargin = 15;
50 tag.PixelsAboveLines = 5;
51 tag.PixelsBelowLines = 5;
52 TagTable.Add(tag);
54 tag = new TextTag("author");
55 tag.LeftMargin = 15;
56 tag.PixelsBelowLines = 5;
57 TagTable.Add(tag);
59 tag = new TextTag("description");
60 tag.Style = Pango.Style.Italic;
61 tag.LeftMargin = 15;
62 TagTable.Add(tag);
64 tag = new TextTag("spacer");
65 tag.Scale = 0.25;
66 TagTable.Add(tag);
69 private void Append(ref TextIter iter, ArrayList plugins)
71 if(plugins.Count == 0)
73 InsertWithTagsByName(ref iter, Catalog.GetString("No plugins available.\n"), "description");
74 return;
77 foreach(IFactory p in plugins)
78 Append(ref iter, p);
81 private void Append(ref TextIter iter, IFactory p)
83 InsertWithTagsByName(ref iter, p.Info.Name + " " + p.Info.Version + "\n", "name");
84 InsertWithTagsByName(ref iter, Catalog.GetString("Author: ") + p.Info.Author + "\n", "author");
85 InsertWithTagsByName(ref iter, p.Info.Description + "\n", "description");
89 public class PluginList
91 [Widget] Window PluginListWindow;
92 [Widget] Image PluginImage;
93 [Widget] TextView PluginListDisplay;
94 [Widget] Button CloseButton;
96 public PluginList()
98 Glade.XML gxml = new Glade.XML("PluginList.glade", "PluginListWindow");
99 gxml.BindFields(this);
101 PluginListWindow.DeleteEvent += CloseWindow;
102 CloseButton.Clicked += CloseWindow;
104 PluginListWindow.IconList = new Gdk.Pixbuf[2] {new Gdk.Pixbuf(null, "plugin-48.png"),
105 new Gdk.Pixbuf(null, "plugin-16.png")};
106 PluginImage.FromPixbuf = new Gdk.Pixbuf(null, "plugin-48.png");
108 PluginListDisplay.Buffer = new PluginListContent();
110 PluginListWindow.ShowAll();
113 private void CloseWindow(object o, EventArgs args)
115 PluginListWindow.Destroy();