diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml
index 920945d..373c784 100644
--- a/.github/workflows/flatpak.yml
+++ b/.github/workflows/flatpak.yml
@@ -10,8 +10,8 @@ concurrency:
cancel-in-progress: true
jobs:
- flatpak:
- name: Flathub
+ flatpak-devel:
+ name: Flatpak (Devel)
runs-on: ubuntu-latest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-46
@@ -20,6 +20,6 @@ jobs:
- uses: actions/checkout@v4
- uses: flathub-infra/flatpak-github-actions/flatpak-builder@master
with:
- bundle: butler.flatpak
- manifest-path: com.cassidyjames.butler.json
+ bundle: com.cassidyjames.butler.Devel.flatpak
+ manifest-path: com.cassidyjames.butler.Devel.json
cache-key: "flatpak-builder-${{ github.sha }}"
diff --git a/com.cassidyjames.butler.json b/com.cassidyjames.butler.Devel.json
similarity index 74%
rename from com.cassidyjames.butler.json
rename to com.cassidyjames.butler.Devel.json
index 264a576..1aefb83 100644
--- a/com.cassidyjames.butler.json
+++ b/com.cassidyjames.butler.Devel.json
@@ -1,9 +1,9 @@
{
- "app-id": "com.cassidyjames.butler",
+ "app-id": "com.cassidyjames.butler.Devel",
"runtime": "org.gnome.Platform",
"runtime-version": "46",
"sdk": "org.gnome.Sdk",
- "command": "com.cassidyjames.butler",
+ "command": "com.cassidyjames.butler.Devel",
"finish-args": [
"--socket=wayland",
"--socket=fallback-x11",
@@ -16,6 +16,9 @@
"name": "butler",
"buildsystem": "meson",
"run-tests": true,
+ "config-opts": [
+ "-Dprofile=devel"
+ ],
"sources": [
{
"type": "dir",
diff --git a/data/gresource.xml b/data/gresource.xml
index f54825f..058ffb3 100644
--- a/data/gresource.xml
+++ b/data/gresource.xml
@@ -1,10 +1,7 @@
- metainfo.xml
- style.css
-
-
- icons/app.svg
+ metainfo.xml.in
+ style.css
diff --git a/data/gschema.xml b/data/gschema.xml.in
similarity index 94%
rename from data/gschema.xml
rename to data/gschema.xml.in
index 01de8b3..e3a200c 100644
--- a/data/gschema.xml
+++ b/data/gschema.xml.in
@@ -1,6 +1,6 @@
-
+
""
Current URL
diff --git a/data/icons/app.svg b/data/icons/release.svg
similarity index 100%
rename from data/icons/app.svg
rename to data/icons/release.svg
diff --git a/data/icons/com.cassidyjames.butler.Source.svg b/data/icons/source.svg
similarity index 100%
rename from data/icons/com.cassidyjames.butler.Source.svg
rename to data/icons/source.svg
diff --git a/data/launcher.desktop b/data/launcher.desktop.in
similarity index 60%
rename from data/launcher.desktop
rename to data/launcher.desktop.in
index a8df4ac..7cbe657 100644
--- a/data/launcher.desktop
+++ b/data/launcher.desktop.in
@@ -1,11 +1,11 @@
[Desktop Entry]
-Name=Butler
+Name=@app_name@
GenericName=Smart Home Dashboard
Comment=Control your smart home
Categories=Network;GTK;
-Exec=com.cassidyjames.butler
-Icon=com.cassidyjames.butler
+Exec=@app_id@
+Icon=@app_id@
Terminal=false
Type=Application
-X-GNOME-Gettext-Domain=com.cassidyjames.butler
+X-GNOME-Gettext-Domain=@app_id@
Keywords=hass;home;assistant;smart;lights;
diff --git a/data/meson.build b/data/meson.build
index 72b908a..0274e88 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,29 +1,51 @@
+data_config = configuration_data()
+data_config.set('app_id', app_id)
+data_config.set('app_name', app_name)
+
install_data(
- 'icons' / 'app.svg',
+ 'icons' / profile + '.svg',
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'scalable', 'apps'),
- rename: meson.project_name() + '.svg'
+ rename: app_id + '.svg'
)
install_data(
'icons' / 'symbolic.svg',
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'symbolic', 'apps'),
- rename: meson.project_name() + '-symbolic.svg'
+ rename: app_id + '-symbolic.svg'
)
-install_data(
- 'gschema.xml',
+gschema_file = configure_file(
+ input: files('gschema.xml.in'),
+ output: app_id + '.gschema.xml',
+ configuration: data_config,
+ install: true,
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
- rename: meson.project_name() + '.gschema.xml'
)
-install_data(
- 'launcher.desktop',
+desktop_file = configure_file(
+ input: files('launcher.desktop.in'),
+ output: app_id + '.desktop',
+ configuration: data_config,
+ install: true,
install_dir: get_option('datadir') / 'applications',
- rename: meson.project_name() + '.desktop'
)
-install_data(
- 'metainfo.xml',
+metainfo_file = configure_file(
+ input: files('metainfo.xml.in'),
+ output: '@BASENAME@',
+ configuration: data_config,
+ install: true,
install_dir: get_option('datadir') / 'metainfo',
- rename: meson.project_name() + '.metainfo.xml'
)
+
+asresources = gnome.compile_resources(
+ 'as-resources',
+ 'gresource.xml',
+ source_dir: 'data',
+ c_name: 'as',
+)
+
+desktop_utils = find_program('desktop-file-validate', required: false)
+if desktop_utils.found()
+ test('Validate desktop file', desktop_utils, args: [desktop_file])
+endif
diff --git a/data/metainfo.xml b/data/metainfo.xml.in
similarity index 94%
rename from data/metainfo.xml
rename to data/metainfo.xml.in
index 30c4e7e..d73a97c 100644
--- a/data/metainfo.xml
+++ b/data/metainfo.xml.in
@@ -1,11 +1,11 @@
- com.cassidyjames.butler
+ @app_id@
CC-BY-SA-4.0
GPL-3.0-or-later
- Butler
+ @app_name@
Companion for Home Assistant
@@ -38,9 +38,9 @@
- com.cassidyjames.butler
+ @app_id@
- com.cassidyjames.butler.desktop
+ @app_id@.desktop
360
@@ -63,6 +63,14 @@
+
+
+ Under the hood
+
+ - Separate development and release profiles to make development easier
+
+
+
Improved app listing
diff --git a/meson.build b/meson.build
index 79c590b..0803b65 100644
--- a/meson.build
+++ b/meson.build
@@ -1,49 +1,41 @@
project(
'com.cassidyjames.butler',
'vala', 'c',
- version: '1.1.3',
- meson_version: '>=0.58',
+ version: '1.2.0',
+ meson_version: '>=1.1',
)
-gnome = import('gnome')
+app_id = meson.project_name()
+app_name = 'Butler'
-add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language:'c')
+profile = get_option('profile')
+if profile == 'devel'
+ app_id += '.Devel'
+ app_name += ' (Devel)'
+endif
-asresources = gnome.compile_resources(
- 'as-resources',
- 'data' / 'gresource.xml',
- source_dir: 'data',
- c_name: 'as',
-)
+summary({
+ 'Profile': profile,
+}, section: 'Development')
-config_data = configuration_data()
+config_include = include_directories('.')
-config_data.set_quoted('APP_ID', meson.project_name())
-config_data.set_quoted('VERSION', meson.project_version())
+config = configuration_data()
+config.set_quoted('APP_ID', app_id)
+config.set_quoted('APP_NAME', app_name)
+config.set_quoted('VERSION', meson.project_version())
+config.set_quoted('PROFILE', profile)
config_file = configure_file(
input: 'src/Config.vala.in',
output: '@BASENAME@',
- configuration: config_data
+ configuration: config
)
-executable(
- meson.project_name(),
- 'src' / 'App.vala',
- 'src' / 'MainWindow.vala',
- 'src' / 'Widgets' / 'WebView.vala',
- asresources,
- config_file,
- dependencies: [
- dependency('glib-2.0'),
- dependency('gtk4'),
- dependency('libadwaita-1', version: '>=1.5'),
- dependency('webkitgtk-6.0'),
- meson.get_compiler('vala').find_library('posix'),
- ],
- install: true
-)
+gnome = import('gnome')
+add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(app_id), language:'c')
subdir('data')
+subdir('src')
meson.add_install_script('build-aux' / 'meson'/ 'post_install.py')
diff --git a/meson.options b/meson.options
new file mode 100644
index 0000000..b9e4ae2
--- /dev/null
+++ b/meson.options
@@ -0,0 +1 @@
+option('profile', type: 'combo', choices: ['devel', 'release'], value: 'devel', description: 'Whether this is an in-development or release build; affects app ID, icon, etc.')
diff --git a/src/Config.vala.in b/src/Config.vala.in
index 2ae91e2..e1e98b6 100644
--- a/src/Config.vala.in
+++ b/src/Config.vala.in
@@ -1,2 +1,4 @@
public const string APP_ID = @APP_ID@;
+public const string APP_NAME = @APP_NAME@;
public const string VERSION = @VERSION@;
+public const string PROFILE = @PROFILE@;
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index acb7477..b7e1c97 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -20,11 +20,13 @@ public class Butler.MainWindow : Adw.ApplicationWindow {
private Butler.WebView web_view;
- public MainWindow (Gtk.Application application) {
+ public MainWindow (Adw.Application app) {
Object (
- application: application,
+ application: app,
height_request: 294,
+ icon_name: APP_ID,
resizable: true,
+ title: APP_NAME,
width_request: 360
);
add_action_entries (ACTION_ENTRIES, this);
@@ -33,9 +35,10 @@ public class Butler.MainWindow : Adw.ApplicationWindow {
construct {
maximized = App.settings.get_boolean ("window-maximized");
fullscreened = App.settings.get_boolean ("window-fullscreened");
+ this.add_css_class (PROFILE);
about_dialog = new Adw.AboutDialog.from_appdata (
- "/com/cassidyjames/butler/metainfo.xml", VERSION
+ "/com/cassidyjames/butler/metainfo.xml.in", VERSION
) {
comments = _("Companion app to access your Home Assistant dashboard"),
@@ -46,6 +49,8 @@ public class Butler.MainWindow : Adw.ApplicationWindow {
"Tobias Bernard https://tobiasbernard.com/",
},
};
+ about_dialog.application_icon = APP_ID;
+ about_dialog.application_name = APP_NAME;
about_dialog.copyright = "© 2020–%i %s".printf (
new DateTime.now_local ().get_year (),
about_dialog.developer_name
@@ -53,11 +58,6 @@ public class Butler.MainWindow : Adw.ApplicationWindow {
about_dialog.add_link (_("About Home Assistant"), "https://www.home-assistant.io/");
about_dialog.add_link (_("Home Assistant Privacy Policy"), "https://www.home-assistant.io/privacy/");
- // Set MainWindow properties from the AppData already fetched and parsed
- // by the AboutDialog construction
- icon_name = about_dialog.application_icon;
- title = about_dialog.application_name;
-
var home_button = new Gtk.Button.from_icon_name ("go-home-symbolic") {
tooltip_text = _("Go Home")
};
@@ -74,7 +74,7 @@ public class Butler.MainWindow : Adw.ApplicationWindow {
// TODO: How do I add shortcuts to the menu?
app_menu.append (_("_Fullscreen"), "win.toggle_fullscreen");
app_menu.append (_("Change _Server…"), "win.set_server");
- app_menu.append (_("_About %s").printf (title), "win.about");
+ app_menu.append (_("_About %s").printf (APP_NAME), "win.about");
var menu = new Menu ();
menu.append_section (null, site_menu);
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..98ebadd
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,17 @@
+executable(
+ app_id,
+ 'App.vala',
+ 'MainWindow.vala',
+ 'Widgets' / 'WebView.vala',
+ asresources,
+ config_file,
+ include_directories: config_include,
+ dependencies: [
+ dependency('glib-2.0'),
+ dependency('gtk4'),
+ dependency('libadwaita-1', version: '>=1.5'),
+ dependency('webkitgtk-6.0'),
+ meson.get_compiler('vala').find_library('posix'),
+ ],
+ install: true
+)