Ticket #1444: sugar-1444.2.patch

File sugar-1444.2.patch, 2.2 KB (added by alsroot, 11 years ago)
  • src/jarabe/frame/activitiestray.py

    From 12d59e7b7e0d0fdca49baf29c1df233e14c48b31 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Tue, 6 Oct 2009 03:31:48 +0000
    Subject: Take into account not yet opened activity windows #1444
    
    ---
     src/jarabe/frame/activitiestray.py |   16 ++++++++++++----
     1 files changed, 12 insertions(+), 4 deletions(-)
    
    diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
    index 4946875..110eff6 100644
    a b class ActivitiesTray(HTray): 
    334334
    335335        filetransfer.new_file_transfer.connect(self.__new_file_transfer_cb)
    336336
     337    def _get_button_id(self, home_activity):
     338        if home_activity.get_activity_id() is not None:
     339            # activity button
     340            return home_activity.get_activity_id()
     341        else:
     342            # non-activity window button
     343            return (None, home_activity.get_xid())
     344
    337345    def __activity_added_cb(self, home_model, home_activity):
    338346        logging.debug('__activity_added_cb: %r', home_activity)
    339347        if self.get_children():
    class ActivitiesTray(HTray): 
    343351
    344352        button = ActivityButton(home_activity, group)
    345353        self.add_item(button)
    346         self._buttons[home_activity.get_xid()] = button
     354        self._buttons[self._get_button_id(home_activity)] = button
    347355        button.connect('clicked', self.__activity_clicked_cb, home_activity)
    348356        button.show()
    349357
    350358    def __activity_removed_cb(self, home_model, home_activity):
    351359        logging.debug('__activity_removed_cb: %r', home_activity)
    352         button = self._buttons[home_activity.get_xid()]
     360        button = self._buttons[self._get_button_id(home_activity)]
    353361        self.remove_item(button)
    354         del self._buttons[home_activity.get_xid()]
     362        del self._buttons[self._get_button_id(home_activity)]
    355363
    356364    def _activate_activity(self, home_activity):
    357         button = self._buttons[home_activity.get_xid()]
     365        button = self._buttons[self._get_button_id(home_activity)]
    358366        self._freeze_button_clicks = True
    359367        button.props.active = True
    360368        self._freeze_button_clicks = False