[Aptitude-svn-commit] r4397 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows at costa.debian.org
Sat Oct 1 01:23:50 UTC 2005


Author: dburrows
Date: Sat Oct  1 01:23:46 2005
New Revision: 4397

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/ui.cc
   branches/aptitude-0.3/aptitude/src/ui.h
   branches/aptitude-0.3/aptitude/src/ui_download_manager.cc
   branches/aptitude-0.3/aptitude/src/ui_download_manager.h
Log:
Make sure the download status widget stays in memory until the download finishes.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Oct  1 01:23:46 2005
@@ -1,5 +1,11 @@
 2005-09-30  Daniel Burrows  <dburrows at debian.org>
 
+	* src/ui.cc, src/ui.h, src/ui_download_manager.cc, src/ui_download_manager.h:
+
+	  Expose the widget that's handling the download status, so it can
+	  be explicitly kept alive as long as the download lasts
+	  (regardless of its destruction).
+
 	* src/download_list.cc:
 
 	  Always destroy a download list when destroy() is called, even

Modified: branches/aptitude-0.3/aptitude/src/ui.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/ui.cc	Sat Oct  1 01:23:46 2005
@@ -2495,12 +2495,14 @@
   active_status_download=NULL;
 }
 
-download_signal_log *gen_download_progress(bool force_noninvasive,
-					   bool list_update,
-					   const wstring &title,
-					   const wstring &longtitle,
-					   const wstring &tablabel,
-					   slot0arg abortslot)
+std::pair<download_signal_log *,
+	  vs_widget_ref>
+gen_download_progress(bool force_noninvasive,
+		      bool list_update,
+		      const wstring &title,
+		      const wstring &longtitle,
+		      const wstring &tablabel,
+		      slot0arg abortslot)
 {
   download_signal_log *m=new download_signal_log;
   download_list_ref w=NULL;
@@ -2545,7 +2547,7 @@
   m->Complete_sig.connect(sigc::mem_fun(w.unsafe_get_ref(),
 					&download_list::Complete));
 
-  return m;
+  return std::pair<download_manager *, vs_widget_ref>(m, w);
 }
 
 static void do_prompt_string(const wstring &s,

Modified: branches/aptitude-0.3/aptitude/src/ui.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.h	(original)
+++ branches/aptitude-0.3/aptitude/src/ui.h	Sat Oct  1 01:23:46 2005
@@ -212,14 +212,16 @@
  *                           used as its long title; it will be transcoded.
  *  \param abortslot         the slot to trigger if the download is aborted.
  *
- *  \return the new download manager.
+ *  \return the new download manager and the download status widget.
  */
-download_signal_log *gen_download_progress(bool force_noninvasive,
-					   bool list_update,
-					   const std::string &title,
-					   const std::string &longtitle,
-					   const std::string &tablabel,
-					   slot0arg abortslot);
+std::pair<download_signal_log *,
+	  vs_widget_ref>
+gen_download_progress(bool force_noninvasive,
+		      bool list_update,
+		      const std::string &title,
+		      const std::string &longtitle,
+		      const std::string &tablabel,
+		      slot0arg abortslot);
 
 // Asks the user for simple input (the question will appear in a "minibuffer"
 // or in a dialog according to preferences)

Modified: branches/aptitude-0.3/aptitude/src/ui_download_manager.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui_download_manager.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/ui_download_manager.cc	Sat Oct  1 01:23:46 2005
@@ -36,13 +36,18 @@
 					 const std::string &longtitle,
 					 const std::string &tablabel)
   : manager(_manager),
-    t(NULL),
-    log(gen_download_progress(force_noninvasive, list_update,
-			      title, longtitle, tablabel,
-			      arg(sigc::mem_fun(abort_state,
-						&aborter::abort)))),
-    st(log)
+    t(NULL)
 {
+  std::pair<download_signal_log *, vs_widget_ref> progpair =
+    gen_download_progress(force_noninvasive, list_update,
+			  title, longtitle, tablabel,
+			  arg(sigc::mem_fun(abort_state,
+					    &aborter::abort)));
+
+  log             = progpair.first;
+  download_status = progpair.second;
+  st              = new background_status(log);
+
   ui_start_download();
 }
 
@@ -57,6 +62,7 @@
 
   delete t;
   delete log;
+  delete st;
 }
 
 void ui_download_manager::done(download_thread *, pkgAcquire::RunResult res)

Modified: branches/aptitude-0.3/aptitude/src/ui_download_manager.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui_download_manager.h	(original)
+++ branches/aptitude-0.3/aptitude/src/ui_download_manager.h	Sat Oct  1 01:23:46 2005
@@ -67,7 +67,12 @@
 
   download_signal_log *log;
 
-  background_status st;
+  background_status *st;
+
+  /** Used to keep the download status widget alive until the download
+   *  completes.
+   */
+  vs_widget_ref download_status;
 
   void done(download_thread *, pkgAcquire::RunResult res);
 public:



More information about the Aptitude-svn-commit mailing list