Commit 4d223323 authored by Kai Willadsen's avatar Kai Willadsen

Partial fix for sensitivity setting (closes bgo#638629)

Sensitivity for MeldApp-mediated actions has to be handled on container
switch. FileDiff didn't handle this aggressively enough, and neither
DirDiff or VcView handled it at all. With this commit, FileDiff emits
the next-diff-changed signal correctly, and DirDiff and VcView emit
dummy values; this corrects the regression from previous behaviour.
parent 4a3fb2a8
......@@ -233,6 +233,8 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
label = misc.make_tool_button_widget(self.filter_menu_button.props.label)
self.filter_menu_button.set_label_widget(label)
# FIXME: Add real sensitivity handling
self.emit("next-diff-changed", True, True)
if self.treeview_focussed:
self.scheduler.add_task(self.treeview_focussed.grab_focus)
self.scheduler.add_task(self.on_treeview_cursor_changed)
......
......@@ -286,6 +286,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
def on_container_switch_in_event(self, ui):
melddoc.MeldDoc.on_container_switch_in_event(self, ui)
# FIXME: If no focussed textview, action sensitivity will be unset
if self.textview_focussed:
self.scheduler.add_task(self.textview_focussed.grab_focus)
......@@ -338,10 +339,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
if line != self.cursor.line or force:
chunk, prev, next = self.linediffer.locate_chunk(pane, line)
if chunk != self.cursor.chunk:
if chunk != self.cursor.chunk or force:
self.cursor.chunk = chunk
self.emit("current-diff-changed")
if prev != self.cursor.prev or next != self.cursor.next:
if prev != self.cursor.prev or next != self.cursor.next or force:
self.emit("next-diff-changed", prev is not None,
next is not None)
......@@ -353,7 +354,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
next_conflict = conflict
break
if prev_conflict != self.cursor.prev_conflict or \
next_conflict != self.cursor.next_conflict:
next_conflict != self.cursor.next_conflict or force:
self.emit("next-conflict-changed", prev_conflict is not None,
next_conflict is not None)
......
......@@ -314,9 +314,9 @@ class MeldApp(gnomeglade.Component):
nbl = self.notebook.get_tab_label( newdoc.widget )
self.widget.set_title(nbl.get_label_text() + " - Meld")
self.statusbar.set_doc_status("")
newdoc.on_container_switch_in_event(self.ui)
self.diff_handler = newdoc.connect("next-diff-changed",
self.on_next_diff_changed)
newdoc.on_container_switch_in_event(self.ui)
self.scheduler.add_task( newdoc.scheduler )
def on_notebook_label_changed(self, component, text, tooltip):
......
......@@ -209,6 +209,11 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
self.combobox_vcs.show()
self.combobox_vcs.connect("changed", self.on_vc_change)
def on_container_switch_in_event(self, ui):
melddoc.MeldDoc.on_container_switch_in_event(self, ui)
# FIXME: Add real sensitivity handling
self.emit("next-diff-changed", True, True)
def update_actions_sensitivity(self):
"""Disable actions that use not implemented VC plugin methods
"""
......
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