[gnome-nibbles/arnaudb/modernize-code] Make D-Bus activatable.



commit 707dcc98774f41e24a8709f0bf787c27916b196b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue May 26 16:57:23 2020 +0200

    Make D-Bus activatable.

 data/meson.build                  | 14 ++++++++++++++
 data/org.gnome.Nibbles.desktop.in |  1 +
 data/org.gnome.Nibbles.service.in |  3 +++
 meson.build                       | 13 +++++++------
 4 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 1d7753f..c82c3ec 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -44,6 +44,20 @@ install_data(join_paths('icons', 'hicolor', 'scalable', 'org.gnome.Nibbles.svg')
 install_data(join_paths('icons', 'hicolor', 'symbolic', 'org.gnome.Nibbles-symbolic.svg'),
              install_dir: join_paths (datadir, 'icons', 'hicolor', 'symbolic', 'apps'))
 
+# Make D-Bus activatable
+service_conf = configuration_data()
+service_conf.set('bindir', bindir)
+
+service = 'org.gnome.Nibbles.service'
+
+configure_file (
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: join_paths (datadir, 'dbus-1', 'services'),
+  configuration: service_conf
+)
+
 # Appdata
 appdata_file = i18n.merge_file(
     input: 'org.gnome.Nibbles.appdata.xml.in',
diff --git a/data/org.gnome.Nibbles.desktop.in b/data/org.gnome.Nibbles.desktop.in
index c6c2d16..46bc2ee 100644
--- a/data/org.gnome.Nibbles.desktop.in
+++ b/data/org.gnome.Nibbles.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.Nibbles.service.in b/data/org.gnome.Nibbles.service.in
new file mode 100644
index 0000000..b624015
--- /dev/null
+++ b/data/org.gnome.Nibbles.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Nibbles
+Exec=@bindir@/gnome-nibbles --gapplication-service
diff --git a/meson.build b/meson.build
index 9bb6ce2..e372857 100644
--- a/meson.build
+++ b/meson.build
@@ -7,12 +7,13 @@ project('gnome-nibbles', ['c', 'vala'],
 gnome = import('gnome')
 i18n = import('i18n')
 
-prefix = get_option('prefix')
-datadir = join_paths(prefix, get_option('datadir'))
-pkgdatadir = join_paths(datadir, meson.project_name())
-sounddir = join_paths(pkgdatadir, 'sounds')
-localedir = join_paths(prefix, get_option('localedir'))
-podir = join_paths(meson.source_root(), 'po')
+prefix      = get_option('prefix')
+datadir     = join_paths(prefix, get_option('datadir'))
+pkgdatadir  = join_paths(datadir, meson.project_name())
+sounddir    = join_paths(pkgdatadir, 'sounds')
+localedir   = join_paths(prefix, get_option('localedir'))
+podir       = join_paths(meson.source_root(), 'po')
+bindir      = join_paths(prefix, get_option ('bindir'))
 
 # Dependencies
 glib_version = '2.42.0'


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