diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-16 09:00:46 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-16 09:00:46 (GMT) |
commit | 956b663409ae61234f1e73641d0b2eaddf1d0a57 (patch) | |
tree | ad97854e604823993e5e160fb4006a54abde3008 /shell | |
parent | 11a013aff2c21ac75d76b492acb848dad9976776 (diff) |
Do not show invite if there is no active activity
Diffstat (limited to 'shell')
-rw-r--r-- | shell/view/BuddyPopup.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/shell/view/BuddyPopup.py b/shell/view/BuddyPopup.py index 018e7fa..5f5e1ba 100644 --- a/shell/view/BuddyPopup.py +++ b/shell/view/BuddyPopup.py @@ -5,6 +5,7 @@ import gobject from sugar.canvas.CanvasView import CanvasView from sugar.canvas.CanvasBox import CanvasBox from sugar.canvas.IconItem import IconItem +from sugar.presence import PresenceService class BuddyPopup(gtk.Window): ACTION_MAKE_FRIEND = 0 @@ -58,6 +59,9 @@ class BuddyPopup(gtk.Window): canvas.set_model(model) def _add_actions(self, grid, root): + shell_model = self._shell.get_model() + pservice = PresenceService.get_instance() + separator = goocanvas.Path(data='M 15 0 L 185 0', line_width=3, fill_color='black') grid.set_constraints(separator, 0, 4) @@ -66,7 +70,7 @@ class BuddyPopup(gtk.Window): box = CanvasBox(grid, CanvasBox.HORIZONTAL, 1) grid.set_constraints(box, 0, 5) - friends = self._shell.get_model().get_friends() + friends = shell_model.get_friends() if friends.has_buddy(self._buddy): icon = IconItem(icon_name='stock-remove-friend') icon.connect('clicked', self._action_clicked_cb, @@ -83,11 +87,17 @@ class BuddyPopup(gtk.Window): box.set_constraints(icon, 3, 3) box.add_child(icon) - icon = IconItem(icon_name='stock-invite') - icon.connect('clicked', self._action_clicked_cb, - BuddyPopup.ACTION_INVITE) - box.set_constraints(icon, 3, 3) - box.add_child(icon) + activity = shell_model.get_current_activity() + if activity != None: + activity_ps = pservice.get_activity(activity.get_id()) + + # FIXME check that the buddy is not in the activity already + + icon = IconItem(icon_name='stock-invite') + icon.connect('clicked', self._action_clicked_cb, + BuddyPopup.ACTION_INVITE) + box.set_constraints(icon, 3, 3) + box.add_child(icon) root.add_child(box) |