Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-08-09 12:22:58 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-08-09 12:22:58 (GMT)
commita9a65f42dfe4f0ca4eb7c916ec4afc9b3e376c69 (patch)
tree2e146f58a19f7e59cc625785f431d00d0869b0d1 /shell
parenta0c69066d4531a85acfe8917cf94db7a3e36b9d9 (diff)
Create the hosts when windows are displayed
Diffstat (limited to 'shell')
-rwxr-xr-xshell/Shell.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/shell/Shell.py b/shell/Shell.py
index f08d724..55b8902 100755
--- a/shell/Shell.py
+++ b/shell/Shell.py
@@ -48,10 +48,12 @@ class Shell:
def __init__(self, registry):
self._screen = wnck.screen_get_default()
self._registry = registry
+ self._hosts = {}
+ self._console_windows = {}
def start(self):
- log_writer = LogWriter("Shell", False)
- log_writer.start()
+ #log_writer = LogWriter("Shell", False)
+ #log_writer.start()
session_bus = dbus.SessionBus()
bus_name = dbus.service.BusName('com.redhat.Sugar.Shell', bus=session_bus)
@@ -66,8 +68,18 @@ class Shell:
self._home_window = HomeWindow(self)
self._home_window.show()
- self._hosts = {}
- self._console_windows = {}
+ self._screen.connect('window-opened', self.__window_opened_cb)
+ self._screen.connect('window-closed', self.__window_closed_cb)
+
+ def __window_opened_cb(self, screen, window):
+ if window.get_window_type() == wnck.WINDOW_NORMAL:
+ xid = window.get_xid()
+ self._hosts[xid] = ActivityHost(self, xid)
+
+ def __window_closed_cb(self, screen, window):
+ if window.get_window_type() == wnck.WINDOW_NORMAL:
+ xid = window.get_xid()
+ self._hosts[xid] = None
def get_current_activity(self):
window = self._screen.get_active_window()
@@ -82,11 +94,7 @@ class Shell:
xid = parent.get_xid()
if xid != None:
- if self._hosts.has_key(xid):
- return self._hosts[xid]
- else:
- self._hosts[xid] = ActivityHost(self, xid)
- return self._hosts[xid]
+ return self._hosts[xid]
return None