Newer
Older
# Copyright (c) 2019 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
#
# Initial version based on GNOME Lollypop
# https://gitlab.gnome.org/World/lollypop/blob/1.0.2/lollypop.in
import gettext
import locale
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio
PACKAGE_DATA_DIR = '@PACKAGE_DATA_DIR@'
LOCALE_DIR = '@LOCALE_DIR@'
def add_package_to_sys_path():
sys.path.insert(1, PACKAGE_DATA_DIR)
def handle_sigint_default_way():
signal.signal(signal.SIGINT, signal.SIG_DFL)
def prepare_locale():
locale.bindtextdomain('briar-gtk', LOCALE_DIR)
locale.textdomain('briar-gtk')
def prepare_gettext():
gettext.bindtextdomain('briar-gtk', LOCALE_DIR)
gettext.textdomain('briar-gtk')
def prepare_localization():
prepare_locale()
prepare_gettext()
def prepare_resource():
resource = Gio.Resource.load(os.path.join(PACKAGE_DATA_DIR, 'briar-gtk.gresource'))
def prepare():
add_package_to_sys_path()
handle_sigint_default_way()
prepare_localization()
prepare_resource()
def start_application():
from briar.gtk.application import Application
sys.exit(Application("@VERSION@").run(sys.argv))