[Gambas-user] DBus.IsRegistered --> Unknown symbol

Benoît Minisini gambas at ...1...
Sat Feb 20 09:58:14 CET 2016


Le 20/02/2016 09:05, T Lee Davidson a écrit :
> I am developing an application that conditionally registers an object on the DBus session bus. I have to use the Form_Close
> event to, if it was registered, unregister the object or the form will close but the application will not stop.
>
> Based on http://gambaswiki.org/wiki/comp/gb.dbus/dbus/isregistered :
> [quote]
> DBus.IsRegistered (gb.dbus)
>
> Static Function IsRegistered ( Object As DBusObject ) As Boolean
>
> Return if the specified object is registered on a DBus bus.
> [/quote]
>
> my code is:
> [code]
> Public Sub Form_Close()
>
>     If DBus.IsRegistered(MyDBusObject) Then
>       DBus.Session.Unregister(MyDBusObject)
>     Endif
>
> End
> [/code]
>
> When the form is closed, I get, "Unknown symbol 'IsRegistered' in class 'Dbus'".
>
> Did I miss something in the documented syntax?
>
>
> As a temporary workaround, I can use:
> [code]
>     If DBus["org.freedesktop.DBus"]["/"].NameHasOwner(DBus.Name) Then
>       DBus.Session.Unregister(MyDBusObject)
>     Endif
> [/code]
>
> But that is not very granular.
>
>
> System Information:
> [System]
> Gambas=3.6.2
> OperatingSystem=Linux
> Kernel=4.1.15-desktop-2.mga5
> Architecture=x86_64
> Distribution=Mageia 5
> Desktop=KDE4
> Theme=Oxygen
> Language=en_US.UTF-8
> Memory=2002M
> [Libraries]
> Curl=libcurl.so.4.3.0
> DBus=libdbus-1.so.3.8.13
> GStreamer=libgstreamer-0.10.so.0.30.0
> GStreamer=libgstreamer-1.0.so.0.403.0
> OpenGL=libGL.so.1.2.0
> Qt4=libQtCore.so.4.8.6
>
>

I think I add this method in a more recent version of Gambas and forgot 
to specify it in the wiki...

-- 
Benoît Minisini




More information about the User mailing list