- def on_tool_visibility_changed(self, role, active, reason, temporary):
- if reason is "toggle-window-cb":
- return
- tool_item = self.tool_toggle_items.get(role, None)
- if tool_item is None:
+ def on_subwindow_visibility_changed(self, window, active):
+ # Responds to non-tool subwindows being hidden and shown
+ role = window.get_role()
+ self.on_toggle_item_visibility_changed(role, active)
+
+ def on_toggle_item_visibility_changed(self, role, active, *a, **kw):
+ # Responds to any item with a role being hidden or shown by
+ # silently updating its ToggleAction to match.
+ action_name = role[0].upper() + role[1:]
+ action = self.action_group.get_action(action_name)
+ if action is None:
+ warn("Unable to find action %s" % action_name, RuntimeWarning, 1)