/soc/2013/ankitkv/gobjectification: c53c8be87d39: Global replace...

Ankit Vani a at nevitus.org
Fri Jul 19 17:07:08 EDT 2013


Changeset: c53c8be87d39802c04195f9c9a25e65f189d3d57
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-20 02:30 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/c53c8be87d39

Description:

Global replaces for to update codebase to use GObject PurplePresence API

diffstat:

 finch/gntconv.c                  |   2 +-
 libpurple/account.c              |   4 ++--
 libpurple/blistnodetypes.c       |   4 ++--
 libpurple/plugins/tcl/tcl_cmds.c |   4 ++--
 libpurple/presence.c             |  20 ++++++++++----------
 libpurple/status.c               |   4 ++--
 pidgin/gtkconv.c                 |   6 +++---
 7 files changed, 22 insertions(+), 22 deletions(-)

diffs (210 lines):

diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -581,7 +581,7 @@ generate_send_to_menu(FinchConv *ggc)
 	}
 	for (list = g_list_reverse(list); list != NULL; list = g_list_delete_link(list, list)) {
 		PurplePresence *pre = list->data;
-		PurpleBuddy *buddy = purple_presence_get_buddy(pre);
+		PurpleBuddy *buddy = purple_buddy_presence_get_buddy(pre);
 		PurpleAccount *account = purple_buddy_get_account(buddy);
 		gchar *name = g_strdup(purple_buddy_get_name(buddy));
 		gchar *text = g_strdup_printf("%s (%s)", purple_buddy_get_name(buddy), purple_account_get_username(account));
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -2932,7 +2932,7 @@ purple_account_constructed(GObject *obje
 		purple_account_set_status_types(account,
 				prpl_info->status_types(account));
 
-	priv->presence = purple_presence_new_for_account(account);
+	priv->presence = purple_account_presence_new(account);
 
 	status_type = purple_account_get_status_type_with_primitive(account,
 			PURPLE_STATUS_AVAILABLE);
@@ -2975,7 +2975,7 @@ purple_account_dispose(GObject *object)
 		purple_proxy_info_destroy(priv->proxy_info);
 
 	if (priv->presence)
-		purple_presence_destroy(priv->presence);
+		g_object_unref(priv->presence);
 
 	if(priv->system_log)
 		purple_log_free(priv->system_log);
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -615,7 +615,7 @@ purple_buddy_constructed(GObject *object
 
 	G_OBJECT_CLASS(blistnode_parent_class)->constructed(object);
 
-	priv->presence = purple_presence_new_for_buddy(buddy);
+	priv->presence = purple_buddy_presence_new(buddy);
 	purple_presence_set_status_active(priv->presence, "offline", TRUE);
 
 	if (ops && ops->new_node)
@@ -644,7 +644,7 @@ purple_buddy_dispose(GObject *object)
 
 	/* Delete the node */
 	purple_buddy_icon_unref(priv->icon);
-	purple_presence_destroy(priv->presence);
+	g_object_unref(priv->presence);
 
 	PURPLE_DBUS_UNREGISTER_POINTER(buddy);
 
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
@@ -1198,7 +1198,7 @@ int tcl_cmd_presence(ClientData unused, 
 		if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL)
 			return TCL_ERROR;
 		Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefAccount,
-		                                          purple_presence_get_account(presence)));
+		                                          purple_account_presence_get_account(presence)));
 		break;
 	case CMD_PRESENCE_ACTIVE_STATUS:
 		if (objc != 3 && objc != 4 && objc != 5) {
@@ -1289,7 +1289,7 @@ int tcl_cmd_presence(ClientData unused, 
 		if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL)
 			return TCL_ERROR;
 		Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation,
-		                                          purple_presence_get_conversation(presence)));
+		                                          purple_conversation_presence_get_conversation(presence)));
 		break;
 	case CMD_PRESENCE_IDLE:
 		if (objc < 3 || objc > 5) {
diff --git a/libpurple/presence.c b/libpurple/presence.c
--- a/libpurple/presence.c
+++ b/libpurple/presence.c
@@ -98,7 +98,7 @@ purple_presence_new(PurplePresenceContex
 }
 
 PurplePresence *
-purple_presence_new_for_account(PurpleAccount *account)
+purple_account_presence_new(PurpleAccount *account)
 {
 	PurplePresence *presence = NULL;
 	g_return_val_if_fail(account != NULL, NULL);
@@ -111,7 +111,7 @@ purple_presence_new_for_account(PurpleAc
 }
 
 PurplePresence *
-purple_presence_new_for_conv(PurpleConversation *conv)
+purple_conversation_presence_new(PurpleConversation *conv)
 {
 	PurplePresence *presence;
 
@@ -125,7 +125,7 @@ purple_presence_new_for_conv(PurpleConve
 }
 
 PurplePresence *
-purple_presence_new_for_buddy(PurpleBuddy *buddy)
+purple_buddy_presence_new(PurpleBuddy *buddy)
 {
 	PurplePresence *presence;
 	PurpleAccount *account;
@@ -285,7 +285,7 @@ purple_presence_set_idle(PurplePresence 
 
 	if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY)
 	{
-		update_buddy_idle(purple_presence_get_buddy(presence), presence, current_time,
+		update_buddy_idle(purple_buddy_presence_get_buddy(presence), presence, current_time,
 		                  old_idle, idle);
 	}
 	else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_ACCOUNT)
@@ -295,7 +295,7 @@ purple_presence_set_idle(PurplePresence 
 		PurplePlugin *prpl = NULL;
 		PurplePluginProtocolInfo *prpl_info = NULL;
 
-		account = purple_presence_get_account(presence);
+		account = purple_account_presence_get_account(presence);
 
 		if (purple_prefs_get_bool("/purple/logging/log_system"))
 		{
@@ -352,7 +352,7 @@ purple_presence_get_context(const Purple
 }
 
 PurpleAccount *
-purple_presence_get_account(const PurplePresence *presence)
+purple_account_presence_get_account(const PurplePresence *presence)
 {
 	PurplePresenceContext context;
 
@@ -367,7 +367,7 @@ purple_presence_get_account(const Purple
 }
 
 PurpleConversation *
-purple_presence_get_conversation(const PurplePresence *presence)
+purple_conversation_presence_get_conversation(const PurplePresence *presence)
 {
 	g_return_val_if_fail(presence != NULL, NULL);
 	g_return_val_if_fail(purple_presence_get_context(presence) ==
@@ -387,7 +387,7 @@ purple_presence_get_chat_user(const Purp
 }
 
 PurpleBuddy *
-purple_presence_get_buddy(const PurplePresence *presence)
+purple_buddy_presence_get_buddy(const PurplePresence *presence)
 {
 	g_return_val_if_fail(presence != NULL, NULL);
 	g_return_val_if_fail(purple_presence_get_context(presence) ==
@@ -542,13 +542,13 @@ purple_presence_compute_score(const Purp
 		if (purple_status_is_active(status)) {
 			score += primitive_scores[purple_status_type_get_primitive(type)];
 			if (!purple_status_is_online(status)) {
-				PurpleBuddy *b = purple_presence_get_buddy(presence);
+				PurpleBuddy *b = purple_buddy_presence_get_buddy(presence);
 				if (b && purple_account_supports_offline_message(purple_buddy_get_account(b), b))
 					score += primitive_scores[SCORE_OFFLINE_MESSAGE];
 			}
 		}
 	}
-	score += purple_account_get_int(purple_presence_get_account(presence), "score", 0);
+	score += purple_account_get_int(purple_account_presence_get_account(presence), "score", 0);
 	if (purple_presence_is_idle(presence))
 		score += primitive_scores[SCORE_IDLE];
 	return score;
diff --git a/libpurple/status.c b/libpurple/status.c
--- a/libpurple/status.c
+++ b/libpurple/status.c
@@ -578,7 +578,7 @@ notify_status_update(PurplePresence *pre
 
 	if (context == PURPLE_PRESENCE_CONTEXT_ACCOUNT)
 	{
-		PurpleAccount *account = purple_presence_get_account(presence);
+		PurpleAccount *account = purple_account_presence_get_account(presence);
 		PurpleAccountUiOps *ops = purple_accounts_get_ui_ops();
 
 		if (purple_account_get_enabled(account, purple_core_get_ui()))
@@ -591,7 +591,7 @@ notify_status_update(PurplePresence *pre
 	}
 	else if (context == PURPLE_PRESENCE_CONTEXT_BUDDY)
 	{
-			notify_buddy_status_update(purple_presence_get_buddy(presence), presence,
+			notify_buddy_status_update(purple_buddy_presence_get_buddy(presence), presence,
 					old_status, new_status);
 	}
 }
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -3995,8 +3995,8 @@ compare_buddy_presence(PurplePresence *p
 	/* This is necessary because multiple PurpleBuddy's don't share the same
 	 * PurplePresence anymore.
 	 */
-	PurpleBuddy *b1 = purple_presence_get_buddy(p1);
-	PurpleBuddy *b2 = purple_presence_get_buddy(p2);
+	PurpleBuddy *b1 = purple_buddy_presence_get_buddy(p1);
+	PurpleBuddy *b2 = purple_buddy_presence_get_buddy(p2);
 	if (purple_buddy_get_account(b1) == purple_buddy_get_account(b2) &&
 			strcmp(purple_buddy_get_name(b1), purple_buddy_get_name(b2)) == 0)
 		return FALSE;
@@ -4074,7 +4074,7 @@ generate_send_to_items(PidginWindow *win
 				 * since we did a g_list_prepend() earlier. */
 				for (iter = g_list_last(list); iter != NULL; iter = iter->prev) {
 					PurplePresence *pre = iter->data;
-					PurpleBuddy *buddy = purple_presence_get_buddy(pre);
+					PurpleBuddy *buddy = purple_buddy_presence_get_buddy(pre);
 					create_sendto_item(menu, sg, &group, buddy,
 							purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
 				}



More information about the Commits mailing list