Philipp Hörist pushed to branch newcontrol at gajim / gajim
Commits: 05eec1aa by lovetox at 2022-08-04T22:37:41+02:00 cs: Use get_action() so we have less asserts
- - - - -
1 changed file:
- gajim/gtk/message_actions_box.py
Changes:
===================================== gajim/gtk/message_actions_box.py ===================================== @@ -145,20 +145,16 @@ def _connect_actions(self) -> None: ]
for action in actions: - action = app.window.lookup_action(action) - assert action is not None + action = app.window.get_action(action) action.connect('activate', self._on_action)
- action = app.window.lookup_action('set-encryption') - assert action is not None + action = app.window.get_action('set-encryption') action.connect('change-state', self._change_encryption)
- action = app.window.lookup_action('send-file-jingle') - assert action is not None + action = app.window.get_action('send-file-jingle') action.connect('notify::enabled', self._on_send_file_enabled_changed)
- action = app.window.lookup_action('send-file-httpupload') - assert action is not None + action = app.window.get_action('send-file-httpupload') action.connect('notify::enabled', self._on_send_file_enabled_changed)
def _on_action(self, @@ -293,8 +289,7 @@ def _set_chatstate(self, state: bool) -> None: self._contact, Chatstate.INACTIVE)
def _set_encryption_state(self, state: str) -> None: - action = app.window.lookup_action('set-encryption') - assert action is not None + action = app.window.get_action('set-encryption') action.set_state(GLib.Variant('s', state))
if state in ('OMEMO', 'OpenPGP', 'PGP'): @@ -514,8 +509,7 @@ def _update_send_file_button_tooltip(self):
def _on_buffer_changed(self, textbuffer: Gtk.TextBuffer) -> None: has_text = self.msg_textview.has_text - send_message_action = app.window.lookup_action('send-message') - assert send_message_action is not None + send_message_action = app.window.get_action('send-message') send_message_action.set_enabled(has_text)
encryption_enabled, encryption_name = self._get_encryption_state()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/05eec1aab5c3813e45a895274e95b92bd...