summaryrefslogtreecommitdiff
path: root/src/load-graph.cpp
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-18 14:01:51 +0100
committerinfirit <[email protected]>2014-12-18 14:01:51 +0100
commit9b315b69304482298749dd5a3bf527df9154f75a (patch)
treee537a23f944048476fa6aac254dc643852c9a230 /src/load-graph.cpp
parent9b124d7cac10ee7651879b4145c6c5b19677a975 (diff)
downloadmate-system-monitor-9b315b69304482298749dd5a3bf527df9154f75a.tar.bz2
mate-system-monitor-9b315b69304482298749dd5a3bf527df9154f75a.tar.xz
Don't show swap history when computer has no swap
Taken from GSM commit: 466b7e64cdac761eabd9ab69be8f72955e07f813 From: Chris Kühl <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=414492
Diffstat (limited to 'src/load-graph.cpp')
-rw-r--r--src/load-graph.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 07b0d2e..918ebd7 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -339,8 +339,12 @@ namespace
used_text = procman::format_size(used);
total_text = procman::format_size(total);
- // xgettext: 540MiB (53 %) of 1.0 GiB
- text = g_strdup_printf(_("%s (%.1f %%) of %s"), used_text, 100.0 * percent, total_text);
+ if (total == 0) {
+ text = g_strdup(_("not available"));
+ } else {
+ // xgettext: 540MiB (53 %) of 1.0 GiB
+ text = g_strdup_printf(_("%s (%.1f %%) of %s"), used_text, 100.0 * percent, total_text);
+ }
gtk_label_set_text(label, text);
g_free(used_text);
g_free(total_text);