pidgin/pidgin

Parents 70522200fe58
Children 0b3b172cd50e
Convert the XMPP Console plugin to the new GAction/GMenu based actions

Testing Done:
Verified the action worked as expected.

Reviewed at https://reviews.imfreedom.org/r/1558/
--- a/pidgin/plugins/xmppconsole/xmppconsole.c Sun Jul 31 00:53:12 2022 -0500
+++ b/pidgin/plugins/xmppconsole/xmppconsole.c Sun Jul 31 00:54:01 2022 -0500
@@ -583,7 +583,8 @@
* Plugin implementation
*****************************************************************************/
static void
-create_console(PurplePluginAction *action)
+create_console(G_GNUC_UNUSED GSimpleAction *action,
+ G_GNUC_UNUSED GVariant *parameter, G_GNUC_UNUSED gpointer data)
{
if (console == NULL) {
console = g_object_new(PIDGIN_TYPE_XMPP_CONSOLE, NULL);
@@ -593,26 +594,29 @@
gtk_window_present(GTK_WINDOW(console));
}
-static GList *
-actions(PurplePlugin *plugin)
-{
- GList *l = NULL;
- PurplePluginAction *act = NULL;
-
- act = purple_plugin_action_new(_("XMPP Console"), create_console);
- l = g_list_append(l, act);
-
- return l;
-}
-
static GPluginPluginInfo *
xmpp_console_query(GError **error)
{
+ GActionEntry entries[] = {
+ {
+ .name = "console",
+ .activate = create_console,
+ }
+ };
+ GMenu *menu = NULL;
+ GSimpleActionGroup *group = NULL;
const gchar * const authors[] = {
"Sean Egan <seanegan@gmail.com>",
NULL
};
+ group = g_simple_action_group_new();
+ g_action_map_add_action_entries(G_ACTION_MAP(group), entries,
+ G_N_ELEMENTS(entries), NULL);
+
+ menu = g_menu_new();
+ g_menu_append(menu, _("XMPP Console"), "console");
+
return pidgin_plugin_info_new(
"id", PLUGIN_ID,
"name", N_("XMPP Console"),
@@ -624,7 +628,8 @@
"authors", authors,
"website", PURPLE_WEBSITE,
"abi-version", PURPLE_ABI_VERSION,
- "actions-cb", actions,
+ "action-group", group,
+ "action-menu", menu,
NULL
);
}