Use stock-missing when there is no activity icon
This commit is contained in:
parent
2b1a11fb66
commit
4cca5dc9ff
@ -12,9 +12,6 @@ from sugar.canvas.GridBox import GridBox
|
||||
class ActivityItem(IconItem):
|
||||
def __init__(self, activity):
|
||||
icon_name = activity.get_icon()
|
||||
if not icon_name:
|
||||
act_type = activity.get_type()
|
||||
raise RuntimeError("Activity %s did not have an icon!" % act_type)
|
||||
IconItem.__init__(self, icon_name=icon_name, color=IconColor('white'))
|
||||
self._activity = activity
|
||||
|
||||
@ -59,12 +56,6 @@ class BottomPanel(GridBox):
|
||||
self.add_invite(invite)
|
||||
|
||||
def add_activity(self, activity):
|
||||
# Need an icon to show up on the bar
|
||||
if not activity.get_icon():
|
||||
name = activity.get_name()
|
||||
logging.info("Activity %s did not have an icon. Won't show it." % name)
|
||||
return
|
||||
|
||||
item = ActivityItem(activity)
|
||||
item.connect('clicked', self.__activity_clicked_cb)
|
||||
self.add_child(item)
|
||||
|
@ -103,13 +103,16 @@ class IconView(goocanvas.ItemViewSimple, goocanvas.ItemView):
|
||||
return self.bounds
|
||||
|
||||
def do_paint(self, cr, bounds, scale):
|
||||
icon_name = self.item.icon_name
|
||||
if icon_name == None:
|
||||
icon_name = 'stock-missing'
|
||||
|
||||
if self.item.color == None:
|
||||
theme = gtk.icon_theme_get_default()
|
||||
info = theme.lookup_icon(self.item.icon_name, self.item.size, 0)
|
||||
info = theme.lookup_icon(icon_name, self.item.size, 0)
|
||||
handle = rsvg.Handle(file=info.get_filename())
|
||||
else:
|
||||
icon = IconView._icon_cache.get_icon(self.item.icon_name,
|
||||
self.item.color)
|
||||
icon = IconView._icon_cache.get_icon(icon_name, self.item.color)
|
||||
handle = rsvg.Handle(data=icon)
|
||||
|
||||
cr.save()
|
||||
@ -155,6 +158,7 @@ class IconItem(goocanvas.ItemSimple, goocanvas.Item):
|
||||
self.y = 0.0
|
||||
self.size = 24
|
||||
self.color = None
|
||||
self.icon_name = None
|
||||
|
||||
goocanvas.ItemSimple.__init__(self, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user