Gnome-text-editor should be able to edit files located in removable media, thus we added to the last snap version the removable-media plug. I request to allow the autoconnection of that plug. The package is maintained by the desktop team at Canonical.
This a clear case and the user should expect this. +1 for auto-connect
to removable-media
for gnome-text-editor
snap
Hi, gnome-text-editor should be able to use portals, but as I see it is not. But, I can fix it. Should I share a PR?
EDIT: This is how we can achieve it
But, the icon is missing too.
Mmm⦠good point. So it isnāt using portals by defaultā¦
Iāll try with GTK_USE_PORTAL=1
Anyway, I presume that it is still required to have the removable-media plug for the case when the editor tries to open a file passed by command lineā¦
Mmm⦠it doesnāt work⦠I tried to open the .bash-history file using the portal, and it allows me to select it, but canāt load it because I donāt have permissions.
I remember GTK discussing removing GTK_USE_PORTAL
in favour of GDK_DEBUG=portals
. Relevant discussion https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4829, which looks like itās been in for long enough that Iāll just assume itās in the latest releases.
Up until recently Iād been under the impression the GTK4 libs in the Core22 Gnome extension were fairly fixed, but apparently they have been rolling since the extensions release. I think in effect, portals probably worked for GTK4 apps when the extension was released, but might not be now, since the GTK upgrades?
@jamesh does GDK_DEBUG=PORTALS need appending alongside the older GTK3 logic here? https://github.com/snapcore/snapcraft/blob/4b1cff546cde4ddd933e92ae928ba140a78cef2b/snapcraft/extensions/gnome.py#L149
The odd thing is that the gnome-text-editor code does have some extra checks for āGTK_USE_PORTALāā¦
Ok, setting both GTK_USE_PORTAL and GDK_DEBUG=āportalsā seems to workā¦
gnome-text-editor version 45 will fix this issue. Before this release, , which for some reason was not able to use portals in snaps, but were able to use it in flatpaks. Gtk.FileChooserNative
was usedGtk.FileDialog
fixes it. I have two such snaps clapper
, metadata-cleaner
facing the same issue.
This is a related forum post.
EDIT: gnome-text-editor
version 45 have not implemented Gtk.FileDialog
yet. Sorry about that
https://gitlab.gnome.org/GNOME/gnome-text-editor/-/blob/main/src/editor-window-actions.c#L349
I created an extra patch that adds GDK_DEBUG=portals
But Iām not sure if itās a good idea⦠What do you think?
Shit, I made one too!
This is a bit of a pain. That might be worth doing in the short term, but it is clearly not something they want us doing. Slightly longer term, we probably want:
- Follow up on this thread in GLib MR !3037, and make
glib_get_sandbox_type
a real exported API of libgio. - In GTK, replace
gdk_running_in_sandbox
body withglib_get_sandbox_type() != G_SANDBOX_TYPE_UNKNOWN
or whatever the public API ends up being called.
It looks like glibās use of GTK_USE_PORTAL
was also changed in GLib MR !3602, but it correctly detects snap confinement already so the portal calls there function correctly.
Hi @SergioCostas , I see that the issue has been solved using portals. Do you still need auto-connect
to removable-media
interface (e.g. for cases where desktop portals are not available)? In case itās not needed anymore I can go ahead and remove this request from our queue. Thanks.
Ops⦠yes, you can remove this. It seems to work fine. If there are people with problems where portals arenāt available, Iāll open this again. Sorry.
@SergioCostas what about old Ubuntus?
Like here mentioned, that it didnāt work in Jammy. Itās not that much old.
Mmm⦠You are right, doing ādouble clickā in nautilus to open a file with gnome-text-editor from a removable media could be a problem⦠So yes, it seems that autoconnect is needed here too.
Yeah⦠that should not work but it works when opening the dialog from within the text-editor right?
Yes. With portals enabled, you can open files from a removable media from within GTE, but canāt pass a URI that points to a file in a removable media. for the later, the āremovable-mediaā plug must be connected.