[Sugar-devel] [PATCH Sugar-toolkit-gtk3] ActivityButton should handle the case of activities without metadata

godiard at sugarlabs.org godiard at sugarlabs.org
Mon May 14 14:22:33 EDT 2012


From: Gonzalo Odiard <godiard at gmail.com>

We already manage this cae in the icon creation but not when we set
the button tooltip

Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>

-------------------

v2: Improve description.
    Do not try to connect the 'updated' signal.
---
 src/sugar3/activity/widgets.py |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py
index 97450f2..c7683cf 100644
--- a/src/sugar3/activity/widgets.py
+++ b/src/sugar3/activity/widgets.py
@@ -60,8 +60,9 @@ class ActivityButton(ToolButton):
         self.set_icon_widget(icon)
         icon.show()
 
-        self.props.tooltip = activity.metadata['title']
-        activity.metadata.connect('updated', self.__jobject_updated_cb)
+        if activity.metadata:
+            self.props.tooltip = activity.metadata['title']
+            activity.metadata.connect('updated', self.__jobject_updated_cb)
 
     def __jobject_updated_cb(self, jobject):
         self.props.tooltip = jobject['title']
-- 
1.7.10.1



More information about the Sugar-devel mailing list