Ticket #1247: sugar-1247.patch

File sugar-1247.patch, 3.2 KB (added by alsroot, 12 years ago)
  • src/sugar/graphics/icon.py

    From d8bc868226539cd94a4bbb249fb1afd968c6d85b Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Sat, 29 Aug 2009 21:50:18 +0000
    Subject: Show selecting status of favorite check box in journal list view even if "start" is prelighted #1247
    
    ---
     src/sugar/graphics/icon.py |   40 ++++++++++++++++++++++++++--------------
     1 files changed, 26 insertions(+), 14 deletions(-)
    
    diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py
    index 76c87d1..1b0356c 100644
    a b class CellRendererIcon(gtk.GenericCellRenderer): 
    964964
    965965        self._buffer = _IconBuffer()
    966966        self._buffer.cache = True
     967        self._xo_color = None
    967968        self._fill_color = None
    968969        self._stroke_color = None
    969970        self._prelit_fill_color = None
    class CellRendererIcon(gtk.GenericCellRenderer): 
    9991000
    10001001    icon_name = gobject.property(type=str, setter=set_icon_name)
    10011002
     1003    def get_xo_color(self):
     1004        return self._xo_color
     1005
    10021006    def set_xo_color(self, value):
    1003         if value is not None:
    1004             self._stroke_color = value.get_stroke_color()
    1005             self._fill_color = value.get_fill_color()
    1006         else:
    1007             self._stroke_color = None
    1008             self._fill_color = None
     1007        self._xo_color = value
    10091008
    1010     xo_color = gobject.property(type=object, setter=set_xo_color)
     1009    xo_color = gobject.property(type=object,
     1010            getter=get_xo_color, setter=set_xo_color)
    10111011
    10121012    def set_fill_color(self, value):
    10131013        if self._fill_color != value:
    class CellRendererIcon(gtk.GenericCellRenderer): 
    10941094        return False
    10951095
    10961096    def on_render(self, window, widget, background_area, cell_area,
    1097         expose_area, flags):
    1098         has_prelit_colors = None not in [self._prelit_fill_color,
    1099                                          self._prelit_stroke_color]
     1097            expose_area, flags):
     1098        if self._xo_color is not None:
     1099            stroke_color = self._xo_color.get_stroke_color()
     1100            fill_color = self._xo_color.get_fill_color()
     1101            prelit_fill_color = stroke_color
     1102            prelit_stroke_color = fill_color
     1103        else:
     1104            stroke_color = self._stroke_color
     1105            fill_color = self._fill_color
     1106            prelit_fill_color = self._prelit_fill_color
     1107            prelit_stroke_color = self._prelit_stroke_color
     1108
     1109        has_prelit_colors = None not in [prelit_fill_color,
     1110                                         prelit_stroke_color]
     1111
    11001112        if flags & gtk.CELL_RENDERER_PRELIT and has_prelit_colors and \
    11011113                self._is_prelit(widget):
    11021114
    1103             self._buffer.fill_color = self._prelit_fill_color
    1104             self._buffer.stroke_color = self._prelit_stroke_color
     1115            self._buffer.fill_color = prelit_fill_color
     1116            self._buffer.stroke_color = prelit_stroke_color
    11051117        else:
    1106             self._buffer.fill_color = self._fill_color
    1107             self._buffer.stroke_color = self._stroke_color
     1118            self._buffer.fill_color = fill_color
     1119            self._buffer.stroke_color = stroke_color
    11081120
    11091121        surface = self._buffer.get_surface()
    11101122        if surface is None: