From aebd62a4ce23d89dfba91f093f9354969e6184c4 Mon Sep 17 00:00:00 2001
From: Simon Schampijer <simon@laptop.org>
Date: Thu, 25 Oct 2012 12:29:56 +0200
Subject: [PATCH shell] FavoritesView: switch ActivityPalette from GTK.Menu to
custom menu, part of SL #3992
The Gtk.Menu triggers a Palette popdown in a long press (and actually as well
a long click). There is not realy a way around that so we go with our custom
Palettes.
Signed-off-by: Simon Schampijer <simon@laptop.org>
---
src/jarabe/desktop/favoritesview.py | 16 +++++++---------
src/jarabe/view/palettes.py | 12 +++++++-----
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index 9c7a76e..e71b769 100644
a
|
b
|
from sugar3.graphics import style |
30 | 30 | from sugar3.graphics.icon import Icon |
31 | 31 | from sugar3.graphics.icon import CanvasIcon |
32 | 32 | from sugar3.graphics.menuitem import MenuItem |
| 33 | from sugar3.graphics.palettemenuitem import PaletteMenuItem |
| 34 | from sugar3.graphics.palettemenuitem import PaletteMenuItemSeparator |
33 | 35 | from sugar3.graphics.alert import Alert |
34 | 36 | from sugar3.graphics.xocolor import XoColor |
35 | 37 | from sugar3.activity import activityfactory |
… |
… |
class ActivityIcon(CanvasIcon): |
488 | 490 | class FavoritePalette(ActivityPalette): |
489 | 491 | __gtype_name__ = 'SugarFavoritePalette' |
490 | 492 | |
491 | | _PALETTE_LABEL_OFFSET = 2 |
492 | | |
493 | 493 | __gsignals__ = { |
494 | 494 | 'entry-activate': (GObject.SignalFlags.RUN_FIRST, |
495 | 495 | None, ([object])), |
… |
… |
class FavoritePalette(ActivityPalette): |
517 | 517 | icon_file_name = misc.get_icon_name(entry) |
518 | 518 | color = misc.get_icon_color(entry) |
519 | 519 | |
520 | | menu_item = MenuItem(text_label=entry['title'], |
521 | | file_name=icon_file_name, |
522 | | xo_color=color) |
| 520 | menu_item = PaletteMenuItem(text_label=entry['title'], |
| 521 | file_name=icon_file_name, |
| 522 | xo_color=color) |
523 | 523 | menu_item.connect('activate', self.__resume_entry_cb, entry) |
524 | 524 | menu_items.append(menu_item) |
525 | 525 | menu_item.show() |
526 | 526 | |
527 | 527 | if journal_entries: |
528 | | separator = Gtk.SeparatorMenuItem() |
| 528 | separator = PaletteMenuItemSeparator() |
529 | 529 | menu_items.append(separator) |
530 | 530 | separator.show() |
531 | 531 | |
532 | 532 | for i in range(0, len(menu_items)): |
533 | | # the first menu_item is the label and the second is a |
534 | | # separator so we need the offset |
535 | | self.menu.insert(menu_items[i], i + self._PALETTE_LABEL_OFFSET) |
| 533 | self.menu_box.pack_start(menu_items[i], True, True, 0) |
536 | 534 | |
537 | 535 | def __resume_entry_cb(self, menu_item, entry): |
538 | 536 | if entry is not None: |
diff --git a/src/jarabe/view/palettes.py b/src/jarabe/view/palettes.py
index 10844ea..79540e6 100644
a
|
b
|
class ActivityPalette(Palette): |
138 | 138 | |
139 | 139 | xo_color = XoColor('%s,%s' % (style.COLOR_WHITE.get_svg(), |
140 | 140 | style.COLOR_TRANSPARENT.get_svg())) |
141 | | menu_item = MenuItem(text_label=_('Start new'), |
142 | | file_name=activity_info.get_icon(), |
143 | | xo_color=xo_color) |
| 141 | self.menu_box = Gtk.VBox() |
| 142 | menu_item = PaletteMenuItem(text_label=_('Start new'), |
| 143 | file_name=activity_info.get_icon(), |
| 144 | xo_color=xo_color) |
144 | 145 | menu_item.connect('activate', self.__start_activate_cb) |
145 | | self.menu.append(menu_item) |
146 | | menu_item.show() |
| 146 | self.menu_box.pack_end(menu_item, True, True, 0) |
| 147 | self.set_content(self.menu_box) |
| 148 | self.menu_box.show_all() |
147 | 149 | |
148 | 150 | # TODO: start-with |
149 | 151 | |