s/BuddyPopup/BuddyMenu
This commit is contained in:
parent
a1d2b993c0
commit
d9fc47ca01
@ -1,5 +1,5 @@
|
|||||||
from sugar.canvas.MenuIcon import MenuIcon
|
from sugar.canvas.MenuIcon import MenuIcon
|
||||||
from view.BuddyPopup import BuddyPopup
|
from view.BuddyMenu import BuddyMenu
|
||||||
|
|
||||||
class BuddyIcon(MenuIcon):
|
class BuddyIcon(MenuIcon):
|
||||||
def __init__(self, shell, friend):
|
def __init__(self, shell, friend):
|
||||||
@ -14,7 +14,7 @@ class BuddyIcon(MenuIcon):
|
|||||||
self._popup_distance = distance
|
self._popup_distance = distance
|
||||||
|
|
||||||
def create_menu(self):
|
def create_menu(self):
|
||||||
menu = BuddyPopup(self._shell, self._friend)
|
menu = BuddyMenu(self._shell, self._friend)
|
||||||
menu.connect('action', self._popup_action_cb)
|
menu.connect('action', self._popup_action_cb)
|
||||||
return menu
|
return menu
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ class BuddyIcon(MenuIcon):
|
|||||||
self.popdown()
|
self.popdown()
|
||||||
|
|
||||||
model = self._shell.get_model()
|
model = self._shell.get_model()
|
||||||
if action == BuddyPopup.ACTION_REMOVE_FRIEND:
|
if action == BuddyMenu.ACTION_REMOVE_FRIEND:
|
||||||
friends = model.get_friends()
|
friends = model.get_friends()
|
||||||
friends.remove(buddy)
|
friends.remove(buddy)
|
||||||
|
|
||||||
@ -30,9 +30,9 @@ class BuddyIcon(MenuIcon):
|
|||||||
if buddy == None:
|
if buddy == None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if action == BuddyPopup.ACTION_INVITE:
|
if action == BuddyMenu.ACTION_INVITE:
|
||||||
activity = model.get_current_activity()
|
activity = model.get_current_activity()
|
||||||
activity.invite(buddy)
|
activity.invite(buddy)
|
||||||
elif action == BuddyPopup.ACTION_MAKE_FRIEND:
|
elif action == BuddyMenu.ACTION_MAKE_FRIEND:
|
||||||
friends = model.get_friends()
|
friends = model.get_friends()
|
||||||
friends.make_friend(buddy)
|
friends.make_friend(buddy)
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import gtk
|
|
||||||
import goocanvas
|
|
||||||
import gobject
|
|
||||||
|
|
||||||
from sugar.canvas.Menu import Menu
|
from sugar.canvas.Menu import Menu
|
||||||
from sugar.canvas.IconItem import IconItem
|
from sugar.canvas.IconItem import IconItem
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
|
|
||||||
class BuddyPopup(Menu):
|
class BuddyMenu(Menu):
|
||||||
ACTION_MAKE_FRIEND = 0
|
ACTION_MAKE_FRIEND = 0
|
||||||
ACTION_INVITE = 1
|
ACTION_INVITE = 1
|
||||||
ACTION_REMOVE_FRIEND = 2
|
ACTION_REMOVE_FRIEND = 2
|
||||||
@ -30,10 +26,10 @@ class BuddyPopup(Menu):
|
|||||||
friends = shell_model.get_friends()
|
friends = shell_model.get_friends()
|
||||||
if friends.has_buddy(self._buddy):
|
if friends.has_buddy(self._buddy):
|
||||||
icon = IconItem(icon_name='stock-remove-friend')
|
icon = IconItem(icon_name='stock-remove-friend')
|
||||||
self.add_action(icon, BuddyPopup.ACTION_REMOVE_FRIEND)
|
self.add_action(icon, BuddyMenu.ACTION_REMOVE_FRIEND)
|
||||||
else:
|
else:
|
||||||
icon = IconItem(icon_name='stock-make-friend')
|
icon = IconItem(icon_name='stock-make-friend')
|
||||||
self.add_action(icon, BuddyPopup.ACTION_MAKE_FRIEND)
|
self.add_action(icon, BuddyMenu.ACTION_MAKE_FRIEND)
|
||||||
|
|
||||||
icon = IconItem(icon_name='stock-chat')
|
icon = IconItem(icon_name='stock-chat')
|
||||||
self.add_action(icon, -1)
|
self.add_action(icon, -1)
|
||||||
@ -45,4 +41,4 @@ class BuddyPopup(Menu):
|
|||||||
# FIXME check that the buddy is not in the activity already
|
# FIXME check that the buddy is not in the activity already
|
||||||
|
|
||||||
icon = IconItem(icon_name='stock-invite')
|
icon = IconItem(icon_name='stock-invite')
|
||||||
self.add_action(icon, BuddyPopup.ACTION_INVITE)
|
self.add_action(icon, BuddyMenu.ACTION_INVITE)
|
Loading…
Reference in New Issue
Block a user