summaryrefslogtreecommitdiff
path: root/src/download_list.h
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2008-10-29 09:16:17 -0700
committerDaniel Burrows <dburrows@debian.org>2008-10-29 09:16:17 -0700
commitcf760f50bf8963da7c35a061ba3b2a162c0fe2cd (patch)
tree27961cebaa3f14caf7356bd168f6ecc6fbe18909 /src/download_list.h
parent0a17acce0bf192c2b7ece3b5f74b474aaa187b3e (diff)
downloadaptitude-cf760f50bf8963da7c35a061ba3b2a162c0fe2cd.tar.gz
Massive refactoring and redesign to properly support background downloads in the GUI and running dpkg in a terminal.
This should probably have been split into a lot of smaller commits, but it's too late now. The GUI now runs downloads in a background thread, just like the curses interface. In fact, it is *just* like the curses interface: the code of ui_download_manager and download_thread has been parameterized so that it can be used from either the curses frontend or the GUI frontend. These files should eventually migrate to the generic directory. Some of the parameterization left ugly stuff behind, like refcounted_progress and the wacky redesign of the curses progress class (which took place solely so that it could be unified with the GTK+ one). It may be worth taking some time to clean this code up. In addition, the code for download_install_manager has been refactored again. Instead of exposing the different parts of "finish", which would eliminate any hope of having a unified ui_download_manager harness, the "finish" method (for all download managers) is now explicitly continuation based, and the install manager uses this feature to break up the download. The function that runs dpkg in a terminal now takes a continuation to be invoked in the main thread, so it can fork dpkg in a subprocess, and then call the continuation when the subprocess terminates. This means we don't need to mess around with threads at all in the dpkg-terminal-creation process, a huge relief. It also fits in with the generally continuation-y feel of a lot of the aptitude code, and everyone loves continuations in their GUI programs anyway! Note: in this commit, I've adopted a policy of always returning right after I invoke the continuation, to make it clear in the code what's going on and to minimize the chances of a future edit screwing this up. (if I really wanted to get serious about that, of course, I would write an INVOKE_CONTINUATION macro...) A few other minor things were touched up here: for instance, the program no longer enters an infinite loop after running dpkg, and more download events are logged. There's still more work to do around the edges: changelog downloading from the GUI is broken, and the download status tab is all messed up. Also, I'd like to support the status pipe from dpkg (but I think that's a post-0.5 thing).
Diffstat (limited to 'src/download_list.h')
-rw-r--r--src/download_list.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/download_list.h b/src/download_list.h
index 0735d6b6..e8520dc6 100644
--- a/src/download_list.h
+++ b/src/download_list.h
@@ -76,13 +76,11 @@ class download_list:public cwidget::widgets::widget
bool sticky_end;
// Set to true if the user asks to cancel the download
- bool cancelled;
+ bool was_cancelled;
// Set to true if an item failed.
bool failed;
- cwidget::util::slot0arg abortslot;
-
// Will we display things other than the current workers?
bool display_messages;
@@ -125,15 +123,13 @@ protected:
void paint(const cwidget::style &st);
bool handle_key(const cwidget::config::key &k);
- download_list(cwidget::util::slot0arg _abortslot = NULL,
- bool _display_messages = true,
+ download_list(bool _display_messages = true,
bool _display_cumulative_progress = true);
public:
- static cwidget::util::ref_ptr<download_list> create(cwidget::util::slot0arg abortslot = NULL,
- bool display_messages = true,
+ static cwidget::util::ref_ptr<download_list> create(bool display_messages = true,
bool display_cumulative_progress = true)
{
- cwidget::util::ref_ptr<download_list> rval(new download_list(abortslot, display_messages, display_cumulative_progress));
+ cwidget::util::ref_ptr<download_list> rval(new download_list(display_messages, display_cumulative_progress));
rval->decref();
return rval;
}
@@ -158,6 +154,8 @@ public:
cwidget::widgets::point get_cursorloc() { return cwidget::widgets::point(0,0); }
bool focus_me() {return true;}
+ sigc::signal<void> cancelled;
+
// FIXME: overriding this is a terrible hack. A cancel() hook should be
// used instead.
void destroy();