Debian Codegraph @

src/open-uri.c

raw symbols SCIP
1 /*
2 * Copyright © 2016 Red Hat, Inc
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authors:
20 * Matthias Clasen <[email protected]>
21 */
22
23 #include "config.h"cxx . . $ `<file>/build/config.h`/
24
25 #include "open-uri.h"cxx . . $ `<file>/src/open-uri.h`/
26
27 #include <errno.h>
28 #include <fcntl.h>
29 #include <locale.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <sys/stat.h>
34 #include <sys/types.h>
35 #include <unistd.h>
36
37 #include <gio/gdesktopappinfo.h>
38 #include <gio/gio.h>
39 #include <gio/gunixfdlist.h>
40
41 #include "xdp-app-launch-context.h"cxx . . $ `<file>/src/xdp-app-launch-context.h`/
42 #include "xdp-context.h"cxx . . $ `<file>/src/xdp-context.h`/
43 #include "xdp-dbus.h"cxx . . $ `<file>/build/src/xdp-dbus.h`/
44 #include "xdp-documents.h"cxx . . $ `<file>/src/xdp-documents.h`/
45 #include "xdp-impl-dbus.h"cxx . . $ `<file>/build/src/xdp-impl-dbus.h`/
46 #include "xdp-permissions.h"cxx . . $ `<file>/src/xdp-permissions.h`/
47 #include "xdp-portal-config.h"cxx . . $ `<file>/src/xdp-portal-config.h`/
48 #include "xdp-request.h"cxx . . $ `<file>/src/xdp-request.h`/
49 #include "xdp-utils.h"cxx . . $ `<file>/src/xdp-utils.h`/
50
51 #define FILE_MANAGER_DBUS_NAMEcxx . . $ `src/open-uri.c:51:9`! "org.freedesktop.FileManager1"
52 #define FILE_MANAGER_DBUS_IFACEcxx . . $ `src/open-uri.c:52:9`! "org.freedesktop.FileManager1"
53 #define FILE_MANAGER_DBUS_PATHcxx . . $ `src/open-uri.c:53:9`! "/org/freedesktop/FileManager1"
54
55 #define FILE_MANAGER_SHOW_ITEMScxx . . $ `src/open-uri.c:55:9`! "ShowItems"
56
57 #define DEFAULT_THRESHOLDcxx . . $ `src/open-uri.c:57:9`! 3
58
59 typedef struct _OpenURIcxx . . $ _OpenURI# OpenURIcxx . . $ OpenURI#;
60
61 typedef struct _OpenURIClasscxx . . $ _OpenURIClass# OpenURIClasscxx . . $ OpenURIClass#;
62
63 struct _OpenURIcxx . . $ _OpenURI#
64 {
65 XdpDbusOpenURISkeletoncxx . . $ XdpDbusOpenURISkeleton# parent_instancecxx . . $ _OpenURI#parent_instance.;
66
67 XdpDbusImplAppChoosercxx . . $ XdpDbusImplAppChooser# *implcxx . . $ _OpenURI#impl.;
68 XdpDbusImplLockdowncxx . . $ XdpDbusImplLockdown# *lockdown_implcxx . . $ _OpenURI#lockdown_impl.;
69 GAppInfoMonitorcxx . . $ GAppInfoMonitor# *monitorcxx . . $ _OpenURI#monitor.;
70 };
71
72 struct _OpenURIClasscxx . . $ _OpenURIClass#
73 {
74 XdpDbusOpenURISkeletonClasscxx . . $ XdpDbusOpenURISkeletonClass# parent_classcxx . . $ _OpenURIClass#parent_class.;
75 };
76
77 enumcxx . . $ $anonymous_type_874128d4fb7c08db_0# {
78 PERM_APP_IDcxx . . $ PERM_APP_ID.,
79 PERM_APP_COUNTcxx . . $ PERM_APP_COUNT.,
80 PERM_APP_THRESHOLDcxx . . $ PERM_APP_THRESHOLD.,
81 LAST_PERMcxx . . $ LAST_PERM.
82 };
83
84 GTypecxx . . $ GType# open_uri_get_typecxx . . $ open_uri_get_type(f708dce9a8856c70). (void) G_GNUC_CONSTcxx . . $ `<external>/12741050725406041920/gmacros.h:640:9`!;
85 static void open_uri_iface_initcxx . . $ open_uri_iface_init(f49c09bbc3407075). (XdpDbusOpenURIIfacecxx . . $ XdpDbusOpenURIIface# *iface);
86
87 G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (OpenURI, open_uri, XDP_DBUS_TYPE_OPEN_URI_SKELETONcxx . . $ `build/src/xdp-dbus.h:5354:9`!,
88 G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (XDP_DBUS_TYPE_OPEN_URIcxx . . $ `build/src/xdp-dbus.h:5090:9`!,
89 open_uri_iface_init));
90
91 G_DEFINE_AUTOPTR_CLEANUP_FUNCcxx . . $ `<external>/12741050725406041920/gmacros.h:1414:9`! (OpenURI, g_object_unref)
92
93 static void
94 parse_permissionscxx . . $ parse_permissions(661bf78b48a25826). (const char **permissions,
95 char **app_id,
96 gintcxx . . $ gint# *app_count,
97 gintcxx . . $ gint# *app_threshold)
98 {
99 char *perms_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
100 gintcxx . . $ gint# perms_count = 0;
101 gintcxx . . $ gint# perms_threshold = DEFAULT_THRESHOLDcxx . . $ `src/open-uri.c:57:9`!;
102
103 if ((permissions != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
104 (permissions[PERM_APP_IDcxx . . $ PERM_APP_ID.] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
105 (permissions[PERM_APP_COUNTcxx . . $ PERM_APP_COUNT.] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!))
106 {
107 perms_id = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (permissions[PERM_APP_ID]);
108 perms_count = atoicxx . . $ atoi(5c4306d8553b3696). (permissions[PERM_APP_COUNTcxx . . $ PERM_APP_COUNT.]);
109 if (permissions[PERM_APP_THRESHOLDcxx . . $ PERM_APP_THRESHOLD.] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
110 {
111 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *threshold = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (permissions[PERM_APP_THRESHOLD]);
112 if (g_strstripcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:248:9`!(threshold)[0] != '\0')
113 perms_threshold = atoicxx . . $ atoi(5c4306d8553b3696). (permissions[PERM_APP_THRESHOLDcxx . . $ PERM_APP_THRESHOLD.]);
114 }
115 }
116
117 *app_id = perms_id;
118 *app_count = perms_count;
119 *app_threshold = perms_threshold;
120 }
121
122 static gbooleancxx . . $ gboolean#
123 get_latest_choice_infocxx . . $ get_latest_choice_info(7a91054e8df9575a). (const char *app_id,
124 const char *content_type,
125 gcharcxx . . $ gchar# **latest_id,
126 gintcxx . . $ gint# *latest_count,
127 gintcxx . . $ gint# *latest_threshold,
128 gbooleancxx . . $ gboolean# *always_ask)
129 {
130 char *choice_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
131 int choice_count = 0;
132 int choice_threshold = DEFAULT_THRESHOLDcxx . . $ `src/open-uri.c:57:9`!;
133 gbooleancxx . . $ gboolean# ask = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
134 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
135 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) out_perms = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
136 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) out_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
137
138 if (!xdp_dbus_impl_permission_store_call_lookup_synccxx . . $ xdp_dbus_impl_permission_store_call_lookup_sync(b4ce393c2c779376). (xdp_get_permission_storecxx . . $ xdp_get_permission_store(ac6178aae3a00722). (),
139 OPEN_URI_PERMISSION_TABLEcxx . . $ `src/xdp-types.h:106:9`!,
140 content_type,
141 &out_perms,
142 &out_data,
143 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
144 &error))
145 {
146 g_dbus_error_strip_remote_errorcxx . . $ g_dbus_error_strip_remote_error(425e103a815b829). (error);
147 /* Not finding an entry for the content type in the permission store is perfectly ok */
148 if (!g_error_matchescxx . . $ g_error_matches(604444fafc3e7b63). (error, XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:115:9`!, XDG_DESKTOP_PORTAL_ERROR_NOT_FOUNDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_FOUND.))
149 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Unable to retrieve info for '%s' in the %s table of the permission store: %s",
150 content_type, OPEN_URI_PERMISSION_TABLEcxx . . $ `src/xdp-types.h:106:9`!, error->message);
151 g_clear_errorcxx . . $ g_clear_error(19f343512d040fc2). (&error);
152 }
153
154 if (out_data != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
155 {
156 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) data = g_variant_get_child_valuecxx . . $ g_variant_get_child_value(8aa5a571b04b0b30). (out_data, 0);
157 if (g_variant_is_of_typecxx . . $ g_variant_is_of_type(1b093e6d7a188be5). (data, G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!))
158 g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (data, "always-ask", "b", &ask);
159 }
160
161 if (out_perms != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
162 {
163 GVariantItercxx . . $ GVariantIter# iter;
164 GVariantcxx . . $ GVariant# *child;
165 gbooleancxx . . $ gboolean# app_found = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
166
167 g_variant_iter_initcxx . . $ g_variant_iter_init(83d0c9c646e4f22c). (&iter, out_perms);
168 while (!app_found && (child = g_variant_iter_next_valuecxx . . $ g_variant_iter_next_value(45397e10577d0db). (&iter)))
169 {
170 const char *child_app_id;
171 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! const char **permissions;
172
173 g_variant_getcxx . . $ g_variant_get(671e9cd8f09cd612). (child, "{&s^a&s}", &child_app_id, &permissions);
174 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (child_app_id, app_id) == 0)
175 {
176 parse_permissionscxx . . $ parse_permissions(661bf78b48a25826). (permissions, &choice_id, &choice_count, &choice_threshold);
177 app_found = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
178 }
179 g_variant_unrefcxx . . $ g_variant_unref(86dbca581f53fd84). (child);
180 }
181 }
182
183 *latest_id = choice_id;
184 *latest_count = choice_count;
185 *latest_threshold = choice_threshold;
186 *always_ask = ask;
187
188 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Found in permission store: handler: %s, count: %d / %d, always ask: %d",
189 choice_id, choice_count, choice_threshold, ask);
190
191 return (choice_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
192 }
193
194 static gbooleancxx . . $ gboolean#
195 is_sandboxedcxx . . $ is_sandboxed(a4c0fc30d3fa64a2). (GDesktopAppInfocxx . . $ GDesktopAppInfo# *info)
196 {
197 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *flatpak = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
198
199 flatpak = g_desktop_app_info_get_stringcxx . . $ g_desktop_app_info_get_string(2aaba2c2b17e46e9). (G_DESKTOP_APP_INFOcxx . . $ `<external>/8681645713364988092/gdesktopappinfo.h:31:9`! (info), "X-Flatpak");
200
201 return flatpak != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
202 }
203
204 /* This returns the desktop file basename without extension.
205 * We cant' just use the flatpak ID, since flatpaks are allowed
206 * to export 'sub ids', like the org.libreoffice.LibreOffice
207 * flatpak exporting org.libreoffice.LibreOffice.Impress.desktop,
208 * and we need to track the actual handlers.
209 *
210 * We still strip the .desktop extension, since that is what
211 * the backends expect.
212 */
213 static char *
214 get_app_idcxx . . $ get_app_id(8a7c9d8fd417e913). (GAppInfocxx . . $ GAppInfo# *info)
215 {
216 const char *desktop_id;
217
218 desktop_id = g_app_info_get_idcxx . . $ g_app_info_get_id(946cbaa9210a41). (info);
219
220 return xdp_get_app_id_from_desktop_idcxx . . $ xdp_get_app_id_from_desktop_id(a8b8e32347182212). (desktop_id);
221 }
222
223 static gbooleancxx . . $ gboolean#
224 is_file_uricxx . . $ is_file_uri(5c4306d8553b3696). (const char *uri)
225 {
226 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *scheme = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
227
228 scheme = g_uri_parse_schemecxx . . $ g_uri_parse_scheme(a8b8e32347182212). (uri);
229
230 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (scheme, "file") == 0)
231 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
232
233 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
234 }
235
236 static gbooleancxx . . $ gboolean#
237 launch_application_with_uricxx . . $ launch_application_with_uri(4d7e5581eb89311d). (const char *choice_id,
238 const char *uri,
239 const char *parent_window,
240 gbooleancxx . . $ gboolean# writable,
241 const char *activation_token,
242 GErrorcxx . . $ GError# **error)
243 {
244 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *desktop_id = g_strconcatcxx . . $ g_strconcat(a849077ff1b8d812). (choice_id, ".desktop", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
245 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GDesktopAppInfo) info = g_desktop_app_info_newcxx . . $ g_desktop_app_info_new(eecce1e92d8304e9). (desktop_id);
246 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpAppLaunchContext) xdp_context = xdp_app_launch_context_newcxx . . $ xdp_app_launch_context_new(76568252a1f361cc). ();
247 GAppLaunchContextcxx . . $ GAppLaunchContext# *context = G_APP_LAUNCH_CONTEXTcxx . . $ `<external>/6793221688627496808/gappinfo.h:40:9`! (xdp_context);
248 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *ruri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
249 XdpDocumentFlagscxx . . $ XdpDocumentFlags# flags = XDP_DOCUMENT_FLAG_NONEcxx . . $ XDP_DOCUMENT_FLAG_NONE.;
250 GListcxx . . $ GList# uris;
251
252 if (info == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
253 {
254 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Cannot launch %s because desktop file does not exist", desktop_id);
255 g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:115:9`!, XDG_DESKTOP_PORTAL_ERROR_NOT_FOUNDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_FOUND., "Desktop file %s does not exist", desktop_id);
256 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
257 }
258
259 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Launching %s %s", choice_id, uri);
260
261 if (is_sandboxedcxx . . $ is_sandboxed(a4c0fc30d3fa64a2). (info) && is_file_uricxx . . $ is_file_uri(5c4306d8553b3696). (uri))
262 {
263 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`!;
264
265 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Registering %s for %s", uri, choice_id);
266 if (writable)
267 flags |= XDP_DOCUMENT_FLAG_WRITABLEcxx . . $ XDP_DOCUMENT_FLAG_WRITABLE.;
268
269 ruri = xdp_register_documentcxx . . $ xdp_register_document(e16c043bff209580). (uri, choice_id, flags, &local_error);
270 if (ruri == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
271 {
272 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Error registering %s for %s: %s", uri, choice_id, local_error->message);
273 g_propagate_errorcxx . . $ g_propagate_error(902e08a176509aff). (error, g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&local_error));
274 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
275 }
276 }
277 else
278 ruri = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (uri);
279
280 g_app_launch_context_setenvcxx . . $ g_app_launch_context_setenv(d7afcd4fa847190). (context, "PARENT_WINDOW_ID", parent_window);
281
282 xdp_app_launch_context_set_activation_tokencxx . . $ xdp_app_launch_context_set_activation_token(e948952cc5d8af89). (xdp_context, activation_token);
283
284 uris.datacxx . . $ _GList#data. = (gpointercxx . . $ gpointer#)ruri;
285 uris.nextcxx . . $ _GList#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
286
287 g_app_info_launch_uriscxx . . $ g_app_info_launch_uris(6cc48b63116ab7bf). (G_APP_INFOcxx . . $ `<external>/6793221688627496808/gappinfo.h:35:9`! (info), &uris, context, error);
288
289 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
290 }
291
292 static void
293 update_permissions_storecxx . . $ update_permissions_store(facfdab5246d4be7). (const char *app_id,
294 const char *content_type,
295 const char *chosen_id)
296 {
297 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
298 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *latest_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
299 gintcxx . . $ gint# latest_count;
300 gintcxx . . $ gint# latest_threshold;
301 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GStrv) in_permissions = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
302 gbooleancxx . . $ gboolean# ask;
303
304 if (get_latest_choice_infocxx . . $ get_latest_choice_info(7a91054e8df9575a). (app_id, content_type,
305 &latest_id, &latest_count, &latest_threshold, &ask) &&
306 (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (chosen_id, latest_id) == 0))
307 {
308 /* same app chosen once again: update the counter */
309 if (latest_count >= latest_threshold)
310 latest_count = latest_threshold;
311 else
312 latest_count++;
313 }
314 else
315 {
316 latest_id = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (chosen_id);
317 latest_count = 1;
318 }
319
320 in_permissions = (GStrvcxx . . $ GStrv#) g_new0cxx . . $ `<external>/1123956534522462559/gmem.h:335:9`! (char *, LAST_PERM + 1);
321 in_permissions[PERM_APP_IDcxx . . $ PERM_APP_ID.] = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (latest_id);
322 in_permissions[PERM_APP_COUNTcxx . . $ PERM_APP_COUNT.] = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%u", latest_count);
323 in_permissions[PERM_APP_THRESHOLDcxx . . $ PERM_APP_THRESHOLD.] = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%u", latest_threshold);
324
325 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("updating permissions for %s: content-type %s, handler %s, count %s / %s",
326 app_id,
327 content_type,
328 in_permissions[PERM_APP_ID],
329 in_permissions[PERM_APP_COUNT],
330 in_permissions[PERM_APP_THRESHOLD]);
331
332
333 if (!xdp_dbus_impl_permission_store_call_set_permission_synccxx . . $ xdp_dbus_impl_permission_store_call_set_permission_sync(244a1218c71d5ad7). (xdp_get_permission_storecxx . . $ xdp_get_permission_store(ac6178aae3a00722). (),
334 OPEN_URI_PERMISSION_TABLEcxx . . $ `src/xdp-types.h:106:9`!,
335 TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!,
336 content_type,
337 app_id,
338 (const char * const*) in_permissions,
339 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
340 &error))
341 {
342 g_dbus_error_strip_remote_errorcxx . . $ g_dbus_error_strip_remote_error(425e103a815b829). (error);
343 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Error updating permission store: %s", error->message);
344 g_clear_errorcxx . . $ g_clear_error(19f343512d040fc2). (&error);
345 }
346 }
347
348 static void
349 send_response_in_thread_funccxx . . $ send_response_in_thread_func(4704ff26353eb8ae). (GTaskcxx . . $ GTask# *task,
350 gpointercxx . . $ gpointer# source_object,
351 gpointercxx . . $ gpointer# task_data,
352 GCancellablecxx . . $ GCancellable# *cancellable)
353 {
354 XdpRequestcxx . . $ XdpRequest# *request = XDP_REQUESTcxx . . $ XDP_REQUEST(e3ad50a9247c4f2e). (task_data);
355 guintcxx . . $ guint# response;
356 GVariantcxx . . $ GVariant# *options;
357 const char *choice;
358
359 REQUEST_AUTOLOCKcxx . . $ `src/xdp-request.h:56:9`! (request);
360
361 response = GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "response"));
362 options = (GVariantcxx . . $ GVariant# *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "options");
363
364 if (response != 0)
365 goto out;
366
367 if (g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "choice", "&s", &choice))
368 {
369 const char *uri;
370 const char *parent_window;
371 gbooleancxx . . $ gboolean# writable;
372 const char *content_type;
373 const char *activation_token = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
374
375 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Received choice %s", choice);
376
377 uri = (const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "uri");
378 parent_window = (const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "parent-window");
379 writable = GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "writable"));
380 content_type = (const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "content-type");
381
382 g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "activation_token", "&s", &activation_token);
383
384 if (launch_application_with_uricxx . . $ launch_application_with_uri(4d7e5581eb89311d). (choice, uri, parent_window, writable, activation_token, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!))
385 update_permissions_storecxx . . $ update_permissions_store(facfdab5246d4be7). (xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (request->app_infocxx . . $ _XdpRequest#app_info.), content_type, choice);
386 }
387
388 out:
389 if (request->exportedcxx . . $ _XdpRequest#exported.)
390 {
391 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) opt_builder =
392 G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!);
393
394 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6831:9`! (request),
395 response,
396 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opt_builder));
397 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
398 }
399 }
400
401 static void
402 app_chooser_donecxx . . $ app_chooser_done(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
403 GAsyncResultcxx . . $ GAsyncResult# *result,
404 gpointercxx . . $ gpointer# data)
405 {
406 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpRequest) request = data;
407 guintcxx . . $ guint# response = 2;
408 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) options = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
409 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
410 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
411
412 if (!xdp_dbus_impl_app_chooser_call_choose_application_finishcxx . . $ xdp_dbus_impl_app_chooser_call_choose_application_finish(ce661ef514505337). (XDP_DBUS_IMPL_APP_CHOOSERcxx . . $ `build/src/xdp-impl-dbus.h:390:9`! (source),
413 &response,
414 &options,
415 result,
416 &error))
417 {
418 g_dbus_error_strip_remote_errorcxx . . $ g_dbus_error_strip_remote_error(425e103a815b829). (error);
419 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Backend call failed: %s", error->message);
420 }
421
422 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "response", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (response));
423 if (options)
424 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "options", g_variant_refcxx . . $ g_variant_ref(3606eab35379b54a). (options), (GDestroyNotifycxx . . $ GDestroyNotify#)g_variant_unrefcxx . . $ g_variant_unref(86dbca581f53fd84).);
425
426 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (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`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
427 g_task_set_source_tagcxx . . $ g_task_set_source_tag(8d6a21f582f50705). (task, app_chooser_donecxx . . $ app_chooser_done(aa1d200d824d915d).);
428 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request), g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
429 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, send_response_in_thread_funccxx . . $ send_response_in_thread_func(4704ff26353eb8ae).);
430 }
431
432 static void
433 resolve_scheme_and_content_typecxx . . $ resolve_scheme_and_content_type(8de4e710b16159e6). (const char *uri,
434 char **scheme,
435 char **content_type)
436 {
437 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *uri_scheme = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
438
439 uri_scheme = g_uri_parse_schemecxx . . $ g_uri_parse_scheme(a8b8e32347182212). (uri);
440 if (uri_scheme && uri_scheme[0] != '\0')
441 *scheme = g_ascii_strdowncxx . . $ g_ascii_strdown(a8ddf37f112087c3). (uri_scheme, -1);
442
443 if (*scheme == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
444 return;
445
446 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (*scheme, "file") == 0)
447 {
448 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Not handling file uri %s", uri);
449 return;
450 }
451
452 *content_type = g_strconcatcxx . . $ g_strconcat(a849077ff1b8d812). ("x-scheme-handler/", *scheme, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
453 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Content type for %s uri %s: %s", uri, *scheme, *content_type);
454 }
455
456 static void
457 get_content_type_for_filecxx . . $ get_content_type_for_file(4a08200150b6cca3). (const char *path,
458 char **content_type)
459 {
460 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
461 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) file = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (path);
462 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFileInfo) info = g_file_query_infocxx . . $ g_file_query_info(ba301068419f3de0). (file,
463 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPEcxx . . $ `<external>/10155032491143044340/gfileinfo.h:220:9`!,
464 G_FILE_QUERY_INFO_NONEcxx . . $ G_FILE_QUERY_INFO_NONE.,
465 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
466 &error);
467
468 if (info != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
469 {
470 *content_type = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (g_file_info_get_content_type (info));
471 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Content type for file %s: %s", path, *content_type);
472 }
473 else
474 {
475 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Failed to fetch content type for file %s: %s", path, error->message);
476 }
477 }
478
479 static gbooleancxx . . $ gboolean#
480 should_use_default_appcxx . . $ should_use_default_app(5ae29d726ae57f88). (const char *scheme,
481 const char *content_type)
482 {
483 const char *skipped_schemes[] = {
484 "http",
485 "https",
486 "ftp",
487 "mailto",
488 "webcal",
489 "calendar",
490 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!
491 };
492
493 /* We skip the app chooser for Internet URIs, to be open in the browser,
494 * mail client, or calendar, as well as for directories to be opened in
495 * the file manager */
496 if (g_strv_containscxx . . $ g_strv_contains(c305579a79625c02). (skipped_schemes, scheme) ||
497 g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (content_type, "inode/directory") == 0)
498 {
499 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Can skip app chooser for %s", content_type);
500 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
501 }
502
503 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
504 }
505
506 static void
507 find_recommended_choicescxx . . $ find_recommended_choices(48682a4472cdb0f3). (const char *scheme,
508 const char *content_type,
509 char **default_app,
510 GStrvcxx . . $ GStrv# *choices,
511 guintcxx . . $ guint# *choices_len)
512 {
513 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GAppInfo) info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
514 g_autolistcxx . . $ `<external>/12741050725406041920/gmacros.h:1425:9`!(GAppInfo) infos = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
515 GListcxx . . $ GList# *l;
516 guintcxx . . $ guint# n_choices = 0;
517 GStrvcxx . . $ GStrv# result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
518 int i;
519
520 info = g_app_info_get_default_for_typecxx . . $ g_app_info_get_default_for_type(9f5189d3a3bca4f7). (content_type, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
521
522 if (info != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
523 {
524 *default_app = get_app_idcxx . . $ get_app_id(8a7c9d8fd417e913). (info);
525 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Default handler %s for %s, %s", *default_app, scheme, content_type);
526 }
527 else
528 {
529 *default_app = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
530 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("No default handler for %s, %s", scheme, content_type);
531 }
532
533 infos = g_app_info_get_recommended_for_typecxx . . $ g_app_info_get_recommended_for_type(39546108f7976f40). (content_type);
534 /* Use fallbacks if we have no recommended application for this type */
535 if (!infos)
536 infos = g_app_info_get_all_for_typecxx . . $ g_app_info_get_all_for_type(39546108f7976f40). (content_type);
537
538 n_choices = g_list_lengthcxx . . $ g_list_length(950b32bff6717769). (infos);
539 result = g_newcxx . . $ `<external>/1123956534522462559/gmem.h:318:9`! (char *, n_choices + 1);
540 for (l = infos, i = 0; l; l = l->nextcxx . . $ _GList#next.)
541 {
542 result[i++] = get_app_idcxx . . $ get_app_id(8a7c9d8fd417e913). (G_APP_INFOcxx . . $ `<external>/6793221688627496808/gappinfo.h:35:9`! (l->data));
543 }
544 result[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
545
546 {
547 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *a = g_strjoinvcxx . . $ g_strjoinv(3bdede71480c687a). (", ", result);
548 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Recommended handlers for %s, %s: %s", scheme, content_type, a);
549 }
550
551 *choices = result;
552 *choices_len = n_choices;
553 }
554
555 static void
556 on_app_info_changedcxx . . $ on_app_info_changed(f347c97cd8e82819). (GAppInfoMonitorcxx . . $ GAppInfoMonitor# *monitor,
557 XdpRequestcxx . . $ XdpRequest# *request)
558 {
559 OpenURIcxx . . $ OpenURI# *open_uri;
560 const char *scheme;
561 const char *content_type;
562 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *default_app = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
563 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GStrv) choices = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
564 guintcxx . . $ guint# n_choices;
565
566 open_uri = (OpenURIcxx . . $ OpenURI# *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "open-uri");
567 scheme = (const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "scheme");
568 content_type = (const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "content-type");
569 find_recommended_choicescxx . . $ find_recommended_choices(48682a4472cdb0f3). (scheme, content_type, &default_app, &choices, &n_choices);
570
571 xdp_dbus_impl_app_chooser_call_update_choicescxx . . $ xdp_dbus_impl_app_chooser_call_update_choices(a9be7dd1ddcad475). (open_uri->implcxx . . $ _OpenURI#impl.,
572 request->idcxx . . $ _XdpRequest#id.,
573 (const char * const *)choices,
574 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
575 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
576 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
577 }
578
579 static gbooleancxx . . $ gboolean#
580 app_existscxx . . $ app_exists(5c4306d8553b3696). (const char *app_id)
581 {
582 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GDesktopAppInfo) info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
583 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! gcharcxx . . $ gchar# *with_desktop = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
584
585 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (app_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
586
587 with_desktop = g_strconcatcxx . . $ g_strconcat(a849077ff1b8d812). (app_id, ".desktop", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
588 info = g_desktop_app_info_newcxx . . $ g_desktop_app_info_new(eecce1e92d8304e9). (with_desktop);
589 return (info != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
590 }
591
592 static void
593 handle_open_in_thread_funccxx . . $ handle_open_in_thread_func(4704ff26353eb8ae). (GTaskcxx . . $ GTask# *task,
594 gpointercxx . . $ gpointer# source_object,
595 gpointercxx . . $ gpointer# task_data,
596 GCancellablecxx . . $ GCancellable# *cancellable)
597 {
598 XdpRequestcxx . . $ XdpRequest# *request = XDP_REQUESTcxx . . $ XDP_REQUEST(e3ad50a9247c4f2e). (task_data);
599 OpenURIcxx . . $ OpenURI# *open_uri = (OpenURIcxx . . $ OpenURI# *) source_object;
600 const char *parent_window;
601 const char *app_id = xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (request->app_infocxx . . $ _XdpRequest#app_info.);
602 const char *activation_token;
603 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *uri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
604 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`!;
605 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *default_app = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
606 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GStrv) choices = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
607 guintcxx . . $ guint# n_choices;
608 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *scheme = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
609 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *content_type = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
610 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *latest_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
611 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *basename = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
612 gintcxx . . $ gint# latest_count;
613 gintcxx . . $ gint# latest_threshold;
614 gbooleancxx . . $ gboolean# ask_for_content_type;
615 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) opts_builder =
616 G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!);
617 gbooleancxx . . $ gboolean# skip_app_chooser = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
618 g_autofdcxx . . $ `<external>/6704587548159124736/gstdio.h:291:9`! int fd = -1;
619 gbooleancxx . . $ gboolean# writable = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
620 gbooleancxx . . $ gboolean# ask = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
621 gbooleancxx . . $ gboolean# open_dir = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
622 gbooleancxx . . $ gboolean# use_default_app = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
623 const char *reason;
624
625 REQUEST_AUTOLOCKcxx . . $ `src/xdp-request.h:56:9`! (request);
626
627 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "open-uri",
628 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (open_uri),
629 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
630
631 parent_window = (const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "parent-window");
632 uri = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! ((const char *)g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "uri"));
633 fd = GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "fd"));
634 writable = GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "writable"));
635 ask = GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "ask"));
636 open_dir = GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (g_object_get_data (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "open-dir"));
637 activation_token = (const char *)g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "activation-token");
638
639 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "fd", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (-1));
640
641 /* Verify that either uri or fd is set, not both */
642 if (uri != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && fd != -1)
643 {
644 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Rejecting invalid open-uri request (both URI and fd are set)");
645 if (request->exportedcxx . . $ _XdpRequest#exported.)
646 {
647 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6831:9`! (request),
648 XDG_DESKTOP_PORTAL_RESPONSE_OTHERcxx . . $ XDG_DESKTOP_PORTAL_RESPONSE_OTHER.,
649 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opts_builder));
650 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
651 }
652 return;
653 }
654
655 if (uri)
656 {
657 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`!;
658
659 if (!g_uri_is_validcxx . . $ g_uri_is_valid(10ff756d9b897251). (uri, G_URI_FLAGS_NONEcxx . . $ G_URI_FLAGS_NONE., &local_error))
660 {
661 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Rejecting open request for invalid uri '%s': %s", uri, local_error->message);
662
663 /* Reject the request */
664 if (request->exportedcxx . . $ _XdpRequest#exported.)
665 {
666 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6831:9`! (request),
667 XDG_DESKTOP_PORTAL_RESPONSE_OTHERcxx . . $ XDG_DESKTOP_PORTAL_RESPONSE_OTHER.,
668 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opts_builder));
669 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
670 }
671 return;
672 }
673
674 resolve_scheme_and_content_typecxx . . $ resolve_scheme_and_content_type(8de4e710b16159e6). (uri, &scheme, &content_type);
675 if (content_type == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
676 {
677 /* Reject the request */
678 if (request->exportedcxx . . $ _XdpRequest#exported.)
679 {
680 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Rejecting open request as content-type couldn't be fetched for '%s'", uri);
681 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6831:9`! (request),
682 XDG_DESKTOP_PORTAL_RESPONSE_OTHERcxx . . $ XDG_DESKTOP_PORTAL_RESPONSE_OTHER.,
683 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opts_builder));
684 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
685 }
686 return;
687 }
688 }
689 else
690 {
691 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
692 gbooleancxx . . $ gboolean# fd_is_writable;
693 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`!;
694
695 path = xdp_app_info_get_path_for_fdcxx . . $ xdp_app_info_get_path_for_fd(2620023ef1f997b4). (request->app_infocxx . . $ _XdpRequest#app_info., fd, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &fd_is_writable, &local_error);
696
697 if (path != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
698 {
699 char *resolved_path = xdp_resolve_document_portal_pathcxx . . $ xdp_resolve_document_portal_path(7ec23921cb940e71). (path, XDP_RESOLVE_DOCUMENT_TO_FILEcxx . . $ XDP_RESOLVE_DOCUMENT_TO_FILE.);
700 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&path, g_free);
701 path = g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&resolved_path);
702 }
703
704 if (path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ||
705 (writable && !fd_is_writable) ||
706 (!xdp_app_info_is_hostcxx . . $ xdp_app_info_is_host(ac6b23a20a03546d). (request->app_infocxx . . $ _XdpRequest#app_info.) && !writable && fd_is_writable))
707 {
708 /* Reject the request */
709 if (path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
710 {
711 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Rejecting open request: %s", local_error->message);
712 }
713 else
714 {
715 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Rejecting open request for %s as opening %swritable but fd is %swritable",
716 path, writable ? "" : "not ", fd_is_writable ? "" : "not ");
717 }
718
719 if (request->exportedcxx . . $ _XdpRequest#exported.)
720 {
721 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6831:9`! (request),
722 XDG_DESKTOP_PORTAL_RESPONSE_OTHERcxx . . $ XDG_DESKTOP_PORTAL_RESPONSE_OTHER.,
723 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opts_builder));
724 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
725 }
726 return;
727 }
728
729 if (open_dir)
730 {
731 /* Try opening the directory via the file manager interface, then
732 fall back to a plain URI open */
733 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`!;
734 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariant) result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
735 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GVariantBuilder) uris_builder = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
736 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *item_uri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
737 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GDBusConnection) bus = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
738 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *real_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
739
740 real_path = xdp_resolve_document_portal_pathcxx . . $ xdp_resolve_document_portal_path(7ec23921cb940e71). (path, XDP_RESOLVE_DOCUMENT_TO_DIRECTORYcxx . . $ XDP_RESOLVE_DOCUMENT_TO_DIRECTORY.);
741 item_uri = g_filename_to_uricxx . . $ g_filename_to_uri(aa426d2e062653f5). (real_path, 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`!);
742
743 bus = g_bus_get_synccxx . . $ g_bus_get_sync(193826227f1d0b52). (G_BUS_TYPE_SESSIONcxx . . $ G_BUS_TYPE_SESSION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &local_error);
744
745 uris_builder = g_variant_builder_newcxx . . $ g_variant_builder_new(a0b3f434545b5412). (G_VARIANT_TYPEcxx . . $ `<external>/14064154155447831270/gvarianttype.h:298:10`! ("as"));
746 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (uris_builder, "s", item_uri);
747
748 if (bus)
749 result = g_dbus_connection_call_synccxx . . $ g_dbus_connection_call_sync(a18d7fd6ea76844a). (bus,
750 FILE_MANAGER_DBUS_NAMEcxx . . $ `src/open-uri.c:51:9`!,
751 FILE_MANAGER_DBUS_PATHcxx . . $ `src/open-uri.c:53:9`!,
752 FILE_MANAGER_DBUS_IFACEcxx . . $ `src/open-uri.c:52:9`!,
753 FILE_MANAGER_SHOW_ITEMScxx . . $ `src/open-uri.c:55:9`!,
754 g_variant_newcxx . . $ g_variant_new(59b7d1999758b6d9). ("(ass)", uris_builder, activation_token ? activation_token : ""),
755 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* ignore returned type */
756 G_DBUS_CALL_FLAGS_NONEcxx . . $ G_DBUS_CALL_FLAGS_NONE.,
757 -1,
758 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
759 &local_error);
760
761 if (result == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
762 {
763 if (g_error_matchescxx . . $ g_error_matches(604444fafc3e7b63). (local_error, G_DBUS_ERRORcxx . . $ `<external>/517763016858796244/gdbuserror.h:49:9`!,
764 G_DBUS_ERROR_NAME_HAS_NO_OWNERcxx . . $ G_DBUS_ERROR_NAME_HAS_NO_OWNER.) ||
765 g_error_matchescxx . . $ g_error_matches(604444fafc3e7b63). (local_error, G_DBUS_ERRORcxx . . $ `<external>/517763016858796244/gdbuserror.h:49:9`!,
766 G_DBUS_ERROR_SERVICE_UNKNOWNcxx . . $ G_DBUS_ERROR_SERVICE_UNKNOWN.))
767 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("No " FILE_MANAGER_DBUS_NAMEcxx . . $ `src/open-uri.c:51:9`! " available");
768 else
769 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to call " FILE_MANAGER_SHOW_ITEMScxx . . $ `src/open-uri.c:55:9`! ": %s",
770 local_error->message);
771 }
772 else
773 {
774 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6831:9`! (request),
775 XDG_DESKTOP_PORTAL_RESPONSE_SUCCESScxx . . $ XDG_DESKTOP_PORTAL_RESPONSE_SUCCESS.,
776 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opts_builder));
777 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
778 return;
779 }
780
781 g_freecxx . . $ g_free(5d22bdacc48458e8). (path);
782 path = g_path_get_dirnamecxx . . $ g_path_get_dirname(a8b8e32347182212). (real_path);
783 }
784
785 get_content_type_for_filecxx . . $ get_content_type_for_file(4a08200150b6cca3). (path, &content_type);
786 basename = g_path_get_basenamecxx . . $ g_path_get_basename(a8b8e32347182212). (path);
787
788 scheme = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! ("file");
789 uri = g_filename_to_uricxx . . $ g_filename_to_uri(aa426d2e062653f5). (path, 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`!);
790 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "uri", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (uri), g_freecxx . . $ g_free(5d22bdacc48458e8).);
791 }
792
793 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "scheme", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (scheme), g_freecxx . . $ g_free(5d22bdacc48458e8).);
794 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "content-type", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (content_type), g_freecxx . . $ g_free(5d22bdacc48458e8).);
795
796 /* collect all the information */
797 find_recommended_choicescxx . . $ find_recommended_choices(48682a4472cdb0f3). (scheme, content_type, &default_app, &choices, &n_choices);
798 /* it's never NULL, but might be empty (only contain the NULL terminator) */
799 g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (choices != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
800 if (default_app != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && !app_existscxx . . $ app_exists(5c4306d8553b3696). (default_app))
801 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&default_app, g_free);
802 use_default_app = should_use_default_appcxx . . $ should_use_default_app(5ae29d726ae57f88). (scheme, content_type);
803 get_latest_choice_infocxx . . $ get_latest_choice_info(7a91054e8df9575a). (app_id, content_type,
804 &latest_id, &latest_count, &latest_threshold,
805 &ask_for_content_type);
806 if (latest_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && !app_existscxx . . $ app_exists(5c4306d8553b3696). (latest_id))
807 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&latest_id, g_free);
808
809 skip_app_chooser = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
810 reason = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
811
812 /* apply default handling: skip if the we have a default handler */
813 if (default_app != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && use_default_app)
814 {
815 reason = "Allowing to skip app chooser: can use default";
816 skip_app_chooser = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
817 }
818
819 if (n_choices == 1)
820 {
821 if (!skip_app_chooser)
822 reason = "Allowing to skip app chooser: no choice";
823 skip_app_chooser = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
824 }
825
826 /* also skip if the user has made the same choice often enough */
827 if (latest_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && latest_count >= latest_threshold)
828 {
829 if (!skip_app_chooser)
830 reason = "Allowing to skip app chooser: above threshold";
831 skip_app_chooser = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
832 }
833
834 /* respect the app choices */
835 if (ask)
836 {
837 if (skip_app_chooser)
838 reason = "Refusing to skip app chooser: app request";
839 skip_app_chooser = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
840 }
841
842 /* respect the users choices: paranoid mode overrides everything else */
843 if (ask_for_content_type || latest_threshold == G_MAXINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:39:9`!)
844 {
845 if (skip_app_chooser)
846 reason = "Refusing to skip app chooser: always-ask enabled";
847 skip_app_chooser = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
848 }
849
850 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("%s", reason);
851
852 if (skip_app_chooser)
853 {
854 const char *app = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
855
856 if (default_app != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && use_default_app)
857 app = default_app;
858 else if (latest_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
859 app = latest_id;
860 else if (default_app != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
861 app = default_app;
862 else if (n_choices > 0 && app_existscxx . . $ app_exists(5c4306d8553b3696). (choices[0]))
863 app = choices[0];
864
865 if (app)
866 {
867 /* Launch the app directly */
868 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
869
870 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Skipping app chooser");
871
872 gbooleancxx . . $ gboolean# result = launch_application_with_uricxx . . $ launch_application_with_uri(4d7e5581eb89311d). (app, uri, parent_window, writable, activation_token, &error);
873 if (request->exportedcxx . . $ _XdpRequest#exported.)
874 {
875 if (!result)
876 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Open request for '%s' failed: %s", uri, error->message);
877 xdp_dbus_request_emit_responsecxx . . $ xdp_dbus_request_emit_response(6deab25eec490adc). (XDP_DBUS_REQUESTcxx . . $ `build/src/xdp-dbus.h:6831:9`! (request),
878 result ? XDG_DESKTOP_PORTAL_RESPONSE_SUCCESScxx . . $ XDG_DESKTOP_PORTAL_RESPONSE_SUCCESS. : XDG_DESKTOP_PORTAL_RESPONSE_OTHERcxx . . $ XDG_DESKTOP_PORTAL_RESPONSE_OTHER.,
879 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opts_builder));
880 xdp_request_unexportcxx . . $ xdp_request_unexport(8bf1d2bcdc4be36d). (request);
881 }
882
883 return;
884 }
885 }
886
887 if (latest_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
888 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&opts_builder, "{sv}", "last_choice", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (latest_id));
889 else if (default_app != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
890 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&opts_builder, "{sv}", "last_choice", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (default_app));
891
892 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "content-type", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (content_type), g_freecxx . . $ g_free(5d22bdacc48458e8).);
893
894 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&opts_builder, "{sv}", "content_type", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (content_type));
895 if (basename)
896 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&opts_builder, "{sv}", "filename", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (basename));
897 if (uri)
898 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&opts_builder, "{sv}", "uri", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (uri));
899 if (activation_token)
900 g_variant_builder_addcxx . . $ g_variant_builder_add(a422658e2ec2035a). (&opts_builder, "{sv}", "activation_token", g_variant_new_stringcxx . . $ g_variant_new_string(8d35775da1697fc2). (activation_token));
901
902 impl_request =
903 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`! (open_uri->impl)),
904 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIEScxx . . $ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES.,
905 g_dbus_proxy_get_namecxx . . $ g_dbus_proxy_get_name(c2c3b8a4da378b0d). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (open_uri->impl)),
906 request->idcxx . . $ _XdpRequest#id.,
907 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`!);
908
909 xdp_request_set_impl_requestcxx . . $ xdp_request_set_impl_request(18bd0ab3b325ada4). (request, impl_request);
910
911 g_signal_connect_objectcxx . . $ g_signal_connect_object(567cfbe0c886a38e). (open_uri->monitorcxx . . $ _OpenURI#monitor., "changed",
912 G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_app_info_changed),
913 request, G_CONNECT_DEFAULTcxx . . $ G_CONNECT_DEFAULT.);
914
915 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Opening app chooser");
916
917 xdp_dbus_impl_app_chooser_call_choose_applicationcxx . . $ xdp_dbus_impl_app_chooser_call_choose_application(ff0cb164ebac8965). (open_uri->implcxx . . $ _OpenURI#impl.,
918 request->idcxx . . $ _XdpRequest#id.,
919 app_id,
920 parent_window,
921 (const char * const *)choices,
922 g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&opts_builder),
923 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
924 app_chooser_donecxx . . $ app_chooser_done(aa1d200d824d915d).,
925 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request));
926 }
927
928 static gbooleancxx . . $ gboolean#
929 handle_scheme_supportedcxx . . $ handle_scheme_supported(f3cb790c41b26c4b). (XdpDbusOpenURIcxx . . $ XdpDbusOpenURI# *object,
930 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation,
931 const gcharcxx . . $ gchar# *arg_scheme,
932 GVariantcxx . . $ GVariant# *arg_options)
933 {
934 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GAppInfo) app_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
935
936 if (arg_scheme == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || *arg_scheme == '\0')
937 {
938 g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation,
939 XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:115:9`!,
940 XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT.,
941 "Scheme not specified");
942 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
943 }
944
945 app_info = g_app_info_get_default_for_uri_schemecxx . . $ g_app_info_get_default_for_uri_scheme(282f451903100788). (arg_scheme);
946
947 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Handler for scheme: %s%s found.", arg_scheme, app_info ? "" : " not");
948 g_dbus_method_invocation_return_valuecxx . . $ g_dbus_method_invocation_return_value(dc2237947fc93dda). (invocation, g_variant_newcxx . . $ g_variant_new(59b7d1999758b6d9). ("(b)", app_info != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
949
950 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
951 }
952
953 static gbooleancxx . . $ gboolean#
954 handle_open_uricxx . . $ handle_open_uri(15b392a60de7ebcc). (XdpDbusOpenURIcxx . . $ XdpDbusOpenURI# *object,
955 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation,
956 const gcharcxx . . $ gchar# *arg_parent_window,
957 const gcharcxx . . $ gchar# *arg_uri,
958 GVariantcxx . . $ GVariant# *arg_options)
959 {
960 OpenURIcxx . . $ OpenURI# *open_uri = (OpenURIcxx . . $ OpenURI# *) object;
961 XdpRequestcxx . . $ XdpRequest# *request = xdp_request_from_invocationcxx . . $ xdp_request_from_invocation(9583a51810815010). (invocation);
962 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
963 gbooleancxx . . $ gboolean# writable;
964 gbooleancxx . . $ gboolean# ask;
965 const char *activation_token = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
966
967 if (xdp_dbus_impl_lockdown_get_disable_application_handlerscxx . . $ xdp_dbus_impl_lockdown_get_disable_application_handlers(611f976d47c30f42). (open_uri->lockdown_implcxx . . $ _OpenURI#lockdown_impl.))
968 {
969 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Application handlers disabled");
970 g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation,
971 XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:115:9`!,
972 XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWED.,
973 "Application handlers disabled");
974 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
975 }
976
977 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "writable", "b", &writable))
978 writable = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
979
980 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "ask", "b", &ask))
981 ask = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
982
983 g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "activation_token", "&s", &activation_token);
984
985 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "fd", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (-1));
986 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "uri", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (arg_uri), g_freecxx . . $ g_free(5d22bdacc48458e8).);
987 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "parent-window", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (arg_parent_window), g_freecxx . . $ g_free(5d22bdacc48458e8).);
988 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "writable", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (writable));
989 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "ask", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (ask));
990
991 if (activation_token)
992 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "activation-token", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (activation_token), g_freecxx . . $ g_free(5d22bdacc48458e8).);
993
994 xdp_request_exportcxx . . $ xdp_request_export(49d11f351a243e17). (request, g_dbus_method_invocation_get_connectioncxx . . $ g_dbus_method_invocation_get_connection(8c6afd006dd99032). (invocation));
995 xdp_dbus_open_uri_complete_open_uricxx . . $ xdp_dbus_open_uri_complete_open_uri(73c2d4e78fa12a2e). (object, invocation, request->idcxx . . $ _XdpRequest#id.);
996
997 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (open_uri, 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`!);
998 g_task_set_source_tagcxx . . $ g_task_set_source_tag(8d6a21f582f50705). (task, handle_open_uricxx . . $ handle_open_uri(15b392a60de7ebcc).);
999 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request), g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
1000 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, handle_open_in_thread_funccxx . . $ handle_open_in_thread_func(4704ff26353eb8ae).);
1001
1002 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
1003 }
1004
1005 static gbooleancxx . . $ gboolean#
1006 handle_open_filecxx . . $ handle_open_file(56a1e6e6cc901d93). (XdpDbusOpenURIcxx . . $ XdpDbusOpenURI# *object,
1007 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation,
1008 GUnixFDListcxx . . $ GUnixFDList# *fd_list,
1009 const gcharcxx . . $ gchar# *arg_parent_window,
1010 GVariantcxx . . $ GVariant# *arg_fd,
1011 GVariantcxx . . $ GVariant# *arg_options)
1012 {
1013 OpenURIcxx . . $ OpenURI# *open_uri = (OpenURIcxx . . $ OpenURI# *) object;
1014 XdpRequestcxx . . $ XdpRequest# *request = xdp_request_from_invocationcxx . . $ xdp_request_from_invocation(9583a51810815010). (invocation);
1015 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1016 gbooleancxx . . $ gboolean# writable;
1017 gbooleancxx . . $ gboolean# ask;
1018 g_autofdcxx . . $ `<external>/6704587548159124736/gstdio.h:291:9`! int fd = -1;
1019 const char *activation_token = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1020 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1021
1022 if (xdp_dbus_impl_lockdown_get_disable_application_handlerscxx . . $ xdp_dbus_impl_lockdown_get_disable_application_handlers(611f976d47c30f42). (open_uri->lockdown_implcxx . . $ _OpenURI#lockdown_impl.))
1023 {
1024 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Application handlers disabled");
1025 g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation,
1026 XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:115:9`!,
1027 XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWED.,
1028 "Application handlers disabled");
1029 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
1030 }
1031
1032 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "writable", "b", &writable))
1033 writable = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
1034
1035 if (!g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "ask", "b", &ask))
1036 ask = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
1037
1038 fd = xdp_get_portal_call_fdcxx . . $ xdp_get_portal_call_fd(57b895fb290201ec). (fd_list, g_variant_get_handlecxx . . $ g_variant_get_handle(defe45d02e0cfb24). (arg_fd), &error);
1039 if (fd < 0)
1040 {
1041 g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error);
1042 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
1043 }
1044
1045 g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "activation_token", "&s", &activation_token);
1046
1047 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "fd", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (g_steal_fd (&fd)));
1048 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "parent-window", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (arg_parent_window), g_freecxx . . $ g_free(5d22bdacc48458e8).);
1049 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "writable", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (writable));
1050 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "ask", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (ask));
1051
1052 if (activation_token)
1053 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "activation-token", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (activation_token), g_freecxx . . $ g_free(5d22bdacc48458e8).);
1054
1055 xdp_request_exportcxx . . $ xdp_request_export(49d11f351a243e17). (request, g_dbus_method_invocation_get_connectioncxx . . $ g_dbus_method_invocation_get_connection(8c6afd006dd99032). (invocation));
1056 xdp_dbus_open_uri_complete_open_filecxx . . $ xdp_dbus_open_uri_complete_open_file(8143baca4c5da55). (object, invocation, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, request->idcxx . . $ _XdpRequest#id.);
1057
1058 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (object, 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`!);
1059 g_task_set_source_tagcxx . . $ g_task_set_source_tag(8d6a21f582f50705). (task, handle_open_filecxx . . $ handle_open_file(56a1e6e6cc901d93).);
1060 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request), g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
1061 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, handle_open_in_thread_funccxx . . $ handle_open_in_thread_func(4704ff26353eb8ae).);
1062
1063 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
1064 }
1065
1066 static gbooleancxx . . $ gboolean#
1067 handle_open_directorycxx . . $ handle_open_directory(56a1e6e6cc901d93). (XdpDbusOpenURIcxx . . $ XdpDbusOpenURI# *object,
1068 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation,
1069 GUnixFDListcxx . . $ GUnixFDList# *fd_list,
1070 const gcharcxx . . $ gchar# *arg_parent_window,
1071 GVariantcxx . . $ GVariant# *arg_fd,
1072 GVariantcxx . . $ GVariant# *arg_options)
1073 {
1074 OpenURIcxx . . $ OpenURI# *open_uri = (OpenURIcxx . . $ OpenURI# *) object;
1075 XdpRequestcxx . . $ XdpRequest# *request = xdp_request_from_invocationcxx . . $ xdp_request_from_invocation(9583a51810815010). (invocation);
1076 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1077 g_autofdcxx . . $ `<external>/6704587548159124736/gstdio.h:291:9`! int fd = -1;
1078 const char *activation_token = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1079 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1080
1081 if (xdp_dbus_impl_lockdown_get_disable_application_handlerscxx . . $ xdp_dbus_impl_lockdown_get_disable_application_handlers(611f976d47c30f42). (open_uri->lockdown_implcxx . . $ _OpenURI#lockdown_impl.))
1082 {
1083 g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("Application handlers disabled");
1084 g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation,
1085 XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:115:9`!,
1086 XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWED.,
1087 "Application handlers disabled");
1088 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
1089 }
1090
1091 fd = xdp_get_portal_call_fdcxx . . $ xdp_get_portal_call_fd(57b895fb290201ec). (fd_list, g_variant_get_handlecxx . . $ g_variant_get_handle(defe45d02e0cfb24). (arg_fd), &error);
1092 if (fd < 0)
1093 {
1094 g_dbus_method_invocation_return_gerrorcxx . . $ g_dbus_method_invocation_return_gerror(f84b6a1e02aa551). (invocation, error);
1095 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
1096 }
1097
1098 g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (arg_options, "activation_token", "&s", &activation_token);
1099
1100 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "fd", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (g_steal_fd (&fd)));
1101 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "parent-window", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (arg_parent_window), g_freecxx . . $ g_free(5d22bdacc48458e8).);
1102 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "writable", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (0));
1103 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "ask", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (0));
1104 g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "open-dir", GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (1));
1105
1106 if (activation_token)
1107 g_object_set_data_fullcxx . . $ g_object_set_data_full(218df00be1d2a06c). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (request), "activation-token", g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (activation_token), g_freecxx . . $ g_free(5d22bdacc48458e8).);
1108
1109 xdp_request_exportcxx . . $ xdp_request_export(49d11f351a243e17). (request, g_dbus_method_invocation_get_connectioncxx . . $ g_dbus_method_invocation_get_connection(8c6afd006dd99032). (invocation));
1110 xdp_dbus_open_uri_complete_open_directorycxx . . $ xdp_dbus_open_uri_complete_open_directory(8143baca4c5da55). (object, invocation, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, request->idcxx . . $ _XdpRequest#id.);
1111
1112 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (object, 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`!);
1113 g_task_set_source_tagcxx . . $ g_task_set_source_tag(8d6a21f582f50705). (task, handle_open_directorycxx . . $ handle_open_directory(56a1e6e6cc901d93).);
1114 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (request), g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
1115 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, handle_open_in_thread_funccxx . . $ handle_open_in_thread_func(4704ff26353eb8ae).);
1116
1117 return G_DBUS_METHOD_INVOCATION_HANDLEDcxx . . $ `<external>/7877694576918326146/gdbusmethodinvocation.h:56:9`!;
1118 }
1119
1120 static void
1121 open_uri_iface_initcxx . . $ open_uri_iface_init(f49c09bbc3407075). (XdpDbusOpenURIIfacecxx . . $ XdpDbusOpenURIIface# *iface)
1122 {
1123 iface->handle_open_uricxx . . $ _XdpDbusOpenURIIface#handle_open_uri. = handle_open_uricxx . . $ handle_open_uri(15b392a60de7ebcc).;
1124 iface->handle_open_filecxx . . $ _XdpDbusOpenURIIface#handle_open_file. = handle_open_filecxx . . $ handle_open_file(56a1e6e6cc901d93).;
1125 iface->handle_open_directorycxx . . $ _XdpDbusOpenURIIface#handle_open_directory. = handle_open_directorycxx . . $ handle_open_directory(56a1e6e6cc901d93).;
1126 iface->handle_scheme_supportedcxx . . $ _XdpDbusOpenURIIface#handle_scheme_supported. = handle_scheme_supportedcxx . . $ handle_scheme_supported(f3cb790c41b26c4b).;
1127 }
1128
1129 static void
1130 open_uri_disposecxx . . $ open_uri_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object)
1131 {
1132 OpenURIcxx . . $ OpenURI# *openuri = (OpenURIcxx . . $ OpenURI# *) object;
1133
1134 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&openuri->impl);
1135 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&openuri->lockdown_impl);
1136 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&openuri->monitor);
1137
1138 G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (open_uri_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object);
1139 }
1140
1141 static void
1142 open_uri_initcxx . . $ open_uri_init(ff6c0d888fbd352f). (OpenURIcxx . . $ OpenURI# *openuri)
1143 {
1144 }
1145
1146 static void
1147 open_uri_class_initcxx . . $ open_uri_class_init(be45620aeb6b4688). (OpenURIClasscxx . . $ OpenURIClass# *klass)
1148 {
1149 GObjectClasscxx . . $ GObjectClass# *object_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass);
1150
1151 object_class->disposecxx . . $ _GObjectClass#dispose. = open_uri_disposecxx . . $ open_uri_dispose(6087475fa43034d3).;
1152 }
1153
1154 static OpenURIcxx . . $ OpenURI# *
1155 open_uri_newcxx . . $ open_uri_new(51da76c2157c9160). (XdpDbusImplAppChoosercxx . . $ XdpDbusImplAppChooser# *app_chooser_impl,
1156 XdpDbusImplLockdowncxx . . $ XdpDbusImplLockdown# *lockdown_impl)
1157 {
1158 OpenURIcxx . . $ OpenURI# *open_uri;
1159
1160 open_uri = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (open_uri_get_typecxx . . $ open_uri_get_type(f708dce9a8856c70). (), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1161 open_uri->implcxx . . $ _OpenURI#impl. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (app_chooser_impl);
1162 open_uri->lockdown_implcxx . . $ _OpenURI#lockdown_impl. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (lockdown_impl);
1163 open_uri->monitorcxx . . $ _OpenURI#monitor. = g_app_info_monitor_getcxx . . $ g_app_info_monitor_get(df10c266f4692c45). ();
1164
1165 g_dbus_proxy_set_default_timeoutcxx . . $ g_dbus_proxy_set_default_timeout(c68bf28eca88e1d4). (G_DBUS_PROXYcxx . . $ `<external>/4635717660623816082/gdbusproxy.h:36:9`! (open_uri->impl),
1166 G_MAXINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:39:9`!);
1167
1168 xdp_dbus_open_uri_set_versioncxx . . $ xdp_dbus_open_uri_set_version(3458b0183b03759). (XDP_DBUS_OPEN_URIcxx . . $ `build/src/xdp-dbus.h:5091:9`! (open_uri), 5);
1169
1170 return open_uri;
1171 }
1172
1173 void
1174 init_open_uricxx . . $ init_open_uri(7d190a42f72e5c4f). (XdpContextcxx . . $ XdpContext# *context)
1175 {
1176 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(OpenURI) open_uri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1177 GDBusConnectioncxx . . $ GDBusConnection# *connection = xdp_context_get_connectioncxx . . $ xdp_context_get_connection(a09559f10e8590c5). (context);
1178 XdpPortalConfigcxx . . $ XdpPortalConfig# *config = xdp_context_get_configcxx . . $ xdp_context_get_config(3deea62d2e42aa7). (context);
1179 XdpImplConfigcxx . . $ XdpImplConfig# *impl_config;
1180 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpDbusImplAppChooser) impl = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1181 XdpDbusImplLockdowncxx . . $ XdpDbusImplLockdown# *lockdown_impl;
1182 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1183
1184 impl_config = xdp_portal_config_findcxx . . $ xdp_portal_config_find(5212eece2399491d). (config, APP_CHOOSER_DBUS_IMPL_IFACEcxx . . $ `src/xdp-types.h:53:9`!);
1185 if (impl_config == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
1186 return;
1187
1188 impl = xdp_dbus_impl_app_chooser_proxy_new_synccxx . . $ xdp_dbus_impl_app_chooser_proxy_new_sync(75edbf6bba41c121). (connection,
1189 G_DBUS_PROXY_FLAGS_NONEcxx . . $ G_DBUS_PROXY_FLAGS_NONE.,
1190 impl_config->dbus_namecxx . . $ $anonymous_type_accd296e72675a4a_0#dbus_name.,
1191 DESKTOP_DBUS_PATHcxx . . $ `src/xdp-types.h:47:9`!,
1192 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error);
1193 if (impl == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
1194 {
1195 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to create app chooser proxy: %s", error->message);
1196 return;
1197 }
1198
1199 lockdown_impl = xdp_context_get_lockdown_implcxx . . $ xdp_context_get_lockdown_impl(9ee3f1c16a0ceb58). (context);
1200
1201 open_uri = open_uri_newcxx . . $ open_uri_new(51da76c2157c9160). (impl, lockdown_impl);
1202
1203 xdp_context_take_and_export_portalcxx . . $ xdp_context_take_and_export_portal(54303e2939dd494f). (context,
1204 G_DBUS_INTERFACE_SKELETONcxx . . $ `<external>/1991948168568871819/gdbusinterfaceskeleton.h:32:9`! (g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&open_uri)),
1205 XDP_CONTEXT_EXPORT_FLAGS_NONEcxx . . $ XDP_CONTEXT_EXPORT_FLAGS_NONE.);
1206 }