Skip to content

Commit

Permalink
Use Sugar palette menus for view source, not Gtk.Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
samdroid-apps committed Aug 7, 2015
1 parent 24bf6d1 commit ff7c7c7
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/jarabe/view/viewsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
from sugar3.graphics import style
from sugar3.graphics.icon import Icon
from sugar3.graphics.xocolor import XoColor
from sugar3.graphics.menuitem import MenuItem
from sugar3.graphics.toolbutton import ToolButton
from sugar3.graphics.palettemenu import PaletteMenuBox
from sugar3.graphics.palettemenu import PaletteMenuItem
from sugar3.graphics.radiotoolbutton import RadioToolButton
from sugar3.bundle.activitybundle import get_bundle_instance
from sugar3.datastore import datastore
Expand Down Expand Up @@ -354,22 +355,20 @@ def __init__(self, file_name, document_path, title, bundle=False):
self.set_icon_widget(icon)
icon.show()

box = PaletteMenuBox()
self.props.palette.set_content(box)
box.show()

if bundle:
menu_item = MenuItem(_('Duplicate'))
icon = Icon(icon_name='edit-duplicate',
pixel_size=style.SMALL_ICON_SIZE,
xo_color=XoColor(self._color))
menu_item = PaletteMenuItem(_('Duplicate'), 'edit-duplicate',
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__copy_to_home_cb)
else:
menu_item = MenuItem(_('Keep'))
icon = Icon(icon_name='document-save',
pixel_size=style.SMALL_ICON_SIZE,
xo_color=XoColor(self._color))
menu_item = PaletteMenuItem(_('Keep'), 'document-save',
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__keep_in_journal_cb)

menu_item.set_image(icon)

self.props.palette.menu.append(menu_item)
box.append_item(menu_item)
menu_item.show()

def __copy_to_home_cb(self, menu_item):
Expand Down

0 comments on commit ff7c7c7

Please sign in to comment.