[kupfer: 6/51] fileactions: Support ctx.environment for current screen in Open



commit b075a5f504fb7e16057b848ac453cb05dedbb42e
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Mar 28 16:51:41 2011 +0200

    fileactions: Support ctx.environment for current screen in Open

 kupfer/obj/fileactions.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/kupfer/obj/fileactions.py b/kupfer/obj/fileactions.py
index 938927d..1ad1cd1 100644
--- a/kupfer/obj/fileactions.py
+++ b/kupfer/obj/fileactions.py
@@ -4,6 +4,7 @@ import gio
 from kupfer import icons
 from kupfer import pretty
 from kupfer import utils
+from kupfer import launch
 
 from kupfer.obj.base import Action, InvalidDataError, OperationError
 
@@ -47,10 +48,13 @@ class Open (Action):
 				)
 		return def_app
 
-	def activate(self, leaf):
-		self.activate_multiple((leaf, ))
+	def wants_context(self):
+		return True
+
+	def activate(self, leaf, ctx):
+		self.activate_multiple((leaf, ), ctx)
 
-	def activate_multiple(self, objects):
+	def activate_multiple(self, objects, ctx):
 		appmap = {}
 		leafmap = {}
 		for obj in objects:
@@ -61,7 +65,9 @@ class Open (Action):
 
 		for id_, leaves in leafmap.iteritems():
 			app = appmap[id_]
-			utils.launch_app(app, paths=[L.object for L in leaves])
+			launch.launch_application(app, paths=[L.object for L in leaves],
+			                          activate=False,
+			                          screen=ctx and ctx.environment.get_screen())
 
 	def get_description(self):
 		return _("Open with default application")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]