dbus: Add option to use app-id for bus name

This is required for Flatpak but is an API break so it is opt-in
for now.
This commit is contained in:
Patrick Griffis 2018-02-18 04:44:59 -05:00
parent 23c7e7c3da
commit 8aa3b03261
5 changed files with 17 additions and 4 deletions

View File

@ -25,6 +25,9 @@ option('with-libcanberra', type: 'boolean',
option('with-theme-manager', type: 'boolean', value: false, option('with-theme-manager', type: 'boolean', value: false,
description: 'Utility to help manage themes, requires mono/.net' description: 'Utility to help manage themes, requires mono/.net'
) )
option('dbus-service-use-appid', type: 'boolean', value: false,
description: 'Rename dbus service to match app-id, required for Flatpak'
)
# Plugins # Plugins
option('with-checksum', type: 'boolean', option('with-checksum', type: 'boolean',

View File

@ -27,7 +27,6 @@
#include "hexchat.h" #include "hexchat.h"
#include "hexchatc.h" #include "hexchatc.h"
#define DBUS_SERVICE "org.hexchat.service"
#define DBUS_REMOTE_PATH "/org/hexchat/Remote" #define DBUS_REMOTE_PATH "/org/hexchat/Remote"
#define DBUS_REMOTE_INTERFACE "org.hexchat.plugin" #define DBUS_REMOTE_INTERFACE "org.hexchat.plugin"

View File

@ -32,7 +32,6 @@
#define PDESC _("plugin for remote access using DBUS") #define PDESC _("plugin for remote access using DBUS")
#define PVERSION "" #define PVERSION ""
#define DBUS_SERVICE "org.hexchat.service"
#define DBUS_OBJECT_PATH "/org/hexchat" #define DBUS_OBJECT_PATH "/org/hexchat"
static hexchat_plugin *ph; static hexchat_plugin *ph;

View File

@ -14,11 +14,22 @@ dbus_includes = [
dbus_service_dir = join_paths(get_option('datadir'), 'dbus-1/services') dbus_service_dir = join_paths(get_option('datadir'), 'dbus-1/services')
if get_option('dbus-service-use-appid')
dbus_service_name = 'io.github.Hexchat'
dbus_output_file = 'io.github.Hexchat.service'
dbus_cargs = '-DDBUS_SERVICE="io.github.Hexchat"'
else
dbus_service_name = 'org.hexchat.service'
dbus_output_file = 'org.hexchat.service.service'
dbus_cargs = '-DDBUS_SERVICE="org.hexchat.service"'
endif
dbus_conf = configuration_data() dbus_conf = configuration_data()
dbus_conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) dbus_conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
dbus_conf.set('service_name', dbus_service_name)
configure_file( configure_file(
input: 'org.hexchat.service.service.in', input: 'org.hexchat.service.service.in',
output: 'org.hexchat.service.service', output: dbus_output_file,
configuration: dbus_conf, configuration: dbus_conf,
install: true, install: true,
install_dir: dbus_service_dir install_dir: dbus_service_dir
@ -34,6 +45,7 @@ dbus_remote_object = custom_target('remote-object-glue',
hexchat_dbus = static_library('hexchatdbus', hexchat_dbus = static_library('hexchatdbus',
sources: [dbus_remote_object, marshal] + dbus_sources, sources: [dbus_remote_object, marshal] + dbus_sources,
c_args: dbus_cargs,
dependencies: common_deps + dbus_deps, dependencies: common_deps + dbus_deps,
include_directories: dbus_includes, include_directories: dbus_includes,
pic: true pic: true

View File

@ -1,3 +1,3 @@
[D-BUS Service] [D-BUS Service]
Name=org.hexchat.service Name=@service_name@
Exec=@bindir@/hexchat Exec=@bindir@/hexchat