| 1 | /* |
| 2 | * Copyright © 2022 Matthew Leeds |
| 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 | * Matthew Leeds <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 24 | |
| 25 | #include <locale.h> |
| 26 | #include <stdio.h> |
| 27 | #include <string.h> |
| 28 | #include <errno.h> |
| 29 | |
| 30 | #include <sys/types.h> |
| 31 | #include <sys/stat.h> |
| 32 | #include <fcntl.h> |
| 33 | |
| 34 | #include <gio/gio.h> |
| 35 | #include <gio/gunixfdlist.h> |
| 36 | #include <gio/gunixinputstream.h> |
| 37 | #include <gio/gdesktopappinfo.h> |
| 38 | #include <glib/gi18n.h> |
| 39 | |
| 40 | #include "xdp-call.h"cxx . . $ `<file>/src/xdp-call.h`/ |
| 41 | #include "dynamic-launcher.h"cxx . . $ `<file>/src/dynamic-launcher.h`/ |
| 42 | #include "xdp-app-launch-context.h"cxx . . $ `<file>/src/xdp-app-launch-context.h`/ |
| 43 | #include "xdp-request.h"cxx . . $ `<file>/src/xdp-request.h`/ |
| 44 | #include "xdp-dbus.h"cxx . . $ `<file>/build/src/xdp-dbus.h`/ |
| 45 | #include "xdp-impl-dbus.h"cxx . . $ `<file>/build/src/xdp-impl-dbus.h`/ |
| 46 | #include "xdp-utils.h"cxx . . $ `<file>/src/xdp-utils.h`/ |
| 47 | |
| 48 | #define MAX_DESKTOP_SIZE_BYTEScxx . . $ `src/dynamic-launcher.c:48:9`! 1048576 |
| 49 | |
| 50 | typedef struct _DynamicLaunchercxx . . $ _DynamicLauncher# DynamicLaunchercxx . . $ DynamicLauncher#; |
| 51 | typedef struct _DynamicLauncherClasscxx . . $ _DynamicLauncherClass# DynamicLauncherClasscxx . . $ DynamicLauncherClass#; |
| 52 | |
| 53 | struct _DynamicLaunchercxx . . $ _DynamicLauncher# |
| 54 | { |
| 55 | XdpDbusDynamicLauncherSkeletoncxx . . $ XdpDbusDynamicLauncherSkeleton# parent_instancecxx . . $ _DynamicLauncher#parent_instance.; |
| 56 | }; |
| 57 | |
| 58 | struct _DynamicLauncherClasscxx . . $ _DynamicLauncherClass# |
| 59 | { |
| 60 | XdpDbusDynamicLauncherSkeletonClasscxx . . $ XdpDbusDynamicLauncherSkeletonClass# parent_classcxx . . $ _DynamicLauncherClass#parent_class.; |
| 61 | }; |
| 62 | |
| 63 | static XdpDbusImplDynamicLaunchercxx . . $ XdpDbusImplDynamicLauncher# *implcxx . . $ impl.; |
| 64 | static DynamicLaunchercxx . . $ DynamicLauncher# *dynamic_launchercxx . . $ dynamic_launcher.; |
| 65 | |
| 66 | static GMutexcxx . . $ GMutex# transient_permissions_lockcxx . . $ transient_permissions_lock.; |
| 67 | static GHashTablecxx . . $ GHashTable# *transient_permissionscxx . . $ transient_permissions.; |
| 68 | |
| 69 | GTypecxx . . $ GType# dynamic_launcher_get_typecxx . . $ dynamic_launcher_get_type(f708dce9a8856c70). (void) G_GNUC_CONSTcxx . . $ `<external>/12741050725406041920/gmacros.h:640:9`!; |
| 70 | static void dynamic_launcher_iface_initcxx . . $ dynamic_launcher_iface_init(c92e85fdfc49f46f). (XdpDbusDynamicLauncherIfacecxx . . $ XdpDbusDynamicLauncherIface# *iface); |
| 71 | |
| 72 | G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (DynamicLauncher, dynamic_launcher, |
| 73 | XDP_DBUS_TYPE_DYNAMIC_LAUNCHER_SKELETONcxx . . $ `build/src/xdp-dbus.h:1893:9`!, |
| 74 | G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (XDP_DBUS_TYPE_DYNAMIC_LAUNCHERcxx . . $ `build/src/xdp-dbus.h:1540:9`!, |
| 75 | dynamic_launcher_iface_init)); |
| 76 | |
| 77 | typedef enumcxx . . $ $anonymous_type_4b964b488e9391a7_0# { |
| 78 | DYNAMIC_LAUNCHER_TYPE_APPLICATIONcxx . . $ DYNAMIC_LAUNCHER_TYPE_APPLICATION. = 1, |
| 79 | DYNAMIC_LAUNCHER_TYPE_WEBAPPcxx . . $ DYNAMIC_LAUNCHER_TYPE_WEBAPP. = 2, |
| 80 | } DynamicLauncherTypecxx . . $ DynamicLauncherType#; |
| 81 | |
| 82 | static GVariantcxx . . $ GVariant# * |
| 83 | get_launcher_data_and_revoke_tokencxx . . $ get_launcher_data_and_revoke_token(8d35775da1697fc2). (const char *token) |
| 84 | { |
| 85 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GMutexLocker) locker = g_mutex_locker_newcxx . . $ g_mutex_locker_new(3c345ff2ce91af48). (&transient_permissions_lockcxx . . $ transient_permissions_lock.); |
| 86 | GVariantcxx . . $ GVariant# *launcher_data_wrapped; |
| 87 | |
| 88 | if (!transient_permissionscxx . . $ transient_permissions.) |
| 89 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 90 | |
| 91 | if (!g_uuid_string_is_validcxx . . $ g_uuid_string_is_valid(5c4306d8553b3696). (token)) |
| 92 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 93 | |
| 94 | launcher_data_wrapped = g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (transient_permissionscxx . . $ transient_permissions., token); |
| 95 | if (launcher_data_wrapped) |
| 96 | { |
| 97 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) launcher_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 98 | guintcxx . . $ guint# timeout_id; |
| 99 | |
| 100 | g_variant_getcxx . . $ g_variant_get(671e9cd8f09cd612). (launcher_data_wrapped, "(vu)", &launcher_data, &timeout_id); |
| 101 | |
| 102 | g_source_removecxx . . $ g_source_remove(4c679297bf94b9eb). (timeout_id); |
| 103 | g_hash_table_removecxx . . $ g_hash_table_remove(453ebbf4abdbe50e). (transient_permissionscxx . . $ transient_permissions., token); |
| 104 | |
| 105 | return g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&launcher_data); |
| 106 | } |
| 107 | |
| 108 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 109 | } |
| 110 | |
| 111 | static gbooleancxx . . $ gboolean# |
| 112 | validate_desktop_file_idcxx . . $ validate_desktop_file_id(fa805841931d76a9). (XdpAppInfocxx . . $ XdpAppInfo# *app_info, |
| 113 | const char *desktop_file_id, |
| 114 | GErrorcxx . . $ GError# **error) |
| 115 | { |
| 116 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *no_dot_desktop = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 117 | |
| 118 | if (!g_str_has_suffixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:183:9`! (desktop_file_id, ".desktop")) |
| 119 | { |
| 120 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, |
| 121 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 122 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop file id missing .desktop suffix: %s"), desktop_file_id); |
| 123 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 124 | } |
| 125 | |
| 126 | no_dot_desktop = g_strndupcxx . . $ g_strndup(eabdfdef77619b3d). (desktop_file_id, |
| 127 | strlencxx . . $ strlen(751346f8406fd082).(desktop_file_id) - strlencxx . . $ strlen(751346f8406fd082). (".desktop")); |
| 128 | |
| 129 | if (!xdp_app_info_is_valid_sub_app_idcxx . . $ xdp_app_info_is_valid_sub_app_id(388d360a4f0b83e4). (app_info, no_dot_desktop)) |
| 130 | { |
| 131 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, |
| 132 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 133 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop file id is not valid")); |
| 134 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 135 | } |
| 136 | |
| 137 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 138 | } |
| 139 | |
| 140 | static gbooleancxx . . $ gboolean# |
| 141 | validate_serialized_iconcxx . . $ validate_serialized_icon(92a1765d39599c41). (GVariantcxx . . $ GVariant# *arg_icon_v, |
| 142 | char **icon_format, |
| 143 | char **icon_size) |
| 144 | { |
| 145 | GBytescxx . . $ GBytes# *bytes; |
| 146 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GIcon) icon = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 147 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) icon_v = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 148 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpSealedFd) sealed_icon = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 149 | |
| 150 | if (!arg_icon_v) |
| 151 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 152 | |
| 153 | if (!(icon_v = g_variant_get_variantcxx . . $ g_variant_get_variant(3606eab35379b54a). (arg_icon_v))) |
| 154 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 155 | |
| 156 | icon = g_icon_deserializecxx . . $ g_icon_deserialize(8cd3f636b419dca6). (icon_v); |
| 157 | |
| 158 | if (!G_IS_BYTES_ICONcxx . . $ `<external>/989989476751690633/gbytesicon.h:36:9`! (icon)) |
| 159 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 160 | |
| 161 | bytes = g_bytes_icon_get_bytescxx . . $ g_bytes_icon_get_bytes(509df4ba4ef0cc0a). (G_BYTES_ICONcxx . . $ `<external>/989989476751690633/gbytesicon.h:35:9`! (icon)); |
| 162 | sealed_icon = xdp_sealed_fd_new_from_bytescxx . . $ xdp_sealed_fd_new_from_bytes(2ec9282664e76650). (bytes, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 163 | |
| 164 | return sealed_icon && |
| 165 | xdp_validate_iconcxx . . $ xdp_validate_icon(d2530f8b074c20c3). (sealed_icon, |
| 166 | XDP_ICON_TYPE_DESKTOPcxx . . $ XDP_ICON_TYPE_DESKTOP., |
| 167 | icon_format, |
| 168 | icon_size); |
| 169 | } |
| 170 | |
| 171 | static gbooleancxx . . $ gboolean# |
| 172 | write_icon_to_diskcxx . . $ write_icon_to_disk(c48be7af9ab19294). (GVariantcxx . . $ GVariant# *icon_v, |
| 173 | const char *icon_subdir, |
| 174 | const char *icon_path, |
| 175 | GErrorcxx . . $ GError# **error) |
| 176 | { |
| 177 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GIcon) icon = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 178 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) icon_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 179 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFileOutputStream) icon_stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 180 | GBytescxx . . $ GBytes# *icon_bytes; |
| 181 | gconstpointercxx . . $ gconstpointer# bytes_data; |
| 182 | gsizecxx . . $ gsize# bytes_len; |
| 183 | |
| 184 | icon = g_icon_deserializecxx . . $ g_icon_deserialize(8cd3f636b419dca6). (icon_v); |
| 185 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (G_IS_BYTES_ICONcxx . . $ `<external>/989989476751690633/gbytesicon.h:36:9`! (icon)); |
| 186 | icon_bytes = g_bytes_icon_get_bytescxx . . $ g_bytes_icon_get_bytes(509df4ba4ef0cc0a). (G_BYTES_ICONcxx . . $ `<external>/989989476751690633/gbytesicon.h:35:9`! (icon)); |
| 187 | |
| 188 | g_mkdir_with_parentscxx . . $ g_mkdir_with_parents(cb7559238bb26814). (icon_subdir, 0700); |
| 189 | icon_file = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (icon_path); |
| 190 | icon_stream = g_file_replacecxx . . $ g_file_replace(fce880e00edcb3c1). (icon_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, G_FILE_CREATE_REPLACE_DESTINATIONcxx . . $ G_FILE_CREATE_REPLACE_DESTINATION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error); |
| 191 | if (icon_stream == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 192 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 193 | |
| 194 | /* Use write_all() instead of write_bytes() so we don't have to worry about |
| 195 | * partial writes (https://gitlab.gnome.org/GNOME/glib/-/issues/570). |
| 196 | */ |
| 197 | bytes_data = g_bytes_get_datacxx . . $ g_bytes_get_data(e1c692f77020eb9f). (icon_bytes, &bytes_len); |
| 198 | if (!g_output_stream_write_allcxx . . $ g_output_stream_write_all(bc39c6265c1f8b99). (G_OUTPUT_STREAMcxx . . $ `<external>/12960712863927311157/goutputstream.h:35:9`! (icon_stream), |
| 199 | bytes_data, bytes_len, |
| 200 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error) || |
| 201 | !g_output_stream_closecxx . . $ g_output_stream_close(9a028ff89e05cae6). (G_OUTPUT_STREAMcxx . . $ `<external>/12960712863927311157/goutputstream.h:35:9`! (icon_stream), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error)) |
| 202 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 203 | |
| 204 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 205 | } |
| 206 | |
| 207 | static void |
| 208 | get_icon_pathcxx . . $ get_icon_path(cc107ce794e18dc2). (const char *desktop_file_id, |
| 209 | const char *icon_extension, |
| 210 | const char *icon_size, |
| 211 | char **icon_dir_path_out, |
| 212 | char **icon_path_out) |
| 213 | { |
| 214 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *no_dot_desktop = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 215 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 216 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *subdir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 217 | |
| 218 | no_dot_desktop = g_strndupcxx . . $ g_strndup(eabdfdef77619b3d). (desktop_file_id, |
| 219 | strlencxx . . $ strlen(751346f8406fd082).(desktop_file_id) - strlencxx . . $ strlen(751346f8406fd082). (".desktop")); |
| 220 | icon_name = g_strconcatcxx . . $ g_strconcat(a849077ff1b8d812). (no_dot_desktop, ".", icon_extension, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 221 | |
| 222 | /* Put the icon in a per-size subdirectory so the size is discernible |
| 223 | * without reading the file |
| 224 | */ |
| 225 | if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (icon_extension, "svg") == 0) |
| 226 | subdir = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! ("scalable"); |
| 227 | else |
| 228 | subdir = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%sx%s", icon_size, icon_size); |
| 229 | |
| 230 | *icon_dir_path_out = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), |
| 231 | XDG_PORTAL_ICONS_DIRcxx . . $ `src/dynamic-launcher.h:30:9`!, |
| 232 | subdir, |
| 233 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 234 | *icon_path_out = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (*icon_dir_path_out, |
| 235 | icon_name, |
| 236 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 237 | } |
| 238 | |
| 239 | static gbooleancxx . . $ gboolean# |
| 240 | write_keyfile_to_diskcxx . . $ write_keyfile_to_disk(73eb134db2aeb9ef). (const char *desktop_file_id, |
| 241 | GKeyFilecxx . . $ GKeyFile# *desktop_keyfile, |
| 242 | GErrorcxx . . $ GError# **error) |
| 243 | { |
| 244 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 245 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 246 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *link_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 247 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *link_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 248 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *relative_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 249 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) link_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 250 | |
| 251 | /* Put the desktop file in ~/.local/share/xdg-desktop-portal/applications/ so |
| 252 | * there's no ambiguity about which launchers were created by this portal. |
| 253 | */ |
| 254 | desktop_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), |
| 255 | XDG_PORTAL_APPLICATIONS_DIRcxx . . $ `src/dynamic-launcher.h:29:9`!, |
| 256 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 257 | g_mkdir_with_parentscxx . . $ g_mkdir_with_parents(cb7559238bb26814). (desktop_dir, 0700); |
| 258 | desktop_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (desktop_dir, desktop_file_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 259 | |
| 260 | if (!g_key_file_save_to_filecxx . . $ g_key_file_save_to_file(a2c93750f4457442). (desktop_keyfile, desktop_path, error)) |
| 261 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 262 | |
| 263 | /* Make a sym link in ~/.local/share/applications so the launcher shows up in |
| 264 | * the desktop environment's menu. |
| 265 | */ |
| 266 | link_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), |
| 267 | "applications", |
| 268 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 269 | g_mkdir_with_parentscxx . . $ g_mkdir_with_parents(cb7559238bb26814). (link_dir, 0700); |
| 270 | link_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (link_dir, desktop_file_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 271 | |
| 272 | relative_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). ("..", |
| 273 | XDG_PORTAL_APPLICATIONS_DIRcxx . . $ `src/dynamic-launcher.h:29:9`!, |
| 274 | desktop_file_id, |
| 275 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 276 | |
| 277 | link_file = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (link_path); |
| 278 | g_file_deletecxx . . $ g_file_delete(a0fdb3d3b8f9744a). (link_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 279 | |
| 280 | if (!g_file_make_symbolic_linkcxx . . $ g_file_make_symbolic_link(7ebad09e11e0d3cd). (link_file, relative_path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error)) |
| 281 | { |
| 282 | removecxx . . $ remove(5c4306d8553b3696). (desktop_path); |
| 283 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 284 | } |
| 285 | |
| 286 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 287 | } |
| 288 | |
| 289 | static GKeyFilecxx . . $ GKeyFile# * |
| 290 | get_desktop_entrycxx . . $ get_desktop_entry(f1a20dae16019641). (const char *desktop_file_id, |
| 291 | const char *desktop_entry, |
| 292 | const char *name, |
| 293 | const char *app_id, |
| 294 | char *icon_path, |
| 295 | GErrorcxx . . $ GError# **error) |
| 296 | { |
| 297 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GKeyFile) key_file = g_key_file_newcxx . . $ g_key_file_new(9306a185df8cc356). (); |
| 298 | g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GStrv) groups = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 299 | |
| 300 | if (!g_key_file_load_from_datacxx . . $ g_key_file_load_from_data(df81ac01d9816af1). (key_file, desktop_entry, -1, |
| 301 | G_KEY_FILE_KEEP_COMMENTScxx . . $ G_KEY_FILE_KEEP_COMMENTS. | G_KEY_FILE_KEEP_TRANSLATIONScxx . . $ G_KEY_FILE_KEEP_TRANSLATIONS., |
| 302 | error)) |
| 303 | { |
| 304 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, |
| 305 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 306 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop entry given to Install() not a valid key file")); |
| 307 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 308 | } |
| 309 | |
| 310 | /* The desktop entry spec supports more than one group but we don't in case |
| 311 | * there's a security risk. |
| 312 | */ |
| 313 | groups = g_key_file_get_groupscxx . . $ g_key_file_get_groups(3778decce795f4da). (key_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 314 | if (g_strv_lengthcxx . . $ g_strv_length(658e6f1ffe3b2f0c). (groups) != 1 || |
| 315 | !g_strv_containscxx . . $ g_strv_contains(c305579a79625c02). ((const char * const *)groups, G_KEY_FILE_DESKTOP_GROUPcxx . . $ `<external>/12366871247351836173/gkeyfile.h:302:9`!)) |
| 316 | { |
| 317 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, |
| 318 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 319 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop entry given to Install() must have exactly one group")); |
| 320 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 321 | } |
| 322 | |
| 323 | /* Overwrite Name= and Icon= if they are present */ |
| 324 | g_key_file_set_stringcxx . . $ g_key_file_set_string(c55395ecd37921cb). (key_file, G_KEY_FILE_DESKTOP_GROUPcxx . . $ `<external>/12366871247351836173/gkeyfile.h:302:9`!, "Name", name); |
| 325 | g_key_file_set_stringcxx . . $ g_key_file_set_string(c55395ecd37921cb). (key_file, G_KEY_FILE_DESKTOP_GROUPcxx . . $ `<external>/12366871247351836173/gkeyfile.h:302:9`!, "Icon", icon_path); |
| 326 | |
| 327 | return g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&key_file); |
| 328 | } |
| 329 | |
| 330 | static gbooleancxx . . $ gboolean# |
| 331 | handle_installcxx . . $ handle_install(55d7fe1f05396d6b). (XdpDbusDynamicLaunchercxx . . $ XdpDbusDynamicLauncher# *object, |
| 332 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 333 | const gcharcxx . . $ gchar# *arg_token, |
| 334 | const gcharcxx . . $ gchar# *arg_desktop_file_id, |
| 335 | const gcharcxx . . $ gchar# *arg_desktop_entry, |
| 336 | GVariantcxx . . $ GVariant# *arg_options) |
| 337 | { |
| 338 | XdpCallcxx . . $ XdpCall# *call = xdp_call_from_invocationcxx . . $ xdp_call_from_invocation(844a7d983c951e16). (invocation); |
| 339 | const char *app_id = xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (call->app_infocxx . . $ _XdpCall#app_info.); |
| 340 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) launcher_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 341 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 342 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GKeyFile) desktop_keyfile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 343 | gsizecxx . . $ gsize# desktop_entry_length = G_MAXSIZEcxx . . $ `<external>/10505296616216143549/glibconfig.h:89:9`!; |
| 344 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) icon_v = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 345 | const char *name, *icon_extension, *icon_size; |
| 346 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_dir_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 347 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 348 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GDesktopAppInfo) desktop_app_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 349 | |
| 350 | launcher_data = get_launcher_data_and_revoke_tokencxx . . $ get_launcher_data_and_revoke_token(8d35775da1697fc2). (arg_token); |
| 351 | if (launcher_data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 352 | { |
| 353 | g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation, |
| 354 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, |
| 355 | XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 356 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Token given is invalid: %s"), arg_token); |
| 357 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 358 | } |
| 359 | |
| 360 | g_variant_getcxx . . $ g_variant_get(671e9cd8f09cd612). (launcher_data, "(&sv&s&s)", &name, &icon_v, &icon_extension, &icon_size); |
| 361 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (name != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && name[0] != '\0'); |
| 362 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (icon_v); |
| 363 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (icon_extension != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && icon_extension[0] != '\0'); |
| 364 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (icon_size != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && icon_size[0] != '\0'); |
| 365 | |
| 366 | if (!validate_desktop_file_idcxx . . $ validate_desktop_file_id(fa805841931d76a9). (call->app_infocxx . . $ _XdpCall#app_info., arg_desktop_file_id, &error)) |
| 367 | { |
| 368 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 369 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 370 | } |
| 371 | |
| 372 | get_icon_pathcxx . . $ get_icon_path(cc107ce794e18dc2). (arg_desktop_file_id, icon_extension, icon_size, |
| 373 | &icon_dir_path, &icon_path); |
| 374 | |
| 375 | desktop_keyfile = get_desktop_entrycxx . . $ get_desktop_entry(f1a20dae16019641). (arg_desktop_file_id, |
| 376 | arg_desktop_entry, |
| 377 | name, |
| 378 | app_id, |
| 379 | icon_path, |
| 380 | &error); |
| 381 | if (desktop_keyfile == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 382 | { |
| 383 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 384 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 385 | } |
| 386 | |
| 387 | if (!xdp_app_info_validate_dynamic_launchercxx . . $ xdp_app_info_validate_dynamic_launcher(f177895438394bd). (call->app_infocxx . . $ _XdpCall#app_info., |
| 388 | desktop_keyfile, |
| 389 | &error)) |
| 390 | { |
| 391 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 392 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 393 | } |
| 394 | |
| 395 | desktop_app_info = g_desktop_app_info_new_from_keyfilecxx . . $ g_desktop_app_info_new_from_keyfile(6cbd00cc015d10d). (desktop_keyfile); |
| 396 | if (desktop_app_info == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 397 | { |
| 398 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 399 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 400 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop entry given to Install() not valid")); |
| 401 | goto error; |
| 402 | } |
| 403 | |
| 404 | g_freecxx . . $ g_free(5d22bdacc48458e8). (g_key_file_to_datacxx . . $ g_key_file_to_data(a45dc388ad4c0686). (desktop_keyfile, &desktop_entry_length, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)); |
| 405 | if (desktop_entry_length > MAX_DESKTOP_SIZE_BYTEScxx . . $ `src/dynamic-launcher.c:48:9`!) |
| 406 | { |
| 407 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 408 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED., |
| 409 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop file exceeds max size (%d): %s"), |
| 410 | MAX_DESKTOP_SIZE_BYTEScxx . . $ `src/dynamic-launcher.c:48:9`!, arg_desktop_file_id); |
| 411 | goto error; |
| 412 | } |
| 413 | |
| 414 | /* Write the files last so it's only on-disk if other checks passed */ |
| 415 | if (!write_icon_to_diskcxx . . $ write_icon_to_disk(c48be7af9ab19294). (icon_v, icon_dir_path, icon_path, &error)) |
| 416 | goto error; |
| 417 | |
| 418 | if (!write_keyfile_to_diskcxx . . $ write_keyfile_to_disk(73eb134db2aeb9ef). (arg_desktop_file_id, desktop_keyfile, &error)) |
| 419 | { |
| 420 | removecxx . . $ remove(5c4306d8553b3696). (icon_path); |
| 421 | goto error; |
| 422 | } |
| 423 | |
| 424 | xdp_dbus_dynamic_launcher_complete_installcxx . . $ xdp_dbus_dynamic_launcher_complete_install(251bcec31cd6a143). (object, invocation); |
| 425 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 426 | |
| 427 | error: |
| 428 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 429 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 430 | } |
| 431 | |
| 432 | static XdpOptionKeycxx . . $ XdpOptionKey# response_optionscxx . . $ response_options.[] = { |
| 433 | { "name", G_VARIANT_TYPE_STRINGcxx . . $ `<external>/14064154155447831270/gvarianttype.h:122:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! }, |
| 434 | { "icon", G_VARIANT_TYPE_VARIANTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:160:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! }, |
| 435 | { "token", G_VARIANT_TYPE_UINT32cxx . . $ `<external>/14064154155447831270/gvarianttype.h:81:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! } |
| 436 | }; |
| 437 | |
| 438 | static gbooleancxx . . $ gboolean# |
| 439 | install_token_timeoutcxx . . $ install_token_timeout(dedf1e9b1c614a07). (gpointercxx . . $ gpointer# data) |
| 440 | { |
| 441 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) launcher_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 442 | const char *token = data; |
| 443 | |
| 444 | g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Revoking install token %s", token); |
| 445 | launcher_data = get_launcher_data_and_revoke_tokencxx . . $ get_launcher_data_and_revoke_token(8d35775da1697fc2). (token); |
| 446 | |
| 447 | return G_SOURCE_REMOVEcxx . . $ `<external>/1856471541377536744/gmain.h:475:9`!; |
| 448 | } |
| 449 | |
| 450 | static void |
| 451 | set_launcher_data_for_tokencxx . . $ set_launcher_data_for_token(74fbd327f53f8797). (const char *token, |
| 452 | GVariantcxx . . $ GVariant# *launcher_data) |
| 453 | { |
| 454 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GMutexLocker) locker = g_mutex_locker_newcxx . . $ g_mutex_locker_new(3c345ff2ce91af48). (&transient_permissions_lockcxx . . $ transient_permissions_lock.); |
| 455 | guintcxx . . $ guint# timeout_id; |
| 456 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) launcher_data_wrapped = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 457 | |
| 458 | if (!transient_permissionscxx . . $ transient_permissions.) |
| 459 | { |
| 460 | transient_permissionscxx . . $ transient_permissions. = g_hash_table_new_fullcxx . . $ g_hash_table_new_full(e2dd12b570de7430). (g_str_hashcxx . . $ g_str_hash(b11f534102b1ad6)., g_str_equalcxx . . $ g_str_equal(9148c8c3ff42c9d8)., |
| 461 | g_freecxx . . $ g_free(5d22bdacc48458e8)., (GDestroyNotifycxx . . $ GDestroyNotify#)g_variant_unrefcxx . . $ g_variant_unref(86dbca581f53fd84).); |
| 462 | } |
| 463 | |
| 464 | /* Revoke the token if it hasn't been used after 5 minutes, in case of |
| 465 | * client bugs. This is what the GNOME print portal implementation does. |
| 466 | */ |
| 467 | timeout_id = g_timeout_add_seconds_fullcxx . . $ g_timeout_add_seconds_full(4087e95f42316890). (G_PRIORITY_DEFAULTcxx . . $ `<external>/1856471541377536744/gmain.h:434:9`!, 300, install_token_timeoutcxx . . $ install_token_timeout(dedf1e9b1c614a07)., |
| 468 | g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (token), g_freecxx . . $ g_free(5d22bdacc48458e8).); |
| 469 | launcher_data_wrapped = |
| 470 | g_variant_ref_sinkcxx . . $ g_variant_ref_sink(3606eab35379b54a). (g_variant_newcxx . . $ g_variant_new(59b7d1999758b6d9). ("(vu)", launcher_data, timeout_id)); |
| 471 | |
| 472 | g_hash_table_insertcxx . . $ g_hash_table_insert(6a7c46015dd5ef26). (transient_permissionscxx . . $ transient_permissions., |
| 473 | g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (token), |
| 474 | g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&launcher_data_wrapped)); |
| 475 | } |
| 476 | |
| 477 | static void |
| 478 | prepare_install_donecxx . . $ prepare_install_done(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source, |
| 479 | GAsyncResultcxx . . $ GAsyncResult# *result, |
| 480 | gpointercxx . . $ gpointer# data) |
| 481 | { |
| 482 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpRequest) request = data; |
| 483 | guintcxx . . $ guint# response = 2; |
| 484 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) results = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 485 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 486 | g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) results_builder = |
| 487 | G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!); |
| 488 | |
| 489 | REQUEST_AUTOLOCKcxx . . $ `src/xdp-request.h:103:9`! (request); |
| 490 | |
| 491 | if (!xdp_dbus_impl_dynamic_launcher_call_prepare_install_finishcxx . . $ xdp_dbus_impl_dynamic_launcher_call_prepare_install_finish(a125bcd5bd299874). (XDP_DBUS_IMPL_DYNAMIC_LAUNCHERcxx . . $ `build/src/xdp-impl-dbus.h:1199:9`! (source), |
| 492 | &response, |
| 493 | &results, |
| 494 | result, |
| 495 | &error)) |
| 496 | { |
| 497 | g_dbus_error_strip_remote_errorcxx . . $ g_dbus_error_strip_remote_error(425e103a815b829). (error); |
| 498 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Backend call failed: %s", error->message); |
| 499 | goto out; |
| 500 | } |
| 501 | |
| 502 | if (request->exportedcxx . . $ _XdpRequest#exported. && response == 0) |
| 503 | { |
| 504 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *token = g_uuid_string_randomcxx . . $ g_uuid_string_random(41208ce6ca65dd58). (); |
| 505 | const char *chosen_name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 506 | const char *icon_format = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 507 | const char *icon_size = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 508 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) chosen_icon = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 509 | |
| 510 | icon_format = g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "icon-format"); |
| 511 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (icon_format != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && icon_format[0] != '\0'); |
| 512 | icon_size = g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "icon-size"); |
| 513 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (icon_size != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && icon_size[0] != '\0'); |
| 514 | |
| 515 | if (!xdp_filter_optionscxx . . $ xdp_filter_options(d63f67045969ba55). (results, &results_builder, |
| 516 | response_optionscxx . . $ response_options., G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (response_options), |
| 517 | &error) || |
| 518 | !g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (results, "name", "&s", &chosen_name) || |
| 519 | chosen_name[0] == '\0' || |
| 520 | !g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (results, "icon", "v", &chosen_icon)) |
| 521 | { |
| 522 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Results from backend failed validation: %s", |
| 523 | error ? error->message : "missing entries"); |
| 524 | response = 2; |
| 525 | } |
| 526 | else |
| 527 | { |
| 528 | GVariantcxx . . $ GVariant# *launcher_data; |
| 529 | |
| 530 | /* Save the token in memory and return it to the caller */ |
| 531 | launcher_data = g_variant_newcxx . . $ g_variant_new(59b7d1999758b6d9). ("(svss)", chosen_name, chosen_icon, icon_format, icon_size); |
| 532 | set_launcher_data_for_tokencxx . . $ set_launcher_data_for_token(74fbd327f53f8797). (token, launcher_data); |
| 533 | g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&results_builder, "{sv}", "token", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (token)); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | out: |
| 538 | if (request->exportedcxx . . $ _XdpRequest#exported.) |
| 539 | { |
| 540 | xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6732:9`! (request), |
| 541 | response, |
| 542 | g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&results_builder)); |
| 543 | |
| 544 | xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request); |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | static gbooleancxx . . $ gboolean# |
| 549 | validate_urlcxx . . $ validate_url(a4f81f97d7ea3409). (const char *key, |
| 550 | GVariantcxx . . $ GVariant# *value, |
| 551 | GVariantcxx . . $ GVariant# *options, |
| 552 | GErrorcxx . . $ GError# **error) |
| 553 | { |
| 554 | const char *url = g_variant_get_stringcxx . . $ g_variant_get_string(5d5cac9792ea78b8). (value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 555 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) local_error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 556 | guint32cxx . . $ guint32# launcher_type; |
| 557 | |
| 558 | g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "launcher_type", "u", &launcher_type); |
| 559 | if (launcher_type == DYNAMIC_LAUNCHER_TYPE_WEBAPPcxx . . $ DYNAMIC_LAUNCHER_TYPE_WEBAPP. && |
| 560 | !g_uri_is_validcxx . . $ g_uri_is_valid(10ff756d9b897251). (url, G_URI_FLAGS_NONEcxx . . $ G_URI_FLAGS_NONE., &local_error)) |
| 561 | { |
| 562 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 563 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("URL given is invalid: %s"), local_error->messagecxx . . $ _GError#message.); |
| 564 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 565 | } |
| 566 | |
| 567 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 568 | } |
| 569 | |
| 570 | static gbooleancxx . . $ gboolean# |
| 571 | validate_launcher_typecxx . . $ validate_launcher_type(a4f81f97d7ea3409). (const char *key, |
| 572 | GVariantcxx . . $ GVariant# *value, |
| 573 | GVariantcxx . . $ GVariant# *options, |
| 574 | GErrorcxx . . $ GError# **error) |
| 575 | { |
| 576 | guint32cxx . . $ guint32# launcher_type = g_variant_get_uint32cxx . . $ g_variant_get_uint32(59fb6aaaf011986f). (value); |
| 577 | guint32cxx . . $ guint32# supported_launcher_types; |
| 578 | |
| 579 | supported_launcher_types = |
| 580 | xdp_dbus_dynamic_launcher_get_supported_launcher_typescxx . . $ xdp_dbus_dynamic_launcher_get_supported_launcher_types(5954be25188d6f72). |
| 581 | (XDP_DBUS_DYNAMIC_LAUNCHERcxx . . $ `build/src/xdp-dbus.h:1541:9`! (dynamic_launcher)); |
| 582 | |
| 583 | if (__builtin_popcountcxx . . $ __builtin_popcount(4c679297bf94b9eb). (launcher_type) != 1) |
| 584 | { |
| 585 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 586 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Invalid launcher type: %x"), launcher_type); |
| 587 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 588 | } |
| 589 | |
| 590 | if (!(supported_launcher_types & launcher_type)) |
| 591 | { |
| 592 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 593 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Unsupported launcher type: %x"), launcher_type); |
| 594 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 595 | } |
| 596 | |
| 597 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 598 | } |
| 599 | |
| 600 | static XdpOptionKeycxx . . $ XdpOptionKey# prepare_install_optionscxx . . $ prepare_install_options.[] = { |
| 601 | { "modal", G_VARIANT_TYPE_BOOLEANcxx . . $ `<external>/14064154155447831270/gvarianttype.h:41:9`! }, |
| 602 | { "launcher_type", G_VARIANT_TYPE_UINT32cxx . . $ `<external>/14064154155447831270/gvarianttype.h:81:9`!, validate_launcher_typecxx . . $ validate_launcher_type(a4f81f97d7ea3409). }, |
| 603 | { "target", G_VARIANT_TYPE_STRINGcxx . . $ `<external>/14064154155447831270/gvarianttype.h:122:9`!, validate_urlcxx . . $ validate_url(a4f81f97d7ea3409). }, |
| 604 | { "editable_name", G_VARIANT_TYPE_BOOLEANcxx . . $ `<external>/14064154155447831270/gvarianttype.h:41:9`! }, |
| 605 | { "editable_icon", G_VARIANT_TYPE_BOOLEANcxx . . $ `<external>/14064154155447831270/gvarianttype.h:41:9`! } |
| 606 | }; |
| 607 | |
| 608 | static gbooleancxx . . $ gboolean# |
| 609 | handle_prepare_installcxx . . $ handle_prepare_install(fa583d548849c6c3). (XdpDbusDynamicLaunchercxx . . $ XdpDbusDynamicLauncher# *object, |
| 610 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 611 | const gcharcxx . . $ gchar# *arg_parent_window, |
| 612 | const gcharcxx . . $ gchar# *arg_name, |
| 613 | GVariantcxx . . $ GVariant# *arg_icon_v, |
| 614 | GVariantcxx . . $ GVariant# *arg_options) |
| 615 | { |
| 616 | XdpRequestcxx . . $ XdpRequest# *request = xdp_request_from_invocationcxx . . $ xdp_request_from_invocation(9583a51810815010). (invocation); |
| 617 | const char *app_id = xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (request->app_infocxx . . $ _XdpRequest#app_info.); |
| 618 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 619 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpDbusImplRequest) impl_request = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 620 | g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) opt_builder = |
| 621 | G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!); |
| 622 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_format = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 623 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_size = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 624 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) icon_v = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 625 | |
| 626 | REQUEST_AUTOLOCKcxx . . $ `src/xdp-request.h:103:9`! (request); |
| 627 | |
| 628 | impl_request = xdp_dbus_impl_request_proxy_new_synccxx . . $ xdp_dbus_impl_request_proxy_new_sync(b36c38a372f8f089). (g_dbus_proxy_get_connectioncxx . . $ g_dbus_proxy_get_connection(fd0690ce15ac5ecf). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl)), |
| 629 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIEScxx . . $ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES., |
| 630 | g_dbus_proxy_get_namecxx . . $ g_dbus_proxy_get_name(c2c3b8a4da378b0d). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl)), |
| 631 | request->idcxx . . $ _XdpRequest#id., |
| 632 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error); |
| 633 | if (!impl_request) |
| 634 | { |
| 635 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 636 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 637 | } |
| 638 | |
| 639 | xdp_request_set_impl_requestcxx . . $ xdp_request_set_impl_request(18bd0ab3b325ada4). (request, impl_request); |
| 640 | xdp_request_exportcxx . . $ xdp_request_export(49d11f351a243e17). (request, g_dbus_method_invocation_get_connectioncxx . . $ g_dbus_method_invocation_get_connection(8c6afd006dd99032). (invocation)); |
| 641 | |
| 642 | if (!xdp_filter_optionscxx . . $ xdp_filter_options(d63f67045969ba55). (arg_options, &opt_builder, |
| 643 | prepare_install_optionscxx . . $ prepare_install_options., G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (prepare_install_options), &error)) |
| 644 | { |
| 645 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 646 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 647 | } |
| 648 | |
| 649 | /* Do some validation on the icon before passing it along */ |
| 650 | if (!validate_serialized_iconcxx . . $ validate_serialized_icon(92a1765d39599c41). (arg_icon_v, &icon_format, &icon_size)) |
| 651 | { |
| 652 | g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation, |
| 653 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, |
| 654 | XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 655 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Dynamic launcher icon failed validation")); |
| 656 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 657 | } |
| 658 | |
| 659 | g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "icon-format", g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&icon_format), g_freecxx . . $ g_free(5d22bdacc48458e8).); |
| 660 | g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "icon-size", g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&icon_size), g_freecxx . . $ g_free(5d22bdacc48458e8).); |
| 661 | |
| 662 | xdp_dbus_impl_dynamic_launcher_call_prepare_installcxx . . $ xdp_dbus_impl_dynamic_launcher_call_prepare_install(c97b27e409ac774b). (implcxx . . $ impl., |
| 663 | request->idcxx . . $ _XdpRequest#id., |
| 664 | app_id, |
| 665 | arg_parent_window, |
| 666 | arg_name, |
| 667 | arg_icon_v, |
| 668 | g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder), |
| 669 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* cancellable */ |
| 670 | prepare_install_donecxx . . $ prepare_install_done(aa1d200d824d915d)., |
| 671 | g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request)); |
| 672 | |
| 673 | xdp_dbus_dynamic_launcher_complete_prepare_installcxx . . $ xdp_dbus_dynamic_launcher_complete_prepare_install(be3cb18eb745f7b8). (object, invocation, request->idcxx . . $ _XdpRequest#id.); |
| 674 | |
| 675 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 676 | } |
| 677 | |
| 678 | static gbooleancxx . . $ gboolean# |
| 679 | handle_request_install_tokencxx . . $ handle_request_install_token(a0f66a6094544459). (XdpDbusDynamicLaunchercxx . . $ XdpDbusDynamicLauncher# *object, |
| 680 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 681 | const gcharcxx . . $ gchar# *arg_name, |
| 682 | GVariantcxx . . $ GVariant# *arg_icon_v, |
| 683 | GVariantcxx . . $ GVariant# *arg_options) |
| 684 | { |
| 685 | XdpCallcxx . . $ XdpCall# *call = xdp_call_from_invocationcxx . . $ xdp_call_from_invocation(844a7d983c951e16). (invocation); |
| 686 | const char *app_id = xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (call->app_infocxx . . $ _XdpCall#app_info.); |
| 687 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 688 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *token = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 689 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_format = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 690 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_size = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 691 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) icon_v = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 692 | guintcxx . . $ guint# response = 2; |
| 693 | |
| 694 | /* Don't enforce app ID requirements on unsandboxed apps if the app ID |
| 695 | * couldn't be determined. Otherwise the check would fail if for example the |
| 696 | * app was launched from the CLI: |
| 697 | * https://github.com/flatpak/xdg-desktop-portal/pull/719#issuecomment-1057412221 |
| 698 | */ |
| 699 | if (xdp_app_info_is_hostcxx . . $ xdp_app_info_is_host(ac6b23a20a03546d). (call->app_infocxx . . $ _XdpCall#app_info.) && g_str_equalcxx . . $ `<external>/7714589265505779806/ghash.h:175:9`! (app_id, "")) |
| 700 | { |
| 701 | response = 0; |
| 702 | } |
| 703 | else if (!xdp_dbus_impl_dynamic_launcher_call_request_install_token_synccxx . . $ xdp_dbus_impl_dynamic_launcher_call_request_install_token_sync(196dcb9f89b67781). (implcxx . . $ impl., |
| 704 | app_id, |
| 705 | arg_options, |
| 706 | &response, |
| 707 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* cancellable */ |
| 708 | &error)) |
| 709 | { |
| 710 | g_dbus_error_strip_remote_errorcxx . . $ g_dbus_error_strip_remote_error(425e103a815b829). (error); |
| 711 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Backend call failed: %s", error->message); |
| 712 | response = 2; |
| 713 | } |
| 714 | |
| 715 | if (response == 0) |
| 716 | { |
| 717 | GVariantcxx . . $ GVariant# *launcher_data; |
| 718 | |
| 719 | /* Do some validation on the icon before saving it */ |
| 720 | if (!validate_serialized_iconcxx . . $ validate_serialized_icon(92a1765d39599c41). (arg_icon_v, &icon_format, &icon_size)) |
| 721 | { |
| 722 | g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation, |
| 723 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, |
| 724 | XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 725 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Dynamic launcher icon failed validation")); |
| 726 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 727 | } |
| 728 | |
| 729 | launcher_data = g_variant_newcxx . . $ g_variant_new(59b7d1999758b6d9). ("(svss)", arg_name, icon_v, icon_format, icon_size); |
| 730 | token = g_uuid_string_randomcxx . . $ g_uuid_string_random(41208ce6ca65dd58). (); |
| 731 | |
| 732 | /* Save the token in memory and return it to the caller */ |
| 733 | set_launcher_data_for_tokencxx . . $ set_launcher_data_for_token(74fbd327f53f8797). (token, launcher_data); |
| 734 | |
| 735 | xdp_dbus_dynamic_launcher_complete_request_install_tokencxx . . $ xdp_dbus_dynamic_launcher_complete_request_install_token(be3cb18eb745f7b8). (object, invocation, token); |
| 736 | } |
| 737 | else |
| 738 | { |
| 739 | g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation, |
| 740 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWED., |
| 741 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("RequestInstallToken() not allowed for app id %s"), |
| 742 | xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (call->app_infocxx . . $ _XdpCall#app_info.)); |
| 743 | } |
| 744 | |
| 745 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 746 | } |
| 747 | |
| 748 | static gbooleancxx . . $ gboolean# |
| 749 | handle_uninstallcxx . . $ handle_uninstall(232026e62ae49bff). (XdpDbusDynamicLaunchercxx . . $ XdpDbusDynamicLauncher# *object, |
| 750 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 751 | const gcharcxx . . $ gchar# *arg_desktop_file_id, |
| 752 | GVariantcxx . . $ GVariant# *arg_options) |
| 753 | { |
| 754 | XdpCallcxx . . $ XdpCall# *call = xdp_call_from_invocationcxx . . $ xdp_call_from_invocation(844a7d983c951e16). (invocation); |
| 755 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 756 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) desktop_file_error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 757 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 758 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 759 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 760 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) icon_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 761 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) desktop_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 762 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) link_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 763 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GKeyFile) desktop_keyfile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 764 | |
| 765 | if (!validate_desktop_file_idcxx . . $ validate_desktop_file_id(fa805841931d76a9). (call->app_infocxx . . $ _XdpCall#app_info., arg_desktop_file_id, &error)) |
| 766 | { |
| 767 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 768 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 769 | } |
| 770 | |
| 771 | icon_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), XDG_PORTAL_ICONS_DIRcxx . . $ `src/dynamic-launcher.h:30:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 772 | desktop_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), XDG_PORTAL_APPLICATIONS_DIRcxx . . $ `src/dynamic-launcher.h:29:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 773 | |
| 774 | link_file = g_file_new_build_filenamecxx . . $ g_file_new_build_filename(8ea5684f6e18073b). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), "applications", arg_desktop_file_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 775 | if (!g_file_deletecxx . . $ g_file_delete(a0fdb3d3b8f9744a). (link_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error)) |
| 776 | { |
| 777 | if (g_error_matchescxx . . $ g_error_matches(604444fafc3e7b63). (error, G_IO_ERRORcxx . . $ `<external>/13894955190784973534/gioerror.h:42:9`!, G_IO_ERROR_NOT_FOUNDcxx . . $ G_IO_ERROR_NOT_FOUND.)) |
| 778 | g_infocxx . . $ `<external>/5169755362661750954/gmessages.h:368:9`! ("Uninstall() method failed because launcher '%s' does not exist", arg_desktop_file_id); |
| 779 | goto error; |
| 780 | } |
| 781 | |
| 782 | desktop_file = g_file_new_build_filenamecxx . . $ g_file_new_build_filename(8ea5684f6e18073b). (desktop_dir, arg_desktop_file_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 783 | desktop_keyfile = g_key_file_newcxx . . $ g_key_file_new(9306a185df8cc356). (); |
| 784 | if (g_key_file_load_from_filecxx . . $ g_key_file_load_from_file(bcc17b2835987676). (desktop_keyfile, g_file_peek_pathcxx . . $ g_file_peek_path(7a86aa469ebf3be2). (desktop_file), G_KEY_FILE_NONEcxx . . $ G_KEY_FILE_NONE., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 785 | icon_path = g_key_file_get_stringcxx . . $ g_key_file_get_string(30132561f3054bb4). (desktop_keyfile, G_KEY_FILE_DESKTOP_GROUPcxx . . $ `<external>/12366871247351836173/gkeyfile.h:302:9`!, "Icon", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 786 | |
| 787 | g_file_deletecxx . . $ g_file_delete(a0fdb3d3b8f9744a). (desktop_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &desktop_file_error); |
| 788 | |
| 789 | if (icon_path && g_str_has_prefixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:159:9`! (icon_path, icon_dir)) |
| 790 | { |
| 791 | icon_file = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (icon_path); |
| 792 | if (!g_file_deletecxx . . $ g_file_delete(a0fdb3d3b8f9744a). (icon_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error)) |
| 793 | goto error; |
| 794 | } |
| 795 | |
| 796 | if (desktop_file_error) |
| 797 | goto error; |
| 798 | |
| 799 | xdp_dbus_dynamic_launcher_complete_uninstallcxx . . $ xdp_dbus_dynamic_launcher_complete_uninstall(251bcec31cd6a143). (object, invocation); |
| 800 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 801 | |
| 802 | error: |
| 803 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 804 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 805 | } |
| 806 | |
| 807 | static gbooleancxx . . $ gboolean# |
| 808 | handle_get_desktop_entrycxx . . $ handle_get_desktop_entry(7380464565706a3b). (XdpDbusDynamicLaunchercxx . . $ XdpDbusDynamicLauncher# *object, |
| 809 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 810 | const gcharcxx . . $ gchar# *arg_desktop_file_id) |
| 811 | { |
| 812 | XdpCallcxx . . $ XdpCall# *call = xdp_call_from_invocationcxx . . $ xdp_call_from_invocation(844a7d983c951e16). (invocation); |
| 813 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 814 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 815 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *contents = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 816 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 817 | gsizecxx . . $ gsize# length; |
| 818 | |
| 819 | if (!validate_desktop_file_idcxx . . $ validate_desktop_file_id(fa805841931d76a9). (call->app_infocxx . . $ _XdpCall#app_info., arg_desktop_file_id, &error)) |
| 820 | goto error; |
| 821 | |
| 822 | desktop_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), XDG_PORTAL_APPLICATIONS_DIRcxx . . $ `src/dynamic-launcher.h:29:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 823 | |
| 824 | desktop_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (desktop_dir, arg_desktop_file_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 825 | if (!g_file_get_contentscxx . . $ g_file_get_contents(295e1f4744034d8a). (desktop_path, &contents, &length, &error)) |
| 826 | goto error; |
| 827 | if (length > MAX_DESKTOP_SIZE_BYTEScxx . . $ `src/dynamic-launcher.c:48:9`!) |
| 828 | { |
| 829 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 830 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED., |
| 831 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop file exceeds max size (%d): %s"), |
| 832 | MAX_DESKTOP_SIZE_BYTEScxx . . $ `src/dynamic-launcher.c:48:9`!, arg_desktop_file_id); |
| 833 | goto error; |
| 834 | } |
| 835 | |
| 836 | xdp_dbus_dynamic_launcher_complete_get_desktop_entrycxx . . $ xdp_dbus_dynamic_launcher_complete_get_desktop_entry(be3cb18eb745f7b8). (object, invocation, contents); |
| 837 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 838 | |
| 839 | error: |
| 840 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 841 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 842 | } |
| 843 | |
| 844 | static gbooleancxx . . $ gboolean# |
| 845 | handle_get_iconcxx . . $ handle_get_icon(7380464565706a3b). (XdpDbusDynamicLaunchercxx . . $ XdpDbusDynamicLauncher# *object, |
| 846 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 847 | const gcharcxx . . $ gchar# *arg_desktop_file_id) |
| 848 | { |
| 849 | XdpCallcxx . . $ XdpCall# *call = xdp_call_from_invocationcxx . . $ xdp_call_from_invocation(844a7d983c951e16). (invocation); |
| 850 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 851 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 852 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *contents = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 853 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 854 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 855 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 856 | gsizecxx . . $ gsize# length; |
| 857 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GKeyFile) key_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 858 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) icon_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 859 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GIcon) icon = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 860 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GInputStream) stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 861 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GBytes) bytes = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 862 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GIcon) bytes_icon = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 863 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) icon_v = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 864 | const gcharcxx . . $ gchar# *icon_format = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 865 | int icon_size = 0; |
| 866 | |
| 867 | if (!validate_desktop_file_idcxx . . $ validate_desktop_file_id(fa805841931d76a9). (call->app_infocxx . . $ _XdpCall#app_info., arg_desktop_file_id, &error)) |
| 868 | goto error; |
| 869 | |
| 870 | desktop_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), XDG_PORTAL_APPLICATIONS_DIRcxx . . $ `src/dynamic-launcher.h:29:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 871 | icon_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), XDG_PORTAL_ICONS_DIRcxx . . $ `src/dynamic-launcher.h:30:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 872 | |
| 873 | desktop_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (desktop_dir, arg_desktop_file_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 874 | if (!g_file_get_contentscxx . . $ g_file_get_contents(295e1f4744034d8a). (desktop_path, &contents, &length, &error)) |
| 875 | goto error; |
| 876 | if (length > MAX_DESKTOP_SIZE_BYTEScxx . . $ `src/dynamic-launcher.c:48:9`!) |
| 877 | { |
| 878 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 879 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED., |
| 880 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop file exceeds max size (%d): %s"), |
| 881 | MAX_DESKTOP_SIZE_BYTEScxx . . $ `src/dynamic-launcher.c:48:9`!, arg_desktop_file_id); |
| 882 | goto error; |
| 883 | } |
| 884 | |
| 885 | key_file = g_key_file_newcxx . . $ g_key_file_new(9306a185df8cc356). (); |
| 886 | if (!g_key_file_load_from_datacxx . . $ g_key_file_load_from_data(df81ac01d9816af1). (key_file, contents, -1, G_KEY_FILE_NONEcxx . . $ G_KEY_FILE_NONE., &error)) |
| 887 | goto error; |
| 888 | |
| 889 | icon_path = g_key_file_get_stringcxx . . $ g_key_file_get_string(30132561f3054bb4). (key_file, G_KEY_FILE_DESKTOP_GROUPcxx . . $ `<external>/12366871247351836173/gkeyfile.h:302:9`!, "Icon", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 890 | if (icon_path && g_str_has_prefixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:159:9`! (icon_path, icon_dir)) |
| 891 | { |
| 892 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 893 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *icon_dir_basename = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 894 | const char *x; |
| 895 | |
| 896 | if (g_str_has_suffixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:183:9`! (icon_path, ".png")) |
| 897 | icon_format = "png"; |
| 898 | else if (g_str_has_suffixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:183:9`! (icon_path, ".svg")) |
| 899 | icon_format = "svg"; |
| 900 | else if (g_str_has_suffixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:183:9`! (icon_path, ".jpeg") || g_str_has_suffixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:183:9`! (icon_path, ".jpg")) |
| 901 | icon_format = "jpeg"; |
| 902 | |
| 903 | /* dir should be either scalable or e.g. 512x512 */ |
| 904 | icon_dir = g_path_get_dirnamecxx . . $ g_path_get_dirname(a8b8e32347182212). (icon_path); |
| 905 | icon_dir_basename = g_path_get_basenamecxx . . $ g_path_get_basename(a8b8e32347182212). (icon_dir); |
| 906 | if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (icon_dir_basename, "scalable") == 0) { |
| 907 | /* An svg can have a width and height set, but it is probably not |
| 908 | * needed since it can be scaled to any size. |
| 909 | */ |
| 910 | icon_size = 4096; |
| 911 | } else if ((x = strchrcxx . . $ strchr(2050848944e00d54). (icon_dir_basename, 'x')) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 912 | icon_size = atoicxx . . $ atoi(5c4306d8553b3696). (x + 1); |
| 913 | } |
| 914 | } |
| 915 | |
| 916 | if (!icon_format || icon_size <= 0 || icon_size > 4096) |
| 917 | { |
| 918 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 919 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED., |
| 920 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop file '%s' icon at unrecognized path"), arg_desktop_file_id); |
| 921 | goto error; |
| 922 | } |
| 923 | |
| 924 | icon_file = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (icon_path); |
| 925 | icon = g_file_icon_newcxx . . $ g_file_icon_new(fb64a04948a40608). (icon_file); |
| 926 | stream = g_loadable_icon_loadcxx . . $ g_loadable_icon_load(dc67b6450e94a6eb). (G_LOADABLE_ICONcxx . . $ `<external>/3440158711917559949/gloadableicon.h:35:9`! (icon), 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 927 | |
| 928 | /* Icons are usually smaller than 1 MiB. Set a 10 MiB |
| 929 | * limit so we can't use a huge amount of memory or hit |
| 930 | * the D-Bus message size limit |
| 931 | */ |
| 932 | if (stream) |
| 933 | bytes = g_input_stream_read_bytescxx . . $ g_input_stream_read_bytes(cdd8f014f6fa6fca). (stream, 10485760 /* 10 MiB */, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 934 | if (bytes) |
| 935 | bytes_icon = g_bytes_icon_newcxx . . $ g_bytes_icon_new(c33aa6e58dc08f3). (bytes); |
| 936 | if (bytes_icon) |
| 937 | icon_v = g_icon_serializecxx . . $ g_icon_serialize(2b21c86047595053). (bytes_icon); |
| 938 | |
| 939 | if (icon_v == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 940 | { |
| 941 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 942 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED., |
| 943 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Desktop file '%s' icon failed to serialize"), arg_desktop_file_id); |
| 944 | goto error; |
| 945 | } |
| 946 | |
| 947 | xdp_dbus_dynamic_launcher_complete_get_iconcxx . . $ xdp_dbus_dynamic_launcher_complete_get_icon(4f3a8cff7035ea52). (object, invocation, |
| 948 | g_variant_new_variantcxx . . $ g_variant_new_variant(3606eab35379b54a). (icon_v), |
| 949 | icon_format, icon_size); |
| 950 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 951 | |
| 952 | error: |
| 953 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 954 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 955 | } |
| 956 | |
| 957 | static gbooleancxx . . $ gboolean# |
| 958 | handle_launchcxx . . $ handle_launch(232026e62ae49bff). (XdpDbusDynamicLaunchercxx . . $ XdpDbusDynamicLauncher# *object, |
| 959 | GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation, |
| 960 | const gcharcxx . . $ gchar# *arg_desktop_file_id, |
| 961 | GVariantcxx . . $ GVariant# *arg_options) |
| 962 | { |
| 963 | XdpCallcxx . . $ XdpCall# *call = xdp_call_from_invocationcxx . . $ xdp_call_from_invocation(844a7d983c951e16). (invocation); |
| 964 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 965 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_dir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 966 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 967 | const char *activation_token = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 968 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpAppLaunchContext) xdp_launch_context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 969 | GAppLaunchContextcxx . . $ GAppLaunchContext# *launch_context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 970 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GDesktopAppInfo) app_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 971 | |
| 972 | if (!validate_desktop_file_idcxx . . $ validate_desktop_file_id(fa805841931d76a9). (call->app_infocxx . . $ _XdpCall#app_info., arg_desktop_file_id, &error)) |
| 973 | goto error; |
| 974 | |
| 975 | desktop_dir = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), XDG_PORTAL_APPLICATIONS_DIRcxx . . $ `src/dynamic-launcher.h:29:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 976 | |
| 977 | desktop_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (desktop_dir, arg_desktop_file_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 978 | if (!g_file_testcxx . . $ g_file_test(d991f72152d535bf). (desktop_path, G_FILE_TEST_EXISTScxx . . $ G_FILE_TEST_EXISTS.)) |
| 979 | { |
| 980 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 981 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT., |
| 982 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("No dynamic launcher exists with id '%s'"), arg_desktop_file_id); |
| 983 | goto error; |
| 984 | } |
| 985 | |
| 986 | g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "activation_token", "&s", &activation_token); |
| 987 | |
| 988 | xdp_launch_context = xdp_app_launch_context_newcxx . . $ xdp_app_launch_context_new(76568252a1f361cc). (); |
| 989 | launch_context = G_APP_LAUNCH_CONTEXTcxx . . $ `<external>/6793221688627496808/gappinfo.h:40:9`! (xdp_launch_context); |
| 990 | /* Unset env var set in main() */ |
| 991 | g_app_launch_context_unsetenvcxx . . $ g_app_launch_context_unsetenv(7801ea72181143d1). (launch_context, "GIO_USE_VFS"); |
| 992 | /* Set activation token for focus stealing prevention */ |
| 993 | xdp_app_launch_context_set_activation_tokencxx . . $ xdp_app_launch_context_set_activation_token(e948952cc5d8af89). (xdp_launch_context, |
| 994 | activation_token); |
| 995 | |
| 996 | app_info = g_desktop_app_info_new_from_filenamecxx . . $ g_desktop_app_info_new_from_filename(eecce1e92d8304e9). (desktop_path); |
| 997 | if (app_info == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 998 | { |
| 999 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (&error, |
| 1000 | XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!, XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED., |
| 1001 | _cxx . . $ `<external>/12274105664691031387/gi18n.h:28:10`!("Failed to create GDesktopAppInfo for launcher with id '%s'"), |
| 1002 | arg_desktop_file_id); |
| 1003 | goto error; |
| 1004 | } |
| 1005 | |
| 1006 | g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Launching %s", arg_desktop_file_id); |
| 1007 | if (!g_app_info_launchcxx . . $ g_app_info_launch(6cc48b63116ab7bf). (G_APP_INFOcxx . . $ `<external>/6793221688627496808/gappinfo.h:35:9`! (app_info), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, launch_context, &error)) |
| 1008 | goto error; |
| 1009 | |
| 1010 | xdp_dbus_dynamic_launcher_complete_launchcxx . . $ xdp_dbus_dynamic_launcher_complete_launch(251bcec31cd6a143). (object, invocation); |
| 1011 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 1012 | |
| 1013 | error: |
| 1014 | g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error); |
| 1015 | return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!; |
| 1016 | } |
| 1017 | |
| 1018 | static void |
| 1019 | dynamic_launcher_iface_initcxx . . $ dynamic_launcher_iface_init(c92e85fdfc49f46f). (XdpDbusDynamicLauncherIfacecxx . . $ XdpDbusDynamicLauncherIface# *iface) |
| 1020 | { |
| 1021 | iface->handle_installcxx . . $ _XdpDbusDynamicLauncherIface#handle_install. = handle_installcxx . . $ handle_install(55d7fe1f05396d6b).; |
| 1022 | iface->handle_prepare_installcxx . . $ _XdpDbusDynamicLauncherIface#handle_prepare_install. = handle_prepare_installcxx . . $ handle_prepare_install(fa583d548849c6c3).; |
| 1023 | iface->handle_request_install_tokencxx . . $ _XdpDbusDynamicLauncherIface#handle_request_install_token. = handle_request_install_tokencxx . . $ handle_request_install_token(a0f66a6094544459).; |
| 1024 | iface->handle_uninstallcxx . . $ _XdpDbusDynamicLauncherIface#handle_uninstall. = handle_uninstallcxx . . $ handle_uninstall(232026e62ae49bff).; |
| 1025 | iface->handle_get_desktop_entrycxx . . $ _XdpDbusDynamicLauncherIface#handle_get_desktop_entry. = handle_get_desktop_entrycxx . . $ handle_get_desktop_entry(7380464565706a3b).; |
| 1026 | iface->handle_get_iconcxx . . $ _XdpDbusDynamicLauncherIface#handle_get_icon. = handle_get_iconcxx . . $ handle_get_icon(7380464565706a3b).; |
| 1027 | iface->handle_launchcxx . . $ _XdpDbusDynamicLauncherIface#handle_launch. = handle_launchcxx . . $ handle_launch(232026e62ae49bff).; |
| 1028 | } |
| 1029 | |
| 1030 | static void |
| 1031 | dynamic_launcher_initcxx . . $ dynamic_launcher_init(c78680a1af899229). (DynamicLaunchercxx . . $ DynamicLauncher# *dl) |
| 1032 | { |
| 1033 | xdp_dbus_dynamic_launcher_set_versioncxx . . $ xdp_dbus_dynamic_launcher_set_version(198961d598aff954). (XDP_DBUS_DYNAMIC_LAUNCHERcxx . . $ `build/src/xdp-dbus.h:1541:9`! (dl), 1); |
| 1034 | g_object_bind_propertycxx . . $ g_object_bind_property(c97799d956973899). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (impl), "supported-launcher-types", |
| 1035 | G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (dl), "supported-launcher-types", |
| 1036 | G_BINDING_SYNC_CREATEcxx . . $ G_BINDING_SYNC_CREATE.); |
| 1037 | } |
| 1038 | |
| 1039 | static void |
| 1040 | dynamic_launcher_class_initcxx . . $ dynamic_launcher_class_init(d9d666c83655777b). (DynamicLauncherClasscxx . . $ DynamicLauncherClass# *klass) |
| 1041 | { |
| 1042 | } |
| 1043 | |
| 1044 | GDBusInterfaceSkeletoncxx . . $ GDBusInterfaceSkeleton# * |
| 1045 | dynamic_launcher_createcxx . . $ dynamic_launcher_create(e35f8a0759ac8f9a). (GDBusConnectioncxx . . $ GDBusConnection# *connection, |
| 1046 | const char *dbus_name) |
| 1047 | { |
| 1048 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1049 | |
| 1050 | implcxx . . $ impl. = xdp_dbus_impl_dynamic_launcher_proxy_new_synccxx . . $ xdp_dbus_impl_dynamic_launcher_proxy_new_sync(5c1565343345b83d). (connection, |
| 1051 | G_DBUS_PROXY_FLAGS_NONEcxx . . $ G_DBUS_PROXY_FLAGS_NONE., |
| 1052 | dbus_name, |
| 1053 | DESKTOP_PORTAL_OBJECT_PATHcxx . . $ `src/xdp-utils.h:37:9`!, |
| 1054 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 1055 | &error); |
| 1056 | if (implcxx . . $ impl. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1057 | { |
| 1058 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to create dynamic_launcher proxy: %s", error->message); |
| 1059 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1060 | } |
| 1061 | |
| 1062 | g_dbus_proxy_set_default_timeoutcxx . . $ g_dbus_proxy_set_default_timeout(c68bf28eca88e1d4). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (impl), G_MAXINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:39:9`!); |
| 1063 | |
| 1064 | dynamic_launchercxx . . $ dynamic_launcher. = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (dynamic_launcher_get_typecxx . . $ dynamic_launcher_get_type(f708dce9a8856c70). (), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1065 | |
| 1066 | return G_DBUS_INTERFACE_SKELETONcxx . . $ `<external>/1991948168568871819/gdbusinterfaceskeleton.h:32:9`! (dynamic_launcher); |
| 1067 | } |