pidgin/pidgin

Add settings-schema to libpurple plugin info

18 months ago, Elliott Sales de Andrade
454caa755f53
Parents 86518b429f50
Children b03ca9889e90
Add settings-schema to libpurple plugin info

Also, remove their preference frame functions.

This should make them work with the new GPlugin settings list.

Testing Done:
Compiled with /r/2128, /r/2129, /r/2130, opened Plugins dialog, and saw settings listed on these plugins.

Reviewed at https://reviews.imfreedom.org/r/2131/
--- a/libpurple/plugins/autoaccept/autoaccept.c Mon Dec 12 23:47:38 2022 -0600
+++ b/libpurple/plugins/autoaccept/autoaccept.c Tue Dec 13 01:59:36 2022 -0600
@@ -251,44 +251,6 @@
(*menu) = g_list_prepend(*menu, action);
}
-static PurplePluginPrefFrame *
-get_plugin_pref_frame(PurplePlugin *plugin)
-{
- PurplePluginPrefFrame *frame;
- PurplePluginPref *pref;
-
- frame = purple_plugin_pref_frame_new();
-
- /* XXX: Is there a better way than this? There really should be. */
- pref = purple_plugin_pref_new_with_name_and_label(PREF_PATH, _("Path to save the files in\n"
- "(Please provide the full path)"));
- purple_plugin_pref_frame_add(frame, pref);
-
- pref = purple_plugin_pref_new_with_name_and_label(PREF_STRANGER,
- _("When a file-transfer request arrives from a user who is\n"
- "*not* on your buddy list:"));
- purple_plugin_pref_set_pref_type(pref, PURPLE_PLUGIN_PREF_CHOICE);
- purple_plugin_pref_add_choice(pref, _("Ask"), GINT_TO_POINTER(FT_ASK));
- purple_plugin_pref_add_choice(pref, _("Auto Accept"), GINT_TO_POINTER(FT_ACCEPT));
- purple_plugin_pref_add_choice(pref, _("Auto Reject"), GINT_TO_POINTER(FT_REJECT));
- purple_plugin_pref_frame_add(frame, pref);
-
- pref = purple_plugin_pref_new_with_name_and_label(PREF_NOTIFY,
- _("Notify with a popup when an autoaccepted file transfer is complete\n"
- "(only when there's no conversation with the sender)"));
- purple_plugin_pref_frame_add(frame, pref);
-
- pref = purple_plugin_pref_new_with_name_and_label(PREF_NEWDIR,
- _("Create a new directory for each user"));
- purple_plugin_pref_frame_add(frame, pref);
-
- pref = purple_plugin_pref_new_with_name_and_label(PREF_ESCAPE,
- _("Escape the filenames"));
- purple_plugin_pref_frame_add(frame, pref);
-
- return frame;
-}
-
static GPluginPluginInfo *
auto_accept_query(GError **error)
{
@@ -304,7 +266,7 @@
"authors", authors,
"website", PURPLE_WEBSITE,
"abi-version", PURPLE_ABI_VERSION,
- "pref-frame-cb", get_plugin_pref_frame,
+ "settings-schema", SETTINGS_SCHEMA_ID,
NULL
);
}
--- a/libpurple/plugins/joinpart/joinpart.c Mon Dec 12 23:47:38 2022 -0600
+++ b/libpurple/plugins/joinpart/joinpart.c Tue Dec 13 01:59:36 2022 -0600
@@ -189,37 +189,6 @@
return TRUE;
}
-static PurplePluginPrefFrame *
-get_plugin_pref_frame(PurplePlugin *plugin)
-{
- PurplePluginPrefFrame *frame;
- PurplePluginPref *ppref;
-
- g_return_val_if_fail(plugin != NULL, FALSE);
-
- frame = purple_plugin_pref_frame_new();
-
- ppref = purple_plugin_pref_new_with_label(_("Hide Joins/Parts"));
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(THRESHOLD_PREF,
- /* Translators: Followed by an input request a number of people */
- _("For rooms with more than this many people"));
- purple_plugin_pref_set_bounds(ppref, 0, 1000);
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(DELAY_PREF,
- _("If user has not spoken in this many minutes"));
- purple_plugin_pref_set_bounds(ppref, 0, 8 * 60); /* 8 Hours */
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(HIDE_BUDDIES_PREF,
- _("Apply hiding rules to buddies"));
- purple_plugin_pref_frame_add(frame, ppref);
-
- return frame;
-}
-
static GPluginPluginInfo *
join_part_query(GError **error)
{
@@ -240,7 +209,7 @@
"authors", authors,
"website", PURPLE_WEBSITE,
"abi-version", PURPLE_ABI_VERSION,
- "pref-frame-cb", get_plugin_pref_frame,
+ "settings-schema", SETTINGS_SCHEMA_ID,
NULL
);
}
--- a/libpurple/plugins/notification-sound/notification-sound.c Mon Dec 12 23:47:38 2022 -0600
+++ b/libpurple/plugins/notification-sound/notification-sound.c Tue Dec 13 01:59:36 2022 -0600
@@ -246,6 +246,7 @@
"authors", authors,
"action-group", group,
"action-menu", menu,
+ "settings-schema", SETTINGS_SCHEMA_ID,
NULL
);
}
--- a/libpurple/plugins/psychic/psychic.c Mon Dec 12 23:47:38 2022 -0600
+++ b/libpurple/plugins/psychic/psychic.c Tue Dec 13 01:59:36 2022 -0600
@@ -91,36 +91,6 @@
}
-static PurplePluginPrefFrame *
-get_plugin_pref_frame(PurplePlugin *plugin) {
-
- PurplePluginPrefFrame *frame;
- PurplePluginPref *pref;
-
- frame = purple_plugin_pref_frame_new();
-
- pref = purple_plugin_pref_new_with_name(PREF_BUDDIES);
- purple_plugin_pref_set_label(pref, _("Only enable for users on"
- " the buddy list"));
- purple_plugin_pref_frame_add(frame, pref);
-
- pref = purple_plugin_pref_new_with_name(PREF_STATUS);
- purple_plugin_pref_set_label(pref, _("Disable when away"));
- purple_plugin_pref_frame_add(frame, pref);
-
- pref = purple_plugin_pref_new_with_name(PREF_NOTICE);
- purple_plugin_pref_set_label(pref, _("Display notification message in"
- " conversations"));
- purple_plugin_pref_frame_add(frame, pref);
-
- pref = purple_plugin_pref_new_with_name(PREF_RAISE);
- purple_plugin_pref_set_label(pref, _("Raise psychic conversations"));
- purple_plugin_pref_frame_add(frame, pref);
-
- return frame;
-}
-
-
static GPluginPluginInfo *
psychic_query(GError **error) {
const gchar * const authors[] = PLUGIN_AUTHORS;
@@ -135,7 +105,7 @@
"authors", authors,
"website", PURPLE_WEBSITE,
"abi-version", PURPLE_ABI_VERSION,
- "pref-frame-cb", get_plugin_pref_frame,
+ "settings-schema", SETTINGS_SCHEMA_ID,
NULL
);
}
--- a/libpurple/plugins/statenotify/statenotify.c Mon Dec 12 23:47:38 2022 -0600
+++ b/libpurple/plugins/statenotify/statenotify.c Tue Dec 13 01:59:36 2022 -0600
@@ -23,6 +23,7 @@
#include <purple.h>
#define STATENOTIFY_PLUGIN_ID "core-statenotify"
+#define SETTINGS_SCHEMA_ID "im.pidgin.Purple.plugin.StateNotify"
static void
write_status(PurpleBuddy *buddy, const char *message)
@@ -74,7 +75,7 @@
available = purple_status_is_available(status);
old_available = purple_status_is_available(old_status);
- settings = g_settings_new_with_backend("im.pidgin.Purple.plugin.StateNotify",
+ settings = g_settings_new_with_backend(SETTINGS_SCHEMA_ID,
purple_core_get_settings_backend());
if(g_settings_get_boolean(settings, "notify-away")) {
if (available && !old_available) {
@@ -92,7 +93,7 @@
{
GSettings *settings = NULL;
- settings = g_settings_new_with_backend("im.pidgin.Purple.plugin.StateNotify",
+ settings = g_settings_new_with_backend(SETTINGS_SCHEMA_ID,
purple_core_get_settings_backend());
if(g_settings_get_boolean(settings, "notify-idle")) {
if (idle && !old_idle) {
@@ -109,7 +110,7 @@
{
GSettings *settings = NULL;
- settings = g_settings_new_with_backend("im.pidgin.Purple.plugin.StateNotify",
+ settings = g_settings_new_with_backend(SETTINGS_SCHEMA_ID,
purple_core_get_settings_backend());
if(g_settings_get_boolean(settings, "notify-signon")) {
write_status(buddy, _("%s has signed on."));
@@ -122,7 +123,7 @@
{
GSettings *settings = NULL;
- settings = g_settings_new_with_backend("im.pidgin.Purple.plugin.StateNotify",
+ settings = g_settings_new_with_backend(SETTINGS_SCHEMA_ID,
purple_core_get_settings_backend());
if(g_settings_get_boolean(settings, "notify-signon")) {
write_status(buddy, _("%s has signed off."));
@@ -130,29 +131,6 @@
g_object_unref(settings);
}
-static PurplePluginPrefFrame *
-get_plugin_pref_frame(PurplePlugin *plugin)
-{
- PurplePluginPrefFrame *frame;
- PurplePluginPref *ppref;
-
- frame = purple_plugin_pref_frame_new();
-
- ppref = purple_plugin_pref_new_with_label(_("Notify When"));
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_away", _("Buddy Goes _Away"));
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_idle", _("Buddy Goes _Idle"));
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_signon", _("Buddy _Signs On/Off"));
- purple_plugin_pref_frame_add(frame, ppref);
-
- return frame;
-}
-
static GPluginPluginInfo *
state_notify_query(GError **error)
{
@@ -173,7 +151,7 @@
"authors", authors,
"website", PURPLE_WEBSITE,
"abi-version", PURPLE_ABI_VERSION,
- "pref-frame-cb", get_plugin_pref_frame,
+ "settings-schema", SETTINGS_SCHEMA_ID,
NULL
);
}