summaryrefslogtreecommitdiff
path: root/src/proctable.cpp
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-18 22:02:14 +0100
committerinfirit <[email protected]>2014-12-18 22:02:14 +0100
commitc133c2c81935f77ac35d341e2cb5378222b2ea55 (patch)
tree37b37bc6e250df281134b004fe6f309763e0548c /src/proctable.cpp
parent89a5256bf2b7292e0fcbd6c7fb0d5a3901271645 (diff)
downloadmate-system-monitor-c133c2c81935f77ac35d341e2cb5378222b2ea55.tar.bz2
mate-system-monitor-c133c2c81935f77ac35d341e2cb5378222b2ea55.tar.xz
Add custom sort method for numerical columns with descending sort first
Taken from GSM commit: b439f813ceaf6ce6e82cd490c734c67aeb1f2028 From: Robert Roth <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=557122
Diffstat (limited to 'src/proctable.cpp')
-rw-r--r--src/proctable.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/proctable.cpp b/src/proctable.cpp
index 63cd572..8f993d0 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -357,7 +357,6 @@ proctable_new (ProcData * const procdata)
GUINT_TO_POINTER(i),
NULL);
break;
-
case COL_VMSIZE:
case COL_MEMRES:
case COL_MEMSHARED:
@@ -394,12 +393,33 @@ proctable_new (ProcData * const procdata)
&procman::priority_cell_data_func,
GUINT_TO_POINTER(COL_NICE),
NULL);
+ break;
+ default:
+ gtk_tree_view_column_set_attributes(col, cell, "text", i, NULL);
+ break;
+ }
+
+ // sorting
+ switch (i) {
+ case COL_MEMXSERVER:
+ case COL_VMSIZE:
+ case COL_MEMRES:
+ case COL_MEMSHARED:
+ case COL_MEM:
+ case COL_MEMWRITABLE:
+ case COL_CPU:
+ case COL_CPU_TIME:
+ case COL_START_TIME:
+ gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), i,
+ procman::number_compare_func, GUINT_TO_POINTER(i),
+ NULL);
+ break;
+ case COL_PRIORITY:
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), i,
procman::priority_compare_func,
GUINT_TO_POINTER(COL_NICE), NULL);
break;
default:
- gtk_tree_view_column_set_attributes(col, cell, "text", i, NULL);
break;
}