pidgin/pidgin

Parents 3c1574216aed
Children e588455a446e
Add a gtk-config-frame-cb property to PidginPluginInfo as it used to be there and some plugins were still trying to set it.

Testing Done:
ran in a devenv with `G_DEBUG=fatal-warnings gdb --args pidgin3` and verified that the program didn't halt on the gestures plugin anymore.

Reviewed at https://reviews.imfreedom.org/r/1090/
--- a/pidgin/pidginplugininfo.c Sat Oct 23 01:06:57 2021 -0500
+++ b/pidgin/pidginplugininfo.c Sat Oct 23 02:18:02 2021 -0500
@@ -22,14 +22,55 @@
#include "pidgincore.h"
+enum {
+ PROP_0,
+ PROP_GTK_CONFIG_FRAME,
+ N_PROPERTIES,
+};
+static GParamSpec *properties[N_PROPERTIES] = {NULL, };
+
struct _PidginPluginInfo {
PurplePluginInfo parent;
+
+ PidginPluginInfoGetConfigFrameFunc get_config_frame;
};
/******************************************************************************
* GObject Implementation
*****************************************************************************/
-G_DEFINE_TYPE(PidginPluginInfo, pidgin_plugin_info, PURPLE_TYPE_PLUGIN_INFO);
+G_DEFINE_TYPE(PidginPluginInfo, pidgin_plugin_info, PURPLE_TYPE_PLUGIN_INFO)
+
+static void
+pidgin_plugin_info_get_property(GObject *obj, guint param_id, GValue *value,
+ GParamSpec *pspec)
+{
+ PidginPluginInfo *info = PIDGIN_PLUGIN_INFO(obj);
+
+ switch(param_id) {
+ case PROP_GTK_CONFIG_FRAME:
+ g_value_set_pointer(value, info->get_config_frame);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
+pidgin_plugin_info_set_property(GObject *obj, guint param_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ PidginPluginInfo *info = PIDGIN_PLUGIN_INFO(obj);
+
+ switch(param_id) {
+ case PROP_GTK_CONFIG_FRAME:
+ info->get_config_frame = g_value_get_pointer(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
static void
pidgin_plugin_info_init(PidginPluginInfo *info) {
@@ -37,14 +78,29 @@
static void
pidgin_plugin_info_class_init(PidginPluginInfoClass *klass) {
+ GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+
+ obj_class->get_property = pidgin_plugin_info_get_property;
+ obj_class->set_property = pidgin_plugin_info_set_property;
+
+ /**
+ * PidginPluginInfo::gtk-config-frame-cb:
+ *
+ * A function to call to create the configuration widget for the plugin.
+ */
+ properties[PROP_GTK_CONFIG_FRAME] = g_param_spec_pointer(
+ "gtk-config-frame-cb", "gtk-config-frame-cb",
+ "The callback function to create a configuration widget.",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
}
/******************************************************************************
* API
*****************************************************************************/
GPluginPluginInfo *
-pidgin_plugin_info_new(const char *first_property, ...)
-{
+pidgin_plugin_info_new(const char *first_property, ...) {
GObject *info;
va_list var_args;
--- a/pidgin/pidginplugininfo.h Sat Oct 23 01:06:57 2021 -0500
+++ b/pidgin/pidginplugininfo.h Sat Oct 23 02:18:02 2021 -0500
@@ -46,6 +46,18 @@
G_DECLARE_FINAL_TYPE(PidginPluginInfo, pidgin_plugin_info, PIDGIN, PLUGIN_INFO, PurplePluginInfo)
/**
+ * PidginPluginInfoGetConfigFrameFunc:
+ * @plugin: The instance of the plugin.
+ *
+ * Gets the [class@Gtk.Widget] for configruing @plugin.
+ *
+ * Returns: (transfer full): The widget used to configure @plugin.
+ *
+ * Since: 3.0.0
+ */
+typedef GtkWidget *(*PidginPluginInfoGetConfigFrameFunc)(PurplePlugin *plugin);
+
+/**
* pidgin_plugin_info_new:
* @first_property: The first property name
* @...: The value of the first property, followed optionally by more