[meld/ui-next] melddoc: Log when our action helpers don't find named actions
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/ui-next] melddoc: Log when our action helpers don't find named actions
- Date: Sat, 23 Mar 2019 02:01:11 +0000 (UTC)
commit d87746a7190fea606f4cda48726fbd6162366963
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Feb 24 08:58:11 2019 +1000
melddoc: Log when our action helpers don't find named actions
This helps quite a bit during these migrations.
meld/melddoc.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/meld/melddoc.py b/meld/melddoc.py
index 51d5ef7f..8cf9f690 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -189,14 +189,25 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject):
def get_action_state(self, action_name: str):
action = self.view_action_group.lookup_action(action_name)
+ if not action:
+ log.error(f'No action {action_name!r} found')
+ return
return action.get_state().unpack()
def set_action_state(self, action_name: str, state):
# TODO: Try to do GLib.Variant things here instead of in callers
- self.view_action_group.lookup_action(action_name).set_state(state)
+ action = self.view_action_group.lookup_action(action_name)
+ if not action:
+ log.error(f'No action {action_name!r} found')
+ return
+ action.set_state(state)
- def set_action_enabled(self, action, enabled):
- self.view_action_group.lookup_action(action).set_enabled(enabled)
+ def set_action_enabled(self, action_name, enabled):
+ action = self.view_action_group.lookup_action(action_name)
+ if not action:
+ log.error(f'No action {action_name!r} found')
+ return
+ action.set_enabled(enabled)
def on_container_switch_in_event(self, uimanager, window):
"""Called when the container app switches to this tab.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]