diff --git a/shell/view/frame/activitybutton.py b/shell/view/frame/activitybutton.py index f3e2b7e9..43251d0b 100644 --- a/shell/view/frame/activitybutton.py +++ b/shell/view/frame/activitybutton.py @@ -18,13 +18,14 @@ import gtk import os import gobject +from gettext import gettext as _ from sugar.graphics.palette import Palette from sugar.graphics.tray import TrayButton from sugar.graphics.icon import Icon from sugar.graphics import style -from gettext import gettext as _ +from view.frame.frameinvoker import FrameWidgetInvoker class ActivityButton(TrayButton, gobject.GObject): __gtype_name__ = 'SugarActivityButton' @@ -50,6 +51,7 @@ class ActivityButton(TrayButton, gobject.GObject): def setup_rollover_options(self): palette = Palette(self._activity_info.name) self.set_palette(palette) + palette.props.invoker = FrameWidgetInvoker(self) menu_item = gtk.MenuItem(_('Remove')) menu_item.connect('activate', self.item_remove_cb) diff --git a/shell/view/frame/frameinvoker.py b/shell/view/frame/frameinvoker.py index 8be0eaf9..2ce2f398 100644 --- a/shell/view/frame/frameinvoker.py +++ b/shell/view/frame/frameinvoker.py @@ -20,6 +20,26 @@ import gtk from sugar.graphics import style from sugar.graphics.palette import Palette from sugar.graphics.palette import CanvasInvoker +from sugar.graphics.palette import WidgetInvoker + +def _get_screen_area(): + frame_thickness = style.GRID_CELL_SIZE + + x = y = frame_thickness + width = gtk.gdk.screen_width() - frame_thickness + height = gtk.gdk.screen_height() - frame_thickness + + return gtk.gdk.Rectangle(x, y, width, height) + +class FrameWidgetInvoker(WidgetInvoker): + def __init__(self, widget): + WidgetInvoker.__init__(self, widget) + + def get_default_position(self): + return Palette.AROUND + + def get_screen_area(self): + return _get_screen_area() class FrameCanvasInvoker(CanvasInvoker): def __init__(self, item): @@ -29,10 +49,4 @@ class FrameCanvasInvoker(CanvasInvoker): return Palette.AROUND def get_screen_area(self): - frame_thickness = style.GRID_CELL_SIZE - - x = y = frame_thickness - width = gtk.gdk.screen_width() - frame_thickness - height = gtk.gdk.screen_height() - frame_thickness - - return gtk.gdk.Rectangle(x, y, width, height) + return _get_screen_area()