Commit bd02a7c0 authored by Nico's avatar Nico
Browse files

Make AddContactView from AddContactContainer

parent 75de06e9
# Copyright (c) 2019 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
import os
from gettext import gettext as _
from gi.repository import Gtk
from briar_wrapper.models.contacts import Contacts
from briar_gtk.actions.add_contact import AddContactActions
from briar_gtk.actions.prefixes import ADD_CONTACT_PREFIX
from briar_gtk.container import Container
from briar_gtk.define import APP
from briar_gtk.define import APP, RESOURCES_DIR
class AddContactContainer(Container):
class AddContactView(Gtk.Overlay):
ADD_CONTACT_UI = "add_contact.ui"
STACK_NAME = "add_contact_flow_stack"
......@@ -20,6 +20,7 @@ class AddContactContainer(Container):
def __init__(self):
super().__init__()
self.builder = Gtk.Builder()
AddContactActions(self)
self._setup_view()
self._load_content()
......@@ -72,6 +73,11 @@ class AddContactContainer(Container):
self._setup_add_contact_flow_headers()
self._setup_link_enter_listener()
def _add_from_resource(self, ui_filename):
self.builder.add_from_resource(
os.path.join(RESOURCES_DIR, ui_filename)
)
def _load_content(self):
contacts = Contacts(APP().api)
own_link = contacts.get_link()
......
......@@ -8,7 +8,7 @@ from gettext import gettext as _
from gi.repository import Gio, Gtk
from briar_gtk.actions.window import WindowActions
from briar_gtk.containers.add_contact import AddContactContainer
from briar_gtk.views.add_contact import AddContactView
from briar_gtk.controllers.main_window import MainWindowController
from briar_gtk.views.main_window import MainWindowView
from briar_gtk.containers.startup import StartupContainer
......@@ -111,7 +111,7 @@ class Window(Gtk.ApplicationWindow):
self.current_controller = main_window_controller
def _setup_add_contact_container(self):
self._setup_container(AddContactContainer())
self._setup_container(AddContactView())
def _setup_builder(self):
builder = Gtk.Builder.new()
......
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