From 723429fb80720d26797822996f68c255b25cff7b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 17 Aug 2007 11:52:22 -0400 Subject: [PATCH] Include free swap space in the activity ring's "free memory" slice Mostly only affects sugar-jhbuild, but also people with USB/SD swap on B2s --- shell/view/home/activitiesdonut.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/view/home/activitiesdonut.py b/shell/view/home/activitiesdonut.py index 3b12a091..306cdf54 100644 --- a/shell/view/home/activitiesdonut.py +++ b/shell/view/home/activitiesdonut.py @@ -16,6 +16,7 @@ import colorsys from gettext import gettext as _ +import logging import math import hippo @@ -317,10 +318,12 @@ class ActivitiesDonut(hippo.CanvasBox, hippo.CanvasItem): 'expected format' % pid) # Next, see how much free memory is left. + free_memory = 0 try: meminfo = open('/proc/meminfo') - meminfo.readline() - free_memory = int(meminfo.readline()[9:-3]) + for line in meminfo.readlines(): + if line.startswith('MemFree:') or line.startswith('SwapFree:'): + free_memory += int(line[9:-3]) meminfo.close() except IOError: logging.warn('ActivitiesDonut: could not read /proc/meminfo')