Skip to content
Snippets Groups Projects
Commit be7a7def authored by Nico's avatar Nico
Browse files

Use action instead of clicked function for back button in add contact

parent e5bca2d2
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ class WindowActions(Actions):
self._setup_back_to_sidebar_action()
self._setup_open_about_page_action()
self._setup_open_add_contact_action()
self._setup_open_main_window_action()
self._setup_open_private_chat_action()
def _setup_back_to_sidebar_action(self):
......@@ -37,6 +38,9 @@ class WindowActions(Actions):
def _setup_open_add_contact_action(self):
self._setup_action("open-add-contact", None, self._open_add_contact)
def _setup_open_main_window_action(self):
self._setup_action("open-main-window", None, self._open_main_window)
def _setup_open_private_chat_action(self):
self._setup_action("open-private-chat", GLib.VariantType.new("i"),
self._open_private_chat)
......@@ -54,6 +58,10 @@ class WindowActions(Actions):
def _open_add_contact(self, action, parameter):
self.widget.show_add_contact_container()
# pylint: disable=unused-argument
def _open_main_window(self, action, parameter):
self.widget.show_main_container()
# pylint: disable=unused-argument
def _open_private_chat(self, action, contact_id):
self.widget.current_container.open_private_chat(contact_id.get_int32())
......@@ -4,8 +4,6 @@
from gettext import gettext as _
from gi.repository import GLib
from briar_wrapper.models.contacts import Contacts
from briar_gtk.container import Container
......@@ -54,10 +52,6 @@ class AddContactContainer(Container):
def _on_link_enter(self, widget):
self.on_links_next_pressed(None)
# pylint: disable=unused-argument
def on_link_back_pressed(self, button):
self._back_to_main_window()
# pylint: disable=unused-argument
def on_links_next_pressed(self, button):
link_error_label = self.builder.get_object("link_error_label")
......@@ -118,7 +112,7 @@ class AddContactContainer(Container):
return
alias_error_label.hide()
self._add_contact()
self._back_to_main_window()
APP().window.show_main_container()
def _alias_is_empty(self):
alias = self.builder.get_object("alias_entry").get_text()
......@@ -129,7 +123,3 @@ class AddContactContainer(Container):
their_link = self.builder.get_object("their_link_entry").get_text()
alias = self.builder.get_object("alias_entry").get_text()
contacts.add_pending(their_link, alias)
# pylint: disable=no-self-use
def _back_to_main_window(self):
GLib.idle_add(APP().window.show_main_container)
......@@ -187,7 +187,7 @@
<object class="GtkButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="clicked" handler="on_link_back_pressed"/>
<property name="action_name">win.open-main-window</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment