Commit 53735119 authored by Nico Alt's avatar Nico Alt

Try to make first files in src/ easier to understand

parent 81042aac
......@@ -15,24 +15,43 @@ import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'
PACKAGE_DATA_DIR = '@PACKAGE_DATA_DIR@'
LOCALE_DIR = '@LOCALE_DIR@'
sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)
def add_package_to_sys_path():
sys.path.insert(1, PACKAGE_DATA_DIR)
if __name__ == '__main__':
locale.bindtextdomain('briar-gtk', localedir)
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')
gettext.bindtextdomain('briar-gtk', localedir)
def prepare_gettext():
gettext.bindtextdomain('briar-gtk', LOCALE_DIR)
gettext.textdomain('briar-gtk')
import gi
def prepare_localization():
prepare_locale()
prepare_gettext()
from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'briar-gtk.gresource'))
def prepare_resource():
resource = Gio.Resource.load(os.path.join(PACKAGE_DATA_DIR, 'briar-gtk.gresource'))
resource._register()
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))
if __name__ == '__main__':
prepare()
start_application()
......@@ -2,16 +2,16 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
moduledir = join_paths(pkgdatadir, 'briar')
PACKAGE_DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
MODULE_DIR = join_paths(PACKAGE_DATA_DIR, 'briar')
python3 = import('python3')
conf = configuration_data()
conf.set('PYTHON', python3.find_python().path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)
conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('PACKAGE_DATA_DIR', PACKAGE_DATA_DIR)
configure_file(
input: 'briar-gtk.in',
......@@ -21,5 +21,5 @@ configure_file(
install_dir: get_option('bindir')
)
install_subdir('briar/api', install_dir: moduledir)
install_subdir('briar/gtk', install_dir: moduledir)
install_subdir('briar/api', install_dir: MODULE_DIR)
install_subdir('briar/gtk', install_dir: MODULE_DIR)
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