Keep the invite menu item synced with current activity.

This commit is contained in:
Marco Pesenti Gritti 2007-08-31 13:56:58 +02:00
parent 457a1eaf3b
commit bd9bd2d020

View File

@ -89,16 +89,20 @@ class BuddyMenu(Palette):
self.menu.append(menu_item) self.menu.append(menu_item)
menu_item.show() menu_item.show()
activity = self._shell.get_current_activity() self._invite_menu = MenuItem(_('Invite'), 'stock-invite')
if activity != None: self._invite_menu.connect('activate', self._invite_friend_cb)
activity_ps = pservice.get_activity(activity.get_id()) self.menu.append(self._invite_menu)
self._invite_menu.show()
# FIXME check that the buddy is not in the activity already home_model = shell_model.get_home()
home_model.connect('active-activity-changed',
self._cur_activity_changed_cb)
menu_item = MenuItem(_('Invite'), 'stock-invite') def _cur_activity_changed_cb(self, home_model, activity_model):
menu_item.connect('activate', self._invite_friend_cb) if activity_model is not None:
self.menu.append(menu_item) self._invite_menu.show()
menu_item.show() else:
self._invite_menu.hide()
def _buddy_icon_changed_cb(self, buddy): def _buddy_icon_changed_cb(self, buddy):
pass pass