From de60d50faa3db1170cb811426c96921702decffd Mon Sep 17 00:00:00 2001
From: Tomeu Vizoso <tomeu@sugarlabs.org>
Date: Sun, 5 Apr 2009 18:36:05 +0200
Subject: [PATCH] Take into account launcher windows when checking if an already instance is running #461
---
src/jarabe/model/shell.py | 2 +-
src/jarabe/view/service.py | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index cfc49ab..709eb03 100644
a
|
b
|
class Activity(gobject.GObject): |
77 | 77 | self._activity_id = activity_id |
78 | 78 | self._activity_info = activity_info |
79 | 79 | self._launch_time = time.time() |
80 | | self._launching = False |
| 80 | self._launching = True |
81 | 81 | |
82 | 82 | if window is not None: |
83 | 83 | self.set_window(window) |
diff --git a/src/jarabe/view/service.py b/src/jarabe/view/service.py
index a2439ce..df00ba6 100644
a
|
b
|
class UIService(dbus.service.Object): |
80 | 80 | @dbus.service.method(_DBUS_SHELL_IFACE, |
81 | 81 | in_signature="s", out_signature="b") |
82 | 82 | def ActivateActivity(self, activity_id): |
| 83 | """Switch to the window related to this activity_id and return a boolean |
| 84 | indicating if there is a real (ie. not a launcher window) activity |
| 85 | already open. |
| 86 | """ |
83 | 87 | activity = self._shell_model.get_activity_by_id(activity_id) |
84 | | if activity: |
| 88 | |
| 89 | if activity is not None and activity.get_window() is not None: |
85 | 90 | activity.get_window().activate(gtk.get_current_event_time()) |
86 | | return True |
| 91 | return not activity.props.launching |
87 | 92 | |
88 | 93 | return False |
89 | 94 | |