[Aptitude-devel] r3058 - in branches/aptitude-0.3/aptitude: . src/generic

Daniel Burrows dburrows@costa.debian.org
Sat, 23 Apr 2005 00:59:50 +0000


Author: dburrows
Date: Sat Apr 23 00:59:47 2005
New Revision: 3058

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/aptcache.cc
   branches/aptitude-0.3/aptitude/src/generic/aptcache.h
Log:
Add a signal for solution changes, fix a small bug.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Apr 23 00:59:47 2005
@@ -1,5 +1,11 @@
 2005-04-22  Daniel Burrows  <dburrows@debian.org>
 
+	* src/generic/aptcache.cc, src/generic/aptcache.h:
+
+	  Add a signal that gets called whenever the currently selected
+	  solution is changed, and make sure to set selected_solution to 0
+	  when we insert the first solution.
+
 	* src/ui.cc:
 
 	  In do_next_solution(), handle exceptional situations from the

Modified: branches/aptitude-0.3/aptitude/src/generic/aptcache.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/aptcache.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/aptcache.cc	Sat Apr 23 00:59:47 2005
@@ -1433,7 +1433,9 @@
       try
 	{
 	  solutions.push_back(new aptitude_resolver::solution(resolver->find_next_solution(aptcfg->FindI(PACKAGE "::ProblemResolver::StepLimit", 10000))));
+	  selected_solution=0;
 	  out_of_time=false;
+	  selected_solution_changed();
 	  return *solutions.back();
 	}
       catch(NoMoreTime) {
@@ -1444,6 +1446,7 @@
   else if(selected_solution<solutions.size()-1)
     {
       ++selected_solution;
+      selected_solution_changed();
       return *solutions[selected_solution];
     }
   else
@@ -1461,6 +1464,7 @@
     throw NoMoreSolutions();
 
   --selected_solution;
+  selected_solution_changed;
   return *solutions[selected_solution];
 }
 

Modified: branches/aptitude-0.3/aptitude/src/generic/aptcache.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/aptcache.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/aptcache.h	Sat Apr 23 00:59:47 2005
@@ -456,6 +456,11 @@
    */
   sigc::signal0<void> package_state_changed;
 
+  /** This signal is emitted when the currently selected solution
+   *  changes.
+   */
+  sigc::signal0<void> selected_solution_changed;
+
   // Emitted when a package's categorization is potentially changed.
   // (in particular, when package "new" states are forgotten)
   sigc::signal0<void> package_category_changed;