84
void SetText (string text)
87
void SetText (IEnumerable<ISystemInformationProvider> text)
87
var buf = new TextBuffer (null);
91
var buf = new Gtk.Label ();
92
buf.Selectable = true;
95
StringBuilder sb = new StringBuilder ();
97
foreach (var info in text) {
98
sb.Append ("<b>").Append (GLib.Markup.EscapeText (info.Title)).Append ("</b>\n");
99
sb.Append (GLib.Markup.EscapeText (info.Description.Trim ())).Append ("\n\n");
102
buf.Markup = sb.ToString ().Trim () + "\n";
104
var contentBox = new VBox ();
105
contentBox.BorderWidth = 4;
106
contentBox.PackStart (buf, false, false, 0);
108
var asmButton = new Gtk.Button ("Show loaded assemblies");
109
asmButton.Clicked += (sender, e) => {
111
contentBox.PackStart (CreateAssembliesTable (), false, false, 0);
113
var hb = new Gtk.HBox ();
114
hb.PackStart (asmButton, false, false, 0);
115
contentBox.PackStart (hb, false, false, 0);
90
117
var sw = new MonoDevelop.Components.CompactScrolledWindow () {
91
118
ShowBorderLine = true,
93
Child = new TextView (buf) {
102
sw.Child.ModifyFont (Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont));
121
sw.AddWithViewport (contentBox);
122
sw.ShadowType = ShadowType.None;
123
((Gtk.Viewport)sw.Child).ShadowType = ShadowType.None;
103
125
PackStart (sw, true, true, 0);
104
var hb = new HBox (false, 0) {
107
var copyButton = new Button () { Label = GettextCatalog.GetString ("Copy Version Information") };
108
copyButton.Clicked += (sender, e) => CopyBufferToClipboard (buf);
109
hb.PackStart (copyButton, true, true, 0);
110
PackEnd (hb, false, false, 0);
114
static void CopyBufferToClipboard (TextBuffer buf)
129
Gtk.Widget CreateAssembliesTable ()
116
//get current cursor state
118
TextIter cursorIter = TextIter.Zero;
119
var hadSel = buf.GetSelectionBounds (out s, out e);
121
cursorIter = buf.GetIterAtOffset (buf.CursorPosition);
124
//copy text to clipboard, let the buffer handle the details
125
buf.SelectRange (buf.StartIter, buf.EndIter);
126
Clipboard clipboard = Clipboard.Get (Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM);
127
buf.CopyClipboard (clipboard);
129
//restore cursor state
131
buf.SelectRange (s, e);
133
buf.PlaceCursor (cursorIter);
131
var box = new Gtk.VBox ();
132
box.PackStart (new Gtk.Label () {
133
Markup = "<b>LoadedAssemblies</b>",
136
var table = new Gtk.Table (0, 0, false);
137
table.ColumnSpacing = 3;
139
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies ().Where (a => !a.IsDynamic).OrderBy (a => a.FullName)) {
141
var assemblyName = assembly.GetName ();
142
table.Attach (new Gtk.Label (assemblyName.Name) { Xalign = 0 }, 0, 1, line, line + 1);
143
table.Attach (new Gtk.Label (assemblyName.Version.ToString ()) { Xalign = 0 }, 1, 2, line, line + 1);
144
table.Attach (new Gtk.Label (System.IO.Path.GetFullPath (assembly.Location)) { Xalign = 0 }, 2, 3, line, line + 1);
149
box.PackStart (table, false, false, 0);
137
154
public override void Destroy ()