[lightsoff/arnaudb/purism: 2/2] Make D-Bus activatable.




commit 6d64a61f5ef6ea738329154449c7c310e3905e82
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Nov 5 10:41:47 2020 +0100

    Make D-Bus activatable.

 data/meson.build                    | 19 +++++++++++++++----
 data/org.gnome.LightsOff.desktop.in |  1 +
 data/org.gnome.LightsOff.service.in |  3 +++
 meson.build                         | 11 ++++++-----
 4 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 01849c4..db8a583 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -8,9 +8,22 @@ install_data(['off.svg', 'on.svg', 'highlight.svg'],
   install_dir: pkgdatadir,
 )
 
-desktop = 'org.gnome.LightsOff.desktop'
+# Make D-Bus activatable
+service_conf = configuration_data()
+service_conf.set('bindir', bindir)
+
+service = 'org.gnome.LightsOff.service'
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: join_paths(datadir, 'dbus-1', 'services'),
+  configuration: service_conf
+)
 
 # Desktop file
+desktop = 'org.gnome.LightsOff.desktop'
 desktop_file = i18n.merge_file(
   input: desktop + '.in',
   output: desktop,
@@ -30,10 +43,8 @@ if desktop_file_validate.found()
   )
 endif
 
-
-appdata = 'org.gnome.LightsOff.appdata.xml'
-
 # Appdata
+appdata = 'org.gnome.LightsOff.appdata.xml'
 appdata_file = i18n.merge_file(
   input: appdata + '.in',
   output: appdata,
diff --git a/data/org.gnome.LightsOff.desktop.in b/data/org.gnome.LightsOff.desktop.in
index 2ebea45..8183247 100644
--- a/data/org.gnome.LightsOff.desktop.in
+++ b/data/org.gnome.LightsOff.desktop.in
@@ -10,5 +10,6 @@ Terminal=false
 Type=Application
 Categories=GNOME;GTK;Game;LogicGame;
 StartupNotify=true
+DBusActivatable=true
 # Translators: Do NOT translate or transliterate this text (these are enum types)!
 X-Purism-FormFactor=Workstation;Mobile;
diff --git a/data/org.gnome.LightsOff.service.in b/data/org.gnome.LightsOff.service.in
new file mode 100644
index 0000000..fb16857
--- /dev/null
+++ b/data/org.gnome.LightsOff.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.LightsOff
+Exec=@bindir@/lightsoff --gapplication-service
diff --git a/meson.build b/meson.build
index b409015..33bc9f0 100644
--- a/meson.build
+++ b/meson.build
@@ -7,12 +7,13 @@ project('lightsoff', ['c','vala'],
 gnome = import('gnome')
 i18n = import('i18n')
 
-localedir = join_paths(get_option('prefix'), get_option('localedir'))
-datadir = join_paths (get_option ('prefix'), get_option ('datadir'))
-pkgdatadir = join_paths (datadir, 'lightsoff')
+localedir   = join_paths(get_option('prefix'), get_option('localedir'))
+datadir     = join_paths(get_option('prefix'), get_option('datadir'))
+bindir      = join_paths(get_option('prefix'), get_option('bindir'))
+pkgdatadir  = join_paths(datadir, 'lightsoff')
 
-podir = join_paths(meson.source_root(), 'po')
-vapidir = join_paths(meson.source_root(), 'vapi')
+podir       = join_paths(meson.source_root(), 'po')
+vapidir     = join_paths(meson.source_root(), 'vapi')
 
 # Dependencies
 glib_min_version = '2.38'


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