pidgin/pidgin

Parents 0b3b172cd50e
Children ed1c0145c164
Convert the XMPP discovery plugin to the new GAction/GMenu plugin actions

Testing Done:
Verified the action worked as expected.

Reviewed at https://reviews.imfreedom.org/r/1557/
--- a/pidgin/plugins/disco/xmppdisco.c Sun Jul 31 00:54:46 2022 -0500
+++ b/pidgin/plugins/disco/xmppdisco.c Sun Jul 31 01:45:36 2022 -0500
@@ -583,24 +583,13 @@
}
static void
-create_dialog(PurplePluginAction *action)
+create_dialog(G_GNUC_UNUSED GSimpleAction *action,
+ G_GNUC_UNUSED GVariant *parameter,
+ G_GNUC_UNUSED gpointer data)
{
pidgin_disco_dialog_new();
}
-static GList *
-actions(PurplePlugin *plugin)
-{
- GList *l = NULL;
- PurplePluginAction *action = NULL;
-
- action = purple_plugin_action_new(_("XMPP Service Discovery"),
- create_dialog);
- l = g_list_prepend(l, action);
-
- return l;
-}
-
static void
signed_off_cb(PurpleConnection *pc, gpointer unused)
{
@@ -614,11 +603,26 @@
static GPluginPluginInfo *
xmpp_disco_query(GError **error)
{
+ GActionEntry entries[] = {
+ {
+ .name = "dialog",
+ .activate = create_dialog,
+ }
+ };
+ GMenu *menu = NULL;
+ GSimpleActionGroup *group = NULL;
const gchar * const authors[] = {
"Paul Aurich <paul@darkrain42.org>",
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 Service Discovery"), "dialog");
+
return pidgin_plugin_info_new(
"id", PLUGIN_ID,
"name", N_("XMPP Service Discovery"),
@@ -630,7 +634,8 @@
"authors", authors,
"website", PURPLE_WEBSITE,
"abi-version", PURPLE_ABI_VERSION,
- "actions-cb", actions,
+ "action-group", group,
+ "action-menu", menu,
NULL
);
}