[Aptitude-svn-commit] r4339 - in branches/aptitude-0.3/aptitude: . src src/generic/apt

Daniel Burrows dburrows at costa.debian.org
Thu Sep 29 23:04:43 UTC 2005


Author: dburrows
Date: Thu Sep 29 23:04:40 2005
New Revision: 4339

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/apt/download_install_manager.cc
   branches/aptitude-0.3/aptitude/src/generic/apt/download_update_manager.cc
   branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Implement the before/after hooks in the UI to shut down curses and o display a message while an automatic autocleaning is happening.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Thu Sep 29 23:04:40 2005
@@ -1,5 +1,11 @@
 2005-09-29  Daniel Burrows  <dburrows at debian.org>
 
+	* src/ui.cc, src/generic/download_install_manager.cc, src/generic/download_update_manager.cc:
+
+	  Implement the before/after hooks in the UI to shut down curses
+	  and to display a message while automatic autocleaning is
+	  happening.
+
 	* src/ui.cc:
 
 	  Implement ui_stop_download.

Modified: branches/aptitude-0.3/aptitude/src/generic/apt/download_install_manager.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/apt/download_install_manager.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/apt/download_install_manager.cc	Thu Sep 29 23:04:40 2005
@@ -127,10 +127,6 @@
   log_changes();
 
   pre_install_hook();
-#if 0
-  if(!text_download)
-    vscreen_suspend();
-#endif
 
   // Note that someone could grab the lock before dpkg takes it;
   // without a more complicated synchronization protocol (and I don't
@@ -151,17 +147,6 @@
       rval = failure;
       break;
     case pkgPackageManager::Completed:
-#if 0
-      if(!text_download)
-	{
-	  cerr << _("Press return to continue.\n");
-	  int c = getchar();
-
-	  while(c != '\n'  && c != EOF)
-	    c = getchar();
-	}
-#endif
-
       break;
 
     case pkgPackageManager::Incomplete:
@@ -171,15 +156,6 @@
 
   post_install_hook(pmres);
 
-#if 0
-  // libapt-pkg likes to stomp on SIGINT and SIGQUIT.  Restore them
-  // here in the simplest possible way.
-  vscreen_install_sighandlers();
-
-  if(!text_download)
-    vscreen_resume();
-#endif
-
   fetcher->Shutdown();
 
   // Get source lists.

Modified: branches/aptitude-0.3/aptitude/src/generic/apt/download_update_manager.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/apt/download_update_manager.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/apt/download_update_manager.cc	Thu Sep 29 23:04:40 2005
@@ -130,15 +130,7 @@
 
 #if 0
       // TODO: move this code to the appropriate frontends
-      vs_widget_ref msg = NULL;
-      if(!text_download)
-	{
-	  msg=vs_center::create(vs_frame::create(vs_label::create(_("Deleting obsolete downloaded files"))));
-	  popup_widget(msg);
-	  vscreen_tryupdate();
-	}
-      else
-	printf(_("Deleting obsolete downloaded files\n"));
+      printf(_("Deleting obsolete downloaded files\n"));
 #endif
 
       my_cleaner cleaner;
@@ -147,11 +139,6 @@
 		 *apt_cache_file);
 
       post_autoclean_hook();
-
-#if 0
-      if(msg.valid())
-	msg->destroy();
-#endif
     }
 
   return success;

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	Thu Sep 29 23:04:40 2005
@@ -202,7 +202,7 @@
 {
   active_download = false;
 
-  if(apt_ache_file != NULL)
+  if(apt_cache_file != NULL)
     (*apt_cache_file)->set_read_only(false);
 }
 
@@ -1012,9 +1012,32 @@
 //  can to some degree)
 
 
+static void finish_install_run(pkgPackageManager::OrderResult res)
+{
+  if(res != pkgPackageManager::Incomplete)
+    {
+      cerr << _("Press return to continue.\n");
+      int c = getchar();
+
+      while(c != '\n'  && c != EOF)
+	c = getchar();
+    }
+
+  // libapt-pkg likes to stomp on SIGINT and SIGQUIT.  Restore them
+  // here in the simplest possible way.
+  vscreen_install_sighandlers();
+
+  vscreen_resume();
+}
+
 void install_or_remove_packages()
 {
-  (new ui_download_manager(new download_install_manager(false)))->start();
+  download_install_manager *m = new download_install_manager(false);
+
+  m->pre_install_hook.connect(sigc::ptr_fun(&vscreen_suspend));
+  m->post_install_hook.connect(sigc::ptr_fun(&finish_install_run));
+
+  (new ui_download_manager(m))->start();
 }
 
 /** Make sure that no trust violations are about to be committed.  If
@@ -1323,9 +1346,22 @@
     }
 }
 
+static void lists_autoclean_msg(download_update_manager *m)
+{
+  vs_widget_ref msg = vs_center::create(vs_frame::create(vs_label::create(_("Deleting obsolete downloaded files"))));
+  m->post_autoclean_hook.connect(sigc::mem_fun(msg.unsafe_get_ref(),
+					       &vscreen_widget::destroy));
+
+  popup_widget(msg);
+  vscreen_tryupdate();
+}
+
 void really_do_update_lists()
 {
-  (new ui_download_manager(new download_update_manager))->start();
+  download_update_manager *m = new download_update_manager;
+  m->pre_autoclean_hook.connect(sigc::bind(sigc::ptr_fun(lists_autoclean_msg),
+					   m));
+  (new ui_download_manager(m))->start();
 }
 
 void do_update_lists()



More information about the Aptitude-svn-commit mailing list