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

Daniel Burrows dburrows@costa.debian.org
Tue, 26 Apr 2005 22:45:20 +0000


Author: dburrows
Date: Tue Apr 26 22:45:17 2005
New Revision: 3099

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/solution_dialog.cc
Log:
Make the solution dialog disappear when the user presses the Apply key.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Apr 26 22:45:17 2005
@@ -1,5 +1,10 @@
 2005-04-26  Daniel Burrows  <dburrows@debian.org>
 
+	* src/solution_dialog.cc:
+
+	  Make the solution dialog disappear when the user presses the
+	  apply key.
+
 	* src/solution_fragment.cc:
 
 	  Put parens around archives, don't uselessly translate format

Modified: branches/aptitude-0.3/aptitude/src/solution_dialog.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/solution_dialog.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/solution_dialog.cc	Tue Apr 26 22:45:17 2005
@@ -36,6 +36,8 @@
 #include <generic/apt.h>
 #include <generic/aptitude_resolver.h>
 
+#include <sigc++/bind.h>
+
 class solution_dialog:public vs_text_layout
 {
   aptitude_resolver::solution last_sol;
@@ -108,6 +110,12 @@
   }
 };
 
+static void do_apply(vscreen_widget *w)
+{
+  do_apply_solution();
+  w->destroy();
+}
+
 vscreen_widget *make_solution_dialog()
 {
   vs_table *t=new vs_table;
@@ -142,12 +150,15 @@
 
   bprev->pressed.connect(sigc::ptr_fun(do_previous_solution));
   bnext->pressed.connect(sigc::ptr_fun(do_next_solution));
-  bapply->pressed.connect(sigc::ptr_fun(do_apply_solution));
-  bapply->pressed.connect(sigc::mem_fun(rval,
-					&vscreen_widget::destroy));
+  bapply->pressed.connect(sigc::bind(sigc::ptr_fun(do_apply),
+				     rval));
   bclose->pressed.connect(sigc::mem_fun(rval,
 					&vscreen_widget::destroy));
 
+  rval->connect_key("ApplySolution", &global_bindings,
+		    sigc::bind(sigc::ptr_fun(do_apply),
+			       rval));
+
   bprev->set_bg(get_color("DefaultWidgetBackground")|A_REVERSE);
   bnext->set_bg(get_color("DefaultWidgetBackground")|A_REVERSE);
   bapply->set_bg(get_color("DefaultWidgetBackground")|A_REVERSE);