summary refs log tree commit diff stats
path: root/ranger/fsobject/directory.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-05-17 22:29:26 +0200
committerhut <hut@lavabit.com>2010-05-17 22:29:26 +0200
commit4fc56903c47660d827c7bf27a30395498f72ee21 (patch)
treee896541bdd7f027b72182e9af1edea8bd08a318d /ranger/fsobject/directory.py
parent1337039291f72d1514fe95586c585234b66436d3 (diff)
downloadranger-4fc56903c47660d827c7bf27a30395498f72ee21.tar.gz
fsobject: moved some code from fsobject to directory
Diffstat (limited to 'ranger/fsobject/directory.py')
-rw-r--r--ranger/fsobject/directory.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 930ecb70..50564835 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -97,6 +97,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 		for opt in ('hidden_filter', 'show_hidden'):
 			self.settings.signal_bind('setopt.' + opt,
 				self.request_reload, weak=True)
+		self.use()
 
 	def request_resort(self):
 		self.order_outdated = True
@@ -400,6 +401,25 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 			return True
 		return False
 
+	def get_description(self):
+		return "Loading " + str(self)
+
+	def use(self):
+		"""mark the filesystem-object as used at the current time"""
+		self.last_used = time()
+
+	def is_older_than(self, seconds):
+		"""returns whether this object wasn't use()d in the last n seconds"""
+		if seconds < 0:
+			return True
+		return self.last_used + seconds < time()
+
+	def go(self):
+		"""enter the directory if the filemanager is running"""
+		if self.fm:
+			return self.fm.enter_dir(self.path)
+		return False
+
 	def empty(self):
 		"""Is the directory empty?"""
 		return self.files is None or len(self.files) == 0