[gnome-break-timer/dylanmccall/meson-build: 5/25] Include org.gnome.break-timer.gschema.xml in build
- From: Dylan McCall <dylanmccall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-break-timer/dylanmccall/meson-build: 5/25] Include org.gnome.break-timer.gschema.xml in build
- Date: Wed, 23 Jan 2019 04:03:25 +0000 (UTC)
commit 119790a6a635ed30aa0d51abe730ad4fe4989287
Author: Dylan McCall <dylan dylanmccall com>
Date: Sun Dec 30 23:51:23 2018 -0800
Include org.gnome.break-timer.gschema.xml in build
This file is localized using Meson's included i18n module.
build-aux/meson/postinstall.py | 19 +++++++++++++++++++
data/meson.build | 11 +++++++++++
data/org.gnome.break-timer.gschema.xml.in | 29 +++++++++++++++--------------
meson.build | 14 ++++++++++++--
po/meson.build | 1 +
5 files changed, 58 insertions(+), 16 deletions(-)
---
diff --git a/build-aux/meson/postinstall.py b/build-aux/meson/postinstall.py
new file mode 100755
index 0000000..7fb0345
--- /dev/null
+++ b/build-aux/meson/postinstall.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+from os import environ, path
+from subprocess import call
+
+prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+datadir = path.join(prefix, 'share')
+destdir = environ.get('DESTDIR', '')
+
+if not destdir:
+ print('Updating icon cache...')
+ call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
+
+ print('Updating desktop database...')
+ call(['update-desktop-database', '-q', path.join(datadir, 'applications')])
+
+ print('Compiling GSettings schemas...')
+ call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])
+
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..62d969b
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,11 @@
+schema_dir = join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
+
+schema_file = i18n.merge_file(
+ input: 'org.gnome.break-timer.gschema.xml.in',
+ output: 'org.gnome.break-timer.gschema.xml',
+ po_dir: po_dir,
+ install: true,
+ install_dir: schema_dir
+)
+
+gnome.compile_schemas()
diff --git a/data/org.gnome.break-timer.gschema.xml.in b/data/org.gnome.break-timer.gschema.xml.in
index 6b85c9f..53c70a0 100644
--- a/data/org.gnome.break-timer.gschema.xml.in
+++ b/data/org.gnome.break-timer.gschema.xml.in
@@ -1,24 +1,24 @@
<schemalist>
<schema id="org.gnome.break-timer" path="/org/gnome/break-timer/" gettext-domain="gnome-break-timer">
<key name="enabled" type="b">
- <_summary>True to enable GNOME Break Timer</_summary>
+ <summary>True to enable GNOME Break Timer</summary>
<default>false</default>
</key>
<key name="selected-breaks" type="as">
- <_summary>The list of breaks that are currently enabled</_summary>
+ <summary>The list of breaks that are currently enabled</summary>
<default>['microbreak', 'restbreak']</default>
</key>
<key name="quiet-mode" type="b">
- <_summary>True to enable quiet mode</_summary>
- <_description>Hides breaks until quiet-mode-expire-time.</_description>
+ <summary>True to enable quiet mode</summary>
+ <description>Hides breaks until quiet-mode-expire-time.</description>
<default>false</default>
</key>
<key name="quiet-mode-expire-time" type="x">
- <_summary>Time to end quiet mode.</_summary>
- <_description>The time to automatically disable quiet mode, in unix time.</_description>
+ <summary>Time to end quiet mode.</summary>
+ <description>The time to automatically disable quiet mode, in unix time.</description>
<default>0</default>
</key>
@@ -28,29 +28,30 @@
<schema id="org.gnome.break-timer.restbreak" path="/org/gnome/break-timer/restbreak/"
gettext-domain="gnome-break-timer">
<key name="interval-seconds" type="i">
- <_summary>Time between breaks</_summary>
- <_description>The time between rest breaks, in seconds.</_description>
+ <summary>Time between breaks</summary>
+ <description>The time between rest breaks, in seconds.</description>
<default>2400</default>
</key>
<key name="duration-seconds" type="i">
- <_summary>Duration of each break</_summary>
- <_description>The duration of each rest break, in seconds.</_description>
+ <summary>Duration of each break</summary>
+ <description>The duration of each rest break, in seconds.</description>
<default>360</default>
</key>
</schema>
<schema id="org.gnome.break-timer.microbreak" path="/org/gnome/break-timer/microbreak/"
gettext-domain="gnome-break-timer">
<key name="interval-seconds" type="i">
- <_summary>Time between breaks</_summary>
- <_description>The preferred time between micro breaks, in seconds.</_description>
+ <summary>Time between breaks</summary>
+ <description>The preferred time between micro breaks, in seconds.</description>
<default>360</default>
</key>
<key name="duration-seconds" type="i">
<default>30</default>
- <_summary>Duration of each break</_summary>
- <_description>The preferred duration of each micro break, in seconds.</_description>
+ <summary>Duration of each break</summary>
+ <description>The preferred duration of each micro break, in seconds.</description>
</key>
</schema>
</schemalist>
+
diff --git a/meson.build b/meson.build
index 72bb4f7..50e5a2d 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,8 @@
project('gnome-break-timer', 'vala', 'c')
+gnome = import('gnome')
+i18n = import('i18n')
+
valac = meson.get_compiler('vala')
env = environment()
@@ -17,8 +20,11 @@ libcanberra_gtk_dep = dependency('libcanberra-gtk')
libnotify_dep = dependency('libnotify')
# posix_dep = dependency('posix')
+gettext_package = meson.project_name()
+po_dir = join_paths(meson.source_root(), 'po')
+
conf = configuration_data()
-conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('PACKAGE_URL', 'TODO')
@@ -26,7 +32,7 @@ conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('HELPER_DESKTOP_ID', 'TODO')
conf.set_quoted('SETTINGS_DESKTOP_ID', 'TODO')
-add_global_arguments('-DGETTEXT_PACKAGE="gnome-break-timer"', language: 'c')
+add_project_arguments('-DGETTEXT_PACKAGE="' + gettext_package + '"', language: 'c')
configure_file(
output: 'config.h',
@@ -43,6 +49,10 @@ config_lib_dep = declare_dependency(
include_directories: include_directories('.')
)
+subdir('po')
subdir('common')
+subdir('data')
subdir('settings')
# subdir('helper')
+
+meson.add_install_script('build-aux/meson/postinstall.py')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..6a87565
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(gettext_package, preset: 'glib')
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]