[Mono-osx] Gtk# StatusIcon and Events

KenKen kenneth at hexad.dk
Sat Jul 24 05:29:41 EDT 2010


I was asked off-list how to show the Gtk# NotifyIcon in one thread and run
WinForms in another.
The relevant source code can be found here (LGPL license):
http://code.google.com/p/duplicati/source/browse/sandboxes/Kenneth/MacSupport/Duplicati/GUI/TrayIconWrapper.cs

The code uses reflection to work with Gtk#, so the project can compile
without having Gtk# installed, and the comments show what the code would
look like without reflection.

Line 64 is commented out as that function is in a separate module. The
module should compile using the standard mscorlib and winforms dependencies.

It works by creating a proxy-like interface to a TrayIcon, and can be used
with "TrayIcon icon = new TrayIcon();" replaced by "TrayIconWrapper icon =
new TrayIconWrapper(form);".

The trouble parts are line 156 and line 169 which do not get invoked while
on Mac. Everything else seems to work, but the code must call the Exit()
function to shutdown the Gtk# event loop.

I am planning to write a simple test without all the thread stuff, so I can
determine if it is a general problem, or related to my workaround.

Regards, Kenneth

-- 
View this message in context: http://mono.1490590.n4.nabble.com/Gtk-StatusIcon-and-Events-tp2295916p2300983.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list