Permalink
Browse files

Gtk: Set fixed icon size for episode list

Avoids rendering problems on Windows and with
Gtk themes that have different icon sizes.
  • Loading branch information...
1 parent 9f58b8e commit 6b7bff36dc262dcb448f1eb4e377d3edfb4fbe40 @thp thp committed Mar 3, 2012
Showing with 9 additions and 2 deletions.
  1. +5 −1 src/gpodder/gtkui/draw.py
  2. +4 −1 src/gpodder/gtkui/main.py
@@ -38,6 +38,7 @@ def __init__(self, ctx, text):
tuple = ctx.text_extents(text)
(self.x_bearing, self.y_bearing, self.width, self.height, self.x_advance, self.y_advance) = tuple
+EPISODE_LIST_ICON_SIZE = 16
RRECT_LEFT_SIDE = 1
RRECT_RIGHT_SIDE = 2
@@ -116,11 +117,14 @@ def draw_text_box_centered(ctx, widget, w_width, w_height, text, font_desc=None,
rounded_rectangle(ctx, w_width/2-width/2, w_height/2+height, int(width*add_progress)+.5, bar_height)
ctx.fill()
-def draw_cake(percentage, text=None, emblem=None, size=16):
+def draw_cake(percentage, text=None, emblem=None, size=None):
# Download percentage bar icon - it turns out the cake is a lie (d'oh!)
# ..but the inital idea was to have a cake-style indicator, but that
# didn't work as well as the progress bar, but the name stuck..
+ if size is None:
+ size = EPISODE_LIST_ICON_SIZE
+
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, size, size)
ctx = pangocairo.CairoContext(cairo.Context(surface))
@@ -67,6 +67,7 @@
from gpodder.gtkui.desktopfile import UserAppsReader
from gpodder.gtkui.draw import draw_text_box_centered, draw_cake_pixbuf
+from gpodder.gtkui.draw import EPISODE_LIST_ICON_SIZE
from gpodder.gtkui.interface.common import BuilderWidget
from gpodder.gtkui.interface.common import TreeViewHelper
@@ -778,7 +779,9 @@ def init_episode_list_treeview(self):
TreeViewHelper.set(self.treeAvailable, TreeViewHelper.ROLE_EPISODES)
iconcell = gtk.CellRendererPixbuf()
- iconcell.set_property('stock-size', gtk.ICON_SIZE_BUTTON)
+ episode_list_icon_size = gtk.icon_size_register('episode-list',
+ EPISODE_LIST_ICON_SIZE, EPISODE_LIST_ICON_SIZE)
+ iconcell.set_property('stock-size', episode_list_icon_size)
iconcell.set_fixed_size(self.EPISODE_LIST_ICON_WIDTH, -1)
namecell = gtk.CellRendererText()

0 comments on commit 6b7bff3

Please sign in to comment.