User Tools

Site Tools


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

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.
k24/k24.9/k24.9.2/k24.9.2.1/start.txt · Last modified: by 127.0.0.1