[gnome-system-monitor] Don't show swap history when computer has no swap



commit 466b7e64cdac761eabd9ab69be8f72955e07f813
Author: Chris KÃhl <chrisk openismus com>
Date:   Tue Nov 8 12:27:26 2011 +0100

    Don't show swap history when computer has no swap
    
    https://bugzilla.gnome.org/show_bug.cgi?id=414492

 src/load-graph.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 558986f..c4cc936 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -328,8 +328,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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]