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 programme uses the DBus.Session.Applications and DBus.System.Applications properties to generate lists of applications registered on the D-Bus. This succeeds 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 of 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 code is delightfully 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

Project

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k24/k24.9/k24.9.2/k24.9.2.1/start.txt · Last modified: 16.08.2022 (external edit)

Page Tools