[gnome-robots/arnaudb/modernize-code: 5/5] Make D-Bus activatable.



commit 2067fa587411f6ef584407e5d3215c7aedc56c5c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat May 23 22:03:08 2020 +0200

    Make D-Bus activatable.

 data/meson.build                 | 16 +++++++++++++++-
 data/org.gnome.Robots.desktop.in |  1 +
 data/org.gnome.Robots.service.in |  3 +++
 meson.build                      |  5 +++--
 4 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index b6a0830..a797ac2 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -43,6 +43,20 @@ endif
 # Install man page
 install_man('@0@.6'.format(meson.project_name()))
 
+# Make D-Bus activatable
+service_conf = configuration_data()
+service_conf.set('bindir', bindir)
+
+service = 'org.gnome.Robots.service'
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: join_paths(datadir, 'dbus-1', 'services'),
+  configuration: service_conf
+)
+
 # Install GSchema file
 install_data(
   '@0  gschema xml'.format(application_id),
@@ -96,4 +110,4 @@ install_data(
     ],
     install_dir: join_paths(pkgdatadir, 'themes')
 )
-subdir('icons')
\ No newline at end of file
+subdir('icons')
diff --git a/data/org.gnome.Robots.desktop.in b/data/org.gnome.Robots.desktop.in
index b518cdc..5bc35d2 100644
--- a/data/org.gnome.Robots.desktop.in
+++ b/data/org.gnome.Robots.desktop.in
@@ -10,3 +10,4 @@ Terminal=false
 Type=Application
 Categories=GNOME;GTK;Game;ArcadeGame;
 StartupNotify=true
+DBusActivatable=true
diff --git a/data/org.gnome.Robots.service.in b/data/org.gnome.Robots.service.in
new file mode 100644
index 0000000..91233a7
--- /dev/null
+++ b/data/org.gnome.Robots.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Robots
+Exec=@bindir@/gnome-robots --gapplication-service
diff --git a/meson.build b/meson.build
index 3e5cf64..d13a35d 100644
--- a/meson.build
+++ b/meson.build
@@ -14,8 +14,9 @@ gsound_dependency = dependency('gsound', version: '>= 1.0.2')
 gtk_dependency = dependency('gtk+-3.0', version: '>= 3.24.0')
 rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.36.2')
 
-pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
-
+bindir      = join_paths(get_option('prefix'), get_option('bindir'))
+datadir     = join_paths(get_option('prefix'), get_option('datadir'))
+pkgdatadir  = join_paths(datadir, meson.project_name())
 
 config_h = configuration_data()
 config_h.set_quoted('PACKAGE', meson.project_name())


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