Commit b831bb7e authored by Kai Willadsen's avatar Kai Willadsen

Fix some sensitivity handling issues (closes rhbz#835883, rhbz#806489)

Sensitivity was not being correctly set in cases where no comparison
pane was focused. This patch corrects two cases: chunk actions when the
focus pane becomes unset, and merge actions when the focus pane becomes
unset.
parent 1a395954
......@@ -179,6 +179,7 @@
<signal handler="on_textview_button_press_event" name="button_press_event"/>
<signal handler="on_textview_expose_event" name="expose_event"/>
<signal handler="on_textview_focus_in_event" name="focus_in_event"/>
<signal handler="on_textview_focus_out_event" name="focus_out_event"/>
<signal handler="on_key_press_event" name="key_press_event"/>
<signal handler="on_key_release_event" name="key_release_event"/>
<signal handler="on_textview_popup_menu" name="popup-menu"/>
......@@ -254,6 +255,7 @@
<signal handler="on_textview_button_press_event" name="button_press_event"/>
<signal handler="on_textview_expose_event" name="expose_event"/>
<signal handler="on_textview_focus_in_event" name="focus_in_event"/>
<signal handler="on_textview_focus_out_event" name="focus_out_event"/>
<signal handler="on_key_press_event" name="key_press_event"/>
<signal handler="on_key_release_event" name="key_release_event"/>
<signal handler="on_textview_popup_menu" name="popup-menu"/>
......@@ -291,6 +293,7 @@
<signal handler="on_textview_button_press_event" name="button_press_event"/>
<signal handler="on_textview_expose_event" name="expose_event"/>
<signal handler="on_textview_focus_in_event" name="focus_in_event"/>
<signal handler="on_textview_focus_out_event" name="focus_out_event"/>
<signal handler="on_key_press_event" name="key_press_event"/>
<signal handler="on_key_release_event" name="key_release_event"/>
<signal handler="on_textview_popup_menu" name="popup-menu"/>
......
......@@ -401,14 +401,20 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.cursor.line, self.cursor.offset = line, offset
def on_current_diff_changed(self, widget, *args):
pane = self.cursor.pane
chunk_id = self.cursor.chunk
push_left, push_right, pull_left, pull_right, delete, \
copy_left, copy_right = (True,) * 7
pane = self._get_focused_pane()
if pane != -1:
# While this *should* be redundant, it's possible for focus pane
# and cursor pane to be different in several situations.
pane = self.cursor.pane
chunk_id = self.cursor.chunk
if pane == -1 or chunk_id is None:
push_left, push_right, pull_left, pull_right, delete, \
copy_left, copy_right = (False,) * 7
else:
push_left, push_right, pull_left, pull_right, delete, \
copy_left, copy_right = (True,) * 7
# Push and Delete are active if the current pane has something to
# act on, and the target pane exists and is editable. Pull is
# sensitive if the source pane has something to get, and the
......@@ -650,6 +656,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.on_cursor_position_changed(view.get_buffer(), None, True)
self._set_merge_action_sensitivity()
def on_textview_focus_out_event(self, view, event):
self.focus_pane = None
self._set_merge_action_sensitivity()
def _after_text_modified(self, buffer, startline, sizechange):
if self.num_panes > 1:
pane = self.textbuffer.index(buffer)
......
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