[kupfer: 26/67] launch: Implement make_startup_notification_id
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 26/67] launch: Implement make_startup_notification_id
- Date: Sat, 19 Mar 2011 00:59:55 +0000 (UTC)
commit 0ddf82876d54ff54a9f357ccdc8f9af26959bade
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Mar 15 22:52:30 2011 +0100
launch: Implement make_startup_notification_id
kupfer/launch.py | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/launch.py b/kupfer/launch.py
index bc2b9d1..f7679a2 100644
--- a/kupfer/launch.py
+++ b/kupfer/launch.py
@@ -31,6 +31,24 @@ default_associations = {
}
+_seq = [0]
+_latest_event_time = 0
+
+def make_startup_notification_id():
+ time = _current_event_time()
+ _seq[0] = _seq[0] + 1
+ return "%s-%d-%s_TIME%d" % ("kupfer", os.getpid(), _seq[0], time)
+
+def _current_event_time():
+ _time = gtk.get_current_event_time() or keybindings.get_current_event_time()
+ global _latest_event_time
+ if _time > 0:
+ _latest_event_time = _time
+ else:
+ _time = _latest_event_time
+ return _time
+
+
def application_id(app_info, desktop_file=None):
"""Return an application id (string) for GAppInfo @app_info"""
app_id = app_info.get_id()
@@ -40,9 +58,6 @@ def application_id(app_info, desktop_file=None):
app_id = app_id[:-len(".desktop")]
return app_id
-def _current_event_time():
- return gtk.get_current_event_time() or keybindings.get_current_event_time()
-
def launch_application(app_info, files=(), uris=(), paths=(), track=True,
activate=True, desktop_file=None):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]