int GameSort(Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b) { string name_a, name_b; int sort_column_id; SortType order; ListStore store = (ListStore)model; store.GetSortColumnId(out sort_column_id, out order); name_a = (string)model.GetValue(a, sort_column_id); name_b = (string)model.GetValue(b, sort_column_id); return(String.Compare(name_a, name_b)); }
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, 7); object o2 = model.GetValue(b, 7); if (o1 is Type && o2 is Type) { Type t1 = (Type)o1; Type t2 = (Type)o2; switch (col) { case 0: return(string.Compare(t1.Name, t2.Name)); case 1: return(t1.LastObjectStats.AllocatedCount.CompareTo(t2.LastObjectStats.AllocatedCount)); case 2: return(t1.LastObjectStats.AllocatedTotalBytes.CompareTo(t2.LastObjectStats.AllocatedTotalBytes)); case 3: return(t1.LastObjectStats.AllocatedAverageBytes.CompareTo(t2.LastObjectStats.AllocatedAverageBytes)); case 4: return(t1.LastObjectStats.AllocatedAverageAge.CompareTo(t2.LastObjectStats.AllocatedAverageAge)); case 5: return(t1.BacktraceCount.CompareTo(t2.BacktraceCount)); default: return(1); } } else if (o1 is Type) { return(1); } else { return(-1); } }
private int Compara(TreeModel modelo, TreeIter linha1, TreeIter linha2) { SortType ordem; int colOrdem; ListStore lstore = (ListStore)modelo; lstore.GetSortColumnId(out colOrdem, out ordem); string valor1 = (string)modelo.GetValue(linha1, colOrdem); string valor2 = (string)modelo.GetValue(linha2, colOrdem); return(valor1.CompareTo(valor2)); /* * if (valor1 < valor2) * return -1; * else if (valor1 == valor2) * return 0; * else * return 1; */ }
private int TimeSortFunc(TreeModel model, TreeIter iter1, TreeIter iter2) { LogMessage m1 = (LogMessage)model.GetValue(iter1, (int)Columns.Message); LogMessage m2 = (LogMessage)model.GetValue(iter2, (int)Columns.Message); if (m1 == null || m2 == null) { return(0); } SortType order; int sid; store.GetSortColumnId(out sid, out order); if (order == SortType.Ascending) { return(DateTime.Compare(m1.TimeStamp, m2.TimeStamp)); } else { return(DateTime.Compare(m2.TimeStamp, m1.TimeStamp)); } }