User Tools

Site Tools


Sidebar

Network and communication

k24:k24.9:k24.9.2:k24.9.2.1:start

24.9.2.1 DBusView project

The DBusView program uses the properties DBus.Session.Applications and DBus.System.Applications to generate lists of applications registered on the D-Bus. This is successful because both the DBus.session and DBus.system properties are of the DBusConnection data type and the DBusConnection class has the Applications property, which returns a list with the names of all applications connected to the selected D-Bus:

Figure 24.9.2.1.1: Registered applications on the Session D-Bus and on the System D-Bus

The source text is pleasantly short:

' Gambas class file
 
Public Sub Form_Open()
  FMain.Resizable = False
  GetDBusSessionApplications()
  GetDBusSystemApplications()
End
 
Public Sub btnRefresh_Click()
  GetDBusSessionApplications()
  GetDBusSystemApplications()
End
 
Private Sub GetDBusSessionApplications()
 
  Dim i As Integer
  Dim aSessionList As String[]
 
  txaSession.Clear()
  aSessionList = DBus.Session.Applications.Sort(gb.Descent)
  For i = 0 To aSessionList.Max
    txaSession.Insert(aSessionList[i] & gb.NewLine)
  Next
  txaSession.Pos = 0
 
End
 
Private Sub GetDBusSystemApplications()
 
  Dim i As Integer
  Dim aSystemList As String[]
 
  txaSystem.Clear()
  aSystemList = DBus.System.Applications.Sort(gb.Descent)
  For i = 0 To aSystemList.Max
    txaSystem.Insert(aSystemList[i] & gb.NewLine)
  Next
  txaSystem.Pos = 0
 
End
 
Public Sub btnClose_Click()
  FMain.Close()
End

Download

This website uses cookies. By using the website, you agree with storing the cookies on your computer. More information in the privacy policy.
k24/k24.9/k24.9.2/k24.9.2.1/start.txt · Last modified: 02.07.2018 (external edit)

Page Tools