diff --git a/sugar/shell/PresenceWindow.py b/sugar/shell/PresenceWindow.py index b0ed11ae..2f292aff 100644 --- a/sugar/shell/PresenceWindow.py +++ b/sugar/shell/PresenceWindow.py @@ -15,6 +15,7 @@ class PresenceWindow(gtk.Window): gtk.Window.__init__(self, gtk.WINDOW_POPUP) self._activity_container = activity_container + self._activity = None self._pservice = PresenceService.get_instance() self._pservice.connect("buddy-appeared", self._on_buddy_appeared_cb) @@ -25,8 +26,12 @@ class PresenceWindow(gtk.Window): self._setup_ui() def _is_buddy_visible(self, buddy): - activity_type = self._activity.get_default_type() - buddy.get_service_of_type(activity, activity_type) + if self._activity: + activity_type = self._activity.get_default_type() + service = buddy.get_service_of_type(activity, activity_type) + return service is not None + else: + return True def _update_buddies_visibility(self): for row in self._buddy_store: diff --git a/sugar/shell/shell.py b/sugar/shell/shell.py index b20744aa..e846cd90 100755 --- a/sugar/shell/shell.py +++ b/sugar/shell/shell.py @@ -73,6 +73,21 @@ class ActivityHost(dbus.service.Object): notebook = self.activity_container.notebook index = notebook.append_page(self.socket, hbox) notebook.set_current_page(index) + + self._create_chat() + + def _create_chat(): + group_chat = GroupChat() + group_chat.set_transient_for(self.activity_container.window) + group_chat.set_decorated(False) + group_chat.set_skip_taskbar_hint(True) + + wm = WindowManager(group_chat) + + wm.set_width(0.5, WindowManager.SCREEN_RELATIVE) + wm.set_height(0.5, WindowManager.SCREEN_RELATIVE) + wm.set_position(WindowManager.TOP) + wm.manage() def __close_button_clicked_reply_cb(self): pass @@ -417,18 +432,6 @@ def main(): wm.set_position(WindowManager.CENTER) wm.show() wm.manage() - - group_chat = GroupChat() - group_chat.set_transient_for(activity_container.window) - group_chat.set_decorated(False) - group_chat.set_skip_taskbar_hint(True) - - wm = WindowManager(group_chat) - - wm.set_width(0.5, WindowManager.SCREEN_RELATIVE) - wm.set_height(0.5, WindowManager.SCREEN_RELATIVE) - wm.set_position(WindowManager.TOP) - wm.manage() console.set_parent_window(activity_container.window)