[Gambas-user] Error in gb.dbus ?

T Lee Davidson t.lee.davidson at gmail.com
Mon Mar 19 22:59:01 CET 2018


On 03/19/2018 10:24 AM, Hans Lehmann wrote:
> Hello,
> 
> if I want to observe selected signals for two DBus applications in a project, it does not work.
> Only the signals of the DBus object _noted first_ are observed. The signals of the second object are ignored.
> An error in the component gb.dbus?
> 
> With kind regards
> 
> Hans
> 
[source snipped]

I had to change the session interface to match my system, but the following worked for me, showing appropriate signals from
_both_ buses.

' Gambas module file

Public Sub Main()

  Dim hDBusSessionSignal, hDBusSystemSignal As DBusSignal
  hDBusSessionSignal = New DBusSignal(DBus.Session, "org.mpris.MediaPlayer2.Player", True) As "SessionSignal"
  hDBusSystemSignal = New DBusSignal(DBus.System, "org.freedesktop.NetworkManager", True) As "SystemSignal"

End

Public Sub SystemSignal_Signal(Signal As String, Arguments As Variant[])

  If Signal = "StateChanged" Then
    Print "State changed."
  Endif

End

Public Sub SessionSignal_Signal(Signal As String, Arguments As Variant[])

  Print Signal

End


-- 
Lee


More information about the User mailing list