/soc/2013/ankitkv/gobjectification: 3b6577fd64ee: jabber: use g_...

Ankit Vani a at nevitus.org
Sat Nov 23 15:46:27 EST 2013


Changeset: 3b6577fd64ee0ec4ff415be65e1147049f620604
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-11-24 01:58 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/3b6577fd64ee

Description:

jabber: use g_object_class_install_properties instead of repeated g_object_class_install_property

diffstat:

 libpurple/protocols/jabber/google/google_p2p.c |   8 +++-----
 libpurple/protocols/jabber/jingle/content.c    |  18 +++---------------
 libpurple/protocols/jabber/jingle/iceudp.c     |   8 +++-----
 libpurple/protocols/jabber/jingle/rawudp.c     |   8 +++-----
 libpurple/protocols/jabber/jingle/rtp.c        |   8 +++-----
 libpurple/protocols/jabber/jingle/session.c    |  20 +++-----------------
 6 files changed, 18 insertions(+), 52 deletions(-)

diffs (259 lines):

diff --git a/libpurple/protocols/jabber/google/google_p2p.c b/libpurple/protocols/jabber/google/google_p2p.c
--- a/libpurple/protocols/jabber/google/google_p2p.c
+++ b/libpurple/protocols/jabber/google/google_p2p.c
@@ -161,21 +161,19 @@ jingle_google_p2p_class_init(JingleGoogl
 	klass->parent_class.add_local_candidate = jingle_google_p2p_add_local_candidate;
 	klass->parent_class.get_remote_candidates = jingle_google_p2p_get_remote_candidates;
 
+	g_type_class_add_private(klass, sizeof(JingleGoogleP2PPrivate));
+
 	properties[PROP_LOCAL_CANDIDATES] = g_param_spec_pointer("local-candidates",
 			"Local candidates",
 			"The local candidates for this transport.",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES,
-			properties[PROP_LOCAL_CANDIDATES]);
 
 	properties[PROP_REMOTE_CANDIDATES] = g_param_spec_pointer("remote-candidates",
 			"Remote candidates",
 			"The remote candidates for this transport.",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES,
-			properties[PROP_REMOTE_CANDIDATES]);
 
-	g_type_class_add_private(klass, sizeof(JingleGoogleP2PPrivate));
+	g_object_class_install_properties(gobject_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/protocols/jabber/jingle/content.c b/libpurple/protocols/jabber/jingle/content.c
--- a/libpurple/protocols/jabber/jingle/content.c
+++ b/libpurple/protocols/jabber/jingle/content.c
@@ -103,63 +103,51 @@ jingle_content_class_init (JingleContent
 	klass->to_xml = jingle_content_to_xml_internal;
 	klass->parse = jingle_content_parse_internal;
 
+	g_type_class_add_private(klass, sizeof(JingleContentPrivate));
+
 	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_object_class_install_property(gobject_class, PROP_SESSION,
-			properties[PROP_SESSION]);
 
 	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_object_class_install_property(gobject_class, PROP_CREATOR,
-			properties[PROP_CREATOR]);
 
 	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_object_class_install_property(gobject_class, PROP_DISPOSITION,
-			properties[PROP_DISPOSITION]);
 
 	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_object_class_install_property(gobject_class, PROP_NAME,
-			properties[PROP_NAME]);
 
 	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_object_class_install_property(gobject_class, PROP_SENDERS,
-			properties[PROP_SENDERS]);
 
 	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_object_class_install_property(gobject_class, PROP_TRANSPORT,
-			properties[PROP_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_object_class_install_property(gobject_class, PROP_PENDING_TRANSPORT,
-			properties[PROP_PENDING_TRANSPORT]);
 
-	g_type_class_add_private(klass, sizeof(JingleContentPrivate));
+	g_object_class_install_properties(gobject_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/protocols/jabber/jingle/iceudp.c b/libpurple/protocols/jabber/jingle/iceudp.c
--- a/libpurple/protocols/jabber/jingle/iceudp.c
+++ b/libpurple/protocols/jabber/jingle/iceudp.c
@@ -174,21 +174,19 @@ jingle_iceudp_class_init (JingleIceUdpCl
 	klass->parent_class.add_local_candidate = jingle_iceudp_add_local_candidate;
 	klass->parent_class.get_remote_candidates = jingle_iceudp_get_remote_candidates;
 
+	g_type_class_add_private(klass, sizeof(JingleIceUdpPrivate));
+
 	properties[PROP_LOCAL_CANDIDATES] = g_param_spec_pointer("local-candidates",
 			"Local candidates",
 			"The local candidates for this transport.",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES,
-			properties[PROP_LOCAL_CANDIDATES]);
 
 	properties[PROP_REMOTE_CANDIDATES] = g_param_spec_pointer("remote-candidates",
 			"Remote candidates",
 			"The remote candidates for this transport.",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES,
-			properties[PROP_REMOTE_CANDIDATES]);
 
-	g_type_class_add_private(klass, sizeof(JingleIceUdpPrivate));
+	g_object_class_install_properties(gobject_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/protocols/jabber/jingle/rawudp.c b/libpurple/protocols/jabber/jingle/rawudp.c
--- a/libpurple/protocols/jabber/jingle/rawudp.c
+++ b/libpurple/protocols/jabber/jingle/rawudp.c
@@ -145,21 +145,19 @@ jingle_rawudp_class_init (JingleRawUdpCl
 	klass->parent_class.add_local_candidate = jingle_rawudp_add_local_candidate;
 	klass->parent_class.get_remote_candidates = jingle_rawudp_get_remote_candidates;
 
+	g_type_class_add_private(klass, sizeof(JingleRawUdpPrivate));
+
 	properties[PROP_LOCAL_CANDIDATES] = g_param_spec_pointer("local-candidates",
 			"Local candidates",
 			"The local candidates for this transport.",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES,
-			properties[PROP_LOCAL_CANDIDATES]);
 
 	properties[PROP_REMOTE_CANDIDATES] = g_param_spec_pointer("remote-candidates",
 			"Remote candidates",
 			"The remote candidates for this transport.",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES,
-			properties[PROP_REMOTE_CANDIDATES]);
 
-	g_type_class_add_private(klass, sizeof(JingleRawUdpPrivate));
+	g_object_class_install_properties(gobject_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/protocols/jabber/jingle/rtp.c b/libpurple/protocols/jabber/jingle/rtp.c
--- a/libpurple/protocols/jabber/jingle/rtp.c
+++ b/libpurple/protocols/jabber/jingle/rtp.c
@@ -113,23 +113,21 @@ jingle_rtp_class_init (JingleRtpClass *k
 	klass->parent_class.description_type = JINGLE_APP_RTP;
 	klass->parent_class.handle_action = jingle_rtp_handle_action_internal;
 
+	g_type_class_add_private(klass, sizeof(JingleRtpPrivate));
+
 	properties[PROP_MEDIA_TYPE] = g_param_spec_string("media-type",
 			"Media Type",
 			"The media type (\"audio\" or \"video\") for this rtp session.",
 			NULL,
 			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE,
-			properties[PROP_MEDIA_TYPE]);
 
 	properties[PROP_SSRC] = g_param_spec_string("ssrc",
 			"ssrc",
 			"The ssrc for this rtp session.",
 			NULL,
 			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_SSRC,
-			properties[PROP_SSRC]);
 
-	g_type_class_add_private(klass, sizeof(JingleRtpPrivate));
+	g_object_class_install_properties(gobject_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/protocols/jabber/jingle/session.c b/libpurple/protocols/jabber/jingle/session.c
--- a/libpurple/protocols/jabber/jingle/session.c
+++ b/libpurple/protocols/jabber/jingle/session.c
@@ -101,68 +101,54 @@ jingle_session_class_init (JingleSession
 	gobject_class->set_property = jingle_session_set_property;
 	gobject_class->get_property = jingle_session_get_property;
 
+	g_type_class_add_private(klass, sizeof(JingleSessionPrivate));
+
 	properties[PROP_SID] = g_param_spec_string("sid",
 			"Session ID",
 			"The unique session ID of the Jingle Session.",
 			NULL,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_SID,
-			properties[PROP_SID]);
 
 	properties[PROP_JS] = g_param_spec_pointer("js",
 			"JabberStream",
 			"The Jabber stream associated with this session.",
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_JS,
-			properties[PROP_JS]);
 
 	properties[PROP_REMOTE_JID] = g_param_spec_string("remote-jid",
 			"Remote JID",
 			"The JID of the remote participant.",
 			NULL,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_REMOTE_JID,
-			properties[PROP_REMOTE_JID]);
 
 	properties[PROP_LOCAL_JID] = g_param_spec_string("local-jid",
 			"Local JID",
 			"The JID of the local participant.",
 			NULL,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_LOCAL_JID,
-			properties[PROP_LOCAL_JID]);
 
 	properties[PROP_IS_INITIATOR] = g_param_spec_boolean("is-initiator",
 			"Is Initiator",
 			"Whether or not the local JID is the initiator of the session.",
 			FALSE,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_IS_INITIATOR,
-			properties[PROP_IS_INITIATOR]);
 
 	properties[PROP_STATE] = g_param_spec_boolean("state",
 			"State",
 			"The state of the session (PENDING=FALSE, ACTIVE=TRUE).",
 			FALSE,
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_STATE,
-			properties[PROP_STATE]);
 
 	properties[PROP_CONTENTS] = g_param_spec_pointer("contents",
 			"Contents",
 			"The active contents contained within this session",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_CONTENTS,
-			properties[PROP_CONTENTS]);
 
 	properties[PROP_PENDING_CONTENTS] = g_param_spec_pointer("pending-contents",
 			"Pending contents",
 			"The pending contents contained within this session",
 			G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(gobject_class, PROP_PENDING_CONTENTS,
-			properties[PROP_PENDING_CONTENTS]);
 
-	g_type_class_add_private(klass, sizeof(JingleSessionPrivate));
+	g_object_class_install_properties(gobject_class, PROP_LAST, properties);
 }
 
 static void



More information about the Commits mailing list