From 5512f8461bfadc1bd534ee38b09c8582eadd3b00 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 21 Dec 2006 07:10:21 +0000 Subject: Re-enable buddy icons in rollover menus --- diff --git a/shell/view/BuddyMenu.py b/shell/view/BuddyMenu.py index 069aa6a..a020a59 100644 --- a/shell/view/BuddyMenu.py +++ b/shell/view/BuddyMenu.py @@ -21,6 +21,7 @@ import hippo from sugar.graphics.menu import Menu from sugar.graphics.canvasicon import CanvasIcon from sugar.presence import PresenceService +import _sugar _ICON_SIZE = 75 @@ -33,15 +34,19 @@ class BuddyMenu(Menu): self._buddy = buddy self._shell = shell - icon_item = None pixbuf = self._get_buddy_icon_pixbuf() if pixbuf: + icon_item = hippo.CanvasImage() scaled_pixbuf = pixbuf.scale_simple(_ICON_SIZE, _ICON_SIZE, gtk.gdk.INTERP_BILINEAR) del pixbuf - icon_item = hippo.CanvasImage(pixbuf=scaled_pixbuf) - - Menu.__init__(self, buddy.get_name(), icon_item) + Menu.__init__(self, buddy.get_name(), icon_item) + # FIXME: have to set the image _after_ adding the HippoCanvasImage + # to it's parent item, because that sets the HippoCanvasImage's context, + # which resets the object's 'image' property. Grr. + _sugar.hippo_canvas_image_set_image_from_gdk_pixbuf(icon_item, scaled_pixbuf) + else: + Menu.__init__(self, buddy.get_name(), None) self._buddy.connect('icon-changed', self.__buddy_icon_changed_cb) -- cgit v0.9.1