[Aptitude-devel] r3086 - in branches/aptitude-0.3/aptitude: . src
Daniel Burrows
dburrows@costa.debian.org
Tue, 26 Apr 2005 00:47:48 +0000
Author: dburrows
Date: Tue Apr 26 00:47:44 2005
New Revision: 3086
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/solution_dialog.cc
branches/aptitude-0.3/aptitude/src/ui.cc
branches/aptitude-0.3/aptitude/src/ui.h
Log:
Add buttons to the solution examination dialog.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Tue Apr 26 00:47:44 2005
@@ -1,5 +1,9 @@
2005-04-25 Daniel Burrows <dburrows@debian.org>
+ * src/solution_dialog.cc, src/ui.cc, src/ui.h:
+
+ Add some pushable buttons to issue solution-viewing commands.
+
* src/ui.cc:
Pop up an examination dialog when the user presses 'e'.
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 00:47:44 2005
@@ -19,6 +19,7 @@
#include "solution_dialog.h"
#include "solution_fragment.h"
+#include "ui.h"
#include <aptitude.h>
@@ -27,6 +28,7 @@
#include <vscreen/vs_button.h>
#include <vscreen/vs_center.h>
#include <vscreen/vs_frame.h>
+#include <vscreen/vs_table.h>
#include <vscreen/vs_text_layout.h>
#include <generic/apt.h>
@@ -106,5 +108,41 @@
vscreen_widget *make_solution_dialog()
{
- return new vs_center(new vs_frame(new solution_dialog));
+ vs_table *t=new vs_table;
+ vscreen_widget *rval=new vs_center(new vs_frame(t));
+
+ t->add_widget_opts(new solution_dialog,
+ 0, 0, 1, 4,
+ vs_table::EXPAND | vs_table::FILL,
+ vs_table::FILL | vs_table::SHRINK);
+
+ // TODO: for dialogs like this, I really should have support for
+ // "wrapping" lines of buttons if they get too long, like fragments.
+ vs_button *bprev=new vs_button(_("Previous"));
+ vs_button *bnext=new vs_button(_("Next"));
+ vs_button *bapply=new vs_button(_("Apply"));
+ vs_button *bclose=new vs_button(_("Close"));
+
+ 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));
+ bclose->pressed.connect(sigc::mem_fun(rval,
+ &vscreen_widget::destroy));
+
+ t->add_widget_opts(bprev,
+ 1, 0, 1, 1,
+ vs_table::FILL, vs_table::FILL);
+ t->add_widget_opts(bnext,
+ 1, 1, 1, 1,
+ vs_table::FILL, vs_table::FILL);
+ t->add_widget_opts(bapply,
+ 1, 2, 1, 1,
+ vs_table::FILL, vs_table::FILL);
+ t->add_widget_opts(bclose,
+ 1, 3, 1, 1,
+ vs_table::FILL, vs_table::FILL);
+
+ return rval;
}
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 Tue Apr 26 00:47:44 2005
@@ -1170,7 +1170,7 @@
}
#endif
-static void do_next_solution()
+void do_next_solution()
{
if(apt_cache_file && !(*apt_cache_file)->solutions_exhausted())
try
@@ -1191,7 +1191,7 @@
beep();
}
-static void do_prev_solution()
+void do_previous_solution()
{
if(apt_cache_file && !(*apt_cache_file)->solutions_at_start())
(*apt_cache_file)->previous_solution();
@@ -1199,7 +1199,7 @@
beep();
}
-static void do_apply_solution()
+void do_apply_solution()
{
if(apt_cache_file && (*apt_cache_file)->resolver_exists())
{
@@ -1610,7 +1610,7 @@
sigc::ptr_fun(do_next_solution));
main_stacked->connect_key_post("PrevSolution",
&global_bindings,
- sigc::ptr_fun(do_prev_solution));
+ sigc::ptr_fun(do_previous_solution));
main_stacked->connect_key_post("ApplySolution",
&global_bindings,
sigc::ptr_fun(do_apply_solution));
Modified: branches/aptitude-0.3/aptitude/src/ui.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.h (original)
+++ branches/aptitude-0.3/aptitude/src/ui.h Tue Apr 26 00:47:44 2005
@@ -215,6 +215,15 @@
void do_forget_new();
// Forgets which packages are "new".
+/** Advances to the next solution, if one exists. */
+void do_next_solution();
+
+/** Returns to the previous solution, if one exists. */
+void do_previous_solution();
+
+/** Applies the current solution, if it exists. */
+void do_apply_solution();
+
// These generate particular screens of the UI:
// Info screen