Ticket #1368: sugar-1368.patch

File sugar-1368.patch, 1.8 KB (added by alsroot, 12 years ago)
  • src/sugar/activity/widgets.py

    From 445741588be6a7be3f5a3b6214d170d94eee9fa9 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Thu, 17 Sep 2009 23:11:29 +0000
    Subject: Color of sugar.activity.widgets.ActivityButton is owners all time despite of 'icon-color' metadata property #1368
    
    ---
     src/sugar/activity/widgets.py |   16 ++++++++++------
     1 files changed, 10 insertions(+), 6 deletions(-)
    
    diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
    index 76ccd24..75e9907 100644
    a b from sugar.bundle.activitybundle import ActivityBundle 
    3333_ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
    3434
    3535
    36 def _create_activity_icon():
     36def _create_activity_icon(metadata):
     37    if 'icon-color' in metadata:
     38        color = XoColor(metadata['icon-color'])
     39    else:
     40        client = gconf.client_get_default()
     41        color = XoColor(client.get_string('/desktop/sugar/user/color'))
     42
    3743    from sugar.activity.activity import get_bundle_path
    3844    bundle = ActivityBundle(get_bundle_path())
    39 
    40     client = gconf.client_get_default()
    41     color = XoColor(client.get_string('/desktop/sugar/user/color'))
    4245    icon = Icon(file=bundle.get_icon(), xo_color=color)
     46
    4347    return icon
    4448
    4549
    class ActivityButton(ToolButton): 
    4852    def __init__(self, activity, **kwargs):
    4953        ToolButton.__init__(self, **kwargs)
    5054
    51         icon = _create_activity_icon()
     55        icon = _create_activity_icon(activity.metadata)
    5256        self.set_icon_widget(icon)
    5357        icon.show()
    5458
    class ActivityToolbarButton(ToolbarButton): 
    6771
    6872        ToolbarButton.__init__(self, page=toolbar, **kwargs)
    6973
    70         icon = _create_activity_icon()
     74        icon = _create_activity_icon(activity.metadata)
    7175        self.set_icon_widget(icon)
    7276        icon.show()
    7377