]> git.pld-linux.org Git - packages/gDesklets.git/blob - gDesklets-disksize.patch
- release 1 - works now
[packages/gDesklets.git] / gDesklets-disksize.patch
1 diff -urN gDesklets-0.26.2.orig/libdesklets/Disk.py gDesklets-0.26.2/libdesklets/Disk.py
2 --- gDesklets-0.26.2.orig/libdesklets/Disk.py   2004-08-13 21:56:22.113232392 +0200
3 +++ gDesklets-0.26.2/libdesklets/Disk.py        2004-08-13 21:56:51.983691392 +0200
4 @@ -1,6 +1,6 @@
5  import glibtop
6  import polling
7 -
8 +import os
9  
10  class Disk:
11  
12 @@ -43,15 +43,20 @@
13      #:/function
14      #
15      def __poll_size(self, partition):
16 -
17 -        blocks, bfree, bavail, files, ffree = glibtop.get_fsusage(partition)[:5]
18 -        free = float(bfree * 512)
19 -        total = float(blocks * 512)
20 -        used = total - free
21 -
22 -        return (total, used)#, free)
23 -
24 -
25 +                                                                                                                                
26 +          try:
27 +              import statvfs
28 +              statvfs_data = os.statvfs(partition)
29 +              free = float(statvfs_data[statvfs.F_BFREE] * statvfs_data[statvfs.F_FRSIZE])
30 +              total = float(statvfs_data[statvfs.F_BLOCKS] * statvfs_data[statvfs.F_FRSIZE])
31 +          except:
32 +              blocks, bfree, bavail, files, ffree = glibtop.get_fsusage(partition)
33 +              free = float(bfree * 512)
34 +              total = float(blocks * 512)
35 +                                                                                                                                
36 +          used = total - free
37 +                                                                                                                                
38 +          return (total, used)#, free)
39  
40      #
41      #:function get_fs | partition | Returns the filesystem for the given
This page took 0.094199 seconds and 3 git commands to generate.