From a929dc0b4655eb2fe0c88b437314b80848e16749 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 23 Jun 2006 12:49:57 -0400 Subject: [PATCH] Fix up focus handling some --- shell/shell.py | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/shell/shell.py b/shell/shell.py index 5d9e9aed..a5dc0b72 100755 --- a/shell/shell.py +++ b/shell/shell.py @@ -33,6 +33,8 @@ class ActivityHostSignalHelper(gobject.GObject): class ActivityHost(dbus.service.Object): def __init__(self, activity_container, activity_name, default_type, activity_id = None): + self.peer_service = None + self.activity_name = activity_name self.ellipsize_tab = False self._shared = False @@ -99,6 +101,13 @@ class ActivityHost(dbus.service.Object): def _create_chat(self): self._activity_chat = ActivityChat(self) + def got_focus(self): + if self.peer_service != None: + self.peer_service.got_focus() + + def lost_focus(self): + self.peer_service.lost_focus() + def get_chat(self): return self._activity_chat @@ -365,12 +374,6 @@ class ActivityContainer(dbus.service.Object): def show(self): self.window.show() - def __focus_reply_cb(self): - pass - - def __focus_error_cb(self, error): - pass - def set_current_activity(self, activity): self.current_activity = activity self._presence_window.set_activity(activity) @@ -388,23 +391,12 @@ class ActivityContainer(dbus.service.Object): new_activity = notebook.get_nth_page(page_number).get_data("sugar-activity") if self.current_activity != None: - if self.has_activity(self.current_activity): - self.current_activity.peer_service.lost_focus(reply_handler = self.__focus_reply_cb, error_handler = self.__focus_error_cb) + self.current_activity.lost_focus() - #if self.has_activity(new_activity): self.set_current_activity(new_activity) if self.current_activity != None: - if self.has_activity(self.current_activity): - self.current_activity.peer_service.got_focus(reply_handler = self.__focus_reply_cb, error_handler = self.__focus_error_cb) - - - def has_activity(self, activity_to_check_for): - for owner, activity in self.activities[:]: - if activity_to_check_for == activity: - return True - return False - + self.current_activity.got_focus() def name_owner_changed(self, service_name, old_service_name, new_service_name): #print "in name_owner_changed: svc=%s oldsvc=%s newsvc=%s"%(service_name, old_service_name, new_service_name)