/soc/2013/ankitkv/gobjectification: 9c289149eed4: Global replace...

Ankit Vani a at nevitus.org
Sun Jul 21 04:53:23 EDT 2013


Changeset: 9c289149eed4b43623f96f7da3fe4cf6bdb4e6d4
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-21 14:23 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/9c289149eed4

Description:

Global replaces according to GObject status API
* Replaced purple_status_get_type with purple_status_get_status_type
* Replaced purple_status_get_handle with purple_statuses_get_handle
* Replaced purple_status_init with purple_statuses_init
* Replaced purple_status_uninit with purple_statuses_uninit
* Replaced purple_status_destroy with g_object_unref

diffstat:

 finch/gntblist.c                        |   2 +-
 libpurple/account.c                     |   4 +-
 libpurple/core.c                        |   4 +-
 libpurple/plugins/perl/common/Status.xs |   4 +-
 libpurple/plugins/tcl/tcl_cmds.c        |   2 +-
 libpurple/presence.c                    |   6 ++--
 libpurple/protocols/irc/msgs.c          |   2 +-
 libpurple/protocols/jabber/presence.c   |   2 +-
 libpurple/protocols/mxit/mxit.c         |   2 +-
 libpurple/protocols/myspace/myspace.c   |   2 +-
 libpurple/protocols/novell/novell.c     |   2 +-
 libpurple/protocols/oscar/oscar.c       |   4 +-
 libpurple/protocols/simple/simple.c     |   2 +-
 libpurple/protocols/zephyr/zephyr.c     |   2 +-
 libpurple/server.c                      |   2 +-
 libpurple/status.c                      |  49 +++++++-------------------------
 pidgin/gtkconv.c                        |   2 +-
 pidgin/gtkstatusbox.c                   |   4 +-
 pidgin/gtkutils.c                       |   2 +-
 19 files changed, 36 insertions(+), 63 deletions(-)

diffs (truncated from 408 to 300 lines):

diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -912,7 +912,7 @@ get_display_name(PurpleBListNode *node)
 		else {
 			now = purple_presence_get_active_status(presence);
 
-			prim = purple_status_type_get_primitive(purple_status_get_type(now));
+			prim = purple_status_type_get_primitive(purple_status_get_status_type(now));
 
 			switch(prim) {
 				case PURPLE_STATUS_OFFLINE:
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -2500,7 +2500,7 @@ status_attr_to_xmlnode(const PurpleStatu
 static xmlnode *
 status_attrs_to_xmlnode(const PurpleStatus *status)
 {
-	PurpleStatusType *type = purple_status_get_type(status);
+	PurpleStatusType *type = purple_status_get_status_type(status);
 	xmlnode *node, *child;
 	GList *attrs, *attr;
 
@@ -2547,7 +2547,7 @@ statuses_to_xmlnode(const PurplePresence
 	for (; statuses != NULL; statuses = statuses->next)
 	{
 		status = statuses->data;
-		if (purple_status_type_is_saveable(purple_status_get_type(status)))
+		if (purple_status_type_is_saveable(purple_status_get_status_type(status)))
 		{
 			child = status_to_xmlnode(status);
 			xmlnode_insert_child(node, child);
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -161,7 +161,7 @@ purple_core_init(const char *ui)
 	/* Accounts use status, buddy icons and connection signals, so
 	 * initialize these before accounts
 	 */
-	purple_status_init();
+	purple_statuses_init();
 	purple_buddy_icons_init();
 	purple_connections_init();
 
@@ -244,7 +244,7 @@ purple_core_quit(void)
 	purple_connections_uninit();
 	purple_buddy_icons_uninit();
 	purple_savedstatuses_uninit();
-	purple_status_uninit();
+	purple_statuses_uninit();
 	purple_accounts_uninit();
 	purple_keyring_uninit(); /* after accounts */
 	purple_sound_uninit();
diff --git a/libpurple/plugins/perl/common/Status.xs b/libpurple/plugins/perl/common/Status.xs
--- a/libpurple/plugins/perl/common/Status.xs
+++ b/libpurple/plugins/perl/common/Status.xs
@@ -133,7 +133,7 @@ purple_status_get_attr_value(status, id)
 	const char *id
 
 Purple::Handle
-purple_status_get_handle()
+purple_statuses_get_handle()
 
 const char *
 purple_status_get_id(status)
@@ -148,7 +148,7 @@ purple_status_get_presence(status)
 	Purple::Status status
 
 Purple::StatusType
-purple_status_get_type(status)
+purple_status_get_status_type(status)
 	Purple::Status status
 
 gboolean
diff --git a/libpurple/plugins/tcl/tcl_cmds.c b/libpurple/plugins/tcl/tcl_cmds.c
--- a/libpurple/plugins/tcl/tcl_cmds.c
+++ b/libpurple/plugins/tcl/tcl_cmds.c
@@ -1548,7 +1548,7 @@ int tcl_cmd_status(ClientData unused, Tc
 		}
 		if ((status = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatus)) == NULL)
 			return TCL_ERROR;
-		status_type = purple_status_get_type(status);
+		status_type = purple_status_get_status_type(status);
 		Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefStatusType,
 		                                          status_type));
 		break;
diff --git a/libpurple/presence.c b/libpurple/presence.c
--- a/libpurple/presence.c
+++ b/libpurple/presence.c
@@ -278,7 +278,7 @@ purple_presence_is_status_primitive_acti
 	     l != NULL; l = l->next)
 	{
 		PurpleStatus *temp_status = l->data;
-		PurpleStatusType *type = purple_status_get_type(temp_status);
+		PurpleStatusType *type = purple_status_get_status_type(temp_status);
 
 		if (purple_status_type_get_primitive(type) == primitive &&
 		    purple_status_is_active(temp_status))
@@ -428,7 +428,7 @@ purple_presence_dispose(GObject *object)
 	PURPLE_DBUS_UNREGISTER_POINTER(object);
 
 	g_list_foreach(PURPLE_PRESENCE_GET_PRIVATE(object)->statuses,
-			(GFunc)purple_status_destroy, NULL);
+			(GFunc)g_object_unref, NULL);
 
 	parent_class->dispose(object);
 }
@@ -620,7 +620,7 @@ purple_buddy_presence_compute_score(cons
 
 	for (l = purple_presence_get_statuses(presence); l != NULL; l = l->next) {
 		PurpleStatus *status = (PurpleStatus *)l->data;
-		PurpleStatusType *type = purple_status_get_type(status);
+		PurpleStatusType *type = purple_status_get_status_type(status);
 
 		if (purple_status_is_active(status)) {
 			score += primitive_scores[purple_status_type_get_primitive(type)];
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -99,7 +99,7 @@ static void irc_connected(struct irc_con
 
 	/* If we're away then set our away message */
 	status = purple_account_get_active_status(irc->account);
-	if (purple_status_type_get_primitive(purple_status_get_type(status)) != PURPLE_STATUS_AVAILABLE) {
+	if (purple_status_type_get_primitive(purple_status_get_status_type(status)) != PURPLE_STATUS_AVAILABLE) {
 		PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 		prpl_info->set_status(irc->account, status);
 	}
diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -166,7 +166,7 @@ void jabber_set_status(PurpleAccount *ac
 	js = purple_connection_get_protocol_data(gc);
 
 	/* it's a mood update */
-	if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) {
+	if (purple_status_type_get_primitive(purple_status_get_status_type(status)) == PURPLE_STATUS_MOOD) {
 		const char *mood =
 			purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
 		const char *mood_text =
diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c
--- a/libpurple/protocols/mxit/mxit.c
+++ b/libpurple/protocols/mxit/mxit.c
@@ -426,7 +426,7 @@ static void mxit_set_status( PurpleAccou
 	char*					statusmsg2;
 
 	/* Handle mood changes */
-	if ( purple_status_type_get_primitive( purple_status_get_type( status ) ) == PURPLE_STATUS_MOOD ) {
+	if ( purple_status_type_get_primitive( purple_status_get_status_type( status ) ) == PURPLE_STATUS_MOOD ) {
 		const char* moodid = purple_status_get_attr_string( status, PURPLE_MOOD_NAME );
 		int mood;
 
diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c
--- a/libpurple/protocols/myspace/myspace.c
+++ b/libpurple/protocols/myspace/myspace.c
@@ -2494,7 +2494,7 @@ msim_set_status(PurpleAccount *account, 
 
 	session = purple_connection_get_protocol_data(gc);
 
-	type = purple_status_get_type(status);
+	type = purple_status_get_status_type(status);
 	pres = purple_status_get_presence(status);
 
 	switch (purple_status_type_get_primitive(type)) {
diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c
--- a/libpurple/protocols/novell/novell.c
+++ b/libpurple/protocols/novell/novell.c
@@ -3024,7 +3024,7 @@ novell_set_status(PurpleAccount *account
 
 	connected = purple_account_is_connected(account);
 	presence = purple_status_get_presence(status);
-	type = purple_status_get_type(status);
+	type = purple_status_get_status_type(status);
 	primitive = purple_status_type_get_primitive(type);
 
 	/*
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -3334,7 +3334,7 @@ oscar_set_info_and_status(PurpleAccount 
 	char *status_text = NULL;
 	const char *itmsurl = NULL;
 
-	status_type = purple_status_get_type(status);
+	status_type = purple_status_get_status_type(status);
 	primitive = purple_status_type_get_primitive(status_type);
 
 	if (!setinfo)
@@ -3469,7 +3469,7 @@ oscar_set_status(PurpleAccount *account,
 	od = purple_connection_get_protocol_data(pc);
 
 	/* There's no need to do the stuff below for mood updates. */
-	if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) {
+	if (purple_status_type_get_primitive(purple_status_get_status_type(status)) == PURPLE_STATUS_MOOD) {
 		aim_locate_setcaps(od, purple_caps);
 		return;
 	}
diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c
--- a/libpurple/protocols/simple/simple.c
+++ b/libpurple/protocols/simple/simple.c
@@ -100,7 +100,7 @@ static void do_notifies(struct simple_ac
 
 static void simple_set_status(PurpleAccount *account, PurpleStatus *status) {
 	PurpleConnection *gc = purple_account_get_connection(account);
-	PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status));
+	PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_status_type(status));
 	struct simple_account_data *sip = NULL;
 
 	if (!purple_status_is_active(status))
diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c
--- a/libpurple/protocols/zephyr/zephyr.c
+++ b/libpurple/protocols/zephyr/zephyr.c
@@ -2287,7 +2287,7 @@ static void zephyr_set_status(PurpleAcco
 	size_t result;
 	PurpleConnection *gc = purple_account_get_connection(account);
 	zephyr_account *zephyr = purple_connection_get_protocol_data(gc);
-	PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status));
+	PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_status_type(status));
 
 	if (zephyr->away) {
 		g_free(zephyr->away);
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -628,7 +628,7 @@ void serv_got_im(PurpleConnection *gc, c
 
 		presence = purple_account_get_presence(account);
 		status = purple_presence_get_active_status(presence);
-		status_type = purple_status_get_type(status);
+		status_type = purple_status_get_status_type(status);
 		primitive = purple_status_type_get_primitive(status_type);
 		mobile = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE);
 		if ((primitive == PURPLE_STATUS_AVAILABLE) ||
diff --git a/libpurple/status.c b/libpurple/status.c
--- a/libpurple/status.c
+++ b/libpurple/status.c
@@ -688,7 +688,7 @@ status_set_attr_string(PurpleStatus *sta
 				 "Attempted to set status attribute '%s' for "
 				 "status '%s', which is not legal.  Fix "
                                  "this!\n", id,
-				 purple_status_type_get_name(purple_status_get_type(status)));
+				 purple_status_type_get_name(purple_status_get_status_type(status)));
 		return;
 	}
 	g_return_if_fail(G_VALUE_TYPE(attr_value) == G_TYPE_STRING);
@@ -809,7 +809,7 @@ purple_status_set_active_with_attrs_list
 	}
 
 	/* Reset any unspecified attributes to their default value */
-	status_type = purple_status_get_type(status);
+	status_type = purple_status_get_status_type(status);
 	l = purple_status_type_get_attrs(status_type);
 	while (l != NULL) {
 		PurpleStatusAttr *attr;
@@ -876,7 +876,7 @@ purple_status_get_id(const PurpleStatus 
 {
 	g_return_val_if_fail(status != NULL, NULL);
 
-	return purple_status_type_get_id(purple_status_get_type(status));
+	return purple_status_type_get_id(purple_status_get_status_type(status));
 }
 
 const char *
@@ -884,7 +884,7 @@ purple_status_get_name(const PurpleStatu
 {
 	g_return_val_if_fail(status != NULL, NULL);
 
-	return purple_status_type_get_name(purple_status_get_type(status));
+	return purple_status_type_get_name(purple_status_get_status_type(status));
 }
 
 gboolean
@@ -892,7 +892,7 @@ purple_status_is_independent(const Purpl
 {
 	g_return_val_if_fail(status != NULL, FALSE);
 
-	return purple_status_type_is_independent(purple_status_get_type(status));
+	return purple_status_type_is_independent(purple_status_get_status_type(status));
 }
 
 gboolean
@@ -900,7 +900,7 @@ purple_status_is_exclusive(const PurpleS
 {
 	g_return_val_if_fail(status != NULL, FALSE);
 
-	return purple_status_type_is_exclusive(purple_status_get_type(status));
+	return purple_status_type_is_exclusive(purple_status_get_status_type(status));
 }
 
 gboolean
@@ -908,7 +908,7 @@ purple_status_is_available(const PurpleS
 {
 	g_return_val_if_fail(status != NULL, FALSE);
 
-	return purple_status_type_is_available(purple_status_get_type(status));
+	return purple_status_type_is_available(purple_status_get_status_type(status));
 }
 
 gboolean



More information about the Commits mailing list