## Removing LibBonobo factory

To migrate from LibBonobo to the DBUS API remove PANEL_APPLET_BONOBO_FACTORY and replace it with either PANEL_APPLET_OUT_PROCESS_FACTORY or PANEL_APPLET_IN_PROCESS_FACTORY depending if you want an out-process or in-process applet, respectively.

The new macros have the same parameters as the old, except the version and description parameters have been removed. Also the `OAFIID:GNOME_` prefix of the first parameter can be dropped both from the factory ID and the applet type name. The following two code listings show the difference between the old and new macro definitions:

    1
    2
    3
    4
    5
    6
    PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_HelloWorldFactory",
                                 PANEL_TYPE_APPLET,
                                 "WindowNavigationApplets",
                                 "0",
                                 hello_world_factory,
                                 NULL)

The new version of the macro should be:

    1
    2
    3
    4
    PANEL_APPLET_OUT_PROCESS_FACTORY ("HelloWorldFactory",
                                      PANEL_TYPE_APPLET,
                                      hello_world_factory,
                                      NULL)

The applet factory callback, in this case the `hello_world_factory` usually contains a check to ensure that the applet factory supports the requested applet. Here the `OAFIID:GNOME_` prefix should be dropped as well, see the following two code listings.

When you drop the prefix here, you must also remove the prefix from the applet name in the Panel Applet File.

Old definition:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    static gboolean
    hello_world_factory (PanelApplet *applet,
    const char  *iid,
    gpointer     data)
    {

    if (!g_strcmp (iid, "OAFIID:GNOME_HelloWorldApplet") != 0)
    return FALSE;

    hello_world_applet_fill (applet);

    return TRUE;
    }

The new version of of the factory callback should be:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    static gboolean
    hello_world_factory (PanelApplet *applet,
    const char  *iid,
    gpointer     data)
    {

    if (!g_strcmp0 (iid, "HelloWorldApplet") != 0)
    return FALSE;

    hello_world_applet_fill (applet);

    return TRUE;
    }

### Migrating Service file to Panel Applet File

The old applet will have a `service.in.in` file that was used to register the applet with the GNOME Panel. This file must be renamed to `.panel-applet` and its content changed to match the format of the new file type. See Panel Applet Files for a detailed explanation of the valid fields. If you decided to use the out-process factory macro, then you should also supply a D-BUS Service File so your applet can be started using D-BUS activation.

For compatibility you can keep the old `BonoboId`. This field can contain the old bonobo identifier. It allows the panel to load applets using existing configuration data in your panels settings. It can be a single string or a list of strings in case of applets with more than one identifier.

Example for the migrated panel applet file:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    [Applet Factory]
    Id=HellWorldFactory
    Location=@LOCATION@
    _Name=Hello World Applet Factory
    _Description=Factory for the our example applets

    [HelloWorldApplet]
    _Name=Hello World
    _Description=Factory for the Hello World example applet
    Icon=hello-world-icon
    BonoboId=OAFIID:GNOME_HelloWorldApplet
    X-GNOME-Bugzilla-Bugzilla=GNOME
    X-GNOME-Bugzilla-Product=gnome-panel
    X-GNOME-Bugzilla-Component=hello-world-applet
    X-GNOME-Bugzilla-Version=@VERSION@
    X-GNOME-Bugzilla-OtherBinaries=hello-world-applet