summaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-04-20 12:01:36 +0200
committerlukefromdc <[email protected]>2019-04-28 22:34:36 -0400
commitfc1f63b1c04cb6101f3a780e104a7f295c4d307a (patch)
tree0c75dd1010650682f6d199e247ec6d1962511c78 /src/util.cpp
parent1f42b9e3ab7f82825f2d0dc83a57163f5c67621c (diff)
downloadmate-system-monitor-fc1f63b1c04cb6101f3a780e104a7f295c4d307a.tar.bz2
mate-system-monitor-fc1f63b1c04cb6101f3a780e104a7f295c4d307a.tar.xz
Add disk IO on process info
Based on GNOME/gnome-system-monitor@60a787b
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index a6f46af..14c559d 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -422,6 +422,47 @@ namespace procman
}
}
+ void io_rate_cell_data_func(GtkTreeViewColumn *, GtkCellRenderer *renderer,
+ GtkTreeModel *model, GtkTreeIter *iter,
+ gpointer user_data)
+ {
+ const guint index = GPOINTER_TO_UINT(user_data);
+
+ guint64 size;
+ GValue value = { 0 };
+
+ gtk_tree_model_get_value(model, iter, index, &value);
+
+ switch (G_VALUE_TYPE(&value)) {
+ case G_TYPE_ULONG:
+ size = g_value_get_ulong(&value);
+ break;
+
+ case G_TYPE_UINT64:
+ size = g_value_get_uint64(&value);
+ break;
+
+ default:
+ g_assert_not_reached();
+ }
+
+ g_value_unset(&value);
+
+ if (size == 0) {
+ char *str = g_strdup_printf ("<i>%s</i>", _("N/A"));
+ g_object_set(renderer, "markup", str, NULL);
+ g_free(str);
+ }
+ else {
+ char *str = g_format_size(size);
+ char *formatted_str = g_strdup_printf(_("%s/s"), str);
+ g_object_set(renderer, "text", formatted_str, NULL);
+ g_free(formatted_str);
+ g_free(str);
+ }
+
+ }
+
void duration_cell_data_func(GtkTreeViewColumn *, GtkCellRenderer *renderer,
GtkTreeModel *model, GtkTreeIter *iter,
gpointer user_data)
@@ -568,4 +609,4 @@ namespace procman
g_free(current_value);
}
-} \ No newline at end of file
+}