int CompareNodes(Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
        {
            int      col, val = 0;
            SortType type;

            filestore.GetSortColumnId(out col, out type);

            switch (col)
            {
            case 0:
                val = ColStatus;
                break;

            case 1:
                val = ColRemoteStatus;
                break;

            case 2:
                val = ColCommit;
                break;

            case 3:
                val = ColPath;
                break;
            }
            object o1 = filestore.GetValue(a, val);
            object o2 = filestore.GetValue(b, val);

            if (o1 is string[])
            {
                o1 = ((string[])o1)[0];
            }
            if (o2 is string[])
            {
                o2 = ((string[])o2)[0];
            }

            if (o1 == null && o2 == null)
            {
                return(0);
            }
            else if (o1 == null)
            {
                return(1);
            }
            else if (o2 == null)
            {
                return(-1);
            }

            return(((IComparable)o1).CompareTo(o2));
        }
Example #2
0
        int CompareNodes(Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
        {
            int      col;
            SortType type;

            store.GetSortColumnId(out col, out type);

            object o1 = model.GetValue(a, 6);
            object o2 = model.GetValue(b, 6);

            if (o1 is Backtrace && o2 is Backtrace)
            {
                Backtrace b1 = (Backtrace)o1;
                Backtrace b2 = (Backtrace)o2;
                switch (col)
                {
                case 0:
                    return(string.Compare(b1.Type.Name, b2.Type.Name));

                case 1:
                    return(b1.LastObjectStats.AllocatedCount.CompareTo(b2.LastObjectStats.AllocatedCount));

                case 2:
                    return(b1.LastObjectStats.AllocatedTotalBytes.CompareTo(b2.LastObjectStats.AllocatedTotalBytes));

                case 3:
                    return(b1.LastObjectStats.AllocatedAverageBytes.CompareTo(b2.LastObjectStats.AllocatedAverageBytes));

                case 4:
                    return(b1.LastObjectStats.AllocatedAverageAge.CompareTo(b2.LastObjectStats.AllocatedAverageAge));

                default:
                    return(1);
                }
            }
            else if (o1 is Frame && o2 is Frame)
            {
                return(((Frame)o1).MethodName.CompareTo(((Frame)o2).MethodName));
            }
            else if (o1 is Frame)
            {
                return(1);
            }
            else
            {
                return(-1);
            }
        }