diff --git a/comp/src/gb.dbus.trayicon/.project b/comp/src/gb.dbus.trayicon/.project index 826cbd69c..1aa17f3a2 100644 --- a/comp/src/gb.dbus.trayicon/.project +++ b/comp/src/gb.dbus.trayicon/.project @@ -1,7 +1,7 @@ # Gambas Project File 3.0 # Compiled with Gambas 3.8.90 Title=Tray icons using the new DBus protocol -Startup=FTest +Startup=FMain Version=3.8.90 VersionFile=1 Component=gb.image diff --git a/comp/src/gb.dbus.trayicon/.src/DBusStatusIconMenu.class b/comp/src/gb.dbus.trayicon/.src/DBusStatusIconMenu.class index 6fc6da287..728f5da36 100644 --- a/comp/src/gb.dbus.trayicon/.src/DBusStatusIconMenu.class +++ b/comp/src/gb.dbus.trayicon/.src/DBusStatusIconMenu.class @@ -57,6 +57,8 @@ Public Sub com_canonical_dbusmenu_GetGroupProperties(IdList As Integer[], Proper Dim iId As Integer Dim hResult As _DBusMenuProperties + Debug + For Each iId In IdList aResult.Add([iId, GetProperties(iId, PropertyNames)]) Next diff --git a/comp/src/gb.dbus.trayicon/.src/FMain.class b/comp/src/gb.dbus.trayicon/.src/FMain.class new file mode 100644 index 000000000..9312c147c --- /dev/null +++ b/comp/src/gb.dbus.trayicon/.src/FMain.class @@ -0,0 +1,60 @@ +' Gambas class file + +Public $hTray As TrayIcon +Private $bOK As Boolean + +Public Sub Form_Open() + + DBus.Debug = True + Try $hTray = New TrayIcon + If Error Then + Print "#ERROR" + Return + Endif + '$hTray.Icon = Picture["griG.png"] + object.Attach($hTray, Me, "myMenu") + $hTray.Show + myMenu.Hide + $hTray.PopupMenu = "myMenu" + +End + +Public Sub Menu2_Click() + + Me.Visible = True + +End + +Public Sub Menu3_Click() + + Me.Close + +End + +Public Sub Form_Close() + + If Not $bOK Then + Me.Visible = False + Stop Event + Else + Me.Close + Endif + +End + +Public Sub Menu4_Click() + + $bOK = True + ' Object.Detach($hTray) + ' $hTray.Delete() + Me.Close() + ' Wait + ' Quit + +End + +Public Sub myMenu_Click() + + Print "CLICK" + +End diff --git a/comp/src/gb.dbus.trayicon/.src/FMain.form b/comp/src/gb.dbus.trayicon/.src/FMain.form new file mode 100644 index 000000000..dc17e994a --- /dev/null +++ b/comp/src/gb.dbus.trayicon/.src/FMain.form @@ -0,0 +1,18 @@ +# Gambas Form File 3.0 + +{ Form Form + MoveScaled(0,0,64,64) + { myMenu Menu + Text = ("myMenu") + { Menu2 Menu + Text = Shortcut(("Open"), "O") + Shortcut = "Ctrl+O" + } + { Menu3 Menu + Text = Shortcut(("Close"), "C") + } + { Menu4 Menu + Text = Shortcut(("Quit"), "Q") + } + } +} diff --git a/comp/src/gb.dbus.trayicon/.src/FTest.form b/comp/src/gb.dbus.trayicon/.src/FTest.form index 28ec580f0..a177f7de8 100644 --- a/comp/src/gb.dbus.trayicon/.src/FTest.form +++ b/comp/src/gb.dbus.trayicon/.src/FTest.form @@ -2,7 +2,6 @@ { Form Form MoveScaled(0,0,64,64) - Persistent = True { Menu1 Menu Text = ("Menu1") { Menu2 Menu @@ -53,7 +52,7 @@ #MoveScaled(22,14) Visible = True PopupMenu = "Menu1" - Tooltip = "Hello tooltip !" + Tooltip = ("Hello tooltip !") } { Button1 Button MoveScaled(5,4,16,4) diff --git a/comp/src/gb.dbus.trayicon/.startup b/comp/src/gb.dbus.trayicon/.startup index 6bfa16fc8..1d8f90f81 100644 --- a/comp/src/gb.dbus.trayicon/.startup +++ b/comp/src/gb.dbus.trayicon/.startup @@ -1,4 +1,4 @@ -FTest +FMain Tray icons using the new DBus protocol 0 0 diff --git a/gb.dbus/src/helper.c b/gb.dbus/src/helper.c index cdf482d2a..0351ba3cd 100644 --- a/gb.dbus/src/helper.c +++ b/gb.dbus/src/helper.c @@ -186,6 +186,7 @@ static const char *to_dbus_type(GB_VALUE *arg) while (a--) result = GB.AddChar(result, 'a'); result = GB.AddString(result, dtype, strlen(dtype)); + GB.FreeStringLater(result); return result; }