From a1b97a6ac06f120114cb12c4e4667230edb8d7df Mon Sep 17 00:00:00 2001 From: acid-burn Date: Fri, 13 Feb 2009 08:21:01 +0100 Subject: [PATCH] add remove/add partition interface for external applications not using autofs --- lib/python/Components/Harddisk.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) mode change 100644 => 100755 lib/python/Components/Harddisk.py diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py old mode 100644 new mode 100755 index d165e26c..75d68fad --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -519,4 +519,18 @@ class HarddiskManager: description += " (Partition %d)" % part return description + def addMountedPartition(self, device, desc): + already_mounted = False + for x in self.partitions[:]: + if x.mountpoint == device: + already_mounted = True + if not already_mounted: + self.partitions.append(Partition(mountpoint = device, description = desc)) + + def removeMountedPartition(self, mountpoint): + for x in self.partitions[:]: + if x.mountpoint == mountpoint: + self.partitions.remove(x) + self.on_partition_list_change("remove", x) + harddiskmanager = HarddiskManager() -- 2.30.2