This is a simple C app that can compile against either gtk+-2.0 or gtk+-3.0. You will need your devx.sfs file for this and make sure your gtk-2.0 (or 3.0) include directories are in /usr/include (hint: symlinks are friends) . Check the 'MakeFile' then just run 'make' from a terminal in the MakeFile folder.
This little C file makes a tray app called demo_tray that displays a red or green icon depending on whether or not the file "/tmp/traydemo.txt" exists.
Left-clicking the tray icon will delete the file, Right-clicking will recreate the file. But what's the fun in that, right?
Start the tray app from one terminal window and let it run. Now open another terminal window and execute these commands a few times:
Code: Select all
root# touch /tmp/traydemo.txt
root# rm /tmp/traydemo.txt
.. and watch the blinky light. It will follow the state of the traydemo.txt file.
So give the C source file a good read, and use it as a starting place to do your own tray app experiments. For instance, instead of making direct system calls, you can use the "system()" function to execute a yummy Xdialog bash script :itswhatialwaysdo:
(You might think this 'state-machine' stuff as arcane, but I got semi-notorious for re-writing the kermit file transfer protocol back in the late 80's for DOS. File transfer protocols are built on the science of state machines. So are networking/communication protocols.)