Commit 4350aaae authored by Kai Willadsen's avatar Kai Willadsen

dirdiff: Fix state filter initialisation logic

The callback for setting the active state of the filter buttons entirely
replaces the list we're iterating over. This leads to some extremely
odd interactions, and the UI state desyncs from what we think we have
stored in settings. One better fix here might be to have the filter
callback sync individual items or something instead of recreating the
whole list, but... this is less invasive.

It's somewhat surprising that this hasn't bitten us before.
parent 32ae2ed9
......@@ -470,12 +470,16 @@ class DirDiff(MeldDoc, Component):
self.connect("notify::ignore-blank-lines", self.update_comparator)
self.connect("notify::apply-text-filters", self.update_comparator)
# The list copying and state_filters reset here is because the action
# toggled callback modifies the state while we're constructing it.
self.state_filters = []
for s in self.state_actions:
if self.state_actions[s][0] in self.props.status_filters:
action_name = self.state_actions[s][1]
state_filters = []
status_filters = list(self.props.status_filters)
for state, (filter_name, action_name) in self.state_actions.items():
if filter_name in status_filters:
self.state_filters = state_filters
self._scan_in_progress = 0
......@@ -1288,8 +1292,8 @@ class DirDiff(MeldDoc, Component):
def on_filter_state_toggled(self, button):
active_filters = [
a for a in self.state_actions if
state for state, (_, action_name) in self.state_actions.items()
if self.actiongroup.get_action(action_name).get_active()
if set(active_filters) == set(self.state_filters):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment