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

Daniel Burrows dburrows at costa.debian.org
Mon Sep 26 21:53:34 UTC 2005


Author: dburrows
Date: Mon Sep 26 21:53:31 2005
New Revision: 4304

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Disable more options that require the cache file if it's NULL

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Sep 26 21:53:31 2005
@@ -2,6 +2,12 @@
 
 	* src/ui.cc:
 
+	  Also gray out autocleaning and mark-upgradable when the apt
+	  cache file isn't available, and don't crash even if someone does
+	  call do_autoclean with apt_cache_file == NULL.
+
+	* src/ui.cc:
+
 	  Gray out the install-run menu item whenever the apt cache file
 	  isn't available.
 

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	Mon Sep 26 21:53:31 2005
@@ -1472,9 +1472,16 @@
 {
 }
 
+static bool do_autoclean_enabled()
+{
+  return apt_cache_file != NULL;
+}
+
 static void do_autoclean()
 {
-  if(active_download)
+  if(apt_cache_file == NULL)
+    _error->Error(_("The apt cache file is not available; cannot auto-clean."));
+  else if(active_download)
     // Erk!  That's weird!
     _error->Error(_("Cleaning while a download is in progress is not allowed"));
   else
@@ -1504,6 +1511,11 @@
     }
 }
 
+static bool do_mark_upgradable_enabled()
+{
+  return apt_cache_file != NULL;
+}
+
 static void do_mark_upgradable()
 {
   if(apt_cache_file)



More information about the Aptitude-svn-commit mailing list