[Aptitude-devel] Using views::download_progress

Piotr Galiszewski piotr at galiszewski.pl
Fri Jul 23 14:49:42 UTC 2010


2010/7/23 Piotr Galiszewski <piotr at galiszewski.pl>:
> I am sorry for disturbing you during holidays, but I faced a problem I
> have been unable to solve for some hours
>
> 2010/7/22 Daniel Burrows <dburrows at debian.org>:
>> 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?
>>
>
> I forgot about complete. It works now,
>
>>  (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.
>>
>
> Unfortunately, it is not working for me. It looks like the callbacks
> injecting works nice, but I receive only one request for it. I tried
[snip]

It is not true anymore. After many hours of work on unsuccessful
attempts , I found working solution. Code is little hacky, but works
nice. I hidden the implementation in new file and namespace, so it
could be used from other places.

-- 
Regards
Piotr Galiszewski



More information about the Aptitude-devel mailing list