Commit 5946bec4 authored by Nico Alt's avatar Nico Alt

Add action group for login

parent 06df57e0
Pipeline #4235 failed with stage
in 56 seconds
# Copyright (c) 2020 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
from briar_gtk.actions.actions import Actions
# pylint: disable=too-few-public-methods
class LoginActions(Actions):
ACTIONS_PREFIX = "login"
def __init__(self, widget):
super().__init__(widget)
self._setup_simple_action_group(self.ACTIONS_PREFIX)
self._setup_actions()
def _setup_actions(self):
self._setup_login_action()
def _setup_login_action(self):
self._setup_action("login", None, self._login)
# pylint: disable=unused-argument
def _login(self, action, parameter):
self.widget._on_login_pressed()
......@@ -4,6 +4,7 @@
from gi.repository import GLib
from briar_gtk.actions.login import LoginActions
from briar_gtk.container import Container
from briar_gtk.define import APP
......@@ -16,6 +17,7 @@ class LoginContainer(Container):
def __init__(self, window):
super().__init__()
LoginActions(self)
self._window = window
self._setup_view()
......@@ -35,6 +37,7 @@ class LoginContainer(Container):
def _setup_login_flow_headers(self):
login_flow_headers = self.builder.get_object(self.HEADERS_NAME)
login_flow_headers.show_all()
login_flow_headers.insert_action_group("login", self.get_action_group("login"))
self._window.set_titlebar(login_flow_headers)
def _setup_enter_listener(self):
......@@ -43,10 +46,10 @@ class LoginContainer(Container):
# pylint: disable=unused-argument
def _on_password_enter(self, widget):
self.on_login_pressed(None)
self._on_login_pressed()
# pylint: disable=unused-argument
def on_login_pressed(self, button):
def _on_login_pressed(self):
self._show_loading_animation()
self._login()
......
......@@ -116,7 +116,7 @@
<property name="use_underline">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Log in</property>
<signal name="clicked" handler="on_login_pressed"/>
<property name="action_name">login.login</property>
<style>
<class name="suggested-action"/>
</style>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment