[gnome-break-timer/dylanmccall/meson-build: 11/25] Add a launcher script to launch settings or helper programs



commit e5bde308c7b43bfee93abf3e7dea60a32fb04d68
Author: Dylan McCall <dylan dylanmccall com>
Date:   Tue Jan 1 16:38:53 2019 -0800

    Add a launcher script to launch settings or helper programs
    
    To do this with Flatpak, we need to remove dbus activation, as it is
    impossible to export more than one service file. Enabling dbus
    activation will require some more extensive changes to run both settings
    and the helper program under a single application.

 data/meson.build                        |  7 -----
 data/org.gnome.BreakTimer.desktop.in.in |  5 ++-
 data/org.gnome.BreakTimer.service.in    |  3 --
 flatpak/org.gnome.BreakTimer.json       |  2 +-
 gnome-break-timer.in                    | 16 ++++++++++
 meson.build                             | 55 +++++++++++++++++++++++++--------
 6 files changed, 61 insertions(+), 27 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index bf1a1c3..9cb23bf 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -15,13 +15,6 @@ i18n.merge_file(
     install_dir: join_paths(datadir, 'applications')
 )
 
-configure_file(
-    input: 'org.gnome.BreakTimer.service.in',
-    output: 'org.gnome.BreakTimer.service',
-    configuration: build_conf,
-    install_dir: join_paths(datadir, 'dbus-1', 'services')
-)
-
 appdata_in_file = configure_file(
     input: 'org.gnome.BreakTimer.appdata.xml.in.in',
     output: 'org.gnome.BreakTimer.appdata.xml.in',
diff --git a/data/org.gnome.BreakTimer.desktop.in.in b/data/org.gnome.BreakTimer.desktop.in.in
index 72a47e0..d36e406 100644
--- a/data/org.gnome.BreakTimer.desktop.in.in
+++ b/data/org.gnome.BreakTimer.desktop.in.in
@@ -5,6 +5,5 @@ 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=gapplication launch @SETTINGS_DESKTOP_ID@
-StartupNotify=true
-DBusActivatable=true
\ No newline at end of file
+Exec=@BINDIR@/gnome-break-timer-settings --gapplication-service
+StartupNotify=true
\ No newline at end of file
diff --git a/flatpak/org.gnome.BreakTimer.json b/flatpak/org.gnome.BreakTimer.json
index d389499..83285f4 100644
--- a/flatpak/org.gnome.BreakTimer.json
+++ b/flatpak/org.gnome.BreakTimer.json
@@ -3,7 +3,7 @@
     "runtime" : "org.gnome.Platform",
     "runtime-version" : "3.28",
     "sdk" : "org.gnome.Sdk",
-    "command" : "gnome-break-timer-settings",
+    "command" : "gnome-break-timer",
     "finish-args" : [
         "--share=ipc",
         "--socket=x11",
diff --git a/gnome-break-timer.in b/gnome-break-timer.in
new file mode 100755
index 0000000..96edb70
--- /dev/null
+++ b/gnome-break-timer.in
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+if [ -n "$1" ]; then
+    SUBCOMMAND=$1
+    shift
+else
+    SUBCOMMAND='settings'
+fi
+
+if [ "${SUBCOMMAND}" = 'helper' ]; then
+    exec @BINDIR@/gnome-break-timer-helper $@
+elif [ "${SUBCOMMAND}" = 'settings' ]; then
+    exec @BINDIR@/gnome-break-timer-settings $@
+else
+    echo "Unknown subcommand '${SUBCOMMAND}'"
+fi
diff --git a/meson.build b/meson.build
index 7ed7334..6b5e787 100644
--- a/meson.build
+++ b/meson.build
@@ -27,25 +27,46 @@ prefix = get_option('prefix')
 bindir = join_paths(prefix, get_option('bindir'))
 libdir = join_paths(prefix, get_option('libdir'))
 datadir = join_paths(prefix, get_option('datadir'))
+libexecdir = join_paths(prefix, get_option('libexecdir'))
+
+package_url = 'https://wiki.gnome.org/Apps/BreakTimer'
+settings_desktop_id = 'org.gnome.BreakTimer'
+helper_desktop_id = 'org.gnome.BreakTimer.Helper'
+helper_bus_name = 'org.gnome.BreakTimer.Helper'
+helper_object_path = '/org/gnome/BreakTimer'
+helper_break_object_base_path = '/org/gnome/BreakTimer/'
 
 build_conf = configuration_data()
-build_conf.set_quoted('BINDIR', gettext_package)
-build_conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
-build_conf.set_quoted('PACKAGE_NAME', meson.project_name())
-build_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
-build_conf.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/BreakTimer')
-build_conf.set_quoted('VERSION', meson.project_version())
-build_conf.set_quoted('SETTINGS_DESKTOP_ID', 'org.gnome.BreakTimer')
-build_conf.set_quoted('HELPER_DESKTOP_ID', 'org.gnome.BreakTimer.Helper')
-build_conf.set_quoted('HELPER_BUS_NAME', 'org.gnome.BreakTimer.Helper')
-build_conf.set_quoted('HELPER_OBJECT_PATH', '/org/gnome/BreakTimer')
-build_conf.set_quoted('HELPER_BREAK_OBJECT_BASE_PATH', '/org/gnome/BreakTimer/')
+build_conf.set('BINDIR', bindir)
+build_conf.set('GETTEXT_PACKAGE', gettext_package)
+build_conf.set('PACKAGE_NAME', meson.project_name())
+build_conf.set('PACKAGE_VERSION', meson.project_version())
+build_conf.set('PACKAGE_URL', package_url)
+build_conf.set('VERSION', meson.project_version())
+build_conf.set('SETTINGS_DESKTOP_ID', settings_desktop_id)
+build_conf.set('HELPER_DESKTOP_ID', helper_desktop_id)
+build_conf.set('HELPER_BUS_NAME', helper_bus_name)
+build_conf.set('HELPER_OBJECT_PATH', helper_object_path)
+build_conf.set('HELPER_BREAK_OBJECT_BASE_PATH', helper_break_object_base_path)
+
+build_conf_quoted = configuration_data()
+build_conf_quoted.set_quoted('BINDIR', bindir)
+build_conf_quoted.set_quoted('GETTEXT_PACKAGE', gettext_package)
+build_conf_quoted.set_quoted('PACKAGE_NAME', meson.project_name())
+build_conf_quoted.set_quoted('PACKAGE_VERSION', meson.project_version())
+build_conf_quoted.set_quoted('PACKAGE_URL', package_url)
+build_conf_quoted.set_quoted('VERSION', meson.project_version())
+build_conf_quoted.set_quoted('SETTINGS_DESKTOP_ID', settings_desktop_id)
+build_conf_quoted.set_quoted('HELPER_DESKTOP_ID', helper_desktop_id)
+build_conf_quoted.set_quoted('HELPER_BUS_NAME', helper_bus_name)
+build_conf_quoted.set_quoted('HELPER_OBJECT_PATH', helper_object_path)
+build_conf_quoted.set_quoted('HELPER_BREAK_OBJECT_BASE_PATH', helper_break_object_base_path)
 
 add_project_arguments('-DGETTEXT_PACKAGE="' + gettext_package + '"', language: 'c')
 
 configure_file(
     output: 'config.h',
-    configuration: build_conf
+    configuration: build_conf_quoted
 )
 
 config_lib = valac.find_library(
@@ -58,10 +79,18 @@ config_lib_dep = declare_dependency(
     include_directories: include_directories('.')
 )
 
+configure_file(
+    input: 'gnome-break-timer.in',
+    output: 'gnome-break-timer',
+    configuration: build_conf,
+    install: true,
+    install_dir: bindir
+)
+
 subdir('po')
 subdir('common')
 subdir('data')
 subdir('settings')
 # subdir('helper')
 
-meson.add_install_script('build-aux/meson/postinstall.py')
\ No newline at end of file
+meson.add_install_script('build-aux/meson/postinstall.py')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]