[Aptitude-devel] Using views::download_progress

Daniel Burrows dburrows at debian.org
Thu Jul 22 14:48:36 UTC 2010


On Thu, Jul 22, 2010 at 01:57:18PM +0200, Piotr Galiszewski <piotr at galiszewski.pl> was heard to say:
> 2010/7/22 Daniel Burrows <dburrows at debian.org>:
> I found and fixed this problems. Downloading works fine. I was only
> surprised that complete is never invoked and error is not really and
> error when ignored is set to true ;)

  Hm, complete() should be invoked when you call finish().  It's not?

  (the "ignored" parameter is a nasty hack to allow the command line to
   implement the download UI of apt-get without making it deal directly
   with apt's entire download system)

> >  I think this should work without the ui_download_manager, although
> > you probably want that too.
> >
> 
> Yes. Currently the gui is frozen during downloading. I am still not
> sure how to use both mechanisms in my code, but I have a look on it
> now

  I'm pretty sure you create one and then call start().  The one thing
you'll need to implement on your end is a routine to inject callbacks
into your UI thread.  It should look like this:

    void post_thunk(const sigc::slot<void> &thunk);

  I don't know Qt well enough to tell you what to do, but I'm sure
there must be a way to poke its UI thread.  The curses frontend uses
a built-in cwidget function that invokes a callback in the main thread,
and the GTK+ code uses a threadsafe queue and a Glib function that
wakes up the main thread to check the queue.

  Other than that, I think you should be set.

  Daniel



More information about the Aptitude-devel mailing list