GNOME Bugzilla – Bug 735056
Rating stars are not vertically aligned in GtkTreeView listing
Last modified: 2014-08-23 01:54:20 UTC
The ratings in song listings ( rb-entry-view through rb-rating-cell-renderer ) are not vertically aligned to center. They are more close to the top. This happens, since the rating pixbufs operate independently of the cell renderer's layout. rb-rating-cell-renderer uses cairo and pixel offset for rendering. Due to this, gtk_cell_renderer_set_alignment( cell, 0.5, 0.5 ) has no effect on the alignment. The ratings are aligned properly in rb-rating widget though.
Suggested fix is to add a few pixels to y_offset. 3 pixels of additional y offset makes the alignment proper.
diff --git a/widgets/rb-cell-renderer-rating.c b/widgets/rb-cell-renderer-rating.c index 45cb550..dc82fa4 100644 --- a/widgets/rb-cell-renderer-rating.c +++ b/widgets/rb-cell-renderer-rating.c @@ -287,7 +287,7 @@ rb_cell_renderer_rating_render (GtkCellRenderer *cell, rb_rating_render_stars (widget, cr, cell_class->priv->pixbufs, draw_rect.x - pix_rect.x, draw_rect.y - pix_rect.y, - draw_rect.x, draw_rect.y, + draw_rect.x, draw_rect.y + 3, cellrating->priv->rating, selected); }
Created attachment 283891 [details] [review] Add 3 pixel of y offset to rating pixbufs
Does this work for all font sizes? I think you'll have to do something smarter than this.
Created attachment 283948 [details] UI with bigger font size
looks like you'll have to do something smarter than this.
commit da6d318 does something smarter