From 0ed5403c0ecd9fa92b49ba919aab13060ef777c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Fri, 12 May 2023 11:17:37 +0200 Subject: [PATCH] DBusSession: Exist() is a new method that returns if a specific name is available on the bus. [GB.DBUS] * NEW: DBusSession: Exist() is a new method that returns if a specific name is available on the bus. --- gb.dbus/src/gb.dbus/.src/DBusConnection.class | 7 +++++++ gb.dbus/src/gb.dbus/.src/MMain.module | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gb.dbus/src/gb.dbus/.src/DBusConnection.class b/gb.dbus/src/gb.dbus/.src/DBusConnection.class index 66938e24a..ae42af036 100644 --- a/gb.dbus/src/gb.dbus/.src/DBusConnection.class +++ b/gb.dbus/src/gb.dbus/.src/DBusConnection.class @@ -58,3 +58,10 @@ Public Sub _get((Application) As String) As DBusApplication End +'' Check if a specific application name is used + +Public Sub Exist((Application) As String) As Boolean + + Try Return DBus["org.freedesktop.DBus"]["/", "org.freedesktop.DBus"].NameHasOwner(Application) + +End diff --git a/gb.dbus/src/gb.dbus/.src/MMain.module b/gb.dbus/src/gb.dbus/.src/MMain.module index f9a5c90e9..5491f4479 100644 --- a/gb.dbus/src/gb.dbus/.src/MMain.module +++ b/gb.dbus/src/gb.dbus/.src/MMain.module @@ -173,7 +173,7 @@ Public Sub Main() hSignal = New DBusSignal(DBus.Session, "org.freedesktop.portal.Request", "/org/freedesktop/portal/desktop/request/" & Replace(Mid$(DBus.Session._Name, 2), ".", "_") & "/Gambas1972") As "ResponseSignal" - Print DBus["org.freedesktop.portal.Desktop"]["/org/freedesktop/portal/desktop", "org.freedesktop.portal.Screenshot"].Screenshot("", ["handle_token": "Gambas1972", "interactive": True]) + Print DBus["org.freedesktop.portal.Desktop"]["/org/freedesktop/portal/desktop", "org.freedesktop.portal.Screenshot"].PickColor("", ["handle_token": "Gambas1972", "interactive": True]) End