Ticket #2483: 0001-Do-not-remove-bodies-on-offline-status-2483.2.patch

File 0001-Do-not-remove-bodies-on-offline-status-2483.2.patch, 3.9 KB (added by pbrobinson, 10 years ago)

Updated patch to apply against 0.92.1

  • sugar-0.92.1/src/jarabe/desktop/grid.py

    old new  
    1616# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    1717
    1818import random
     19import logging
    1920
    2021import gobject
    2122import gtk
     
    8586            self._collisions.remove(child)
    8687
    8788    def move(self, child, x, y, locked=False):
     89        if child not in self._child_rects:
     90            import traceback
     91            logging.warn('Grid.move, child %r is not counted:\n%s',
     92                    child, ''.join(traceback.format_stack()))
     93            return
     94
    8895        self.remove_weight(self._child_rects[child])
    8996
    9097        rect = self._child_rects[child]
  • sugar-0.92.1/src/jarabe/model/buddy.py

    old new  
    195195class BuddyModel(BaseBuddyModel):
    196196    __gtype_name__ = 'SugarBuddyModel'
    197197
     198    offline = True
     199
    198200    def __init__(self, **kwargs):
    199201
    200202        self._account = None
  • sugar-0.92.1/src/jarabe/model/neighborhood.py

    old new  
    172172                          ([object, object])),
    173173        'buddy-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
    174174                          ([object])),
     175        'buddy-presence-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
     176                                   ([object, object])),
    175177        'buddy-joined-activity': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
    176178                                  ([object, object])),
    177179        'buddy-left-activity': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
     
    393395        for handle, presence in presences.iteritems():
    394396            if handle in self._buddy_handles:
    395397                presence_type, status_, message_ = presence
    396                 if presence_type == CONNECTION_PRESENCE_TYPE_OFFLINE:
    397                     contact_id = self._buddy_handles[handle]
    398                     del self._buddy_handles[handle]
    399                     self.emit('buddy-removed', contact_id)
     398                self.emit('buddy-presence-changed',
     399                        self._buddy_handles[handle], presence_type)
    400400
    401401    def __buddy_info_updated_cb(self, handle, properties):
    402402        logging.debug('_Account.__buddy_info_updated_cb %r', handle)
     
    674674        account.connect('buddy-added', self.__buddy_added_cb)
    675675        account.connect('buddy-updated', self.__buddy_updated_cb)
    676676        account.connect('buddy-removed', self.__buddy_removed_cb)
     677        account.connect('buddy-presence-changed',
     678                self.__buddy_presence_changed_cb)
     679
    677680        account.connect('buddy-joined-activity',
    678681                        self.__buddy_joined_activity_cb)
    679682        account.connect('buddy-left-activity', self.__buddy_left_activity_cb)
     
    898901        if buddy.props.key is not None:
    899902            self.emit('buddy-removed', buddy)
    900903
     904    def __buddy_presence_changed_cb(self, account, contact_id, presence_type):
     905        if contact_id not in self._buddies:
     906            logging.debug('Neighborhood.__buddy_presence_changed_cb Unknown ' \
     907                    'buddy with contact_id %r', contact_id)
     908            return
     909
     910        buddy = self._buddies[contact_id]
     911        offline = (presence_type == CONNECTION_PRESENCE_TYPE_OFFLINE);
     912
     913        if buddy.offline != offline:
     914            buddy.offline = offline
     915            if buddy.props.key is not None:
     916                if offline:
     917                    self.emit('buddy-removed', buddy)
     918                else:
     919                    self.emit('buddy-added', buddy)
     920
    901921    def __activity_added_cb(self, account, room_handle, activity_id):
    902922        logging.debug('__activity_added_cb %r %r', room_handle, activity_id)
    903923        if activity_id in self._activities: