[Aptitude-devel] Using views::download_progress

Piotr Galiszewski piotr at galiszewski.pl
Fri Jul 23 00:20:11 UTC 2010


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
to debug problem, and the only received callback is from
download_signal_log::Start(). It looks like downloading have not
started. The code is analogous to the gtk one (in gtk downloading is
working fine) . Below is a part of code I am using:

        boost::shared_ptr<download_update_manager>
m(boost::make_shared<download_update_manager>());

        download_signal_log *log = new download_signal_log;

        controller =
controllers::create_acquire_download_progress(log, progress_view);

        using aptitude::util::refcounted_wrapper;
        cwidget::util::ref_ptr<refcounted_wrapper<update_cache_job_impl> >
            n_wrapper(new refcounted_wrapper<update_cache_job_impl>(this));

        ui_download_manager *uim =
            new ui_download_manager(m,
                                    log,
                                    n_wrapper,
                                    sigc::ptr_fun(&make_gui_progress),
                                    &post_event);

        uim->start();

The full code with callback injecting is available in this testing
commit: http://gitorious.org/aptitude/aptitude/commit/a68a400b764928d60d92c6f3795f85bbbcc66485

Thanks in advance for any suggestions

>  Other than that, I think you should be set.
>
>  Daniel
>
-- 
Regards
Piotr Galiszewski



More information about the Aptitude-devel mailing list