Blame SOURCES/dstat-0.6.8-dbus.patch

5da188
diff -up dstat-0.6.8/plugins/dstat_dbus.py.dbus dstat-0.6.8/plugins/dstat_dbus.py
5da188
--- dstat-0.6.8/plugins/dstat_dbus.py.dbus	2007-05-12 06:09:45.000000000 +0200
5da188
+++ dstat-0.6.8/plugins/dstat_dbus.py	2008-09-16 13:26:32.000000000 +0200
5da188
@@ -18,21 +18,23 @@ class dstat_dbus(dstat):
5da188
         try:
5da188
             global dbus
5da188
             import dbus
5da188
-            try:
5da188
-                self.sysbus = dbus.Bus(dbus.Bus.TYPE_SYSTEM).get_service('org.freedesktop.DBus').get_object('/org/freedesktop/DBus', 'org.freedesktop.DBus')
5da188
-                try:
5da188
-                    self.sesbus = dbus.Bus(dbus.Bus.TYPE_SESSION).get_service('org.freedesktop.DBus').get_object('/org/freedesktop/DBus', 'org.freedesktop.DBus')
5da188
-                except:
5da188
-                    self.sesbus = None
5da188
-            except:
5da188
-                raise Exception, 'Unable to connect to dbus message bus'
5da188
         except:
5da188
             raise Exception, 'Needs python-dbus module'
5da188
+        try:
5da188
+            self.sysbus = dbus.Interface(dbus.SystemBus().get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus')
5da188
+        except:
5da188
+            raise Exception, 'Unable to connect to dbus message bus'
5da188
+        try:
5da188
+            self.sesbus = dbus.Interface(dbus.SessionBus().get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus')
5da188
+        except:
5da188
+            self.sesbus = None
5da188
+
5da188
+        return True
5da188
 
5da188
     def extract(self):
5da188
-        self.val['system'] = len(self.sysbus.ListServices()) - 1
5da188
+        self.val['system'] = len(self.sysbus.ListNames()) - 1
5da188
         try:
5da188
-            self.val['session'] = len(self.sesbus.ListServices()) - 1
5da188
+            self.val['session'] = len(self.sesbus.ListNames()) - 1
5da188
         except:
5da188
             self.val['session'] = -1
5da188
 #       print dir(b); print dir(s); print dir(d); print d.ListServices()