diff --git a/io.github.flattool.Warehouse.json b/io.github.flattool.Warehouse.json index ca2f685..047651d 100644 --- a/io.github.flattool.Warehouse.json +++ b/io.github.flattool.Warehouse.json @@ -44,6 +44,7 @@ "name" : "warehouse", "builddir" : true, "buildsystem" : "meson", + "config-opts": [ "-Dprofile=development" ], "sources" : [ { "type" : "dir", diff --git a/meson.build b/meson.build index ae25ec8..a36cacf 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('warehouse', - version: '1.3.1.beta', + version: '1.3.1', meson_version: '>= 0.62.0', default_options: [ 'warning_level=2', 'werror=false', ], ) @@ -7,8 +7,6 @@ project('warehouse', i18n = import('i18n') gnome = import('gnome') - - subdir('data') subdir('src') subdir('po') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..db3076f --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,9 @@ +option( + 'profile', + type: 'combo', + choices: [ + 'default', + 'development' + ], + value: 'default' +) \ No newline at end of file diff --git a/src/const.py.in b/src/const.py.in new file mode 100644 index 0000000..1f7da55 --- /dev/null +++ b/src/const.py.in @@ -0,0 +1,8 @@ +#!@PYTHON@ +# SPDX-License-Identifier: GPL-3.0-or-later + +class Config: + DEVEL = '@DEVEL@' == 'Development' + PROFILE = '@DEVEL@' + APP_ID = '@APPID@' + VERSION = '@VERSION@' \ No newline at end of file diff --git a/src/main.py b/src/main.py index 69c4830..cae4fe6 100644 --- a/src/main.py +++ b/src/main.py @@ -30,12 +30,13 @@ from .window import WarehouseWindow from .remotes_window import RemotesWindow from .orphans_window import OrphansWindow from .search_install_window import SearchInstallWindow +from .const import Config class WarehouseApplication(Adw.Application): """The main application singleton class.""" - troubleshooting = "OS: {os}\nWarehouse version: {wv}\nGTK: {gtk}\nlibadwaita: {adw}\nApp ID: {app_id}\nLanguage: {lang}" - version = "1.3.1.beta" + troubleshooting = "OS: {os}\nWarehouse version: {wv}\nGTK: {gtk}\nlibadwaita: {adw}\nApp ID: {app_id}\nProfile: {profile}\nLanguage: {lang}" + version = Config.VERSION def __init__(self): super().__init__( @@ -62,7 +63,7 @@ class WarehouseApplication(Adw.Application): os_string = GLib.get_os_info("NAME") + " " + GLib.get_os_info("VERSION") lang = GLib.environ_getenv(GLib.get_environ(), "LANG") - self.troubleshooting = self.troubleshooting.format( os = os_string, wv = self.version, gtk = gtk_version, adw = adw_version, app_id = self.get_application_id(), lang = lang ) + self.troubleshooting = self.troubleshooting.format( os = os_string, wv = self.version, gtk = gtk_version, adw = adw_version, profile = Config.PROFILE, app_id = self.get_application_id(), lang = lang ) def open_search_install(self, widget, _): SearchInstallWindow(self.props.active_window).present() diff --git a/src/meson.build b/src/meson.build index bef7d6e..cb76511 100644 --- a/src/meson.build +++ b/src/meson.build @@ -31,7 +31,15 @@ python = import('python') conf = configuration_data() conf.set('PYTHON', python.find_installation('python3').full_path()) -conf.set('VERSION', meson.project_version()) +conf.set('APPID', 'io.github.flattool.Warehouse') # TODO: dynamic version and appID +if get_option('profile') == 'development' + vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() + conf.set('DEVEL', 'Development') + conf.set('VERSION', meson.project_version() + '.dev-' + vcs_tag) +else + conf.set('DEVEL', 'Default') + conf.set('VERSION', meson.project_version()) +endif conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('pkgdatadir', pkgdatadir) @@ -68,4 +76,13 @@ warehouse_sources = [ 'properties.blp', ] +configure_file( + input: 'const.py.in', + output: 'const.py', + configuration: conf, + install: true, + install_dir: moduledir, + install_mode: 'r-xr--r--', +) + install_data(warehouse_sources, install_dir: moduledir) diff --git a/src/window.blp b/src/window.blp index 431f149..fb85dd3 100644 --- a/src/window.blp +++ b/src/window.blp @@ -2,10 +2,6 @@ using Gtk 4.0; using Adw 1; template $WarehouseWindow: Adw.ApplicationWindow { - styles [ - "devel" - ] - Adw.ToolbarView main_toolbar_view { [top] HeaderBar header_bar { diff --git a/src/window.py b/src/window.py index e95c2fd..265b98f 100644 --- a/src/window.py +++ b/src/window.py @@ -28,6 +28,7 @@ from .common import myUtils from .remotes_window import RemotesWindow from .downgrade_window import DowngradeWindow from .snapshots_window import SnapshotsWindow +from .const import Config from .app_row_widget import AppRow @@ -825,6 +826,9 @@ class WarehouseWindow(Adw.ApplicationWindow): file_drop.connect("drop", self.drop_callback) self.scrolled_window.add_controller(file_drop) + if Config.DEVEL: + self.add_css_class("devel") +