[meld] Partial fix for sensitivity setting (closes bgo#638629)



commit 4d22332318b939d3880d11726411a3375651faf4
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Jan 4 19:49:40 2011 +1000

    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.

 meld/dirdiff.py  |    2 ++
 meld/filediff.py |    7 ++++---
 meld/meldapp.py  |    2 +-
 meld/vcview.py   |    5 +++++
 4 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 88a741c..8e4b914 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -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)
diff --git a/meld/filediff.py b/meld/filediff.py
index fadf3f1..281c52e 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -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)
 
diff --git a/meld/meldapp.py b/meld/meldapp.py
index a21f717..89222ba 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -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):
diff --git a/meld/vcview.py b/meld/vcview.py
index fcb65d4..83a5b18 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -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
         """



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]