[gnome-break-timer/dylanmccall/meson-build: 2/3] Restructure data files and add dbus activation
- From: Dylan McCall <dylanmccall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-break-timer/dylanmccall/meson-build: 2/3] Restructure data files and add dbus activation
- Date: Fri, 13 Nov 2020 23:37:19 +0000 (UTC)
commit 674551784e0d150e0cde53a91c078497a2c90ea9
Author: Dylan McCall <dylan dylanmccall ca>
Date: Fri Nov 13 15:15:14 2020 -0800
Restructure data files and add dbus activation
data/applications/meson.build | 55 ++++++++++++++++++++++
...g.gnome.BreakTimer.Helper-autostart.desktop.in} | 0
.../org.gnome.BreakTimer.Helper.desktop.in} | 5 +-
.../org.gnome.BreakTimer.Settings.desktop.in} | 5 +-
data/dbus/meson.build | 15 ++++++
data/dbus/org.gnome.BreakTimer.Helper.service.in | 3 ++
data/dbus/org.gnome.BreakTimer.Settings.service.in | 3 ++
data/gresource/meson.build | 11 +++++
.../org.gnome.BreakTimer.gresource.xml | 0
data/{ => gresource}/settings-panels.ui | 0
data/gschema/meson.build | 9 ++++
.../org.gnome.BreakTimer.gschema.xml.in | 0
data/meson.build | 55 ++--------------------
data/metainfo/meson.build | 21 +++++++++
data/metainfo/org.gnome.BreakTimer.metainfo.xml.in | 23 +++++++++
data/org.gnome.BreakTimer.appdata.xml.in.in | 15 ------
src/helper/break/BreakView.vala | 1 -
src/settings/BreakManager.vala | 1 -
18 files changed, 151 insertions(+), 71 deletions(-)
---
diff --git a/data/applications/meson.build b/data/applications/meson.build
new file mode 100644
index 0000000..87c44ad
--- /dev/null
+++ b/data/applications/meson.build
@@ -0,0 +1,55 @@
+applications_dir = join_paths(datadir, 'applications')
+
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+
+settings_desktop_file = i18n.merge_file(
+ input: 'org.gnome.BreakTimer.Settings.desktop.in',
+ output: 'org.gnome.BreakTimer.Settings.desktop',
+ type: 'desktop',
+ po_dir: po_dir,
+ install: true,
+ install_dir: applications_dir
+)
+
+if desktop_file_validate.found()
+ test(
+ 'Validate desktop file',
+ desktop_file_validate,
+ args: [settings_desktop_file]
+ )
+endif
+
+helper_desktop_file = i18n.merge_file(
+ input: 'org.gnome.BreakTimer.Helper.desktop.in',
+ output: 'org.gnome.BreakTimer.Helper.desktop',
+ type: 'desktop',
+ po_dir: po_dir,
+ install: true,
+ install_dir: applications_dir
+)
+
+if desktop_file_validate.found()
+ test(
+ 'Validate desktop file',
+ desktop_file_validate,
+ args: [helper_desktop_file]
+ )
+endif
+
+
+helper_autostart_desktop_file = i18n.merge_file(
+ input: 'org.gnome.BreakTimer.Helper-autostart.desktop.in',
+ output: 'org.gnome.BreakTimer.Helper-autostart.desktop',
+ type: 'desktop',
+ po_dir: po_dir,
+ install: true,
+ install_dir: applications_dir
+)
+
+if desktop_file_validate.found()
+ test(
+ 'Validate desktop file',
+ desktop_file_validate,
+ args: [helper_autostart_desktop_file]
+ )
+endif
diff --git a/data/org.gnome.BreakTimer.Helper-autostart.desktop.in.in
b/data/applications/org.gnome.BreakTimer.Helper-autostart.desktop.in
similarity index 100%
rename from data/org.gnome.BreakTimer.Helper-autostart.desktop.in.in
rename to data/applications/org.gnome.BreakTimer.Helper-autostart.desktop.in
diff --git a/data/org.gnome.BreakTimer.Helper.desktop.in.in
b/data/applications/org.gnome.BreakTimer.Helper.desktop.in
similarity index 64%
rename from data/org.gnome.BreakTimer.Helper.desktop.in.in
rename to data/applications/org.gnome.BreakTimer.Helper.desktop.in
index aca02be..a2665bb 100644
--- a/data/org.gnome.BreakTimer.Helper.desktop.in.in
+++ b/data/applications/org.gnome.BreakTimer.Helper.desktop.in
@@ -4,5 +4,6 @@ Name=Break Timer
Comment=Provides a gentle reminder to take regular breaks
Icon=org.gnome.BreakTimer
NoDisplay=true
-Exec=@BINDIR@/gnome-break-timer-service
-X-GNOME-UsesNotifications=true
\ No newline at end of file
+Exec=gnome-break-timer-service
+DBusActivatable=true
+X-GNOME-UsesNotifications=true
diff --git a/data/org.gnome.BreakTimer.desktop.in.in
b/data/applications/org.gnome.BreakTimer.Settings.desktop.in
similarity index 72%
rename from data/org.gnome.BreakTimer.desktop.in.in
rename to data/applications/org.gnome.BreakTimer.Settings.desktop.in
index d36e406..19620ee 100644
--- a/data/org.gnome.BreakTimer.desktop.in.in
+++ b/data/applications/org.gnome.BreakTimer.Settings.desktop.in
@@ -5,5 +5,6 @@ Comment=Choose your preferences for micro breaks and rest breaks
Keywords=break;micro;rest;timer;
Categories=GNOME;GTK;Utility;Settings;
Icon=org.gnome.BreakTimer
-Exec=@BINDIR@/gnome-break-timer-settings --gapplication-service
-StartupNotify=true
\ No newline at end of file
+Exec=gnome-break-timer-settings
+StartupNotify=true
+DBusActivatable=true
diff --git a/data/dbus/meson.build b/data/dbus/meson.build
new file mode 100644
index 0000000..4c7e24b
--- /dev/null
+++ b/data/dbus/meson.build
@@ -0,0 +1,15 @@
+dbus_session_bus_services_dir = join_paths(datadir, 'dbus-1', 'services')
+
+configure_file(
+ input: 'org.gnome.BreakTimer.Settings.service.in',
+ output: 'org.gnome.BreakTimer.Settings.service',
+ configuration: build_conf,
+ install_dir: dbus_session_bus_services_dir
+)
+
+configure_file(
+ input: 'org.gnome.BreakTimer.Helper.service.in',
+ output: 'org.gnome.BreakTimer.Helper.service',
+ configuration: build_conf,
+ install_dir: dbus_session_bus_services_dir
+)
diff --git a/data/dbus/org.gnome.BreakTimer.Helper.service.in
b/data/dbus/org.gnome.BreakTimer.Helper.service.in
new file mode 100644
index 0000000..1f6796f
--- /dev/null
+++ b/data/dbus/org.gnome.BreakTimer.Helper.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.BreakTimer.Helper
+Exec=gnome-break-timer-service
diff --git a/data/dbus/org.gnome.BreakTimer.Settings.service.in
b/data/dbus/org.gnome.BreakTimer.Settings.service.in
new file mode 100644
index 0000000..1392eba
--- /dev/null
+++ b/data/dbus/org.gnome.BreakTimer.Settings.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.BreakTimer.Settings
+Exec=gnome-break-timer-settings
diff --git a/data/gresource/meson.build b/data/gresource/meson.build
new file mode 100644
index 0000000..457116e
--- /dev/null
+++ b/data/gresource/meson.build
@@ -0,0 +1,11 @@
+break_timer_resources = gnome.compile_resources(
+ 'resources',
+ 'org.gnome.BreakTimer.gresource.xml',
+ source_dir : '.',
+ c_name : 'gnome_break_timer_resources'
+)
+
+break_timer_resources_dep = declare_dependency(
+ sources: [break_timer_resources],
+ include_directories: include_directories('.')
+)
diff --git a/data/org.gnome.BreakTimer.gresource.xml b/data/gresource/org.gnome.BreakTimer.gresource.xml
similarity index 100%
rename from data/org.gnome.BreakTimer.gresource.xml
rename to data/gresource/org.gnome.BreakTimer.gresource.xml
diff --git a/data/settings-panels.ui b/data/gresource/settings-panels.ui
similarity index 100%
rename from data/settings-panels.ui
rename to data/gresource/settings-panels.ui
diff --git a/data/gschema/meson.build b/data/gschema/meson.build
new file mode 100644
index 0000000..7c5e73e
--- /dev/null
+++ b/data/gschema/meson.build
@@ -0,0 +1,9 @@
+i18n.merge_file(
+ input: 'org.gnome.BreakTimer.gschema.xml.in',
+ output: 'org.gnome.BreakTimer.gschema.xml',
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(datadir, 'glib-2.0', 'schemas')
+)
+
+gnome.compile_schemas()
diff --git a/data/org.gnome.BreakTimer.gschema.xml.in b/data/gschema/org.gnome.BreakTimer.gschema.xml.in
similarity index 100%
rename from data/org.gnome.BreakTimer.gschema.xml.in
rename to data/gschema/org.gnome.BreakTimer.gschema.xml.in
diff --git a/data/meson.build b/data/meson.build
index e52d259..71401ae 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,51 +1,6 @@
+subdir('applications')
+subdir('dbus')
+subdir('gresource')
+subdir('gschema')
subdir('icons')
-
-data_conf = configuration_data()
-data_conf.set('BINDIR', bindir)
-data_conf.set('SETTINGS_APPLICATION_ID', settings_application_id)
-
-desktop_in_file = configure_file(
- input: 'org.gnome.BreakTimer.desktop.in.in',
- output: 'org.gnome.BreakTimer.desktop.in',
- configuration: data_conf
-)
-
-i18n.merge_file(
- input: desktop_in_file,
- output: 'org.gnome.BreakTimer.desktop',
- type: 'desktop',
- po_dir: po_dir,
- install: true,
- install_dir: join_paths(datadir, 'applications')
-)
-
-appdata_in_file = configure_file(
- input: 'org.gnome.BreakTimer.appdata.xml.in.in',
- output: 'org.gnome.BreakTimer.appdata.xml.in',
- configuration: data_conf
-)
-
-i18n.merge_file(
- input: appdata_in_file,
- output: 'org.gnome.BreakTimer.appdata.xml',
- po_dir: po_dir,
- install: true,
- install_dir: join_paths(datadir, 'metainfo')
-)
-
-i18n.merge_file(
- input: 'org.gnome.BreakTimer.gschema.xml.in',
- output: 'org.gnome.BreakTimer.gschema.xml',
- po_dir: po_dir,
- install: true,
- install_dir: join_paths(datadir, 'glib-2.0', 'schemas')
-)
-
-gnome.compile_schemas()
-
-break_timer_resources = gnome.compile_resources(
- 'resources',
- 'org.gnome.BreakTimer.gresource.xml',
- source_dir : '.',
- c_name : 'gnome_break_timer_resources'
-)
+subdir('metainfo')
diff --git a/data/metainfo/meson.build b/data/metainfo/meson.build
new file mode 100644
index 0000000..84dbfd5
--- /dev/null
+++ b/data/metainfo/meson.build
@@ -0,0 +1,21 @@
+metainfo_dir = join_paths(datadir, 'metainfo')
+
+metainfo_file = i18n.merge_file(
+ input: 'org.gnome.BreakTimer.metainfo.xml.in',
+ output: 'org.gnome.BreakTimer.metainfo.xml',
+ type: 'xml',
+ po_dir: po_dir,
+ configuration: build_conf,
+ install: true,
+ install_dir: metainfo_dir
+)
+
+appstream_util = find_program('appstream-util', required: false)
+
+if appstream_util.found()
+ test(
+ 'Validate metainfo file',
+ appstream_util,
+ args: ['validate', metainfo_file]
+ )
+endif
diff --git a/data/metainfo/org.gnome.BreakTimer.metainfo.xml.in
b/data/metainfo/org.gnome.BreakTimer.metainfo.xml.in
new file mode 100644
index 0000000..91aa1fa
--- /dev/null
+++ b/data/metainfo/org.gnome.BreakTimer.metainfo.xml.in
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop-application">
+ <id>org.gnome.BreakTimer</id>
+
+ <name>Break Timer</name>
+ <summary>Remember to take regular breaks from using the computer</summary>
+
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>GPL-3.0-or-later</project_license>
+
+ <description>
+ <p>
+ Break Timer keeps track of how much you are using the computer, and it reminds you to take regular
breaks. It is designed to encourage healthy behaviour, with a mix of short breaks for your eyes and wrists,
as well as longer breaks to keep your body moving and your mind on task.
+ </p>
+ <p>
+ Break Timer is easy to set up, so you can pick a break schedule that works for you and it will carry
on working in the background.
+ </p>
+ </description>
+
+ <url type="homepage">https://wiki.gnome.org/GnomeBreakTimer</url>
+
+ <launchable type="desktop-id">org.gnome.BreakTimer.Settings.desktop</launchable>
+</component>
diff --git a/src/helper/break/BreakView.vala b/src/helper/break/BreakView.vala
index 131e3d7..ba094a6 100644
--- a/src/helper/break/BreakView.vala
+++ b/src/helper/break/BreakView.vala
@@ -87,7 +87,6 @@ public abstract class BreakView : UIFragment {
}
protected void show_break_info () {
- // TODO: Use dbus activation once we can depend on GLib >= 2.37
AppInfo settings_app_info = new DesktopAppInfo (Config.SETTINGS_APPLICATION_ID);
AppLaunchContext app_launch_context = new AppLaunchContext ();
try {
diff --git a/src/settings/BreakManager.vala b/src/settings/BreakManager.vala
index 780a90e..8cd7dcb 100644
--- a/src/settings/BreakManager.vala
+++ b/src/settings/BreakManager.vala
@@ -139,7 +139,6 @@ public class BreakManager : Object {
}
private void launch_break_timer_service () {
- // TODO: Use dbus activation once we can depend on GLib >= 2.37
stdout.printf ("Trying to launch: %s\n", Config.HELPER_DESKTOP_FILE_ID);
AppInfo helper_app_info = new DesktopAppInfo (Config.HELPER_DESKTOP_FILE_ID);
stdout.printf ("helper_app_info: %s\n", helper_app_info.get_name());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]