[rhythmbox/gobject-introspection: 20/41] attempt to update the cover art widget for gtk3 changes, unsuccessfully
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox/gobject-introspection: 20/41] attempt to update the cover art widget for gtk3 changes, unsuccessfully
- Date: Sun, 12 Dec 2010 10:00:55 +0000 (UTC)
commit 291c2be4360343323684c296963369cb141def46
Author: Jonathan Matthew <jonathan d14n org>
Date: Wed Dec 1 09:05:43 2010 +1000
attempt to update the cover art widget for gtk3 changes, unsuccessfully
plugins/artdisplay/artdisplay/__init__.py | 55 +++++++++++++---------------
1 files changed, 26 insertions(+), 29 deletions(-)
---
diff --git a/plugins/artdisplay/artdisplay/__init__.py b/plugins/artdisplay/artdisplay/__init__.py
index d0b7dd9..6fc3d7c 100644
--- a/plugins/artdisplay/artdisplay/__init__.py
+++ b/plugins/artdisplay/artdisplay/__init__.py
@@ -88,14 +88,11 @@ def merge_with_background (pixbuf, bgcolor, pad_if_not_near_square):
class FadingImage (Gtk.Misc):
__gsignals__ = {
- 'size-allocate': 'override',
'get-max-size' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_INT, ())
}
def __init__ (self, missing_image):
gobject.GObject.__init__ (self)
self.sc_id = self.connect('screen-changed', self.screen_changed)
- self.ex_id = self.connect ('expose-event', self.expose)
- self.sr_id = self.connect ('size-request', self.size_request)
self.resize_id, self.fade_id, self.anim_id = 0, 0, 0
self.missing_image, self.size = missing_image, 100
self.screen_changed (self, None)
@@ -105,8 +102,7 @@ class FadingImage (Gtk.Misc):
self.anim, self.anim_frames, self.anim_size = None, None, 0
def disconnect_handlers (self):
- for id in self.sc_id, self.ex_id, self.sr_id:
- self.disconnect(id)
+ self.disconnect(self.sc_id)
self.icon_theme.disconnect(self.tc_id)
for id in self.resize_id, self.fade_id, self.anim_id:
if id != 0:
@@ -150,20 +146,21 @@ class FadingImage (Gtk.Misc):
self.missing_pixbuf = merge_with_background (missing_pixbuf, self.get_style().bg[Gtk.StateType.NORMAL], False)
def do_size_allocate (self, allocation):
- old_width = self.allocation.width
- # self.allocation = allocation
- self.set_allocation(allocation)
+ old_width = self.get_allocated_width()
+ FadingImage.super.size_allocate(self, allocation)
+ #self.set_allocation(allocation)
if self.resize_id == 0:
self.resize_id = gobject.idle_add (self.after_resize)
- if old_width != allocation.width:
+ #if old_width != allocation[2]:
+ if True:
max_size = self.emit ('get-max-size')
- self.size = min (allocation.width, max_size)
+ self.size = min (self.get_allocated_width (), max_size)
self.queue_resize ()
elif self.window is not None:
- self.window.move_resize (allocation.x, allocation.y, allocation.width, allocation.height)
+ self.window.move_resize (*allocation)
self.queue_draw ()
self.window.process_updates (True)
@@ -174,10 +171,10 @@ class FadingImage (Gtk.Misc):
self.queue_draw ()
return False
- def size_request (self, widget, requisition):
- requisition.width, requisition.height = -1, self.size
+ def do_get_preferred_height(self, widget):
+ return (self.size, self.size)
- def expose (self, widget, event):
+ def do_draw (self, widget, cr):
if not self.ensure_merged_pixbuf ():
return False
@@ -187,16 +184,12 @@ class FadingImage (Gtk.Misc):
draw_pb = self.merged_pixbuf
# center the image if we're wider than we are tall
- x = event.expose.area.x
- y = event.expose.area.y
- w = event.expose.area.width
- h = event.expose.area.height # ick
- pad = (self.allocation.width - self.size) / 2
-
- left = max (x, pad)
- right = min (x + w, pad + self.size)
- top = y
- bottom = min (y + h, self.size)
+ pad = (self.get_allocation().width - self.size) / 2
+
+ left = pad
+ right = pad + self.size
+ top = 0
+ bottom = self.size
if right > left and bottom > top:
Gdk.draw_pixbuf(event.any.window, None, draw_pb, left - pad, top, left, top, right - left, bottom - top, Gdk.RgbDither.NORMAL, 0, 0)
@@ -206,15 +199,19 @@ class FadingImage (Gtk.Misc):
return False
def anim_rect (self):
+ alloc_width = self.get_allocated_width()
+ alloc_height = self.get_allocated_height()
return Gdk.Rectangle (
- (self.allocation.width - self.anim_size) / 2,
- (self.allocation.height - self.anim_size) / 2,
- min (self.anim_size, self.allocation.width),
- min (self.anim_size, self.allocation.height))
+ (alloc_width - self.anim_size) / 2,
+ (alloc_height - self.anim_size) / 2,
+ min (self.anim_size, alloc_width),
+ min (self.anim_size, alloc_height))
def ensure_merged_pixbuf (self):
if self.merged_pixbuf is None:
- self.merged_pixbuf = merge_pixbufs (self.old_pixbuf, self.new_pixbuf, self.missing_pixbuf, self.fade_step, self.allocation.width, self.allocation.height)
+ alloc_width = self.get_allocated_width()
+ alloc_height = self.get_allocated_height()
+ self.merged_pixbuf = merge_pixbufs (self.old_pixbuf, self.new_pixbuf, self.missing_pixbuf, self.fade_step, alloc_width, alloc_height)
return self.merged_pixbuf
def render_overlay (self):
@@ -248,7 +245,7 @@ class FadingImage (Gtk.Misc):
return True
def set_current_art (self, pixbuf, working):
- if self.props.visible and self.parent.allocation.width > 1:
+ if self.props.visible and self.get_allocated_width() > 1:
self.old_pixbuf = self.render_overlay ()
else:
self.old_pixbuf = None # don't fade
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]