[Gambas-user] Triggering org.freedesktop.DBus.Properties.PropertiesChanged
Benoit Minisini
benoit.minisini at gambas-basic.org
Tue Feb 7 17:01:37 CET 2023
Le 07/02/2023 à 16:44, Bruce Steers a écrit :
>
> I'm trying to make a dbus mpris interface for a MediaView control.
>
> I have some stuff working like cinnamon media control applet will
> stop/pause/play okay.
>
> What i am stuck with at present is being able to trigger the
> PropertiesChanged event.
>
> I have this code...
>
> Public Sub _new()
>
> $hDSignal = New DBusSignal(DBus.Session,
> "org.freedesktop.DBus.Properties", True) As "DBusSignal"
>
> End
>
>
> Public Sub DBusSignal_Signal(Sig As String, arg As Variant[])
>
> If Sig <> "PropertiesChanged" Then Return
> If arg[0] <> "org.mpris.MediaPlayer2.Player" Then Return
>
> Dim c As Collection = arg[1]
> For Each v As Variant In c
> ' Print c.Key, v
> Select c.Key
> Case "Volume"
> CheckVolumes()
> Case "PlaybackStatus"
> CheckPlayStates()
> Case Else
> Print "unhandled:";; c.Key, v
>
> End Select
> Next
>
> End
>
> With that if i click Play/pause in spotify i get the PlaybackStatus
> PropertiesChanged signal.
>
> But i cannot get my mpris interface to trigger the above property change
> event
> Is it not supposed to be automatic?
I don't think so. Anyway, you can raise any signal with the
DBus[Application].Raise() method.
--
Benoît Minisini.
More information about the User
mailing list