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
This commit is contained in:
tfuxu 2022-08-15 20:33:41 +02:00
parent 691f297675
commit c6365f6c88
12 changed files with 84 additions and 80 deletions

View file

@ -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" : "."
}
]
}

View file

@ -67,11 +67,11 @@
"name" : "adwcustomizer",
"builddir" : true,
"buildsystem" : "meson",
"config-opts": ["-Dbuildtype=release"],
"sources" : [
{
"type" : "git",
"path" : ".",
"branch": "main"
"type" : "dir",
"path" : "."
}
]
}

View file

@ -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

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2022 Adwaita Manager Team -->
<component type="desktop">
<id>com.github.AdwCustomizerTeam.AdwCustomizer</id>
<id>@APP_ID@</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
@ -58,7 +58,7 @@
</screenshot>
</screenshots>
<launchable type="desktop-id">com.github.AdwCustomizerTeam.AdwCustomizer.desktop</launchable>
<launchable type="desktop-id">@APP_ID@.desktop</launchable>
<categories>
<category>Utility</category>
@ -123,10 +123,10 @@
</release>
</releases>
<url type="homepage">https://github.com/AdwCustomizerTeam/AdwCustomizer</url>
<url type="bugtracker">https://github.com/AdwCustomizerTeam/AdwCustomizer/issues</url>
<url type="help">https://github.com/orgs/AdwCustomizerTeam/discussions</url>
<url type="translate">https://www.transifex.com/adwcustomizerteam/adwcustomizer</url>
<url type="homepage">@PROJECT_URL@</url>
<url type="bugtracker">@BUGTRACKER_URL@</url>
<url type="help">@HELP_URL@</url>
<url type="translate">@TRANSLATE_URL@</url>
<update_contact>AdwCustomizerTeam@proton.me</update_contact>
</component>

View file

@ -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;

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="adwcustomizer">
<schema id="com.github.AdwCustomizerTeam.AdwCustomizer" path="/com/github/AdwCustomizerTeam/AdwCustomizer/">
<schema id="@APP_ID@" path="/com/github/AdwCustomizerTeam/AdwCustomizer/">
<key name="window-width" type="i">
<default>1300</default>
</key>

View file

@ -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)
)

View file

@ -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')
)

View file

@ -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

View file

@ -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())

View file

@ -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="""
<ul>
<li>Add AdwViewSwitcher in the header bar.</li>
@ -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)

View file

@ -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