| 1 | /* |
| 2 | * Copyright © 2024 Red Hat, Inc |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * Authors: |
| 20 | * Jonas Ådahl <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 24 | |
| 25 | #include "registry.h"cxx . . $ `<file>/src/registry.h`/ |
| 26 | |
| 27 | #include <stdio.h> |
| 28 | |
| 29 | #include "xdp-app-info-private.h"cxx . . $ `<file>/src/xdp-app-info-private.h`/ |
| 30 | #include "xdp-app-info-test-private.h"cxx . . $ `<file>/src/xdp-app-info-test-private.h`/ |
| 31 | #include "xdp-host-dbus.h"cxx . . $ `<file>/build/src/xdp-host-dbus.h`/ |
| 32 | #include "xdp-utils.h"cxx . . $ `<file>/src/xdp-utils.h`/ |
| 33 | |
| 34 | typedef struct _Registrycxx . . $ _Registry# Registrycxx . . $ Registry#; |
| 35 | typedef struct _RegistryClasscxx . . $ _RegistryClass# RegistryClasscxx . . $ RegistryClass#; |
| 36 | |
| 37 | struct _Registrycxx . . $ _Registry# |
| 38 | { |
| 39 | XdpDbusHostRegistrySkeletoncxx . . $ XdpDbusHostRegistrySkeleton# parent_instancecxx . . $ _Registry#parent_instance.; |
| 40 | }; |
| 41 | |
| 42 | struct _RegistryClasscxx . . $ _RegistryClass# |
| 43 | { |
| 44 | XdpDbusHostRegistrySkeletonClasscxx . . $ XdpDbusHostRegistrySkeletonClass# parent_classcxx . . $ _RegistryClass#parent_class.; |
| 45 | }; |
| 46 | |
| 47 | static Registrycxx . . $ Registry# *registrycxx . . $ registry.; |
| 48 | |
| 49 | GTypecxx . . $ GType# registry_get_typecxx . . $ registry_get_type(f708dce9a8856c70). (void) G_GNUC_CONSTcxx . . $ `<external>/12741050725406041920/gmacros.h:640:9`!; |
| 50 | static void registry_iface_initcxx . . $ registry_iface_init(dc6078a7837537d1). (XdpDbusHostRegistryIfacecxx . . $ XdpDbusHostRegistryIface# *iface); |
| 51 | |
| 52 | G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (Registry, registry, |
| 53 | XDP_DBUS_HOST_TYPE_REGISTRY_SKELETONcxx . . $ `build/src/xdp-host-dbus.h:161:9`!, |
| 54 | G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (XDP_DBUS_HOST_TYPE_REGISTRYcxx . . $ `build/src/xdp-host-dbus.h:20:9`!, |
| 55 | registry_iface_init)); |
| 56 | |
| 57 | static gbooleancxx . . $ gboolean# |
| 58 | handle_registercxx . . $ handle_register(58174fb911022649). (XdpDbusHostRegistrycxx . . $ XdpDbusHostRegistry# *object, |
| 59 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 60 | const char *arg_app_id, |
| 61 | GVariantcxx . . $ GVariant# *arg_options) |
| 62 | { |
| 63 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpAppInfo) app_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 64 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 65 | |
| 66 | app_info = xdp_invocation_register_host_app_info_synccxx . . $ xdp_invocation_register_host_app_info_sync(b491a54df00c9fc2). (invocation, arg_app_id, |
| 67 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error); |
| 68 | if (!app_info) |
| 69 | { |
| 70 | g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation, |
| 71 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, |
| 72 | XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED., |
| 73 | "Could not register app ID: %s", |
| 74 | error->messagecxx . . $ _GError#message.); |
| 75 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 76 | } |
| 77 | |
| 78 | if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (app_info), arg_app_id) != 0) |
| 79 | { |
| 80 | g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation, |
| 81 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, |
| 82 | XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 83 | "Registered too late"); |
| 84 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 85 | } |
| 86 | |
| 87 | xdp_dbus_host_registry_complete_registercxx . . $ xdp_dbus_host_registry_complete_register(49b676f31f8df841). (object, invocation); |
| 88 | |
| 89 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 90 | } |
| 91 | |
| 92 | static void |
| 93 | registry_iface_initcxx . . $ registry_iface_init(dc6078a7837537d1). (XdpDbusHostRegistryIfacecxx . . $ XdpDbusHostRegistryIface# *iface) |
| 94 | { |
| 95 | iface->handle_registercxx . . $ _XdpDbusHostRegistryIface#handle_register. = handle_registercxx . . $ handle_register(58174fb911022649).; |
| 96 | } |
| 97 | |
| 98 | static void |
| 99 | registry_initcxx . . $ registry_init(86fa14a7b5184672). (Registrycxx . . $ Registry# *registry) |
| 100 | { |
| 101 | xdp_dbus_host_registry_set_versioncxx . . $ xdp_dbus_host_registry_set_version(5a65e79fe5c6ce0). (XDP_DBUS_HOST_REGISTRYcxx . . $ `build/src/xdp-host-dbus.h:21:9`! (registry), 1); |
| 102 | } |
| 103 | |
| 104 | static void |
| 105 | registry_class_initcxx . . $ registry_class_init(1cf434604a717f60). (RegistryClasscxx . . $ RegistryClass# *klass) |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | GDBusInterfaceSkeletoncxx . . $ GDBusInterfaceSkeleton# * |
| 110 | registry_createcxx . . $ registry_create(8bec7bbb8da25ec7). (GDBusConnectioncxx . . $ GDBusConnection# *connection) |
| 111 | { |
| 112 | registrycxx . . $ registry. = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (registry_get_typecxx . . $ registry_get_type(f708dce9a8856c70). (), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 113 | |
| 114 | return G_DBUS_INTERFACE_SKELETONcxx . . $ `<external>/1991948168568871819/gdbusinterfaceskeleton.h:32:9`! (registry); |
| 115 | } |