Error with Desktop.Open() in Debian Testing (Gambas 3.19) [SOLVED]
Posted
#1
(In Topic #1195)
Trainee
Code
Public Sub btnOpen_Click()
Desktop.Open(Path_to_file_or_folder)
End
This application has raised an unexpected error and must abort.
org.freedesktop.DBus.ErrorServiceUnknown: The
name org.freedesktop.portal.Desktop was not
provided by any service files
[gb.dbus].DBusProxy._Invoke.357
This procedure runs just fine in Debian 12 (Gambas 3.18) and Debian 11.
Can anyone offer an explanation and suggest a solution
Posted
Guru

or not installed
Debian -- Details of package xdg-desktop-portal in trixie
sudo apt-get install xdg-desktop-portal
Or try this to stop gb.desktop using portal
Posted
Trainee
As for your second suggestion, where would I set Desktop.UsePortal = False ?
Posted
Guru

ask4nix said
Thanks, Bruce. I'm a bit busy with work atm, so will try both when I have a bit more free time, and then report back.
As for your second suggestion, where would I set Desktop.UsePortal = False ?
Just anywhere in the code before you use Desktop.Open()
Desktop.Open will not use desktop portal if Desktop.UsePortal is false
consider this code…
The first instance will use the portal and fail to open computer:/// as portal does not support that address.
after setting UsePortal to False it will then use xdg-open and that in turn will use "gio open computer:///" successfully
Posted
Trainee
But setting Desktop.UsePortal=False in Form_Open did the trick and I no longer get the error I originally described, so thank you for the solution, Bruce.
Interestingly, xdg-desktop-portal was not installed on either of my laptops running Debian 12 (MX23 or SparkyLinux 7), so setting Desktop.UsePortal=False threw an error in Gambas 3.18.0.4 running on those systems. I guess gb.Desktop uses gio by default to open files in Gambas 3.18.04
Posted
Guru

gb.desktop has it's own copy of xdg-utils and uses that if xdg-utils is not installed.
it's xdg-open that uses gio
I think this is the reason Benoit is going the portal way as he wants to remove the xdg-utils files from the mix altogether.
if you want compatibility across different systems use Try
Then it will not throw an error in a previous gambas version so it should work all round as if the Desktop.UsePortal property does not exist then the gambas version does not use it and will use xdg-utils anyway
1 guest and 0 members have just viewed this.



