summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-08-05 16:28:12 +0200
committerhut <hut@lavabit.com>2012-08-05 16:28:12 +0200
commit0b3e5c3e05ecd8725574f2709ea42514f22a07e4 (patch)
tree37dc49c3386575efae48b739fa7f0bb77709c860
parent8d6c23f785d3e1ac9be8855ccc4e0df6c240c8bd (diff)
downloadranger-0b3e5c3e05ecd8725574f2709ea42514f22a07e4.tar.gz
core.actions: Added {old,new} arguments to 'tba.change' signal
-rw-r--r--ranger/core/actions.py7
-rw-r--r--ranger/core/tab.py2
2 files changed, 6 insertions, 3 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index b7205dc5..24b115de 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -838,6 +838,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	def tab_open(self, name, path=None):
 		tab_has_changed = (name != self.current_tab)
 		self.current_tab = name
+		previous_tab = self.thistab
 		try:
 			tab = self.tabs[name]
 		except KeyError:
@@ -851,7 +852,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 
 		if tab_has_changed:
 			self.change_mode('normal')
-			self.signal_emit('tab.change')
+			self.signal_emit('tab.change', old=previous_tab, new=self.thistab)
 
 	def tab_close(self, name=None):
 		if name is None:
@@ -869,6 +870,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 
 	def tab_restore(self):
 		# NOTE: The name of the tab is not restored.
+		previous_tab = self.thistab
 		if self.restorable_tabs:
 			tab = self.restorable_tabs.pop()
 			for name in range(1, len(self.tabs) + 2):
@@ -878,7 +880,8 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 					tab.enter_dir(tab.path)
 					self.thistab = tab
 					self.change_mode('normal')
-					self.signal_emit('tab.change')
+					self.signal_emit('tab.change', old=previous_tab,
+							new=self.thistab)
 					break
 
 	def tab_move(self, offset):
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index 0244adec..e5605f28 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -28,7 +28,7 @@ class Tab(FileManagerAware, SettingsAware):
 				self.pointer = self.thisdir.pointer
 
 	def _on_tab_change(self, signal):
-		if self == self.fm.thistab and self.thisdir:
+		if self == signal.new and self.thisdir:
 			# restore the pointer whenever this tab is reopened
 			self.thisdir.pointer = self.pointer
 			self.thisdir.correct_pointer()