[meld] vcview: Fix sensitivity for Open External action in VcView (bgo#729280)



commit a304d3abd2d50a559feca0870035e55c5f98d708
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat May 3 07:59:59 2014 +1000

    vcview: Fix sensitivity for Open External action in VcView (bgo#729280)

 meld/vcview.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/meld/vcview.py b/meld/vcview.py
index 1269b6b..f534242 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -186,6 +186,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
         self.ui_file = gnomeglade.ui_file("vcview-ui.xml")
         self.actiongroup = self.VcviewActions
         self.actiongroup.set_translation_domain("meld")
+        self.main_actiongroup = None
         self.model = VcTreeStore()
         self.widget.connect("style-updated", self.model.on_style_updated)
         self.model.on_style_updated(self.widget)
@@ -262,10 +263,24 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                 self.state_filters.append(s)
                 self.actiongroup.get_action(action_name).set_active(True)
 
+    def _set_external_action_sensitivity(self, focused):
+        try:
+            self.main_actiongroup.get_action("OpenExternal").set_sensitive(
+                focused)
+        except AttributeError:
+            pass
+
     def on_container_switch_in_event(self, ui):
-        melddoc.MeldDoc.on_container_switch_in_event(self, ui)
+        self.main_actiongroup = [a for a in ui.get_action_groups()
+                                 if a.get_name() == "MainActions"][0]
+        super(VcView, self).on_container_switch_in_event(ui)
+        self._set_external_action_sensitivity(True)
         self.scheduler.add_task(self.on_treeview_cursor_changed)
 
+    def on_container_switch_out_event(self, ui):
+        self._set_external_action_sensitivity(False)
+        super(VcView, self).on_container_switch_out_event(ui)
+
     def update_visible_columns(self):
         for data_id in self.column_name_map:
             col = self.treeview.get_column(self.column_name_map[data_id])


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