[kupfer: 16/67] launch: Pass on timestamp to desktop_launch
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 16/67] launch: Pass on timestamp to desktop_launch
- Date: Sat, 19 Mar 2011 00:59:05 +0000 (UTC)
commit 7f09b16acad84f2523e1587453eca15e1437c1e6
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Mar 15 22:52:28 2011 +0100
launch: Pass on timestamp to desktop_launch
kupfer/desktop_launch.py | 12 ++++++++----
kupfer/launch.py | 11 ++---------
2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/kupfer/desktop_launch.py b/kupfer/desktop_launch.py
index fc2502b..0ef1f7e 100644
--- a/kupfer/desktop_launch.py
+++ b/kupfer/desktop_launch.py
@@ -224,11 +224,12 @@ def _file_and_info_for_app_info(app_info):
error_log("Read error:", exc)
return desktop_file, desktop_info
-def launch_app_info(app_info, gfiles=[], in_terminal=None):
+def launch_app_info(app_info, gfiles=[], in_terminal=None, timestamp=None):
"""
Launch @app_info, opening @gfiles
@in_terminal: override Terminal flag
+ @timestamp: override timestamp
"""
desktop_file, desktop_info = _file_and_info_for_app_info(app_info)
if not desktop_file or not desktop_info:
@@ -279,7 +280,8 @@ def launch_app_info(app_info, gfiles=[], in_terminal=None):
if term.exearg:
targv.append(term.exearg)
argv = targv + argv
- ret = spawn_app(app_info, argv, gfiles, workdir, notify)
+ ret = spawn_app(app_info, argv, gfiles, workdir, notify,
+ timestamp=timestamp)
if not ret:
return False
return True
@@ -295,7 +297,8 @@ def spawn_app_id(app_id, argv, workdir=None, startup_notify=True):
startup_notify = False
return spawn_app(app_info, argv, [], workdir, startup_notify)
-def spawn_app(app_info, argv, filelist, workdir=None, startup_notify=True):
+def spawn_app(app_info, argv, filelist, workdir=None, startup_notify=True,
+ timestamp=None):
"""
Spawn app.
@@ -304,11 +307,12 @@ def spawn_app(app_info, argv, filelist, workdir=None, startup_notify=True):
@app_info: Used for startup notification, if @startup_notify is True
@filelist: Used for startup notification
@startup_notify: Use startup notification
+ @timestamp: Event timestamp
"""
notify_id = None
if startup_notify:
ctx = gtk.gdk.AppLaunchContext()
- ctx.set_timestamp(gtk.get_current_event_time())
+ ctx.set_timestamp(timestamp or gtk.get_current_event_time())
# This not only returns the string ID but
# it actually starts the startup notification!
notify_id = ctx.get_startup_notify_id(app_info, filelist)
diff --git a/kupfer/launch.py b/kupfer/launch.py
index b2f2461..cc9af01 100644
--- a/kupfer/launch.py
+++ b/kupfer/launch.py
@@ -82,19 +82,11 @@ def launch_application(app_info, files=(), uris=(), paths=(), track=True, activa
from gio import File
from glib import GError
- #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())
-
if track:
app_id = application_id(app_info)
os.putenv(kupfer_env, app_id)
@@ -107,7 +99,8 @@ def launch_application(app_info, files=(), uris=(), paths=(), track=True, activa
return True
try:
- ret = desktop_launch.launch_app_info(app_info, files)
+ ret = desktop_launch.launch_app_info(app_info, files,
+ timestamp=_current_event_time())
if not ret:
pretty.print_info(__name__, "Error launching", app_info)
except GError, e:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]