[kupfer: 3/67] Use desktop_launch
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 3/67] Use desktop_launch
- Date: Sat, 19 Mar 2011 00:57:59 +0000 (UTC)
commit 10e5431a4049feeba882006a90924c58846fadc8
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Mar 15 22:52:25 2011 +0100
Use desktop_launch
kupfer/launch.py | 14 +++++++-------
kupfer/obj/fileactions.py | 4 +---
kupfer/utils.py | 8 ++++++++
3 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/kupfer/launch.py b/kupfer/launch.py
index 810d305..b2f2461 100644
--- a/kupfer/launch.py
+++ b/kupfer/launch.py
@@ -7,6 +7,7 @@ import gobject
from kupfer import pretty, config
from kupfer import scheduler
+from kupfer import desktop_launch
from kupfer.ui import keybindings
try:
@@ -81,16 +82,18 @@ def launch_application(app_info, files=(), uris=(), paths=(), track=True, activa
from gio import File
from glib import GError
- ctx = AppLaunchContext()
+ #ctx = AppLaunchContext()
if paths:
files = [File(p) for p in paths]
+ if uris:
+ files = [File(p) for p in uris]
if wnck:
# launch on current workspace
workspace = wnck.screen_get_default().get_active_workspace()
nbr = workspace.get_number() if workspace else -1
- ctx.set_desktop(nbr)
- ctx.set_timestamp(_current_event_time())
+ #ctx.set_desktop(nbr)
+ #ctx.set_timestamp(_current_event_time())
if track:
app_id = application_id(app_info)
@@ -104,10 +107,7 @@ def launch_application(app_info, files=(), uris=(), paths=(), track=True, activa
return True
try:
- if uris:
- ret = app_info.launch_uris(uris, ctx)
- else:
- ret = app_info.launch(files, ctx)
+ ret = desktop_launch.launch_app_info(app_info, files)
if not ret:
pretty.print_info(__name__, "Error launching", app_info)
except GError, e:
diff --git a/kupfer/obj/fileactions.py b/kupfer/obj/fileactions.py
index 9e41978..44cf920 100644
--- a/kupfer/obj/fileactions.py
+++ b/kupfer/obj/fileactions.py
@@ -82,9 +82,7 @@ class OpenTerminal (Action):
super(OpenTerminal, self).__init__(name)
def activate(self, leaf):
- # any: take first successful command
- any(utils.spawn_async((term, ), in_dir=leaf.object) for term in
- ("xdg-terminal", "gnome-terminal", "xterm"))
+ utils.spawn_terminal(leaf.object)
def get_description(self):
return _("Open this location in a terminal")
diff --git a/kupfer/utils.py b/kupfer/utils.py
index c9d7d7a..d4d48ad 100644
--- a/kupfer/utils.py
+++ b/kupfer/utils.py
@@ -10,6 +10,7 @@ import glib
from kupfer import pretty
from kupfer import kupferstring
+from kupfer import desktop_launch
def get_dirlist(folder, depth=0, include=None, exclude=None):
"""
@@ -178,6 +179,13 @@ class AsyncCommand (object):
os.kill(self.pid, signal.SIGKILL)
+TERM = "gnome-terminal"
+TERM_STARTUPNOTIFY = True
+TERM_ID = "gnome-terminal.desktop"
+
+def spawn_terminal(workdir=None):
+ desktop_launch.spawn_app_id(TERM_ID, [TERM], workdir, TERM_STARTUPNOTIFY)
+
def spawn_async(argv, in_dir="."):
pretty.print_debug(__name__, "Spawn commandline", argv, in_dir)
argv = _argv_to_locale(argv)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]