From 364e61f47ad559bf098c37579158f1271cf24290 Mon Sep 17 00:00:00 2001
From: Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
Date: Wed, 6 Oct 2010 11:18:24 +0200
Subject: [PATCH] Handle partial updates to activity properties #2412
---
src/jarabe/model/neighborhood.py | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 91dd059..259ec56 100644
a
|
b
|
class Neighborhood(gobject.GObject): |
879 | 879 | 'activity_id %r', activity_id) |
880 | 880 | return |
881 | 881 | |
882 | | registry = bundleregistry.get_registry() |
883 | | bundle = registry.get_bundle(properties['type']) |
884 | | if not bundle: |
885 | | logging.warning('Ignoring shared activity we don''t have') |
886 | | return |
887 | | |
888 | 882 | activity = self._activities[activity_id] |
889 | | |
890 | 883 | is_new = activity.props.bundle is None |
891 | 884 | |
892 | | activity.props.color = XoColor(properties['color']) |
893 | | activity.props.bundle = bundle |
894 | | activity.props.name = properties['name'] |
895 | | activity.props.private = properties['private'] |
| 885 | if 'type' in properties: |
| 886 | registry = bundleregistry.get_registry() |
| 887 | bundle = registry.get_bundle(properties['type']) |
| 888 | if not bundle: |
| 889 | logging.warning('Ignoring shared activity we don''t have') |
| 890 | return |
| 891 | activity.props.bundle = bundle |
| 892 | else: |
| 893 | bundle = None |
| 894 | |
| 895 | if 'color' in properties: |
| 896 | activity.props.color = XoColor(properties['color']) |
896 | 897 | |
897 | | if is_new: |
| 898 | if 'name' in properties: |
| 899 | activity.props.name = properties['name'] |
| 900 | |
| 901 | if 'private' in properties: |
| 902 | activity.props.private = properties['private'] |
| 903 | |
| 904 | if is_new and bundle is not None: |
898 | 905 | self.emit('activity-added', activity) |
899 | 906 | |
900 | 907 | def __activity_removed_cb(self, account, activity_id): |