system-helper: Move D-Bus names and paths to a header file

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2021-04-14 12:43:34 +01:00
committed by Alexander Larsson
parent 725efe7ae7
commit f508cf1767
4 changed files with 33 additions and 5 deletions

View File

@@ -56,6 +56,7 @@
#include "flatpak-variant-private.h"
#include "flatpak-variant-impl-private.h"
#include "libglnx/libglnx.h"
#include "system-helper/flatpak-system-helper.h"
#ifdef HAVE_LIBMALCONTENT
#include <libmalcontent/malcontent.h>
@@ -2047,9 +2048,9 @@ flatpak_dir_system_helper_call (FlatpakDir *self,
g_debug ("Calling system helper: %s", method_name);
res = g_dbus_connection_call_with_unix_fd_list_sync (self->system_helper_bus,
"org.freedesktop.Flatpak.SystemHelper",
"/org/freedesktop/Flatpak/SystemHelper",
"org.freedesktop.Flatpak.SystemHelper",
FLATPAK_SYSTEM_HELPER_BUS_NAME,
FLATPAK_SYSTEM_HELPER_PATH,
FLATPAK_SYSTEM_HELPER_INTERFACE,
method_name,
parameters,
reply_type,

View File

@@ -16,6 +16,7 @@ systemdsystemunit_DATA += system-helper/flatpak-system-helper.service
flatpak_system_helper_SOURCES = \
system-helper/flatpak-system-helper.c \
system-helper/flatpak-system-helper.h \
$(NULL)
flatpak_system_helper_LDADD = $(BASE_LIBS) $(OSTREE_LIBS) $(JSON_LIBS) $(POLKIT_LIBS) libflatpak-common.la libflatpak-common-base.la libglnx.la

View File

@@ -39,6 +39,7 @@
#include "flatpak-error.h"
#include "flatpak-oci-registry-private.h"
#include "flatpak-progress-private.h"
#include "flatpak-system-helper.h"
#include "flatpak-utils-base-private.h"
#include "flatpak-utils-private.h"
@@ -2236,7 +2237,7 @@ on_bus_acquired (GDBusConnection *connection,
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
connection,
"/org/freedesktop/Flatpak/SystemHelper",
FLATPAK_SYSTEM_HELPER_PATH,
&error))
{
g_warning ("error: %s", error->message);
@@ -2412,7 +2413,7 @@ main (int argc,
flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
name_owner_id = g_bus_own_name (on_session_bus ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
"org.freedesktop.Flatpak.SystemHelper",
FLATPAK_SYSTEM_HELPER_BUS_NAME,
flags,
on_bus_acquired,
on_name_acquired,

View File

@@ -0,0 +1,25 @@
/*
* Copyright © 2021 Collabora Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __FLATPAK_SYSTEM_HELPER_H__
#define __FLATPAK_SYSTEM_HELPER_H__
#define FLATPAK_SYSTEM_HELPER_BUS_NAME "org.freedesktop.Flatpak.SystemHelper"
#define FLATPAK_SYSTEM_HELPER_PATH "/org/freedesktop/Flatpak/SystemHelper"
#define FLATPAK_SYSTEM_HELPER_INTERFACE FLATPAK_SYSTEM_HELPER_BUS_NAME
#endif