[Gambas-user] New Systray

herberth guzman herberthguzman at gmail.com
Thu Apr 23 18:59:42 CEST 2020


The code is:

' Gambas class file

Private $hTrayIcons As New TrayIcon[]
Public Sub Form_Open()
Dim hTray As TrayIcon

  Dim i As Integer
  Dim hDBusApplication As DBusApplication
  Dim hConnection As DBusConnection
  Dim hDBusProxy As DBusProxy
  Dim sDBusName, sDBusObjectPath, sDBusInterface As String
  Dim aChildren As New String[]
  Dim aVal As Variant[]
  Dim s As String


  sDBusName = "org.freedesktop.NetworkManager"
  hConnection = DBus.System
  hDBusApplication = New DBusApplication(hConnection, sDBusName)

  sDBusObjectPath = "/org/freedesktop/NetworkManager"
  sDBusInterface = "org.freedesktop.NetworkManager"
  hDBusProxy = New DBusProxy(hDBusApplication, sDBusObjectPath,
sDBusInterface)

  aChildren = hDBusProxy.Children

  txaReport.Insert(gb.NewLine)
  For i = 0 To aChildren.Max
    txaReport.Insert(sDBusObjectPath &/ aChildren[i] & gb.NewLine)
  Next

  s =
DBus["system://org.freedesktop.NetworkManager"]["/org/freedesktop/NetworkManager",
"org.freedesktop.NetworkManager"].GetAllDevices().Join("\n")
 Print s

 If s Then
    hTray = New TrayIcon
    hTray.Name = s
    $hTrayIcons.Add(hTray)
    hTray.Icon = Picture["icon:/32/connect"]
    Endif
  'Next

   dwgSystemTray.Refresh

End

El mié., 22 abr. 2020 a las 21:44, herberth guzman (<
herberthguzman at gmail.com>) escribió:

> Hi Benoit
>
> I don't have the necessary knowledge for everything I want to do, but I
> try.
>
> I want to make a system tray, could you check my code please.
>
> Could you help me as I managed to get the popup menu of networkmanager
> (example list of wifi networks) by clicking on the icon of the network menu
> and at the same time if you think I am on the right path to continue or
> could you advise me please.
>
> i need my new system tray
>
> at the moment i need networkmanager
> but in the future I need to show any app in the systray (example vlc,
> audio, others)
>
> thank you very much
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200423/9aa747eb/attachment.html>


More information about the User mailing list