summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/environment.py19
-rw-r--r--ranger/core/fm.py20
2 files changed, 21 insertions, 18 deletions
diff --git a/ranger/core/environment.py b/ranger/core/environment.py
index 9febd923..72db5382 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -39,6 +39,10 @@ class EnvironmentCompatibilityWrapper(object):
 	def _set_home_path(self, obj): self.fm.home_path = obj
 	home_path = property(_get_home_path, _set_home_path)
 
+	def _get_garbage_collect(self): return self.fm.thistab.garbage_collect
+	def _set_garbage_collect(self, obj): self.fm.thistab.garbage_collect = obj
+	garbage_collect = property(_get_garbage_collect, _set_garbage_collect)
+
 class Environment(SettingsAware, FileManagerAware, SignalDispatcher,
 		EnvironmentCompatibilityWrapper):
 	"""
@@ -97,21 +101,6 @@ class Environment(SettingsAware, FileManagerAware, SignalDispatcher,
 			except KeyError:
 				return directory
 
-	def garbage_collect(self, age, tabs):
-		"""Delete unused directory objects"""
-		for key in tuple(self.fm.directories):
-			value = self.fm.directories[key]
-			if age != -1:
-				if not value.is_older_than(age) or value in self.pathway:
-					continue
-				if value in tabs.values():
-					continue
-			del self.fm.directories[key]
-			if value.is_directory:
-				value.files = None
-		self.settings.signal_garbage_collect()
-		self.signal_garbage_collect()
-
 	def get_selection(self):
 		if self.cwd:
 			return self.cwd.get_selection()
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 75637390..ba2bbd51 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -180,6 +180,21 @@ class FM(Actions, SignalDispatcher):
 		"""returns the path relative to rangers library directory"""
 		return os.path.join(ranger.RANGERDIR, *paths)
 
+	def garbage_collect(self, age, tabs):
+		"""Delete unused directory objects"""
+		for key in tuple(self.directories):
+			value = self.directories[key]
+			if age != -1:
+				if not value.is_older_than(age) or value in self.pathway:
+					continue
+				if value in tabs.values():
+					continue
+			del self.directories[key]
+			if value.is_directory:
+				value.files = None
+		self.settings.signal_garbage_collect()
+		self.signal_garbage_collect()
+
 	def loop(self):
 		"""
 		The main loop consists of:
@@ -198,7 +213,6 @@ class FM(Actions, SignalDispatcher):
 		ui = self.ui
 		throbber = ui.throbber
 		loader = self.loader
-		env = self.env
 		has_throbber = hasattr(ui, 'throbber')
 		zombies = self.run.zombies
 
@@ -225,7 +239,7 @@ class FM(Actions, SignalDispatcher):
 				gc_tick += 1
 				if gc_tick > ranger.TICKS_BEFORE_COLLECTING_GARBAGE:
 					gc_tick = 0
-					env.garbage_collect(
+					self.garbage_collect(
 						ranger.TIME_BEFORE_FILE_BECOMES_GARBAGE, self.tabs)
 
 		except KeyboardInterrupt:
@@ -238,5 +252,5 @@ class FM(Actions, SignalDispatcher):
 				# XXX: UnicodeEncodeError: 'utf-8' codec can't encode character
 				# '\udcf6' in position 42: surrogates not allowed
 				open(ranger.arg.choosedir, 'w').write(self.env.cwd.path)
-			self.bookmarks.remember(env.cwd)
+			self.bookmarks.remember(self.env.cwd)
 			self.bookmarks.save()