diff options
13 files changed, 13 insertions, 84 deletions
diff --git a/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionNodeBuilder.cs b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionNodeBuilder.cs index 4095a15a48..e10849e2eb 100644 --- a/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionNodeBuilder.cs +++ b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionNodeBuilder.cs @@ -64,7 +64,7 @@ namespace MonoDevelop.AddinAuthoring.NodeBuilders public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Pixbuf icon, ref Pixbuf closedIcon) { Extension ext = (Extension) dataObject; - label = EscapeTextForMarkup (Util.GetDisplayName (ext)); + label = GLib.Markup.EscapeText (Util.GetDisplayName (ext)); icon = Context.GetIcon ("md-extension"); } diff --git a/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionPointNodeBuilder.cs b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionPointNodeBuilder.cs index 2e7cfa5693..632932a809 100644 --- a/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionPointNodeBuilder.cs +++ b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/ExtensionPointNodeBuilder.cs @@ -71,7 +71,7 @@ namespace MonoDevelop.AddinAuthoring.NodeBuilders public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Pixbuf icon, ref Pixbuf closedIcon) { ExtensionPoint ep = (ExtensionPoint) dataObject; - label = EscapeTextForMarkup (!string.IsNullOrEmpty (ep.Name) ? ep.Name : ep.Path); + label = GLib.Markup.EscapeText (!string.IsNullOrEmpty (ep.Name) ? ep.Name : ep.Path); icon = Context.GetIcon ("md-extension-point"); } diff --git a/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/SolutionNodeBuilder.cs b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/SolutionNodeBuilder.cs index 0382b13032..4f2a97f80e 100644 --- a/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/SolutionNodeBuilder.cs +++ b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring.NodeBuilders/SolutionNodeBuilder.cs @@ -71,7 +71,7 @@ namespace MonoDevelop.AddinAuthoring.NodeBuilders public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { Solution sol = (Solution) dataObject; - label = EscapeTextForMarkup (sol.Name); + label = GLib.Markup.EscapeText (sol.Name); icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Solution); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs index 84a4cb1f0b..1286d32081 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs @@ -27,8 +27,6 @@ // using System; -using System.Text; -using System.Collections.Generic; using MonoDevelop.Core; @@ -148,74 +146,5 @@ namespace MonoDevelop.Ide.Gui.Components return (nodeAttr & attr) != 0; } - - - static Dictionary<char, string> MarkupSpecials; - - static NodeBuilder () - { - byte c; - - MarkupSpecials = new Dictionary<char, string> (); - MarkupSpecials.Add ('\'', "'"); - MarkupSpecials.Add ('"', """); - MarkupSpecials.Add ('&', "&"); - MarkupSpecials.Add ('<', "<"); - MarkupSpecials.Add ('>', ">"); - - // Escape control characters. - for (c = 0x1; c <= 0x8; c++) - MarkupSpecials.Add ((char) c, string.Format ("�x{0:x};", c)); - for (c = 0xb; c <= 0xc; c++) - MarkupSpecials.Add ((char) c, string.Format ("�x{0:x};", c)); - for (c = 0xe; c <= 0x1f; c++) - MarkupSpecials.Add ((char) c, string.Format ("�x{0:x};", c)); - for (c = 0x7f; c <= 0x84; c++) - MarkupSpecials.Add ((char) c, string.Format ("�x{0:x};", c)); - for (c = 0x86; c <= 0x9f; c++) - MarkupSpecials.Add ((char) c, string.Format ("�x{0:x};", c)); - } - - static int EscapedLength (string text, out int first) - { - int length = text.Length; - string escaped; - - first = -1; - - for (int i = 0; i < text.Length; i++) { - if (MarkupSpecials.TryGetValue (text[i], out escaped)) { - if (first == -1) - first = i; - - length += escaped.Length; - } - } - - return length; - } - - protected static string EscapeTextForMarkup (string text) - { - StringBuilder sb; - int length, i; - - if ((length = EscapedLength (text, out i)) == text.Length) - return text; - - sb = new StringBuilder (text, 0, i, length); - while (i < text.Length) { - string escaped; - - if (MarkupSpecials.TryGetValue (text[i], out escaped)) - sb.Append (escaped); - else - sb.Append (text[i]); - - i++; - } - - return sb.ToString (); - } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs index cba2856f1b..a44229cc18 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs @@ -73,7 +73,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad { ProjectFile file = (ProjectFile) dataObject; - label = EscapeTextForMarkup (file.Link.IsNullOrEmpty ? file.FilePath.FileName : file.Link.FileName); + label = GLib.Markup.EscapeText (file.Link.IsNullOrEmpty ? file.FilePath.FileName : file.Link.FileName); if (!File.Exists (file.FilePath)) { label = "<span foreground='red'>" + label + "</span>"; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs index 54697fc392..19e558f262 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs @@ -125,7 +125,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad ProjectFolder folder = (ProjectFolder) dataObject; - label = EscapeTextForMarkup (folder.Name); + label = GLib.Markup.EscapeText (folder.Name); icon = folderOpenIcon; closedIcon = folderClosedIcon; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs index fb952fa75f..826f2edded 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs @@ -113,7 +113,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad Project p = dataObject as Project; - string escapedProjectName = EscapeTextForMarkup (p.Name); + string escapedProjectName = GLib.Markup.EscapeText (p.Name); string iconName; if (p is DotNetProject && ((DotNetProject)p).LanguageBinding == null) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs index e708277929..a1543be9d9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs @@ -73,7 +73,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { - label = EscapeTextForMarkup (GettextCatalog.GetString ("References")); + label = GLib.Markup.EscapeText (GettextCatalog.GetString ("References")); icon = Context.GetIcon (Stock.OpenReferenceFolder); closedIcon = Context.GetIcon (Stock.ClosedReferenceFolder); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs index 0829cf52c9..2ae0bc2931 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs @@ -78,7 +78,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad break; } - label = EscapeTextForMarkup (label); + label = GLib.Markup.EscapeText (label); if (!pref.IsValid) { label = "<span color='red'>" + label + "</span>"; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs index 271f2ac781..d8450ff650 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs @@ -78,7 +78,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { SolutionFolder combine = dataObject as SolutionFolder; - label = EscapeTextForMarkup (combine.Name); + label = GLib.Markup.EscapeText (combine.Name); icon = Context.GetIcon (Stock.SolutionFolderOpen); closedIcon = Context.GetIcon (Stock.SolutionFolderClosed); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs index f935786e63..317d88bff6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs @@ -92,7 +92,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { Solution solution = dataObject as Solution; - label = EscapeTextForMarkup (GettextCatalog.GetString ("Solution {0}", solution.Name)); + label = GLib.Markup.EscapeText (GettextCatalog.GetString ("Solution {0}", solution.Name)); icon = Context.GetIcon (Stock.Solution); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs index da8c253351..55483fa000 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs @@ -65,7 +65,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { SystemFile file = (SystemFile) dataObject; - label = EscapeTextForMarkup (file.Name); + label = GLib.Markup.EscapeText (file.Name); icon = DesktopService.GetPixbufForFile (file.Path, Gtk.IconSize.Menu); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs index fe4d794750..82520d844d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs @@ -53,7 +53,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad if (entry.LoadError.Length > 0) { icon = Context.GetIcon (Gtk.Stock.DialogError); - label = GettextCatalog.GetString ("{0} <span foreground='red' size='small'>(Load failed)</span>", EscapeTextForMarkup (entry.Name)); + label = GettextCatalog.GetString ("{0} <span foreground='red' size='small'>(Load failed)</span>", GLib.Markup.EscapeText (entry.Name)); } else { icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Project); Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade"); @@ -62,7 +62,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad Context.CacheComposedIcon (icon, "fade", gicon); } icon = gicon; - label = EscapeTextForMarkup (entry.Name); + label = GLib.Markup.EscapeText (entry.Name); } } |