Ticket #4397: 0004-ViewSource-port-palettes-to-current-palette-implemen.patch

File 0004-ViewSource-port-palettes-to-current-palette-implemen.patch, 2.4 KB (added by manuq, 10 years ago)

Patch - port palettes

  • src/jarabe/view/viewsource.py

    From c404afc145616239b011b0b0907bf6b8fdd00642 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Thu, 24 Jan 2013 10:53:37 -0300
    Subject: [PATCH shell 4/4] ViewSource: port palettes to current palette
     implementation - SL #4397
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    So they get styled correctly.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/jarabe/view/viewsource.py | 15 ++++++++++-----
     1 file changed, 10 insertions(+), 5 deletions(-)
    
    diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py
    index 9533867..d7a4954 100644
    a b from gi.repository import GConf 
    3434from sugar3.graphics import style
    3535from sugar3.graphics.icon import Icon
    3636from sugar3.graphics.xocolor import XoColor
    37 from sugar3.graphics.menuitem import MenuItem
     37from sugar3.graphics.palettemenu import PaletteMenuBox
     38from sugar3.graphics.palettemenu import PaletteMenuItem
    3839from sugar3.graphics.toolbutton import ToolButton
    3940from sugar3.graphics.radiotoolbutton import RadioToolButton
    4041from sugar3.bundle.activitybundle import ActivityBundle
    class DocumentButton(RadioToolButton): 
    276277        self.set_icon_widget(icon)
    277278        icon.show()
    278279
     280        menu_box = PaletteMenuBox()
     281        self.props.palette.set_content(menu_box)
     282        menu_box.show()
     283
    279284        if bundle:
    280             menu_item = MenuItem(_('Duplicate'))
     285            menu_item = PaletteMenuItem(_('Duplicate'))
    281286            icon = Icon(icon_name='edit-duplicate',
    282287                        icon_size=Gtk.IconSize.MENU,
    283288                        xo_color=XoColor(self._color))
    284289            menu_item.connect('activate', self.__copy_to_home_cb)
    285290        else:
    286             menu_item = MenuItem(_('Keep'))
     291            menu_item = PaletteMenuItem(_('Keep'))
    287292            icon = Icon(icon_name='document-save',
    288293                        icon_size=Gtk.IconSize.MENU,
    289294                        xo_color=XoColor(self._color))
    290295            menu_item.connect('activate', self.__keep_in_journal_cb)
    291296
    292297        menu_item.set_image(icon)
    293 
    294         self.props.palette.menu.append(menu_item)
     298        icon.show()
     299        menu_box.append_item(menu_item)
    295300        menu_item.show()
    296301
    297302    def __copy_to_home_cb(self, menu_item):