Commit fc91cbd8 authored by Nico Alt's avatar Nico Alt

Use CAPS for app constant

parent 5f49ed79
Pipeline #3694 failed with stage
in 3 minutes and 45 seconds
......@@ -6,20 +6,22 @@ from gi.repository import GLib, Gtk
from briar.api.models.private_chat import PrivateChat
from briar.gtk.container import Container
from briar.gtk.define import App
from briar.gtk.define import APP
class ChatContainer(Container):
CONTAINER_UI = "/app/briar/gtk/ui/chat.ui"
def __init__(self, contact_id):
super().__init__()
self._api = App().api
self._api = APP().api
self._contact_id = contact_id
self._setup_view()
self._load_content()
def _setup_view(self):
self.builder.add_from_resource("/app/briar/gtk/ui/chat.ui")
self.builder.add_from_resource(self.CONTAINER_UI)
self.add(self.builder.get_object("chat"))
self.builder.connect_signals(self)
chat_entry = self.builder.get_object("chat_entry")
......
......@@ -6,19 +6,21 @@ from gi.repository import GLib, Gtk
from briar.api.models.contacts import Contacts
from briar.gtk.container import Container
from briar.gtk.define import App
from briar.gtk.define import APP
class MainContainer(Container):
CONTAINER_UI = "/app/briar/gtk/ui/main.ui"
def __init__(self):
super().__init__()
self._api = App().api
self._api = APP().api
self._setup_view()
self._load_content()
def _setup_view(self):
self.builder.add_from_resource("/app/briar/gtk/ui/main.ui")
self.builder.add_from_resource(self.CONTAINER_UI)
self.add(self.builder.get_object("contacts_list"))
self.builder.connect_signals(self)
......@@ -36,4 +38,4 @@ class MainContainer(Container):
# pylint: disable=unused-argument
@staticmethod
def _contact_clicked(widget, contact_id):
GLib.idle_add(App().window.open_private_chat, contact_id)
GLib.idle_add(APP().window.open_private_chat, contact_id)
......@@ -5,14 +5,17 @@
from gi.repository import GLib
from briar.gtk.container import Container
from briar.gtk.define import App
from briar.gtk.define import APP
class StartupContainer(Container):
SETUP_UI = "/app/briar/gtk/ui/main.ui"
LOGIN_UI = "/app/briar/gtk/ui/login.ui"
def __init__(self):
super().__init__()
self._api = App().api
self._api = APP().api
self._setup_view()
# pylint: disable=unused-argument
......@@ -39,17 +42,17 @@ class StartupContainer(Container):
def _setup_view(self):
self.set_hexpand(True)
self.set_vexpand(True)
if not App().api.has_account():
self.builder.add_from_resource("/app/briar/gtk/ui/setup.ui")
if not APP().api.has_account():
self.builder.add_from_resource(self.SETUP_UI)
self.add(self.builder.get_object("setup"))
else:
self.builder.add_from_resource("/app/briar/gtk/ui/login.ui")
self.builder.add_from_resource(self.LOGIN_UI)
self.add(self.builder.get_object("login"))
self.builder.connect_signals(self)
@staticmethod
def _startup_completed(succeeded):
if succeeded:
GLib.idle_add(App().window.on_startup_completed)
GLib.idle_add(APP().window.on_startup_completed)
return
print("Startup failed")
......@@ -13,4 +13,4 @@ APPLICATION_NAME = "Briar"
APPLICATION_STYLING = "resource:///app/briar/gtk/ui/application.css"
BRIAR_HEADLESS_JAR = "/app/briar/briar-headless.jar"
App = Gio.Application.get_default # pylint: disable=invalid-name
APP = Gio.Application.get_default
......@@ -7,7 +7,7 @@ from gi.repository import Gtk
from briar.gtk.containers.chat import ChatContainer
from briar.gtk.containers.main import MainContainer
from briar.gtk.containers.startup import StartupContainer
from briar.gtk.define import App, APPLICATION_ID, APPLICATION_NAME
from briar.gtk.define import APP, APPLICATION_ID, APPLICATION_NAME
from briar.gtk.toolbar import Toolbar
......@@ -28,7 +28,7 @@ class Window(Gtk.ApplicationWindow):
return self._toolbar
def _initialize_gtk_application_window(self):
Gtk.ApplicationWindow.__init__(self, application=App(),
Gtk.ApplicationWindow.__init__(self, application=APP(),
title=APPLICATION_NAME,
icon_name=APPLICATION_ID)
......
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