/soc/2013/ankitkv/gobjectification: abab0adfa0ec: libpurple: use...

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


Changeset: abab0adfa0ec5aad5e760091bd12bdd95279140b
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-11-24 02:16 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/abab0adfa0ec

Description:

libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property

diffstat:

 libpurple/account.c           |  24 +++-------------------
 libpurple/blistnode.c         |  18 +++++++---------
 libpurple/blistnodetypes.c    |  45 ++++++++++++++----------------------------
 libpurple/circularbuffer.c    |  10 +-------
 libpurple/connection.c        |  16 ++------------
 libpurple/conversation.c      |  14 ++----------
 libpurple/conversationtypes.c |  35 +++++++++-----------------------
 libpurple/media/codec.c       |  16 ++------------
 libpurple/presence.c          |  28 ++++++++++----------------
 libpurple/roomlist.c          |  10 ++------
 libpurple/smiley.c            |   6 +---
 libpurple/status.c            |  10 ++------
 libpurple/theme-loader.c      |   4 +-
 libpurple/theme.c             |  13 +----------
 libpurple/whiteboard.c        |  12 ++--------
 libpurple/xfer.c              |  38 +++--------------------------------
 16 files changed, 78 insertions(+), 221 deletions(-)

diffs (truncated from 1013 to 300 lines):

diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -3074,69 +3074,53 @@ purple_account_class_init(PurpleAccountC
 	obj_class->get_property = purple_account_get_property;
 	obj_class->set_property = purple_account_set_property;
 
+	g_type_class_add_private(klass, sizeof(PurpleAccountPrivate));
+
 	properties[PROP_USERNAME] = g_param_spec_string("username", "Username",
 				"The username for the account.", NULL,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_USERNAME,
-				properties[PROP_USERNAME]);
 
 	properties[PROP_PRIVATE_ALIAS] = g_param_spec_string("private-alias",
 				"Private Alias",
 				"The private alias for the account.", NULL,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_PRIVATE_ALIAS,
-				properties[PROP_PRIVATE_ALIAS]);
 
 	properties[PROP_USER_INFO] = g_param_spec_string("user-info",
 				"User information",
 				"Detailed user information for the account.", NULL,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_USER_INFO,
-				properties[PROP_USER_INFO]);
 
 	properties[PROP_BUDDY_ICON_PATH] = g_param_spec_string("buddy-icon-path",
 				"Buddy icon path",
 				"Path to the buddyicon for the account.", NULL,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_BUDDY_ICON_PATH,
-				properties[PROP_BUDDY_ICON_PATH]);
 
 	properties[PROP_ENABLED] = g_param_spec_boolean("enabled", "Enabled",
 				"Whether the account is enabled or not.", FALSE,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_ENABLED,
-				properties[PROP_ENABLED]);
 
 	properties[PROP_REMEMBER_PASSWORD] = g_param_spec_boolean(
 				"remember-password", "Remember password",
 				"Whether to remember and store the password for this account.",
 				FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_REMEMBER_PASSWORD,
-				properties[PROP_REMEMBER_PASSWORD]);
 
 	properties[PROP_CHECK_MAIL] = g_param_spec_boolean("check-mail",
 				"Check mail",
 				"Whether to check mails for this account.", FALSE,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_CHECK_MAIL,
-				properties[PROP_CHECK_MAIL]);
 
 	properties[PROP_CONNECTION] = g_param_spec_object("connection",
 				"Connection",
 				"The connection for the account.", PURPLE_TYPE_CONNECTION,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_CONNECTION,
-				properties[PROP_CONNECTION]);
 
 	properties[PROP_PROTOCOL_ID] = g_param_spec_string("protocol-id",
 				"Protocol ID",
 				"ID of the protocol that is responsible for the account.", NULL,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
 				G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_PROTOCOL_ID,
-				properties[PROP_PROTOCOL_ID]);
-
-	g_type_class_add_private(klass, sizeof(PurpleAccountPrivate));
+
+	g_object_class_install_properties(obj_class, PROP_LAST, properties);
 }
 
 GType
diff --git a/libpurple/blistnode.c b/libpurple/blistnode.c
--- a/libpurple/blistnode.c
+++ b/libpurple/blistnode.c
@@ -412,14 +412,15 @@ purple_blist_node_class_init(PurpleBlist
 	obj_class->get_property = purple_blist_node_get_property;
 	obj_class->set_property = purple_blist_node_set_property;
 
+	g_type_class_add_private(klass, sizeof(PurpleBlistNodePrivate));
+
 	bn_properties[BLNODE_PROP_TRANSIENT] = g_param_spec_boolean("transient",
 				"Transient",
 				"Whether node should not be saved with the buddy list.",
 				FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BLNODE_PROP_TRANSIENT,
-				bn_properties[BLNODE_PROP_TRANSIENT]);
 
-	g_type_class_add_private(klass, sizeof(PurpleBlistNodePrivate));
+	g_object_class_install_properties(obj_class, BLNODE_PROP_LAST,
+				bn_properties);
 }
 
 GType
@@ -611,31 +612,28 @@ purple_counting_node_class_init(PurpleCo
 	obj_class->get_property = purple_counting_node_get_property;
 	obj_class->set_property = purple_counting_node_set_property;
 
+	g_type_class_add_private(klass, sizeof(PurpleCountingNodePrivate));
+
 	cn_properties[CNODE_PROP_TOTAL_SIZE] = g_param_spec_int("total-size",
 				"Total size",
 				"The number of children under this node.",
 				G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
 				G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CNODE_PROP_TOTAL_SIZE,
-				cn_properties[CNODE_PROP_TOTAL_SIZE]);
 
 	cn_properties[CNODE_PROP_CURRENT_SIZE] = g_param_spec_int("current-size",
 				"Current size",
 				"The number of children with online accounts.",
 				G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
 				G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CNODE_PROP_CURRENT_SIZE,
-				cn_properties[CNODE_PROP_CURRENT_SIZE]);
 
 	cn_properties[CNODE_PROP_ONLINE_COUNT] = g_param_spec_int("online-count",
 				"Online count",
 				"The number of children that are online.",
 				G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
 				G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CNODE_PROP_ONLINE_COUNT,
-				cn_properties[CNODE_PROP_ONLINE_COUNT]);
 
-	g_type_class_add_private(klass, sizeof(PurpleCountingNodePrivate));
+	g_object_class_install_properties(obj_class, CNODE_PROP_LAST,
+				cn_properties);
 }
 
 GType
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -695,56 +695,45 @@ static void purple_buddy_class_init(Purp
 	obj_class->set_property = purple_buddy_set_property;
 	obj_class->constructed = purple_buddy_constructed;
 
+	g_type_class_add_private(klass, sizeof(PurpleBuddyPrivate));
+
 	bd_properties[BUDDY_PROP_NAME] = g_param_spec_string("name", "Name",
 				"The name of the buddy.", NULL,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BUDDY_PROP_NAME,
-				bd_properties[BUDDY_PROP_NAME]);
 
 	bd_properties[BUDDY_PROP_LOCAL_ALIAS] = g_param_spec_string("local-alias",
 				"Local alias",
 				"Local alias of thee buddy.", NULL,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BUDDY_PROP_LOCAL_ALIAS,
-				bd_properties[BUDDY_PROP_LOCAL_ALIAS]);
 
 	bd_properties[BUDDY_PROP_SERVER_ALIAS] = g_param_spec_string("server-alias",
 				"Server alias",
 				"Server-side alias of the buddy.", NULL,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BUDDY_PROP_SERVER_ALIAS,
-				bd_properties[BUDDY_PROP_SERVER_ALIAS]);
 
 	bd_properties[BUDDY_PROP_ICON] = g_param_spec_pointer("icon", "Buddy icon",
 				"The icon for the buddy.",
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BUDDY_PROP_ICON,
-				bd_properties[BUDDY_PROP_ICON]);
 
 	bd_properties[BUDDY_PROP_ACCOUNT] = g_param_spec_object("account",
 				"Account",
 				"The account for the buddy.", PURPLE_TYPE_ACCOUNT,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
 				G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BUDDY_PROP_ACCOUNT,
-				bd_properties[BUDDY_PROP_ACCOUNT]);
 
 	bd_properties[BUDDY_PROP_PRESENCE] = g_param_spec_object("presence",
 				"Presence",
 				"The status information for the buddy.", PURPLE_TYPE_PRESENCE,
 				G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BUDDY_PROP_PRESENCE,
-				bd_properties[BUDDY_PROP_PRESENCE]);
 
 	bd_properties[BUDDY_PROP_MEDIA_CAPS] = g_param_spec_enum("media-caps",
 				"Media capabilities",
 				"The media capabilities of the buddy.",
 				PURPLE_MEDIA_TYPE_CAPS, PURPLE_MEDIA_CAPS_NONE,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, BUDDY_PROP_MEDIA_CAPS,
-				bd_properties[BUDDY_PROP_MEDIA_CAPS]);
 
-	g_type_class_add_private(klass, sizeof(PurpleBuddyPrivate));
+	g_object_class_install_properties(obj_class, BUDDY_PROP_LAST,
+				bd_properties);
 }
 
 GType
@@ -1068,20 +1057,19 @@ static void purple_contact_class_init(Pu
 	obj_class->get_property = purple_contact_get_property;
 	obj_class->set_property = purple_contact_set_property;
 
+	g_type_class_add_private(klass, sizeof(PurpleContactPrivate));
+
 	co_properties[CONTACT_PROP_ALIAS] = g_param_spec_string("alias", "Alias",
 				"The alias for the contact.", NULL,
 				G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CONTACT_PROP_ALIAS,
-				co_properties[CONTACT_PROP_ALIAS]);
 
 	co_properties[CONTACT_PROP_PRIORITY_BUDDY] = g_param_spec_object(
 				"priority-buddy",
 				"Priority buddy", "The priority buddy of the contact.",
 				PURPLE_TYPE_BUDDY, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CONTACT_PROP_PRIORITY_BUDDY,
-				co_properties[CONTACT_PROP_PRIORITY_BUDDY]);
 
-	g_type_class_add_private(klass, sizeof(PurpleContactPrivate));
+	g_object_class_install_properties(obj_class, CONTACT_PROP_LAST,
+				co_properties);
 }
 
 GType
@@ -1327,28 +1315,24 @@ static void purple_chat_class_init(Purpl
 	obj_class->set_property = purple_chat_set_property;
 	obj_class->constructed = purple_chat_constructed;
 
+	g_type_class_add_private(klass, sizeof(PurpleChatPrivate));
+
 	ch_properties[CHAT_PROP_ALIAS] = g_param_spec_string("alias", "Alias",
 				"The alias for the chat.", NULL,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CHAT_PROP_ALIAS,
-				ch_properties[CHAT_PROP_ALIAS]);
 
 	ch_properties[CHAT_PROP_ACCOUNT] = g_param_spec_object("account", "Account",
 				"The account that the chat belongs to.", PURPLE_TYPE_ACCOUNT,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
 				G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CHAT_PROP_ACCOUNT,
-				ch_properties[CHAT_PROP_ACCOUNT]);
 
 	ch_properties[CHAT_PROP_COMPONENTS] = g_param_spec_pointer("components",
 				"Components",
 				"The protocol components of the chat.",
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
 				G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, CHAT_PROP_COMPONENTS,
-				ch_properties[CHAT_PROP_COMPONENTS]);
 
-	g_type_class_add_private(klass, sizeof(PurpleChatPrivate));
+	g_object_class_install_properties(obj_class, CHAT_PROP_LAST, ch_properties);
 }
 
 GType
@@ -1674,13 +1658,14 @@ static void purple_group_class_init(Purp
 	obj_class->get_property = purple_group_get_property;
 	obj_class->set_property = purple_group_set_property;
 
+	g_type_class_add_private(klass, sizeof(PurpleGroupPrivate));
+
 	gr_properties[GROUP_PROP_NAME] = g_param_spec_string("name", "Name",
 				"Name of the group.", NULL,
 				G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, GROUP_PROP_NAME,
-				gr_properties[GROUP_PROP_NAME]);
 
-	g_type_class_add_private(klass, sizeof(PurpleGroupPrivate));
+	g_object_class_install_properties(obj_class, GROUP_PROP_LAST,
+				gr_properties);
 }
 
 GType
diff --git a/libpurple/circularbuffer.c b/libpurple/circularbuffer.c
--- a/libpurple/circularbuffer.c
+++ b/libpurple/circularbuffer.c
@@ -328,28 +328,22 @@ purple_circular_buffer_class_init(Purple
 		                   0, G_MAXSIZE, 0,
 		                   G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
 		                   G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_GROW_SIZE,
-		                   properties[PROP_GROW_SIZE]);
 
 	properties[PROP_BUFFER_USED] = g_param_spec_ulong("buffer-used",
 		                   "buffer-used",
 		                   "The amount of the buffer used",
 		                   0, G_MAXSIZE, 0,
 		                   G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_BUFFER_USED,
-		                   properties[PROP_BUFFER_USED]);
 
 	properties[PROP_INPUT] = g_param_spec_pointer("input", "input",
 		                     "The input pointer of the buffer",
 		                     G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_INPUT,
-		                     properties[PROP_INPUT]);
 
 	properties[PROP_OUTPUT] = g_param_spec_pointer("output", "output",
 		                     "The output pointer of the buffer",



More information about the Commits mailing list