diff options
28 files changed, 515 insertions, 121 deletions
@@ -3,6 +3,7 @@ /.cache *.mo builddir +_build .flatpak-builder ./*.minisig *.minisig @@ -15,8 +15,8 @@ flatpak_cargo_generator := $(HOME)/projects/vendor/flatpak-builder-tools/cargo # Config: Packaging Config ##################################################### linuxdeploy_url := https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(shell uname -m).AppImage linuxdeploy := .cache/linuxdeploy.AppImage -pkgver := $(shell grep '^pkgver=' build-aux/PKGBUILD | cut -d= -f2) -pkgrel := $(shell grep '^pkgrel=' build-aux/PKGBUILD | cut -d= -f2) +pkgver := $(shell grep '^pkgver=' build-aux/arch/PKGBUILD | cut -d= -f2) +pkgrel := $(shell grep '^pkgrel=' build-aux/arch/PKGBUILD | cut -d= -f2) # Filename format: map-aarch64-unstable.flatpak or map-aarch64-unstable-fedora43.rpm filename = $(app_name)-$(arch)-$(channel) @@ -71,23 +71,6 @@ format: lint: cargo fmt -- --check && cargo clippy -# Internationalization / Localization ########################################## - -find_translatable_files: - @find ./ -not -path '*/.*' -type f -name "*.rs" -exec grep -l "tr!(\"\|gettext" {} \; | sort > po/POTFILES - -extract_strings: find_translatable_files - @xgettext --files-from=po/POTFILES --output=po/systems.tranquil.Map.pot --from-code=UTF-8 --add-comments --keyword='tr!' - -po_files := $(wildcard po/*.po) -mo_files := $(patsubst po/%.po,po/%/LC_MESSAGES/systems.tranquil.Map.mo,$(po_files)) - -compile_translations: $(mo_files) - -po/%/LC_MESSAGES/systems.tranquil.Map.mo: po/%.po - @mkdir -p $(dir $@) - msgfmt $< -o $@ - # Container Images ############################################################# build-container-%: @@ -160,7 +143,7 @@ endif package-pacman: @$(eval staging := $(shell mktemp -d)) rsync -a --filter=':- .gitignore' --exclude='.git' . $(staging)/src - cp build-aux/PKGBUILD $(staging)/ + cp build-aux/arch/PKGBUILD $(staging)/ cd $(staging) && PKGEXT='.pkg.tar.gz' makepkg -f mv $(staging)/$(app_name)-$(pkgver)-$(pkgrel)-$(arch).pkg.tar.gz $(app_name)-$(arch)-$(channel)-arch.pkg.tar.gz @rm -rf $(staging) @@ -4,7 +4,11 @@ A wardley mapping tool: Write some text, get a diagram ## Building -Run `make build` +For default settings, `just build` + +This project uses meson and ninja on top of the rust tools. + +1. Run `meson setup _build` ## Installing diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 0000000..2ab86e9 --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,10 @@ +install_data( + '@0@.svg'.format(application_id), + install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps' +) + +install_data( + '@0@-symbolic.svg'.format(base_id), + install_dir: iconsdir / 'hicolor' / 'symbolic' / 'apps', + rename: '@0@-symbolic.svg'.format(application_id) +) diff --git a/data/icons/systems.tranquil.Map-symbolic.svg b/data/icons/systems.tranquil.Map-symbolic.svg new file mode 100644 index 0000000..76beb4d --- /dev/null +++ b/data/icons/systems.tranquil.Map-symbolic.svg @@ -0,0 +1 @@ +<svg width="512" xmlns="http://www.w3.org/2000/svg" height="512" id="screenshot-fff008b5-167b-80ed-8007-d04e464e63ca" viewBox="0 0 512 512" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1"><g id="shape-fff008b5-167b-80ed-8007-d04e464e63ca"><defs><clipPath id="frame-clip-fff008b5-167b-80ed-8007-d04e464e63ca-render-1" class="frame-clip frame-clip-def"><rect rx="0" ry="0" x="0" y="0" width="512" height="512" transform="matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)"/></clipPath></defs><g class="frame-container-wrapper"><g class="frame-container-blur"><g class="frame-container-shadows"><g clip-path="url(#frame-clip-fff008b5-167b-80ed-8007-d04e464e63ca-render-1)" fill="none"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e464e63ca"><rect width="512" height="512" class="frame-background" x="0" transform="matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)" style="fill: rgb(255, 255, 255); fill-opacity: 1;" ry="0" rx="0" y="0"/></g><g class="frame-children"><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f00"><g class="frame-container-wrapper"><g class="frame-container-blur"><g class="frame-container-shadows"><g fill="none"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f00"><rect width="512" height="313.9999999999999" class="frame-background" x="0" transform="matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)" style="fill: rgb(255, 255, 255); fill-opacity: 0;" ry="0" rx="0" y="99.00000000000009"/></g><g class="frame-children"><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f01" rx="0" ry="0" style="opacity: 1;"><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f02" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f02"><path d="M220.1663818359375,109.581787109375L47.75384521484375,408.10479736328125L34.83819580078125,400.65350341796875L207.2530517578125,102.12744140625L220.1663818359375,109.581787109375ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f03" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f03"><path d="M233.745361328125,139.44955444335938L78.2607421875,408.66058349609375L64.65948486328125,400.810546875L220.1441650390625,131.59954833984375L233.745361328125,139.44955444335938ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f04" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f04"><path d="M248.6656494140625,162.676025390625L107.31591796875,407.4139404296875L93.7147216796875,399.56396484375L235.064453125,154.82601928710938L248.6656494140625,162.676025390625ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f05" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f05"><path d="M262.8006591796875,191.9722900390625L137.156494140625,409.5177001953125L123.55517578125,401.667724609375L249.1993408203125,184.12228393554688L262.8006591796875,191.9722900390625ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f06" rx="0" ry="0" style="opacity: 1;"><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f07" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f07"><path d="M293.9317626953125,109.581787109375L466.347412109375,408.10479736328125L479.2630615234375,400.65350341796875L306.84814453125,102.12744140625L293.9317626953125,109.581787109375ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f08" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f08"><path d="M363.8497314453125,282.1593322753906L436.0950927734375,407.25067138671875L449.6962890625,399.40069580078125L377.450927734375,274.309326171875L363.8497314453125,282.1593322753906ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f09" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f09"><path d="M349.7147216796875,311.458740234375L406.254638671875,409.35137939453125L419.8558349609375,401.5013427734375L363.31591796875,303.6087341308594L349.7147216796875,311.458740234375ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f0a" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f0a"><path d="M334.79443359375,334.68524169921875L377.1993408203125,408.10479736328125L390.8006591796875,400.2547607421875L348.395751953125,326.835205078125L334.79443359375,334.68524169921875ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f0b" rx="0" ry="0" style="opacity: 1;"><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f0c" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f0c"><path d="M264.11962890625,110.70907592773438L322.2301025390625,211.3209228515625L335.831298828125,203.47091674804688L277.7208251953125,102.85906982421875L264.11962890625,110.70907592773438ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f0d" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f0d"><path d="M235.064453125,109.45932006835938L307.309814453125,234.55068969726562L320.9110107421875,226.70068359375L248.6656494140625,101.60931396484375L235.064453125,109.45932006835938ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f0e" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f0e"><path d="M202.8680419921875,108.21273803710938L289.2484130859375,257.77728271484375L302.8497314453125,249.92727661132812L216.4693603515625,100.36273193359375L202.8680419921875,108.21273803710938ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f0f" rx="0" ry="0" style="opacity: 1;"><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f10" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f10"><path d="M221.96630859375,400.0443115234375L177.9908447265625,323.9056396484375L164.3895263671875,331.75567626953125L208.364990234375,407.89434814453125L221.96630859375,400.0443115234375ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f11" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f11"><path d="M249.9908447265625,400.65350341796875L191.88037109375,300.0384826660156L178.9677734375,307.48974609375L237.0782470703125,408.10479736328125L249.9908447265625,400.65350341796875ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f12" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f12"><path d="M279.81591796875,400.65350341796875L206,272.843017578125L193.086669921875,280.2973327636719L266.902587890625,408.10479736328125L279.81591796875,400.65350341796875ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f13" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f13"><path d="M309.6434326171875,400.65350341796875L223.2630615234375,251.08905029296875L210.347412109375,258.54339599609375L296.727783203125,408.10479736328125L309.6434326171875,400.65350341796875ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f14" rx="0" ry="0" style="opacity: 1;"><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f15" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f15"><path d="M293.1748046875,400.43682861328125L381.125732421875,248.15316772460938L394.72705078125,256.003173828125L306.776123046875,408.286865234375L293.1748046875,400.43682861328125ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f16" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f16"><path d="M281.03759765625,371.34161376953125L365.847412109375,224.49639892578125L378.7637939453125,231.95074462890625L293.9539794921875,378.79290771484375L281.03759765625,371.34161376953125ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f17" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f17"><path d="M266.4754638671875,346.1839599609375L352.8558349609375,196.62258911132812L366.45703125,204.47259521484375L280.07666015625,354.033935546875L266.4754638671875,346.1839599609375ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f18" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f18"><path d="M249.1993408203125,321.93682861328125L337.1502685546875,169.65316772460938L350.7515869140625,177.503173828125L262.8006591796875,329.786865234375L249.1993408203125,321.93682861328125ZZ" fill-rule="nonzero" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g></g><g id="shape-fff008b5-167b-80ed-8007-d04e727f1f19" style="opacity: 1;"><g class="fills" id="fills-fff008b5-167b-80ed-8007-d04e727f1f19"><path d="M512,99L0,99L0,413L512,413L512,99M497.0859375,113.85845947265625L497.0859375,398.14154052734375L14.91412353515625,398.14154052734375L14.91412353515625,113.85845947265625L497.0859375,113.85845947265625" style="fill: rgb(15, 38, 31); fill-opacity: 1;"/></g></g></g></g></g></g></g></g></g></g></g></g></g></g></svg>
\ No newline at end of file diff --git a/resources/logo.svg b/data/icons/systems.tranquil.Map.svg index 8700fe1..8700fe1 100644 --- a/resources/logo.svg +++ b/data/icons/systems.tranquil.Map.svg diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..3ca5480 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,79 @@ +subdir('icons') + +################################################################################ +# Desktop File +################################################################################ +desktop_file = i18n.merge_file( + type: 'desktop', + input: configure_file( + input: '@0@.desktop.in.in'.format(base_id), + output: '@BASENAME@', + configuration: { + 'app-id': application_id, + 'gettext-domain': gettext_domain + } + ), + output: '@0@.desktop'.format(application_id), + po_dir: podir, + install: true, + install_dir: datadir / 'applications' +) + +if desktop_file_validate.found() + test( + 'validate-desktop', + desktop_file_validate, + args: [ + desktop_file.full_path() + ], + depends: desktop_file, + ) +endif + +################################################################################ +# Appdata / Metainfo File +################################################################################ +appdata_file = i18n.merge_file( + input: configure_file( + input: '@0@.metainfo.xml.in.in'.format(base_id), + output: '@BASENAME@', + configuration: { + 'app-id': application_id, + 'gettext-domain': gettext_domain + } + ), + output: '@0@.metainfo.xml'.format(application_id), + po_dir: podir, + install: true, + install_dir: datadir / 'metainfo' +) + +if appstream_util.found() + test( + 'validate-appdata', appstream_util, + args: [ + 'validate', '--nonet', appdata_file.full_path() + ], + depends: appdata_file, + ) +endif + +################################################################################ +# DBUS Service File +################################################################################ +configure_file( + input: '@0@.service.in'.format(base_id), + output: '@BASENAME@', + configuration: { + 'app-id': application_id, + 'binary': meson.project_name(), + 'bindir': bindir + }, + install: true, + install_dir: datadir / 'dbus-1' / 'services' +) + +install_data( + 'wmap.lang', + install_dir: datadir / 'gtksourceview-5' / 'language-specs' +) diff --git a/data/systems.tranquil.Map.desktop.in.in b/data/systems.tranquil.Map.desktop.in.in new file mode 100644 index 0000000..82b4bec --- /dev/null +++ b/data/systems.tranquil.Map.desktop.in.in @@ -0,0 +1,14 @@ +[Desktop Entry] +Type=Application +Name=application.name +GenericName=application.generic_name +Comment=application.comment +Categories=GNOME;GTK;Graphics;Utility; +Icon=@app-id@ +Exec=map %u +Terminal=false +Keywords=application.tags +X-GNOME-Gettext-Domain=@gettext-domain@ +MimeType=application/vnd.wmap +StartupNotify=true +DBusActivatable=true diff --git a/resources/systems.tranquil.Map.metainfo.xml b/data/systems.tranquil.Map.metainfo.xml.in.in index 465e9e6..75ff997 100644 --- a/resources/systems.tranquil.Map.metainfo.xml +++ b/data/systems.tranquil.Map.metainfo.xml.in.in @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <component type="desktop-application"> - <id>systems.tranquil.Map</id> + <id>@app-id@</id> - <name>Map</name> - <summary>Visualize your business landscape</summary> + <name>application.name</name> + <summary>application.summary</summary> <metadata_license>CC-BY-SA-4.0</metadata_license> <project_license>AGPL-3.0-or-later</project_license> @@ -19,20 +19,20 @@ <description> <p> - Map is a wardley map editor for linux that uses a simple language to easily create and edit maps that visualize an evolving environment. Draw components, link dependencies, create groups, write notes, or add inertia and evolution markers, and see your map change in an instant. + application.description </p> </description> - <launchable type="desktop-id">systems.tranquil.Map.desktop</launchable> + <launchable type="desktop-id">@app-id@.desktop</launchable> <screenshots> <screenshot type="default"> <image>https://map.tranquil.systems/img/screenshots/key-flathub.png</image> - <caption>The main window of Map showing the code editor on the left pane, and the rendered preview on the right pane.</caption> + <caption>application.screenshot.key.caption</caption> </screenshot> <screenshot> <image>https://map.tranquil.systems/img/screenshots/preferences-flathub.png</image> - <caption>A lineup of the preference panes in map, showing the ways in which you can customize your experience.</caption> + <caption>application.screenshot.preferences.caption</caption> </screenshot> </screenshots> @@ -74,5 +74,5 @@ </branding> <update_contact>inquiries@work.bdr.sh</update_contact> - <translation type="gettext">systems.tranquil.Map</translation> + <translation type="gettext">@gettext-domain@</translation> </component> diff --git a/data/systems.tranquil.Map.service.in b/data/systems.tranquil.Map.service.in new file mode 100644 index 0000000..b6cd998 --- /dev/null +++ b/data/systems.tranquil.Map.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=@app-id@ +Exec=@bindir@/@binary@ --gapplication-service diff --git a/resources/wmap.lang b/data/wmap.lang index e05c8d3..e05c8d3 100644 --- a/resources/wmap.lang +++ b/data/wmap.lang diff --git a/justfile b/justfile new file mode 100644 index 0000000..37ddc01 --- /dev/null +++ b/justfile @@ -0,0 +1,14 @@ +# Build ######################################################################## +build: + meson setup _build + meson compile -C _build + +# Internationalization / Localization ########################################## + +# Finds all files that can be translated and adds them to the POTFILES +find_translatable_files: + find ./ -not -path '*/.*' -type f -name "*.rs" -exec grep -l "tr!(\"\|gettext" {} \; | sed 's|^\./||' | sort > po/POTFILES + find ./data -not -path '*/.*' -name "*.in.in" -type f | sed 's|^\./||' | sort >> po/POTFILES + +extract_strings: find_translatable_files + @xgettext --files-from=po/POTFILES --output=po/systems.tranquil.Map.pot --from-code=UTF-8 --add-comments --keyword='tr!' diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..1236895 --- /dev/null +++ b/meson.build @@ -0,0 +1,95 @@ +################################################################################ +# Project Settings +################################################################################ +# TODO: Consider whether I need to add version and license or if meson is smart +# enough to read that from Cargo.toml. +project('map', 'rust', version: '1.0.4', meson_version: '>= 1.0.0') + +base_id = 'systems.tranquil.Map' + +################################################################################ +# Imports +################################################################################ +i18n = import('i18n') +gnome = import('gnome') +rust = import('rust') + +################################################################################ +# Dependencies +################################################################################ + +dependency('glib-2.0', version: '>= 2.86.0') +dependency('gio-2.0', version: '>= 2.86.0') +dependency('gtk4', version: '>= 4.20.3') +dependency('libadwaita-1', version: '>= 1.8.4') +dependency('gtksourceview-5', version: '>= 5.18.0') + +################################################################################ +# Required Programs +################################################################################ +find_program('cargo') +find_program('glib-compile-resources') +find_program('glib-compile-schemas') +desktop_file_validate = find_program('desktop-file-validate') +appstream_util = find_program('appstream-util') +cargo = find_program('cargo') + +################################################################################ +# Directories +################################################################################ +prefix = get_option('prefix') +bindir = prefix / get_option('bindir') +localedir = prefix / get_option('localedir') +datadir = prefix / get_option('datadir') + +pkgdatadir = datadir / meson.project_name() +iconsdir = datadir / 'icons' +podir = meson.project_source_root() / 'po' + +################################################################################ +# Build Metadata +################################################################################ +version = meson.project_version() + +if get_option('profile') == 'development' + profile = 'Unstable' + vcs_tag = run_command('jj', 'log', '-r', '@', '--no-graph', '-T', 'change_id.short(8)', check: false).stdout().strip() + if vcs_tag == '' + version_suffix = '-unstable' + else + version_suffix = '-@0@'.format(vcs_tag) + endif + application_id = '@0@.@1@'.format(base_id, profile) +else + profile = '' + version_suffix = '' + application_id = base_id +endif + +gettext_domain = application_id + +subdir('src') +subdir('data') +subdir('po') + +summary({ + 'prefix': get_option('prefix'), + 'libdir': get_option('libdir'), + 'localedir': get_option('localedir'), + 'datadir': get_option('datadir'), + 'bindir': get_option('bindir'), + }, + section: 'Directories', +) + +summary({ + 'Profile': get_option('profile'), + }, + section: 'Build options', +) + +gnome.post_install( + gtk_update_icon_cache: true, + glib_compile_schemas: true, + update_desktop_database: true, +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..5903d62 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,9 @@ +option ( + 'profile', + type: 'combo', + choices: [ + 'default', + 'development' + ], + value: 'default', +) diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..7741b83 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +en_US diff --git a/po/POTFILES b/po/POTFILES index 57d39e7..0ded466 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -1,17 +1,19 @@ -./src/components/footer.rs -./src/components/header.rs -./src/components/preference_pages/editor.rs -./src/components/preference_pages/general.rs -./src/components/preference_pages/map.rs -./src/components/preference_pages/stages.rs -./src/components/preference_pages/templates.rs -./src/components/preferences_window.rs -./src/components/stage_form.rs -./src/components/template_row.rs -./src/dialogs.rs -./src/handlers/export.rs -./src/handlers/file.rs -./src/i18n.rs -./src/main.rs -./src/preferences/models.rs -./src/stages.rs +src/components/footer.rs +src/components/header.rs +src/components/preference_pages/editor.rs +src/components/preference_pages/general.rs +src/components/preference_pages/map.rs +src/components/preference_pages/stages.rs +src/components/preference_pages/templates.rs +src/components/preferences_window.rs +src/components/stage_form.rs +src/components/template_row.rs +src/dialogs.rs +src/handlers/export.rs +src/handlers/file.rs +src/i18n.rs +src/main.rs +src/preferences/models.rs +src/stages.rs +data/systems.tranquil.Map.desktop.in.in +data/systems.tranquil.Map.metainfo.xml.in.in diff --git a/po/en_US.po b/po/en_US.po index 6de266d..ba1145f 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-30 13:38+0200\n" -"PO-Revision-Date: 2026-03-30 13:39+0200\n" +"POT-Creation-Date: 2026-04-03 17:32+0200\n" +"PO-Revision-Date: 2026-04-03 17:32+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: en_US\n" @@ -70,27 +70,27 @@ msgstr "About" msgid "command.application.preferences" msgstr "Preferences..." -#: src/components/preference_pages/editor.rs:72 +#: src/components/preference_pages/editor.rs:73 msgid "preferences.editor.font_size.title" msgstr "Font Size" -#: src/components/preference_pages/editor.rs:92 +#: src/components/preference_pages/editor.rs:93 msgid "preferences.editor.default_font_size" msgstr "Default" -#: src/components/preference_pages/editor.rs:106 +#: src/components/preference_pages/editor.rs:107 msgid "preferences.editor.editor_style.title" msgstr "Editor Style" -#: src/components/preference_pages/editor.rs:120 +#: src/components/preference_pages/editor.rs:121 msgid "preferences.editor.font" msgstr "Font" -#: src/components/preference_pages/editor.rs:151 +#: src/components/preference_pages/editor.rs:152 msgid "preferences.editor.editor_style.soft_wrap_lines" msgstr "Soft wrap lines" -#: src/components/preference_pages/editor.rs:160 +#: src/components/preference_pages/editor.rs:161 msgid "preferences.editor.editor_style.use_custom_font" msgstr "Use custom font" @@ -160,27 +160,27 @@ msgstr "Custom Stages" msgid "preferences.stages.explanation" msgstr "Custom stages allow you to define your own evolution axis label." -#: src/components/preference_pages/stages.rs:83 +#: src/components/preference_pages/stages.rs:85 msgid "preferences.stages.column.name" msgstr "Name" -#: src/components/preference_pages/stages.rs:89 +#: src/components/preference_pages/stages.rs:91 msgid "preferences.stages.column.stage_i" msgstr "Stage I" -#: src/components/preference_pages/stages.rs:95 +#: src/components/preference_pages/stages.rs:97 msgid "preferences.stages.column.stage_ii" msgstr "Stage II" -#: src/components/preference_pages/stages.rs:101 +#: src/components/preference_pages/stages.rs:103 msgid "preferences.stages.column.stage_iii" msgstr "Stage III" -#: src/components/preference_pages/stages.rs:107 +#: src/components/preference_pages/stages.rs:109 msgid "preferences.stages.column.stage_iv" msgstr "Stage IV" -#: src/components/preference_pages/stages.rs:130 +#: src/components/preference_pages/stages.rs:132 msgid "preferences.stages.help.add" msgstr "Add custom stage" @@ -189,19 +189,19 @@ msgstr "Add custom stage" msgid "preferences.templates.title" msgstr "Templates" -#: src/components/preference_pages/templates.rs:115 +#: src/components/preference_pages/templates.rs:116 msgid "preferences.templates.help.remove" msgstr "Remove template" -#: src/components/preference_pages/templates.rs:123 +#: src/components/preference_pages/templates.rs:124 msgid "preferences.templates.help.add" msgstr "Add template" -#: src/components/preference_pages/templates.rs:127 +#: src/components/preference_pages/templates.rs:128 msgid "dialog.template.default_label" msgstr "My Template" -#: src/components/preference_pages/templates.rs:186 +#: src/components/preference_pages/templates.rs:187 msgid "preferences.templates.empty" msgstr "There are no templates. Click on the + button to create one." @@ -229,16 +229,16 @@ msgstr "Stages" msgid "preferences.menu.templates" msgstr "Templates" -#: src/components/preferences_window.rs:408 -#: src/components/preferences_window.rs:434 +#: src/components/preferences_window.rs:436 +#: src/components/preferences_window.rs:462 msgid "dialog.file_type.json" msgstr "JSON File" -#: src/components/preferences_window.rs:414 +#: src/components/preferences_window.rs:442 msgid "dialog.export_preferences.title" msgstr "Export Preferences" -#: src/components/preferences_window.rs:440 +#: src/components/preferences_window.rs:468 msgid "dialog.import_preferences.title" msgstr "Import Preferences" @@ -930,6 +930,83 @@ msgstr "Previous Experience" msgid "stages.behavior.iv" msgstr "Known / common usage" +#: data/systems.tranquil.Map.desktop.in.in:3 +#: data/systems.tranquil.Map.metainfo.xml.in.in:5 +msgid "application.name" +msgstr "Map" + +#: data/systems.tranquil.Map.desktop.in.in:4 +msgid "application.generic_name" +msgstr "Wardley Map Editor" + +#: data/systems.tranquil.Map.desktop.in.in:5 +msgid "application.comment" +msgstr "Wardley Map editor for Linux" + +#: data/systems.tranquil.Map.desktop.in.in:10 +msgid "application.tags" +msgstr "wardley;wmap;maps;editor;wardley maps;wardley mapping;" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:6 +msgid "application.summary" +msgstr "Visualize your business landscape" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:21 +msgid "application.description" +msgstr "" +"Map is a wardley map editor for linux that uses a simple language to easily " +"create and edit maps that visualize an evolving environment. Draw " +"components, link dependencies, create groups, write notes, or add inertia " +"and evolution markers, and see your map change in an instant." + +#: data/systems.tranquil.Map.metainfo.xml.in.in:31 +msgid "application.screenshot.key.caption" +msgstr "" +"The main window of Map showing the code editor on the left pane, and the " +"rendered preview on the right pane." + +#: data/systems.tranquil.Map.metainfo.xml.in.in:35 +msgid "application.screenshot.preferences.caption" +msgstr "" +"A lineup of the preference panes in map, showing the ways in which you can " +"customize your experience." + +#: data/systems.tranquil.Map.metainfo.xml.in.in:48 +msgid "Editing preferences now works better on small screens." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:50 +msgid "" +"Templates preferences window uses a collapsible sidebar to work better in " +"small screen sizes." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:51 +msgid "" +"The layout of all other preference windows should display properly in screen " +"sizes up to 360px" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:57 +msgid "Improved layout for small screens, and about window." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:59 +msgid "" +"Automatically switches to vertical layout when using smaller window sizes " +"(eg. for phones)" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:60 +msgid "" +"Adds an about window that includes a link to report issues, and a reference " +"of the language." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:68 +msgid "Rubén Beltrán del Río" +msgstr "" + #~ msgid "dialog.action.open" #~ msgstr "Open" diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..7f15404 --- /dev/null +++ b/po/meson.build @@ -0,0 +1 @@ +i18n.gettext(gettext_domain, preset: 'glib') diff --git a/po/systems.tranquil.Map.pot b/po/systems.tranquil.Map.pot index ff3fa48..bc292e2 100644 --- a/po/systems.tranquil.Map.pot +++ b/po/systems.tranquil.Map.pot @@ -8,13 +8,13 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-30 13:38+0200\n" +"POT-Creation-Date: 2026-04-03 17:32+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "Language: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: src/components/footer.rs:59 src/components/header.rs:186 @@ -69,27 +69,27 @@ msgstr "" msgid "command.application.preferences" msgstr "" -#: src/components/preference_pages/editor.rs:72 +#: src/components/preference_pages/editor.rs:73 msgid "preferences.editor.font_size.title" msgstr "" -#: src/components/preference_pages/editor.rs:92 +#: src/components/preference_pages/editor.rs:93 msgid "preferences.editor.default_font_size" msgstr "" -#: src/components/preference_pages/editor.rs:106 +#: src/components/preference_pages/editor.rs:107 msgid "preferences.editor.editor_style.title" msgstr "" -#: src/components/preference_pages/editor.rs:120 +#: src/components/preference_pages/editor.rs:121 msgid "preferences.editor.font" msgstr "" -#: src/components/preference_pages/editor.rs:151 +#: src/components/preference_pages/editor.rs:152 msgid "preferences.editor.editor_style.soft_wrap_lines" msgstr "" -#: src/components/preference_pages/editor.rs:160 +#: src/components/preference_pages/editor.rs:161 msgid "preferences.editor.editor_style.use_custom_font" msgstr "" @@ -157,27 +157,27 @@ msgstr "" msgid "preferences.stages.explanation" msgstr "" -#: src/components/preference_pages/stages.rs:83 +#: src/components/preference_pages/stages.rs:85 msgid "preferences.stages.column.name" msgstr "" -#: src/components/preference_pages/stages.rs:89 +#: src/components/preference_pages/stages.rs:91 msgid "preferences.stages.column.stage_i" msgstr "" -#: src/components/preference_pages/stages.rs:95 +#: src/components/preference_pages/stages.rs:97 msgid "preferences.stages.column.stage_ii" msgstr "" -#: src/components/preference_pages/stages.rs:101 +#: src/components/preference_pages/stages.rs:103 msgid "preferences.stages.column.stage_iii" msgstr "" -#: src/components/preference_pages/stages.rs:107 +#: src/components/preference_pages/stages.rs:109 msgid "preferences.stages.column.stage_iv" msgstr "" -#: src/components/preference_pages/stages.rs:130 +#: src/components/preference_pages/stages.rs:132 msgid "preferences.stages.help.add" msgstr "" @@ -186,19 +186,19 @@ msgstr "" msgid "preferences.templates.title" msgstr "" -#: src/components/preference_pages/templates.rs:115 +#: src/components/preference_pages/templates.rs:116 msgid "preferences.templates.help.remove" msgstr "" -#: src/components/preference_pages/templates.rs:123 +#: src/components/preference_pages/templates.rs:124 msgid "preferences.templates.help.add" msgstr "" -#: src/components/preference_pages/templates.rs:127 +#: src/components/preference_pages/templates.rs:128 msgid "dialog.template.default_label" msgstr "" -#: src/components/preference_pages/templates.rs:186 +#: src/components/preference_pages/templates.rs:187 msgid "preferences.templates.empty" msgstr "" @@ -226,16 +226,16 @@ msgstr "" msgid "preferences.menu.templates" msgstr "" -#: src/components/preferences_window.rs:408 -#: src/components/preferences_window.rs:434 +#: src/components/preferences_window.rs:436 +#: src/components/preferences_window.rs:462 msgid "dialog.file_type.json" msgstr "" -#: src/components/preferences_window.rs:414 +#: src/components/preferences_window.rs:442 msgid "dialog.export_preferences.title" msgstr "" -#: src/components/preferences_window.rs:440 +#: src/components/preferences_window.rs:468 msgid "dialog.import_preferences.title" msgstr "" @@ -774,3 +774,72 @@ msgstr "" #: src/stages.rs:209 msgid "stages.behavior.iv" msgstr "" + +#: data/systems.tranquil.Map.desktop.in.in:3 +#: data/systems.tranquil.Map.metainfo.xml.in.in:5 +msgid "application.name" +msgstr "" + +#: data/systems.tranquil.Map.desktop.in.in:4 +msgid "application.generic_name" +msgstr "" + +#: data/systems.tranquil.Map.desktop.in.in:5 +msgid "application.comment" +msgstr "" + +#: data/systems.tranquil.Map.desktop.in.in:10 +msgid "application.tags" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:6 +msgid "application.summary" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:21 +msgid "application.description" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:31 +msgid "application.screenshot.key.caption" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:35 +msgid "application.screenshot.preferences.caption" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:48 +msgid "Editing preferences now works better on small screens." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:50 +msgid "" +"Templates preferences window uses a collapsible sidebar to work better in " +"small screen sizes." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:51 +msgid "" +"The layout of all other preference windows should display properly in screen " +"sizes up to 360px" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:57 +msgid "Improved layout for small screens, and about window." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:59 +msgid "" +"Automatically switches to vertical layout when using smaller window sizes " +"(eg. for phones)" +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:60 +msgid "" +"Adds an about window that includes a link to report issues, and a reference " +"of the language." +msgstr "" + +#: data/systems.tranquil.Map.metainfo.xml.in.in:68 +msgid "Rubén Beltrán del Río" +msgstr "" diff --git a/resources/systems.tranquil.Map.desktop b/resources/systems.tranquil.Map.desktop deleted file mode 100644 index c3b8a70..0000000 --- a/resources/systems.tranquil.Map.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Map -GenericName=Wardley Map Editor -Comment=Wardley Map editor for Linux -Categories=GNOME;GTK;Graphics;Utility; -Icon=systems.tranquil.Map -Exec=map %u -Terminal=false -Keywords=wardley;wmap;maps;editor;wardley maps;wardley mapping; -X-GNOME-Gettext-Domain=systems.tranquil.Map -MimeType=application/vnd.wmap -StartupNotify=true -DBusActivatable=true diff --git a/resources/systems.tranquil.Map.service b/resources/systems.tranquil.Map.service deleted file mode 100644 index 1c89966..0000000 --- a/resources/systems.tranquil.Map.service +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=systems.tranquil.Map -Exec=/app/bin/map --gapplication-service diff --git a/src/constants.rs b/src/constants.rs index f4b7836..c2e0eb6 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -23,10 +23,6 @@ pub const ZOOM_STEP: f64 = 0.1; pub const FILE_EXTENSION: &str = "wmap"; pub const MIME_TYPE: &str = "application/vnd.wmap"; -// Application -pub const APP_NAME: &str = "Map"; -pub const APP_ID: &str = "systems.tranquil.Map"; - // Window defaults pub const DEFAULT_WINDOW_WIDTH: i32 = 300; pub const DEFAULT_WINDOW_HEIGHT: i32 = 100; diff --git a/src/i18n.rs b/src/i18n.rs index 35955a1..03c30c3 100644 --- a/src/i18n.rs +++ b/src/i18n.rs @@ -16,11 +16,9 @@ //! Internationalization support using gettext. +use crate::info; use gettextrs::{LocaleCategory, bindtextdomain, setlocale, textdomain}; -/// The gettext domain for the application. -pub const GETTEXT_DOMAIN: &str = "systems.tranquil.Map"; - /// Initializes the localization system. pub fn init() { setlocale(LocaleCategory::LcAll, ""); @@ -38,12 +36,12 @@ pub fn init() { for dir in &locale_dirs { if std::path::Path::new(dir).exists() { - let _ = bindtextdomain(GETTEXT_DOMAIN, *dir); + let _ = bindtextdomain(info::GETTEXT_DOMAIN, *dir); break; } } - textdomain(GETTEXT_DOMAIN).ok(); + textdomain(info::GETTEXT_DOMAIN).ok(); } /// Macro for translating strings at runtime. diff --git a/src/info.rs b/src/info.rs new file mode 100644 index 0000000..1c2a22f --- /dev/null +++ b/src/info.rs @@ -0,0 +1,2 @@ +pub const APP_ID: &str = "systems.tranquil.Map"; +pub const GETTEXT_DOMAIN: &str = "systems.tranquil.Map"; diff --git a/src/info.rs.in b/src/info.rs.in new file mode 100644 index 0000000..835d5a2 --- /dev/null +++ b/src/info.rs.in @@ -0,0 +1,2 @@ +pub const APP_ID: &str = @APP_ID@; +pub const GETTEXT_DOMAIN: &str = @GETTEXT_DOMAIN@; diff --git a/src/main.rs b/src/main.rs index 344a30d..e40681f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,7 @@ mod dialogs; mod file_registry; mod handlers; mod i18n; +mod info; mod preferences; mod stages; @@ -176,9 +177,9 @@ impl AppModel { .unwrap_or(&default_name); if self.modified { - format!("{}* - {}", filename, constants::APP_NAME) + format!("{}* - {}", filename, tr!("application.name")) } else { - format!("{} - {}", filename, constants::APP_NAME) + format!("{} - {}", filename, tr!("application.name")) } } @@ -639,7 +640,7 @@ fn main() { .find(|t| t.is_default) .map(|t| t.content.clone()); - let application = RelmApp::new(constants::APP_ID); + let application = RelmApp::new(info::APP_ID); application.run::<AppModel>(AppInit { zoom: 1.0, orientation: gtk::Orientation::Horizontal, diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..6ce0ee9 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,49 @@ +source_configuration = configuration_data() +source_configuration.set_quoted('APP_ID', application_id) +source_configuration.set_quoted('GETTEXT_DOMAIN', gettext_domain) +configure_file( + input: 'info.rs.in', + output: '@BASENAME@', + configuration: source_configuration +) + +run_command( + 'cp', + meson.project_build_root() / 'src' / 'info.rs', + meson.project_source_root() / 'src' / 'info.rs', + check: true, +) + +cargo_options = ['--manifest-path', meson.project_source_root() / 'Cargo.toml'] +cargo_options += ['--target-dir', meson.project_build_root() / 'src'] +cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home'] + +if get_option('profile') == 'default' + cargo_options += ['--release'] + rust_target = 'release' + message('Building in release mode') +else + rust_target = 'debug' + message('Building in debug mode') +endif + +custom_target( + 'cargo-build', + build_by_default: true, + build_always_stale: true, + output: meson.project_name(), + console: true, + install: true, + install_dir: bindir, + command: [ + 'env', + cargo_env, + cargo, + 'build', + cargo_options, + '&&', + 'cp', + 'src' / rust_target / meson.project_name(), + '@OUTPUT@', + ], +) diff --git a/src/preferences/storage.rs b/src/preferences/storage.rs index b61266b..6d8f199 100644 --- a/src/preferences/storage.rs +++ b/src/preferences/storage.rs @@ -17,7 +17,7 @@ use std::fs; use std::path::PathBuf; -use crate::constants; +use crate::info; use super::models::{UserPreferences, UserPreferencesJson}; @@ -25,7 +25,7 @@ use super::models::{UserPreferences, UserPreferencesJson}; pub fn config_dir() -> PathBuf { dirs::config_dir() .unwrap_or_else(|| PathBuf::from(".")) - .join(constants::APP_ID) + .join(info::APP_ID) } /// Returns the preferences file path |