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

Daniel Burrows dburrows at costa.debian.org
Sat Sep 24 05:19:01 UTC 2005


Author: dburrows
Date: Sat Sep 24 05:18:58 2005
New Revision: 4224

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/solution_screen.cc
Log:
Enable the undo command in solution displays

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Sep 24 05:18:58 2005
@@ -1,5 +1,10 @@
 2005-09-23  Daniel Burrows  <dburrows at debian.org>
 
+	* src/solution_screen.cc:
+
+	  Write a solution_undo_tree (analogue of apt_undo_tree) and use
+	  it to activate the undo command in solution displays.
+
 	* src/ui.cc:
 
 	  Remove the no-longer-necessary do_undo() and undo_enabled()

Modified: branches/aptitude-0.3/aptitude/src/solution_screen.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/solution_screen.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/solution_screen.cc	Sat Sep 24 05:18:58 2005
@@ -299,6 +299,35 @@
   return root;
 }
 
+/** A class for trees in which 'undo' should be mapped to the solution
+ *  undo command.
+ */
+class solution_undo_tree : public menu_tree
+{
+protected:
+  solution_undo_tree()
+  {
+  }
+public:
+  static ref_ptr<solution_undo_tree> create()
+  {
+    ref_ptr<solution_undo_tree> rval(new solution_undo_tree);
+    rval->decref();
+    return rval;
+  }
+
+  bool undo_undo_enabled()
+  {
+    return resman != NULL && resman->has_undo_items();
+  }
+
+  bool undo_undo()
+  {
+    return resman != NULL && resman->undo();
+  }
+};
+typedef ref_ptr<solution_undo_tree> solution_undo_tree_ref;
+
 class solution_examiner : public vs_multiplex
 {
   aptitude_solution last_sol;
@@ -368,7 +397,7 @@
   solution_examiner(const sigc::slot1<void, fragment *> &_set_short_description,
 		    const sigc::slot1<void, aptitude_resolver_dep> &_set_active_dep)
     : vs_multiplex(false),
-      solution_tree(menu_tree::create()), story_tree(menu_tree::create()),
+      solution_tree(solution_undo_tree::create()), story_tree(solution_undo_tree::create()),
       set_short_description(_set_short_description),
       set_active_dep(_set_active_dep)
   {
@@ -517,7 +546,7 @@
   vs_table_ref rval     = vs_table::create();
 
   vs_label_ref l        = vs_label::create(L"");
-  menu_tree_ref info_tree = menu_tree::create();
+  menu_tree_ref info_tree = solution_undo_tree::create();
 
   solution_examiner_ref examiner
     = solution_examiner::create(sigc::mem_fun(l.unsafe_get_ref(),



More information about the Aptitude-svn-commit mailing list