Copyright (C) 2000-2012 |
Whole document tree
Multiple Applet SupportHaving one process per applet might be ok, but when you have many applets it can be quite a hit on the memory. There is an easy way to multiple applets from one process, even different types of applets. For a simple example let's modify our original hello applet to make it possible to have multiple instances of it from just one executable. We will create a factory corba service that can create new instances of the applet. Example 14. Industrialization of hello_applet
What you will notice is that what we do is just make a factory service with applet_factory_new, to which we pass a function pointer to a function that just creates new applets for us. Now we need to create a .gnorba and .desktop files for an applet of this type. The .desktop file is the exact same as for normal applets. The .gnorba file however must now describe the factory as well. Example 15. Industrialization of hello.gnorba
Sometimes you may want to have two applets that have very similiar functionality, but that appear to the user as two different applets, and you want to manage them from the same process. This is extremely simple. Just take the above example and add more types into the .gnorba file, then wherever we check the goad_id, just add another "else if" to check for another goad_id. Then in your desktops on the Exec line, you would have in one .desktop:
|