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

Daniel Burrows dburrows at costa.debian.org
Mon Aug 8 17:51:20 UTC 2005


Author: dburrows
Date: Mon Aug  8 17:51:17 2005
New Revision: 3740

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/download_list.cc
   branches/aptitude-0.3/aptitude/src/download_list.h
Log:
Update the download list for refcounting.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Aug  8 17:51:17 2005
@@ -1,5 +1,9 @@
 2005-08-08  Daniel Burrows  <dburrows at debian.org>
 
+	* src/download_list.cc, src/download_list.h:
+
+	  Update the download list for refcounting.
+
 	* src/download_bar.cc:
 
 	  Make the constructor protected.

Modified: branches/aptitude-0.3/aptitude/src/download_list.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/download_list.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/download_list.cc	Mon Aug  8 17:51:17 2005
@@ -49,13 +49,13 @@
 }
 
 // Unfortunately the cancel_slot is necessary so we know we've cancelled..
-static vscreen_widget *download_summary(download_list *l,
-					bool failed,
-					bool already_cancelled,
-					slot0arg cancel_slot,
-					double FetchedBytes,
-					unsigned long ElapsedTime,
-					double CurrentCPS)
+static vs_widget_ref download_summary(const download_list_ref &l,
+				      bool failed,
+				      bool already_cancelled,
+				      slot0arg cancel_slot,
+				      double FetchedBytes,
+				      unsigned long ElapsedTime,
+				      double CurrentCPS)
 {
   vector<fragment*> fragments;
 
@@ -69,7 +69,7 @@
 
   fragment *fragment=wrapbox(sequence_fragment(fragments));
 
-  vscreen_widget *rval;
+  vs_widget_ref rval;
   if(already_cancelled || !cancel_slot)
     rval=vs_dialog_ok(fragment, arg(sigc::ptr_fun(vscreen_exitmain)));
   else
@@ -83,28 +83,28 @@
 
   rval->connect_key("PrevPage",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::pageup));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::pageup));
   rval->connect_key("Up",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::lineup));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::lineup));
   rval->connect_key("NextPage",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::pagedown));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::pagedown));
   rval->connect_key("Down",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::linedown));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::linedown));
   rval->connect_key("Begin",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::skip_to_top));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::skip_to_top));
   rval->connect_key("End",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::skip_to_bottom));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::skip_to_bottom));
   rval->connect_key("Left",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::shift_left));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::shift_left));
   rval->connect_key("Right",
 		    &global_bindings,
-		    sigc::mem_fun(*l, &download_list::shift_right));
+		    sigc::mem_fun(*l.unsafe_get_ref(), &download_list::shift_right));
 
   rval->show_all();
 
@@ -280,14 +280,14 @@
 			    media.c_str(), drive.c_str()));
 
   bool rval=true;
-  vscreen_widget *w=vs_dialog_yesno(f,
-				    arg(sigc::bind(sigc::ptr_fun(set_and_exit),
-						   rval, true)),
-				    transcode(_("Continue")),
-				    arg(sigc::bind(sigc::ptr_fun(set_and_exit),
-						   rval, false)),
-				    transcode(_("Abort")),
-				    get_style("MediaChange"));
+  vs_widget_ref w=vs_dialog_yesno(f,
+				  arg(sigc::bind(sigc::ptr_fun(set_and_exit),
+						 rval, true)),
+				  transcode(_("Continue")),
+				  arg(sigc::bind(sigc::ptr_fun(set_and_exit),
+						 rval, false)),
+				  transcode(_("Abort")),
+				  get_style("MediaChange"));
   w->show_all();
 
   popup_widget(w);

Modified: branches/aptitude-0.3/aptitude/src/download_list.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/download_list.h	(original)
+++ branches/aptitude-0.3/aptitude/src/download_list.h	Mon Aug  8 17:51:17 2005
@@ -85,9 +85,15 @@
 protected:
   void paint(const style &st);
   bool handle_key(const key &k);
-public:
+
   download_list(slot0arg _abortslot=NULL,
 		bool _display_messages=true);
+public:
+  static ref_ptr<download_list> create(slot0arg abortslot = NULL,
+				       bool display_messages = NULL)
+  {
+    return new download_list(abortslot, display_messages);
+  }
 
   bool MediaChange(std::string media, std::string drive,
 		   download_manager &manager);
@@ -123,4 +129,6 @@
   void shift_right();
 };
 
+typedef ref_ptr<download_list> download_list_ref;
+
 #endif



More information about the Aptitude-svn-commit mailing list