[Aptitude-svn-commit] r4208 - in branches/aptitude-0.3/aptitude: .
src
Daniel Burrows
dburrows at costa.debian.org
Sat Sep 24 01:04:21 UTC 2005
Author: dburrows
Date: Sat Sep 24 01:04:18 2005
New Revision: 4208
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/menu_redirect.cc
Log:
Merge do_menu_test and do_menu_action; use get_widget_active to filter menu actions.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sat Sep 24 01:04:18 2005
@@ -1,5 +1,13 @@
2005-09-23 Daniel Burrows <dburrows at debian.org>
+ * src/menu_redirect.cc:
+
+ Merge do_menu_test and do_menu_action into do_menu_callback, and
+ make the new routine use get_widget_active() to filter calls:
+ menu actions on a widget are valid only when every ancestor of
+ the widget is either the root or the 'active' widget of its
+ owner.
+
* src/vscreen/vs_multiplex.cc:
Make it compile.
Modified: branches/aptitude-0.3/aptitude/src/menu_redirect.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/menu_redirect.cc (original)
+++ branches/aptitude-0.3/aptitude/src/menu_redirect.cc Sat Sep 24 01:04:18 2005
@@ -24,6 +24,7 @@
#include <sigc++/bind.h>
#include <vscreen/ref_ptr.h>
+#include <vscreen/vs_container.h>
bool menu_redirect::package_enabled() { return false; }
bool menu_redirect::package_install() { return false; }
@@ -58,26 +59,23 @@
bool menu_redirect::find_broken_enabled() { return false; }
bool menu_redirect::find_broken() { return false; }
-static bool do_menu_test(vscreen_widget &viewBare,
- menu_redirect *redirect,
- bool (menu_redirect::* test)())
+static bool do_menu_callback(vscreen_widget &viewBare,
+ menu_redirect *redirect,
+ bool (menu_redirect::* action)())
{
vs_widget_ref view(&viewBare);
+ ref_ptr<vs_container> owner = view->get_owner();
- return active_main_widget()==view &&
- (redirect->*test)();
-}
-
-static bool do_menu_action(vscreen_widget &viewBare,
- menu_redirect *redirect,
- bool (menu_redirect::* action)())
-{
- vs_widget_ref view(&viewBare);
+ while(owner.valid())
+ {
+ if(owner->get_active_widget() != view)
+ return false;
+
+ view = owner;
+ owner = view->get_owner();
+ }
- if(active_main_widget() == view)
- return (redirect->*action)();
- else
- return false;
+ return (redirect->*action)();
}
void create_menu_bindings(menu_redirect *menu_handler,
@@ -87,164 +85,164 @@
// TODO: need to change the condition for enabling the menu to
// check whether the overall widget is visible...
- package_menu_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ package_menu_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_enabled));
- package_install.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_install.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_install));
- package_remove.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_remove.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_remove));
- package_purge.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_purge.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_purge));
- package_hold.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_hold.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_hold));
- package_keep.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_keep.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_keep));
- package_mark_auto.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_mark_auto.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_mark_auto));
- package_unmark_auto.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_unmark_auto.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_unmark_auto));
- package_forbid_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ package_forbid_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_forbid_enabled));
- package_forbid.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_forbid.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_forbid));
- package_information_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ package_information_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_information_enabled));
- package_information.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_information.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_information));
- package_changelog_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ package_changelog_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_changelog_enabled));
- package_changelog.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ package_changelog.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::package_changelog));
- resolver_toggle_rejected_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ resolver_toggle_rejected_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::resolver_toggle_rejected_enabled));
- resolver_toggle_rejected.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ resolver_toggle_rejected.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::resolver_toggle_rejected));
- resolver_toggle_approved_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ resolver_toggle_approved_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::resolver_toggle_approved_enabled));
- resolver_toggle_approved.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ resolver_toggle_approved.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::resolver_toggle_approved));
- resolver_view_target_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ resolver_view_target_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::resolver_view_target_enabled));
- resolver_view_target.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ resolver_view_target.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::resolver_view_target));
- find_search_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ find_search_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_search_enabled));
- find_search_back_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ find_search_back_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_search_back_enabled));
- find_search.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ find_search.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_search));
- find_search_back.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ find_search_back.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_search_back));
- find_research_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ find_research_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_research_enabled));
- find_research.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ find_research.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_research));
- find_limit_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ find_limit_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_limit_enabled));
- find_limit.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ find_limit.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_limit));
- find_cancel_limit_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ find_cancel_limit_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_reset_limit_enabled));
- find_cancel_limit.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ find_cancel_limit.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_reset_limit));
- find_broken_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_test),
+ find_broken_enabled.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_broken_enabled));
- find_broken.connect(sigc::bind(sigc::ptr_fun(do_menu_action),
+ find_broken.connect(sigc::bind(sigc::ptr_fun(do_menu_callback),
valve.weak_ref(),
menu_handler,
&menu_redirect::find_broken));
More information about the Aptitude-svn-commit
mailing list