[Aptitude-svn-commit] r4182 - in branches/aptitude-0.3/aptitude: .
src
Daniel Burrows
dburrows at costa.debian.org
Thu Sep 22 20:25:30 UTC 2005
Author: dburrows
Date: Thu Sep 22 20:25:27 2005
New Revision: 4182
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Add a menu for interacting with the problem resolver.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Thu Sep 22 20:25:27 2005
@@ -1,5 +1,10 @@
2005-09-22 Daniel Burrows <dburrows at debian.org>
+ * src/ui.cc:
+
+ Add a Resolver menu with various resolver commands, for those
+ who like such things.
+
* src/vscreen/vs_staticitem.cc:
Make vs_staticitem really use the whole width (it was using one
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 22 20:25:27 2005
@@ -1518,29 +1518,59 @@
resman->state_changed.connect(sigc::ptr_fun(&start_solution_calculation));
}
-void do_next_solution()
+static bool do_next_solution_enabled()
{
+ if(resman == NULL)
+ return false;
+
resolver_manager::state state = resman->state_snapshot();
- if(resman == NULL ||
- state.selected_solution >= state.generated_solutions ||
- (state.selected_solution == state.generated_solutions - 1 &&
- state.solutions_exhausted))
+ return
+ state.selected_solution < state.generated_solutions ||
+ (state.selected_solution == state.generated_solutions - 1 &&
+ !state.solutions_exhausted);
+}
+
+void do_next_solution()
+{
+ if(!do_next_solution_enabled())
beep();
else
resman->select_next_solution();
}
-void do_previous_solution()
+static bool do_previous_solution_enabled()
{
+ if(resman == NULL)
+ return false;
+
resolver_manager::state state = resman->state_snapshot();
- if(resman == NULL || state.selected_solution == 0)
+ return state.selected_solution > 0;
+}
+
+void do_previous_solution()
+{
+ if(!do_previous_solution_enabled())
beep();
else
resman->select_previous_solution();
}
+static bool do_apply_solution_enabled_from_state(const resolver_manager::state &state)
+{
+ return
+ state.resolver_exists &&
+ state.selected_solution >= 0 &&
+ state.selected_solution < state.generated_solutions;
+}
+
+static bool do_apply_solution_enabled()
+{
+ resolver_manager::state state = resman->state_snapshot();
+ return do_apply_solution_enabled_from_state(state);
+}
+
void do_apply_solution()
{
if(!apt_cache_file)
@@ -1548,15 +1578,13 @@
resolver_manager::state state = resman->state_snapshot();
- if(state.resolver_exists)
+ if(!do_apply_solution_enabled_from_state(state))
+ {
+ beep();
+ return;
+ }
+ else
{
- if(!(state.selected_solution >= 0 &&
- state.selected_solution < state.generated_solutions))
- {
- beep();
- return;
- }
-
undo_group *undo=new apt_undo_group;
try
{
@@ -1591,10 +1619,18 @@
*solver = NULL;
}
+static bool do_examine_solution_enabled()
+{
+ return resman != NULL && resman->resolver_exists();
+}
+
void do_examine_solution()
{
- if(resman == NULL || !resman->resolver_exists())
- return;
+ if(!do_examine_solution_enabled())
+ {
+ beep();
+ return;
+ }
static vs_widget_ref solver;
@@ -1761,6 +1797,26 @@
VS_MENU_END
};
+vs_menu_info resolver_menu[] = {
+ vs_menu_info(vs_menu_info::VS_MENU_ITEM, N_("^Examine Solution"),
+ "ExamineSolution", N_("Examine the currently selected solution to the dependency problems."),
+ sigc::ptr_fun(do_examine_solution),
+ sigc::ptr_fun(do_examine_solution_enabled)),
+ vs_menu_info(vs_menu_info::VS_MENU_ITEM, N_("^Apply Solution"),
+ "ApplySolution", N_("Perform the actions contained in the currently selected solution."),
+ sigc::ptr_fun(do_apply_solution),
+ sigc::ptr_fun(do_apply_solution_enabled))),
+ vs_menu_info(vs_menu_info::VS_MENU_ITEM, N_("Next Solution"),
+ "NextSolution", N_("Select the next solution to the dependency problems."),
+ sigc::ptr_fun(do_next_solution),
+ sigc::ptr_fun(do_next_solution_enabled)),
+ vs_menu_info(vs_menu_info::VS_MENU_ITEM, N_("Previous Solution"),
+ "PrevSolution", N_("Select the previous solution to the dependency problems."),
+ sigc::ptr_fun(do_previous_solution),
+ sigc::ptr_fun(do_previous_solution_enabled)),
+ VS_MENU_END
+};
+
vs_menu_info search_menu[]={
vs_menu_info(vs_menu_info::VS_MENU_ITEM, N_("^Find"), "Search",
N_("Search for a package"),
@@ -2000,6 +2056,7 @@
add_menu(actions_menu, _("Actions"), menu_description);
add_menu(undo_menu, _("Undo"), menu_description);
add_menu(package_menu, _("Package"), menu_description);
+ add_menu(resolver_menu, _("Resolver"), menu_description);
add_menu(search_menu, _("Search"), menu_description);
add_menu(options_menu, _("Options"), menu_description);
views_menu=add_menu(views_menu_info, _("Views"), menu_description);
More information about the Aptitude-svn-commit
mailing list