diff --git a/gb.dbus/src/gb.dbus/.src/DBusConnection.class b/gb.dbus/src/gb.dbus/.src/DBusConnection.class index ae42af036..a0fcb67d8 100644 --- a/gb.dbus/src/gb.dbus/.src/DBusConnection.class +++ b/gb.dbus/src/gb.dbus/.src/DBusConnection.class @@ -62,6 +62,19 @@ End Public Sub Exist((Application) As String) As Boolean - Try Return DBus["org.freedesktop.DBus"]["/", "org.freedesktop.DBus"].NameHasOwner(Application) + Try Return Me["org.freedesktop.DBus"]["/", "org.freedesktop.DBus"].NameHasOwner(Application) + +End + +Public Sub Start((Application) As String) + + Dim fTime As Float + + Me["org.freedesktop.DBus"]["/", "org.freedesktop.DBus"].StartServiceByName(Application, 0) + fTime = Timer + While Not {Exist}(Application) + Sleep 0.05 + If (Timer - fTime) > 1 Then Error.Raise("Cannot start service") + Wend End diff --git a/gb.dbus/src/gb.dbus/.src/MMain.module b/gb.dbus/src/gb.dbus/.src/MMain.module index da69c9ccc..489de51e0 100644 --- a/gb.dbus/src/gb.dbus/.src/MMain.module +++ b/gb.dbus/src/gb.dbus/.src/MMain.module @@ -177,6 +177,8 @@ Public Sub Main() Dim hFile As File hFile = Open "~/03.FDR_OAPP_2023_12.05_bois_harpe et piano.pdf" + Print DBus.Session.Exist("org.freedesktop.portal.Desktop") + Print DBus["org.freedesktop.portal.Desktop"]["/org/freedesktop/portal/desktop", "org.freedesktop.portal.OpenURI"].OpenFile("", DBusFile(hFile), ["handle_token": "Gambas1972", "interactive": True]) End