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

Daniel Burrows dburrows at costa.debian.org
Fri Aug 19 20:39:22 UTC 2005


Author: dburrows
Date: Fri Aug 19 20:39:19 2005
New Revision: 3927

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/broken_indicator.cc
Log:
Show the number of remaining solutions when not all solutions have been generated yet.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Fri Aug 19 20:39:19 2005
@@ -1,5 +1,11 @@
 2005-08-19  Daniel Burrows  <dburrows at debian.org>
 
+	* src/broken_indicator.cc:
+
+	  When displaying the summary of the current number of broken
+	  packages, always show how many solutions have been generated so
+	  far; for instance, 1(2)/... .
+
 	* src/generic/aptcache.cc, src/generic/aptcache.h:
 
 	  Tell parties who are interested in the resolver that they should

Modified: branches/aptitude-0.3/aptitude/src/broken_indicator.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/broken_indicator.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/broken_indicator.cc	Fri Aug 19 20:39:19 2005
@@ -27,6 +27,7 @@
 #include <generic/aptitude_resolver_universe.h>
 #include <generic/problemresolver/exceptions.h>
 #include <generic/problemresolver/solution.h>
+#include <generic/util.h>
 
 #include <vscreen/config/colors.h>
 #include <vscreen/config/keybindings.h>
@@ -159,59 +160,42 @@
 	      }
 
 	    vector<fragment *> fragments;
-	    char buf[512];
 
-	    snprintf(buf, 512, (*apt_cache_file)->solution_generation_complete()?"[%d/%d]":"[%d/...]",
-		     (*apt_cache_file)->get_selected_solution()+1,
-		     (*apt_cache_file)->generated_solution_count());
-	    fragments.push_back(fragf("%s ", buf));
+	    string countstr
+	      = ssprintf((*apt_cache_file)->solution_generation_complete()?"[%d/%d]":"[%d(%d)/...]",
+			 (*apt_cache_file)->get_selected_solution()+1,
+			 (*apt_cache_file)->generated_solution_count());
+	    fragments.push_back(fragf("%s ", countstr.c_str()));
 
 	    fragments.push_back(fragf(_("Suggest ")));
 
 	    vector<fragment *> suggestions;
 
 	    if(install_count>1)
-	      {
-		snprintf(buf, 512, _("%d installs"),
-			 install_count);
-		suggestions.push_back(text_fragment(buf));
-	      }
+	      suggestions.push_back(text_fragment(ssprintf(_("%d installs"),
+							   install_count)));
 	    else if(install_count == 1)
 	      suggestions.push_back(text_fragment(_("1 install")));
 
 	    if(remove_count>1)
-	      {
-		snprintf(buf, 512, _("%d removals"),
-			 remove_count);
-		suggestions.push_back(text_fragment(buf));
-	      }
+		suggestions.push_back(text_fragment(ssprintf(_("%d removals"),
+							     remove_count)));
 	    else if(remove_count == 1)
 	      suggestions.push_back(text_fragment(_("1 removal")));
 
 	    if(keep_count>1)
-	      {
-		snprintf(buf, 512, _("%d keeps"),
-			 keep_count);
-		suggestions.push_back(text_fragment(buf));
-	      }
+	      suggestions.push_back(text_fragment(ssprintf(_("%d keeps"),
+							   keep_count)));
 	    else if(keep_count == 1)
 	      suggestions.push_back(text_fragment(_("1 keep")));
 
 	    if(upgrade_count>1)
-	      {
-		snprintf(buf, 512, _("%d upgrades"),
-			 upgrade_count);
-		suggestions.push_back(text_fragment(buf));
-	      }
+	      suggestions.push_back(text_fragment(ssprintf(_("%d upgrades"), upgrade_count)));
 	    else if(upgrade_count == 1)
 	      suggestions.push_back(text_fragment(_("1 upgrade")));
 
 	    if(downgrade_count>1)
-	      {
-		snprintf(buf, 512, _("%d downgrades"),
-			 downgrade_count);
-		suggestions.push_back(text_fragment(buf));
-	      }
+	      suggestions.push_back(text_fragment(ssprintf(_("%d downgrades"), downgrade_count)));
 	    else if(downgrade_count == 1)
 	      suggestions.push_back(text_fragment(_("1 downgrade")));
 



More information about the Aptitude-svn-commit mailing list