From c6365f6c880544a56184f3679d1b6067adf46088 Mon Sep 17 00:00:00 2001 From: tfuxu <73042332+tfuxu@users.noreply.github.com> Date: Mon, 15 Aug 2022 20:33:41 +0200 Subject: [PATCH] feat: set devel app id and version suffix if buildtype is debug, and replace another hard-coded values to constants * modify flatpak json's to use local directory instead of local git repository --- ...AdwCustomizerTeam.AdwCustomizer.Devel.json | 8 +-- ...ithub.AdwCustomizerTeam.AdwCustomizer.json | 6 +- ...tomizerTeam.AdwCustomizer.Devel.desktop.in | 8 --- ...mizerTeam.AdwCustomizer.appdata.xml.in.in} | 12 ++-- ...ustomizerTeam.AdwCustomizer.desktop.in.in} | 2 +- ...stomizerTeam.AdwCustomizer.gschema.xml.in} | 2 +- data/icons/meson.build | 11 +-- data/meson.build | 67 +++++++++---------- meson.build | 25 ++++++- src/adwcustomizer.in | 3 +- src/main.py | 14 ++-- src/window.py | 6 +- 12 files changed, 84 insertions(+), 80 deletions(-) delete mode 100644 data/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.desktop.in rename data/{com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in => com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in.in} (91%) rename data/{com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in => com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in.in} (71%) rename data/{com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml => com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml.in} (81%) diff --git a/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.json b/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.json index 31be453c..295f566b 100644 --- a/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.json +++ b/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.json @@ -1,5 +1,5 @@ { - "app-id" : "com.github.AdwCustomizerTeam.AdwCustomizer", + "app-id" : "com.github.AdwCustomizerTeam.AdwCustomizer.Devel", "runtime" : "org.gnome.Platform", "runtime-version" : "master", "sdk" : "org.gnome.Sdk", @@ -67,11 +67,11 @@ "name" : "adwcustomizer", "builddir" : true, "buildsystem" : "meson", + "config-opts": ["-Dbuildtype=debug"], "sources" : [ { - "type" : "git", - "path" : ".", - "branch": "next" + "type" : "dir", + "path" : "." } ] } diff --git a/com.github.AdwCustomizerTeam.AdwCustomizer.json b/com.github.AdwCustomizerTeam.AdwCustomizer.json index 2bb34ef9..40fa32a9 100644 --- a/com.github.AdwCustomizerTeam.AdwCustomizer.json +++ b/com.github.AdwCustomizerTeam.AdwCustomizer.json @@ -67,11 +67,11 @@ "name" : "adwcustomizer", "builddir" : true, "buildsystem" : "meson", + "config-opts": ["-Dbuildtype=release"], "sources" : [ { - "type" : "git", - "path" : ".", - "branch": "main" + "type" : "dir", + "path" : "." } ] } diff --git a/data/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.desktop.in b/data/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.desktop.in deleted file mode 100644 index 70e70fa5..00000000 --- a/data/com.github.AdwCustomizerTeam.AdwCustomizer.Devel.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=Adwaita Manager -Exec=adwcustomizer -Icon=com.github.AdwCustomizerTeam.AdwCustomizer.Devel -Terminal=false -Type=Application -Categories=GTK; -StartupNotify=true diff --git a/data/com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in b/data/com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in.in similarity index 91% rename from data/com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in rename to data/com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in.in index 0c3a7ce6..2edfea0a 100644 --- a/data/com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in +++ b/data/com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in.in @@ -1,7 +1,7 @@ - com.github.AdwCustomizerTeam.AdwCustomizer + @APP_ID@ CC0-1.0 GPL-3.0 @@ -58,7 +58,7 @@ - com.github.AdwCustomizerTeam.AdwCustomizer.desktop + @APP_ID@.desktop Utility @@ -123,10 +123,10 @@ - https://github.com/AdwCustomizerTeam/AdwCustomizer - https://github.com/AdwCustomizerTeam/AdwCustomizer/issues - https://github.com/orgs/AdwCustomizerTeam/discussions - https://www.transifex.com/adwcustomizerteam/adwcustomizer + @PROJECT_URL@ + @BUGTRACKER_URL@ + @HELP_URL@ + @TRANSLATE_URL@ AdwCustomizerTeam@proton.me diff --git a/data/com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in b/data/com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in.in similarity index 71% rename from data/com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in rename to data/com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in.in index 6e87c2b2..0d9244bf 100644 --- a/data/com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in +++ b/data/com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in.in @@ -1,7 +1,7 @@ [Desktop Entry] Name=Adwaita Manager Exec=adwcustomizer -Icon=com.github.AdwCustomizerTeam.AdwCustomizer +Icon=@APP_ID@ Terminal=false Type=Application Categories=GTK; diff --git a/data/com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml b/data/com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml.in similarity index 81% rename from data/com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml rename to data/com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml.in index fe28f555..186f845f 100644 --- a/data/com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml +++ b/data/com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml.in @@ -1,6 +1,6 @@ - + 1300 diff --git a/data/icons/meson.build b/data/icons/meson.build index 93d42ada..2129524d 100644 --- a/data/icons/meson.build +++ b/data/icons/meson.build @@ -1,17 +1,12 @@ -application_id = 'com.github.AdwCustomizerTeam.AdwCustomizer' - scalable_dir = join_paths('hicolor', 'scalable', 'apps') install_data( join_paths(scalable_dir, ('@0@.svg').format(APPLICATION_ID)), install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) ) -install_data( - join_paths(scalable_dir, ('@0@.Devel.svg').format(APPLICATION_ID)), - install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) -) symbolic_dir = join_paths('hicolor', 'symbolic', 'apps') install_data( - join_paths(symbolic_dir, ('@0@-symbolic.svg').format(APPLICATION_ID)), - install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir) + join_paths(symbolic_dir, ('@0@-symbolic.svg').format(PROJECT_RDNN_NAME)), + install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir), + rename: '@0@-symbolic.svg'.format(APPLICATION_ID) ) diff --git a/data/meson.build b/data/meson.build index b493fe12..dc40c1b7 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,41 +1,36 @@ -if get_option('buildtype') == 'debug' - - desktop_file = i18n.merge_file( - input: 'com.github.AdwCustomizerTeam.AdwCustomizer.Devel.desktop.in', - output: 'com.github.AdwCustomizerTeam.AdwCustomizer.desktop', - type: 'desktop', - po_dir: '../po', - install: true, - install_dir: join_paths(get_option('datadir'), 'applications') - ) +desktop_file = i18n.merge_file( + input: configure_file( + input: '@0@.desktop.in.in'.format(PROJECT_RDNN_NAME), + output: '@BASENAME@', + configuration: conf + ), + output: '@0@.desktop'.format(APPLICATION_ID), + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) - desktop_utils = find_program('desktop-file-validate', required: false) - if desktop_utils.found() - test('Validate desktop file', desktop_utils, - args: [desktop_file] - ) - endif -else - desktop_file = i18n.merge_file( - input: 'com.github.AdwCustomizerTeam.AdwCustomizer.desktop.in', - output: 'com.github.AdwCustomizerTeam.AdwCustomizer.desktop', - type: 'desktop', - po_dir: '../po', - install: true, - install_dir: join_paths(get_option('datadir'), 'applications') +desktop_utils = find_program('desktop-file-validate', required: false) +if desktop_utils.found() + test('Validate desktop file', desktop_utils, + args: [desktop_file] ) - - desktop_utils = find_program('desktop-file-validate', required: false) - if desktop_utils.found() - test('Validate desktop file', desktop_utils, - args: [desktop_file] - ) - endif endif appstream_file = i18n.merge_file( - input: 'com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml.in', - output: 'com.github.AdwCustomizerTeam.AdwCustomizer.appdata.xml', + input: configure_file( + input: '@0@.appdata.xml.in.in'.format(PROJECT_RDNN_NAME), + output: '@BASENAME@', + configuration: configuration_data({ + 'APP_ID': APPLICATION_ID, + 'PROJECT_URL': PROJECT_URL, + 'BUGTRACKER_URL': BUGTRACKER_URL, + 'HELP_URL': HELP_URL, + 'TRANSLATE_URL': TRANSLATE_URL + }) + ), + output: '@0@.appdata.xml'.format(APPLICATION_ID), po_dir: '../po', install: true, install_dir: join_paths(get_option('datadir'), 'appdata') @@ -48,7 +43,11 @@ if appstream_util.found() ) endif -install_data('com.github.AdwCustomizerTeam.AdwCustomizer.gschema.xml', +configure_file( + input: '@0@.gschema.xml.in'.format(PROJECT_RDNN_NAME), + output: '@0@.gschema.xml'.format(APPLICATION_ID), + configuration: conf, + install: true, install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') ) diff --git a/meson.build b/meson.build index b20af991..d1aacc04 100644 --- a/meson.build +++ b/meson.build @@ -11,9 +11,28 @@ gnome = import('gnome') i18n = import('i18n') python = import('python') +# Project information +PROJECT_URL = 'https://github.com/AdwCustomizerTeam/AdwCustomizer' +BUGTRACKER_URL = 'https://github.com/tfuxu/themeteor/issues' +HELP_URL = 'https://github.com/orgs/AdwCustomizerTeam/discussions' +TRANSLATE_URL = 'https://www.transifex.com/adwcustomizerteam/adwcustomizer' + # Constants PROJECT_RDNN_NAME = 'com.github.AdwCustomizerTeam.AdwCustomizer' -APPLICATION_ID = PROJECT_RDNN_NAME + +# Set APPLICATION_ID and VERSION_SUFFIX +if get_option('buildtype') == 'debug' + VCS_TAG = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() + if VCS_TAG == '' + VERSION_SUFFIX = '-devel' + else + VERSION_SUFFIX = '-@0@'.format(VCS_TAG) + endif + APPLICATION_ID = '@0@.Devel'.format(PROJECT_RDNN_NAME) +else + VERSION_SUFFIX = '' + APPLICATION_ID = PROJECT_RDNN_NAME +endif dependency('glib-2.0') dependency('gtk4', version: '>= 4.5.0') @@ -34,12 +53,12 @@ PLUGINS_DIR = join_paths(PKGDATA_DIR, 'adwcustomizer', 'plugins') # Install configuration data conf = configuration_data() -conf.set('APP_ID', PROJECT_RDNN_NAME) +conf.set('APP_ID', APPLICATION_ID) conf.set('PKGDATA_DIR', PKGDATA_DIR) conf.set('DATA_DIR', join_paths(get_option('prefix'), get_option('datadir'))) conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('PYTHON', PY_INSTALLDIR.full_path()) -conf.set('VERSION', meson.project_version()) +conf.set('VERSION', meson.project_version() + VERSION_SUFFIX) conf.set('BUILD_TYPE', get_option('buildtype')) # Subdirs diff --git a/src/adwcustomizer.in b/src/adwcustomizer.in index 6f60743f..96589619 100755 --- a/src/adwcustomizer.in +++ b/src/adwcustomizer.in @@ -26,7 +26,6 @@ import gettext pkgdatadir = '@PKGDATA_DIR@' localedir = '@LOCALE_DIR@' -version = '@VERSION@' builddir = os.environ.get('MESON_BUILD_ROOT') @@ -58,4 +57,4 @@ if __name__ == '__main__': resource._register() from adwcustomizer import main - sys.exit(main.main(version)) + sys.exit(main.main()) diff --git a/src/main.py b/src/main.py index 4ecd544a..dd00b4bc 100644 --- a/src/main.py +++ b/src/main.py @@ -45,12 +45,12 @@ def to_slug_case(non_slug): class AdwcustomizerApplication(Adw.Application): """The main application singleton class.""" - def __init__(self, version): + def __init__(self): super().__init__( application_id=app_id, - flags=Gio.ApplicationFlags.FLAGS_NONE, + flags=Gio.ApplicationFlags.FLAGS_NONE ) - self.version = version + self.set_resource_base_path(rootdir) self.portal = Xdp.Portal() @@ -636,7 +636,7 @@ class AdwcustomizerApplication(Adw.Application): about = Adw.AboutWindow( transient_for=self.props.active_window, application_name=_("Adwaita Manager"), - application_icon="com.github.AdwCustomizerTeam.AdwCustomizer", + application_icon=app_id, developer_name=_("Adwaita Manager Team"), website="https://github.com/AdwCustomizerTeam/AdwCustomizer", support_url="https://github.com/orgs/AdwCustomizerTeam/discussions", @@ -661,7 +661,7 @@ class AdwcustomizerApplication(Adw.Application): Taylan Tatlı https://www.transifex.com/user/profile/TaylanTatli34/""", copyright="© 2022 Adwaita Manager Team", license_type=Gtk.License.GPL_3_0, - version=f"{version}", + version=version, release_notes="""
  • Add AdwViewSwitcher in the header bar.
  • @@ -725,7 +725,7 @@ This app is written in Python and uses GTK 4 and libadwaita. self.set_accels_for_action(f"app.{name}", shortcuts) -def main(version): +def main(): """The application's entry point.""" - app = AdwcustomizerApplication(version) + app = AdwcustomizerApplication() return app.run(sys.argv) diff --git a/src/window.py b/src/window.py index e3818d8d..3a757c3c 100644 --- a/src/window.py +++ b/src/window.py @@ -34,9 +34,10 @@ from .option import AdwcustomizerOption from .app_type_dialog import AdwcustomizerAppTypeDialog from .custom_css_group import AdwcustomizerCustomCSSGroup from material_color_utilities_python import * -from .constants import rootdir, build_type +from .constants import rootdir, app_id, build_type from .presets_manager_window import AdwcustomizerPresetWindow + @Gtk.Template(resource_path=f"{rootdir}/ui/window.ui") class AdwcustomizerMainWindow(Adw.ApplicationWindow): __gtype_name__ = "AdwcustomizerMainWindow" @@ -66,8 +67,7 @@ class AdwcustomizerMainWindow(Adw.ApplicationWindow): self.setup_plugins_page() self.setup_colors_page() - self.settings = Gio.Settings( - "com.github.AdwCustomizerTeam.AdwCustomizer") + self.settings = Gio.Settings(app_id) self.settings.bind( "window-width", self, "default-width", Gio.SettingsBindFlags.DEFAULT