[gpodder-devel] Proposition: progress bar on the tray icon

  • From: thp at perli.net (Thomas Perl)
  • Date: Sat, 23 Feb 2008 10:24:34 +0100

Hello, ?J?r?me!

On Fri, 2008-02-22 at 19:43 +0100, J?r?me Chabod wrote:
> Indeed, much nicer like this. I vote for your version !
> 
> A few remarks:
> * the bug is not really misterious: to fix it, replace trayicon.py
> line 314 with "self.__current_pixbuf = self.__icon" ("__" are missing)

Thanks, I've fixed that :)

> * although performance does not seems to be a problem,  the code could
> be more efficient if you copy the icon only the first time (when ratio
> is 0.0), it will preserve the cached download icon, whereas all other
> icon with a piece of progress bar will be garbage collected anyway, so
> no need to preserve them.

Well, because of the alpha channel, I have to copy the icon every time I
draw a progressbar on it (or else I would modify the current pixmap and
after some time, the progress bar would have a solid background).

> * the tray icon is drawned on every ratio change, it happens very
> offen (around 100*10 time during my big episodes download) and given
> that the icon is 48 pixels big, only 48 are idealy needed. At least,
> you could  improve this  by drawing only on integer percentage change,
> it would then  only happen 100*.

I have updated the code so it only updates the progress bar when the
progress meter changes for more than 3 percent-points, so we save a lot
of updates and it doesn't get noticed in the tray icon (even at maximum
size). 100/3 ~ 30 pixels - given that we subtract some pixels for the
padding and the border, that will be about one pixel in full size.

I've also fixed a related problem where cancelling a download in a
two-download scenario would result in the cancelled download being
counted as finished in the complete progress.

Please test this patch and tell me what you think. If everything's okay,
I will commit it into SVN trunk.

Thanks,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpodder_r579_tray-icon-progressbar-fixed.patch
Type: text/x-patch
Size: 6562 bytes
Desc: not available
URL: 
<https://lists.berlios.de/pipermail/gpodder-devel/attachments/20080223/1045d34b/attachment.bin>

Other related posts: