Handle buddy nick changes

This commit is contained in:
Dan Williams 2007-05-14 01:21:22 -04:00
parent e1b3cde65e
commit 02c99e2a0c
2 changed files with 11 additions and 2 deletions

View File

@ -24,6 +24,8 @@ class BuddyModel(gobject.GObject):
__gsignals__ = {
'appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])),
'disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])),
'nick-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'color-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'icon-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
@ -132,6 +134,9 @@ class BuddyModel(gobject.GObject):
self.emit('color-changed', self.get_color())
if 'current-activity' in keys:
self.emit('current-activity-changed', buddy.props.current_activity)
if 'nick' in keys:
self._nick = self._buddy.props.nick
self.emit('nick-changed', self.get_nick())
def _buddy_disappeared_cb(self, buddy):
if buddy != self._buddy:

View File

@ -47,7 +47,8 @@ class BuddyMenu(Menu):
self.add_separator()
self.append(icon_item)
self._buddy.connect('icon-changed', self.__buddy_icon_changed_cb)
self._buddy.connect('icon-changed', self._buddy_icon_changed_cb)
self._buddy.connect('nick-changed', self._buddy_nick_changed_cb)
owner = shell.get_model().get_owner()
if buddy.get_nick() != owner.get_nick():
@ -96,5 +97,8 @@ class BuddyMenu(Menu):
_('Invite'),
'theme:stock-invite'))
def __buddy_icon_changed_cb(self, buddy):
def _buddy_icon_changed_cb(self, buddy):
pass
def _buddy_nick_changed_cb(self, buddy, nick):
self.set_title(nick)