Debian Codegraph @

src/dynamic-launcher.c

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