diff options
author | Levi Bard <levibard@mono-cvs.ximian.com> | 2009-12-11 01:32:56 +0300 |
---|---|---|
committer | Levi Bard <levibard@mono-cvs.ximian.com> | 2009-12-11 01:32:56 +0300 |
commit | c59066aa12598ea486d44437db97b764d87e0b84 (patch) | |
tree | 39a8ea0504d5b2e71cbeb6bbbebb269512b531c8 | |
parent | 1e3c2f672e9b8b1eb9e8aa934d06467f95c6b9da (diff) |
* MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs: Allow resorting by severity.
svn path=/trunk/monodevelop/; revision=148067
-rw-r--r-- | main/src/core/MonoDevelop.Ide/ChangeLog | 5 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs | 48 |
2 files changed, 50 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/ChangeLog b/main/src/core/MonoDevelop.Ide/ChangeLog index d31fd90d16..03097f3d9d 100644 --- a/main/src/core/MonoDevelop.Ide/ChangeLog +++ b/main/src/core/MonoDevelop.Ide/ChangeLog @@ -1,3 +1,8 @@ +2009-12-10 Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> + + * MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs: Allow resorting by + severity. + 2009-12-09 Michael Hutchinson <mhutchinson@novell.com> * templates/EmptyHTMLFile.xft.xml: Sane casing on HTML tags. diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs index 79cecbb3a4..0c0865e1a6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs @@ -172,12 +172,20 @@ namespace MonoDevelop.Ide.Gui.Pads filter = new TreeModelFilter (store, null); filter.VisibleFunc = filterFunct; - view = new MonoDevelop.Ide.Gui.Components.PadTreeView (filter); + TreeModelSort sort = new TreeModelSort (filter); + sort.SetSortFunc (VisibleColumns.Type, SeverityIterSort); + sort.SetSortFunc (VisibleColumns.Project, ProjectIterSort); + sort.SetSortFunc (VisibleColumns.File, FileIterSort); + + view = new MonoDevelop.Ide.Gui.Components.PadTreeView (sort); view.RulesHint = true; view.PopupMenu += new PopupMenuHandler (OnPopupMenu); view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed); AddColumns (); LoadColumnsVisibility (); + view.Columns[VisibleColumns.Type].SortColumnId = VisibleColumns.Type; + view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project; + view.Columns[VisibleColumns.File].SortColumnId = VisibleColumns.File; sw = new Gtk.ScrolledWindow (); sw.ShadowType = ShadowType.None; @@ -540,8 +548,12 @@ namespace MonoDevelop.Ide.Gui.Pads Task task = model.GetValue (iter, DataColumns.Task) as Task; if (task == null) return; - string project = task.WorkspaceObject is SolutionItem ? task.WorkspaceObject.Name : ""; - SetText (textRenderer, model, iter, task, project); + SetText (textRenderer, model, iter, task, GetProject(task)); + } + + static string GetProject (Task task) + { + return (task != null && task.WorkspaceObject is SolutionItem)? task.WorkspaceObject.Name: string.Empty; } static void PathDataFunc (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) @@ -831,5 +843,35 @@ namespace MonoDevelop.Ide.Gui.Pads else IdeApp.Workbench.StatusBar.ShowMessage (t.Description); } + + static int SeverityIterSort(TreeModel model, TreeIter a, TreeIter z) + { + Task aTask = model.GetValue(a, DataColumns.Task) as Task, + zTask = model.GetValue(z, DataColumns.Task) as Task; + + return (aTask != null && zTask != null) ? + aTask.Severity.CompareTo(zTask.Severity) : + 0; + } + + static int ProjectIterSort (TreeModel model, TreeIter a, TreeIter z) + { + Task aTask = model.GetValue (a, DataColumns.Task) as Task, + zTask = model.GetValue (z, DataColumns.Task) as Task; + + return (aTask != null && zTask != null) ? + GetProject (aTask).CompareTo (GetProject (zTask)) : + 0; + } + + static int FileIterSort (TreeModel model, TreeIter a, TreeIter z) + { + Task aTask = model.GetValue (a, DataColumns.Task) as Task, + zTask = model.GetValue (z, DataColumns.Task) as Task; + + return (aTask != null && zTask != null) ? + aTask.FileName.CompareTo (zTask.FileName) : + 0; + } } } |