Commit a47cd11d authored by Nico Alt's avatar Nico Alt

Abstract resources directory path in containers

parent 8a7c30b6
......@@ -4,9 +4,14 @@
from gi.repository.Gtk import Builder, Overlay
from briar_gtk.define import RESOURCES_DIR
class Container(Overlay):
def __init__(self):
super().__init__()
self.builder = Builder()
def _add_from_resource(self, ui_filename):
self.builder.add_from_resource(RESOURCES_DIR + ui_filename)
......@@ -14,7 +14,7 @@ from briar_gtk.define import APP
class AddContactContainer(Container):
ADD_CONTACT_UI = "/app/briar/gtk/add_contact.ui"
ADD_CONTACT_UI = "add_contact.ui"
STACK_NAME = "add_contact_flow_stack"
HEADERS_NAME = "add_contact_flow_headers"
......@@ -24,7 +24,7 @@ class AddContactContainer(Container):
self._load_content()
def _setup_view(self):
self.builder.add_from_resource(self.ADD_CONTACT_UI)
self._add_from_resource(self.ADD_CONTACT_UI)
self.builder.connect_signals(self)
self._setup_add_contact_flow_stack()
......
......@@ -10,7 +10,7 @@ from briar_gtk.define import APP
class LoginContainer(Container):
LOGIN_UI = "/app/briar/gtk/login.ui"
LOGIN_UI = "login.ui"
STACK_NAME = "login_flow_stack"
HEADERS_NAME = "login_flow_headers"
......@@ -20,7 +20,7 @@ class LoginContainer(Container):
self._setup_view()
def _setup_view(self, ):
self.builder.add_from_resource(self.LOGIN_UI)
self._add_from_resource(self.LOGIN_UI)
self.builder.connect_signals(self)
self._setup_login_flow_stack()
......
......@@ -19,9 +19,9 @@ from briar_gtk.define import APP
class MainWindowContainer(Container):
CONTAINER_UI = "/app/briar/gtk/main_window.ui"
MENU_UI = "/app/briar/gtk/main_menu.ui"
ABOUT_UI = "/app/briar/gtk/about_dialog.ui"
CONTAINER_UI = "main_window.ui"
MENU_UI = "main_menu.ui"
ABOUT_UI = "about_dialog.ui"
def __init__(self):
super().__init__()
......@@ -66,7 +66,7 @@ class MainWindowContainer(Container):
# pylint: disable=line-too-long
def open_about_page(self):
self.builder.add_from_resource(self.ABOUT_UI)
self._add_from_resource(self.ABOUT_UI)
about_dialog = self.builder.get_object("about_dialog")
about_dialog.set_transient_for(APP().window)
......@@ -137,8 +137,8 @@ class MainWindowContainer(Container):
self.history_container.remove(child)
def _setup_view(self):
self.builder.add_from_resource(self.MENU_UI)
self.builder.add_from_resource(self.CONTAINER_UI)
self._add_from_resource(self.MENU_UI)
self._add_from_resource(self.CONTAINER_UI)
self.builder.connect_signals(self)
self._setup_main_window_stack()
......
......@@ -19,7 +19,7 @@ from briar_gtk.widgets.private_message import PrivateMessageWidget
# pylint: disable=too-few-public-methods
class PrivateChatContainer(Container):
CONTAINER_UI = "/app/briar/gtk/private_chat.ui"
CONTAINER_UI = "private_chat.ui"
def __init__(self, contact_name, contact_id):
super().__init__()
......@@ -31,7 +31,7 @@ class PrivateChatContainer(Container):
self._load_content()
def _setup_view(self):
self.builder.add_from_resource(self.CONTAINER_UI)
self._add_from_resource(self.CONTAINER_UI)
self._messages_box = Gtk.ListBox()
self._messages_box.get_style_context().add_class("messages-history")
......
......@@ -12,7 +12,7 @@ from briar_gtk.define import APP
class RegistrationContainer(Container):
REGISTRATION_UI = "/app/briar/gtk/registration.ui"
REGISTRATION_UI = "registration.ui"
STACK_NAME = "registration_flow_stack"
HEADERS_NAME = "registration_flow_headers"
......@@ -21,8 +21,8 @@ class RegistrationContainer(Container):
self._window = window
self._setup_view()
def _setup_view(self, ):
self.builder.add_from_resource(self.REGISTRATION_UI)
def _setup_view(self):
self._add_from_resource(self.REGISTRATION_UI)
self.builder.connect_signals(self)
self._setup_registration_flow_stack()
......
......@@ -10,7 +10,8 @@ from gi.repository import Gio
APPLICATION_ID = "app.briar.gtk"
APPLICATION_NAME = "Briar"
APPLICATION_STYLING_PATH = "resource:///app/briar/gtk/application.css"
RESOURCES_DIR = "/app/briar/gtk/"
APPLICATION_STYLING_PATH = "resource://" + RESOURCES_DIR + "application.css"
BRIAR_HEADLESS_JAR = "/app/briar/briar-headless.jar"
APP = Gio.Application.get_default
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