Commit Graph

15 Commits

Author SHA1 Message Date
Philip Withnall
5bc6c2035a gio: Rename GTK_USE_PORTAL to GIO_USE_PORTALS
The `GTK_USE_PORTAL` environment variable has started to be misused by
users, which is causing deployment issues (such as portal services
themselves ending up being forced to use portals, which is never going
to work).

Try and sidestep users’ broken configurations by renaming the
environment variable, and also separating it from the old GTK
environment variable, since the GLib one affects a lot more processes.
This environment variable is meant to be used for
debugging and development, and never in production.

GTK already renamed their environment variable in
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4829, so keeping the
`GTK_USE_PORTAL` name in GLib doesn’t make sense anyway.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #3107
2023-10-02 15:00:23 +01:00
Marco Trevisan (Treviño)
92fae633a0 gio/tests: Add tests for flatpak infos
Support testing flatpak infos, we do it by faking /.flatpak-info file in
case we're building in test mode.
2022-11-24 20:03:39 +01:00
Marco Trevisan (Treviño)
e6eebfd9c3 gportalsupport: Force use /usr/bin/snapctl to get snap connection status
Do not search in path for snapctl to avoid it to be potentially
overridden by changing the PATH env variable.

Still allow testing by using an ifdef to check if we're building for the
test files or not.
2022-11-24 20:03:39 +01:00
Robert Ancell
216d7ba042 portal: Check for snap plugs before accessing portals
This is of particular use in the gsettings backend, which is currently using
dconf for all snaps.
Fully confined snaps should use the keyfile backend, as Flatpaks do.

Co-Authored-by: Marco Trevisan <mail@3v1n0.net>
2022-11-24 20:00:18 +01:00
Robert Ancell
4ba188c906 portal: Rename function to not be flatpak specific
It will also read snap information
2022-11-24 05:38:32 +01:00
Robert Ancell
bfd7074dfc gio: Fix formatting 2022-11-01 10:20:36 +00:00
Robert Ancell
568763e776 gio: Create a sandbox checking function 2022-11-01 10:20:36 +00:00
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-05-18 09:18:52 +01:00
Will Thompson
4b3183435b portal: Read /.flatpak-info in thread-safe fashion
There is no guarantee that this function would not be called
concurrently. Particularly since flatpak_info_read was set to TRUE
before /.flatpak-info is actually read from disk, there is a potential
race where a second thread would return default values for the various
flags set from that file.

Fixes #2159
2020-07-13 16:26:44 +01:00
Matthias Clasen
9c5d3a6081 portal: Add a getter for dconf access
Add method to find whether the sandbox provides
access to dconf. This will be used to tweak
the priorities for the keyfile settings backend.
2019-07-15 13:01:56 +01:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Philip Withnall
f5993c0e5d gportalsupport: Fix compilation failure from previous commit
Igor says: Thith code did not path the compilation check.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-01 19:34:51 +01:00
Matthias Clasen
82e31de04d portal support: Read /.flatpak-info
The flatpak-info file was moved to a different location a while
ago, we should read it from there instead of relying on the
compat symlink. One advantage is that this is a fixed, short
path, we don't have to construct one dynamically.

https://bugzilla.gnome.org/show_bug.cgi?id=781826
2017-05-01 14:15:44 -04:00
Philip Withnall
e694d1b673 gio: Fix a memory leak in gportalsupport.c
Coverity CID: 1357527
2016-07-12 23:08:27 +01:00
Matthias Clasen
78ef32110a Add portal helpers
These are private helper functions that will be used in
the following commits to get information about whether
we are running in a flatpak sandbox, etc.

We allow the use of GTK_USE_PORTAL=1 in the environment
to force the use of portals. This can be useful for
testing and debugging portal interaction.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:44:43 -04:00