[meld/ui-next] melddoc: Make the action group swapping slightly simpler



commit 33c3b72a84f977a171fc17dc8da783eda4a723b4
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Feb 17 08:32:11 2019 +1000

    melddoc: Make the action group swapping slightly simpler
    
    Here we're making use of the API semantics of deleting an action group
    (including one that doesn't exist) by inserting None.

 meld/melddoc.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/meld/melddoc.py b/meld/melddoc.py
index bd3e0136..0bea3798 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -215,8 +215,8 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject):
             a for a in action_groups if a.get_name() == "MainActions"][0]
         uimanager.ensure_update()
 
-        if hasattr(self, "view_action_group"):
-            window.insert_action_group('view', self.view_action_group)
+        window.insert_action_group(
+            'view', getattr(self, 'view_action_group', None))
 
         if hasattr(self, "focus_pane") and self.focus_pane:
             self.scheduler.add_task(self.focus_pane.grab_focus)
@@ -230,8 +230,7 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject):
         self.popup_menu = None
         self.ui_merge_id = None
 
-        if hasattr(self, "view_action_group"):
-            window.insert_action_group('view', None)
+        window.insert_action_group('view', None)
 
     def on_delete_event(self):
         """Called when the docs container is about to close.


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