Thu, 15 Aug 2024 04:13:56 -0500
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Testing Done:
Called in the turtles and verified that the old actions still worked.
Bugs closed: PIDGIN-17881
Reviewed at https://reviews.imfreedom.org/r/3393/
--- a/protocols/demo/purpledemoprotocol.c Thu Aug 15 04:11:15 2024 -0500 +++ b/protocols/demo/purpledemoprotocol.c Thu Aug 15 04:13:56 2024 -0500 @@ -78,6 +78,7 @@ PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); protocol_class->create_connection = purple_demo_protocol_create_connection; + protocol_class->get_action_menu = purple_demo_protocol_get_action_menu; } /******************************************************************************
--- a/protocols/demo/purpledemoprotocolactions.c Thu Aug 15 04:11:15 2024 -0500 +++ b/protocols/demo/purpledemoprotocolactions.c Thu Aug 15 04:13:56 2024 -0500 @@ -602,3 +602,27 @@ iface->get_action_group = purple_demo_protocol_get_action_group; iface->get_menu = purple_demo_protocol_get_menu; } + +BirbActionMenu * +purple_demo_protocol_get_action_menu(G_GNUC_UNUSED PurpleProtocol *protocol, + G_GNUC_UNUSED PurpleAccount *account) +{ + BirbActionMenu *action_menu = NULL; + GActionGroup *group = NULL; + GMenu *menu = NULL; + GMenu *section = NULL; + + action_menu = birb_action_menu_new(); + + group = purple_demo_protocol_get_action_group(NULL, NULL); + birb_action_menu_add_action_group(action_menu, "prpl-demo", group); + g_clear_object(&group); + + menu = birb_action_menu_get_menu(action_menu); + + section = purple_demo_protocol_get_menu(NULL, NULL); + g_menu_append_section(menu, NULL, G_MENU_MODEL(section)); + g_clear_object(§ion); + + return action_menu; +}
--- a/protocols/demo/purpledemoprotocolactions.h Thu Aug 15 04:11:15 2024 -0500 +++ b/protocols/demo/purpledemoprotocolactions.h Thu Aug 15 04:13:56 2024 -0500 @@ -21,8 +21,15 @@ #include <glib.h> +#include <birb.h> + #include <purple.h> G_GNUC_INTERNAL void purple_demo_protocol_actions_init(PurpleProtocolActionsInterface *iface); +/* This temporarily here until we're ready to remove the protocol actions + * implementation. + */ +G_GNUC_INTERNAL BirbActionMenu *purple_demo_protocol_get_action_menu(PurpleProtocol *protocol, PurpleAccount *account); + #endif /* PURPLE_DEMO_PROTOCOL_ACTIONS_H */