diff --git a/shell/FriendPopup.py b/shell/FriendPopup.py index 1d309a6d..8a9f6691 100644 --- a/shell/FriendPopup.py +++ b/shell/FriendPopup.py @@ -75,7 +75,8 @@ class FriendPopup(gtk.Window): print 'Friend not online' def _make_friend_clicked_cb(self, icon): - pass + friends = self._shell.get_owner().get_friends() + friends.add_buddy(buddy) def _enter_notify_event_cb(self, widget, event): self._hover = True diff --git a/shell/Shell.py b/shell/Shell.py index efe6a5a0..044d25d2 100755 --- a/shell/Shell.py +++ b/shell/Shell.py @@ -84,6 +84,9 @@ class Shell(gobject.GObject): self._frame = Frame(self, self._owner) self._frame.show_and_hide(10) + def get_owner(self): + return self._owner + def __global_key_pressed_cb(self, grabber, key): if key == 'F1': self.set_zoom_level(sugar.ZOOM_ACTIVITY) diff --git a/shell/frame/RightPanel.py b/shell/frame/RightPanel.py index 80729fd3..cb2f4f14 100644 --- a/shell/frame/RightPanel.py +++ b/shell/frame/RightPanel.py @@ -4,6 +4,8 @@ from sugar.canvas.IconItem import IconItem from sugar.canvas.IconColor import IconColor from sugar.canvas.CanvasBox import CanvasBox from sugar.presence import PresenceService +from FriendIcon import FriendIcon +from Friends import Friend class RightPanel(CanvasBox): def __init__(self, grid, shell, friends): @@ -22,11 +24,9 @@ class RightPanel(CanvasBox): shell.connect('activity-changed', self.__activity_changed_cb) def add(self, buddy): - icon = IconItem(icon_name='stock-buddy', - color=IconColor(buddy.get_color())) + friend = Friend(buddy.get_name(), buddy.get_color()) + icon = FriendIcon(self._shell, friend) self.set_constraints(icon, 3, 3) - icon.connect('clicked', self.__buddy_clicked_cb, buddy) - self.add_child(icon) self._buddies[buddy.get_name()] = icon @@ -78,6 +78,3 @@ class RightPanel(CanvasBox): def __buddy_left_cb(self, activity, buddy): self.remove(buddy) - - def __buddy_clicked_cb(self, icon, buddy): - self._friends.add_buddy(buddy)