## Migrating LibBonobo menus to GAction

During GNOME 2 days the context menu of the applet was based on the `BonoboUiVerb` class. These old menu verb definitions have been removed and should be replaced by the GAction interface family of objects.

Previous versions of this migration guide suggested to migrate to the family of GtkActionGroup classes. Since Gtk+ 3.10 these are deprecated and with the change of the Panel Applet Library API to version 5.0 the `panel_applet_setup_menu` family of functions now accept the GActionGroup interface and its related classes.

If the applet that is being ports had a context menu then it should contain code that looks similar to the following listing:

    1
    2
    3
    4
    5
    static const BonoboUIVerb show_desktop_menu_verbs [] = {
        BONOBO_UI_UNSAFE_VERB ("ShowDesktopPreferences", display_preferences_dialog),
        BONOBO_UI_UNSAFE_VERB ("ShowDesktopAbout",       display_about_dialog),
        BONOBO_UI_VERB_END
    };

The new code instead looks like this:

    1
    2
    3
    4
    static const GActionEntry menu_actions[] = {
        { "preferences", display_preferences_dialog },
        { "about",       display_about_dialog }
    };

This change also means that the callbacks must be changed to match the GAction API: Old callback looked like this:

    1
    2
    3
    4
    static void
    display_preferences_dialog (BonoboUIComponent *uic,
                                gpointer          *user_data,
                                const gchar       *verbname)

The new version should have the following signature:

    1
    2
    3
    4
    static void
    display_preferences_dialog (GSimpleAction *action,
                                GVariant      *parameter,
                                gpointer       user_data)

Additionally you should use GtkBuilder to define a GMenuModel in XML and use the `panel_applet_setup_menu` family of functions to setup the menu. See Using a context menu for more details. For more information about using the GMenu and GAction APIs please refer to the GIO Reference Manual.