--- a/libpurple/protocols/jabber/jingle/content.c Mon Nov 18 01:12:39 2013 +0530 +++ b/libpurple/protocols/jabber/jingle/content.c Wed Nov 20 04:54:16 2013 +0530 @@ -23,6 +23,7 @@ */ #include "internal.h" +#include "glibcompat.h" #include "debug.h" #include "content.h" @@ -52,8 +53,6 @@ static PurpleXmlNode *jingle_content_to_xml_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action); static JingleContent *jingle_content_parse_internal(PurpleXmlNode *content); -static GObjectClass *parent_class = NULL; - enum { PROP_0, PROP_SESSION, @@ -63,8 +62,12 @@ PROP_SENDERS, PROP_TRANSPORT, PROP_PENDING_TRANSPORT, + PROP_LAST }; +static GObjectClass *parent_class = NULL; +static GParamSpec *properties[PROP_LAST]; + PURPLE_DEFINE_TYPE(JingleContent, jingle_content, G_TYPE_OBJECT); static void @@ -79,54 +82,61 @@ klass->to_xml = jingle_content_to_xml_internal; klass->parse = jingle_content_parse_internal; - g_object_class_install_property(gobject_class, PROP_SESSION, - g_param_spec_object("session", + properties[PROP_SESSION] = g_param_spec_object("session", "Jingle Session", "The jingle session parent of this content.", JINGLE_TYPE_SESSION, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(gobject_class, PROP_SESSION, + properties[PROP_SESSION]); - g_object_class_install_property(gobject_class, PROP_CREATOR, - g_param_spec_string("creator", + properties[PROP_CREATOR] = g_param_spec_string("creator", "Creator", "The participant that created this content.", NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(gobject_class, PROP_CREATOR, + properties[PROP_CREATOR]); - g_object_class_install_property(gobject_class, PROP_DISPOSITION, - g_param_spec_string("disposition", + properties[PROP_DISPOSITION] = g_param_spec_string("disposition", "Disposition", "The disposition of the content.", NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(gobject_class, PROP_DISPOSITION, + properties[PROP_DISPOSITION]); - g_object_class_install_property(gobject_class, PROP_NAME, - g_param_spec_string("name", + properties[PROP_NAME] = g_param_spec_string("name", "Name", "The name of this content.", NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(gobject_class, PROP_NAME, + properties[PROP_NAME]); - g_object_class_install_property(gobject_class, PROP_SENDERS, - g_param_spec_string("senders", + properties[PROP_SENDERS] = g_param_spec_string("senders", "Senders", "The sender of this content.", NULL, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(gobject_class, PROP_SENDERS, + properties[PROP_SENDERS]); - g_object_class_install_property(gobject_class, PROP_TRANSPORT, - g_param_spec_object("transport", + properties[PROP_TRANSPORT] = g_param_spec_object("transport", "transport", "The transport of this content.", JINGLE_TYPE_TRANSPORT, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(gobject_class, PROP_TRANSPORT, + properties[PROP_TRANSPORT]); - g_object_class_install_property(gobject_class, PROP_PENDING_TRANSPORT, - g_param_spec_object("pending-transport", + properties[PROP_PENDING_TRANSPORT] = g_param_spec_object("pending-transport", "Pending transport", "The pending transport contained within this content", JINGLE_TYPE_TRANSPORT, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property(gobject_class, PROP_PENDING_TRANSPORT, + properties[PROP_PENDING_TRANSPORT]); g_type_class_add_private(klass, sizeof(JingleContentPrivate)); } @@ -345,8 +355,8 @@ obj = G_OBJECT(content); g_object_freeze_notify(obj); - g_object_notify(obj, "transport"); - g_object_notify(obj, "pending-transport"); + g_object_notify_by_pspec(obj, properties[PROP_TRANSPORT]); + g_object_notify_by_pspec(obj, properties[PROP_PENDING_TRANSPORT]); g_object_thaw_notify(obj); } @@ -358,7 +368,7 @@ content->priv->pending_transport = NULL; } - g_object_notify(G_OBJECT(content), "pending-transport"); + g_object_notify_by_pspec(G_OBJECT(content), properties[PROP_PENDING_TRANSPORT]); } void