gobjectification: 46693be3: Fix blist node operations in Finch.

qulogic at pidgin.im qulogic at pidgin.im
Sun Nov 8 03:31:08 EST 2009


-----------------------------------------------------------------
Revision: 46693be3290472731513058297a425f3272d8704
Ancestor: 35339a980e51b7ec34bf93f454b66bce68a04ff3
Author: qulogic at pidgin.im
Date: 2009-11-08T06:30:45
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/46693be3290472731513058297a425f3272d8704

Modified files:
        finch/gntblist.c

ChangeLog: 

Fix blist node operations in Finch.

-------------- next part --------------
============================================================
--- finch/gntblist.c	930b89cc64a6d42b98bf79290a398ddb18393675
+++ finch/gntblist.c	910c8c4a78d247c4b9ba3618f647f470f839331c
@@ -184,8 +184,8 @@ static gboolean default_can_add_node(Pur
 			return TRUE;
 	} else if (PURPLE_IS_CONTACT(node)) {
 		PurpleBlistNode *nd;
-		for (nd = purple_blist_node_get_first_child(node);
-				nd; nd = purple_blist_node_get_sibling_next(nd)) {
+		for (nd = purple_blist_node_first_child(node);
+				nd; nd = purple_blist_node_next(nd)) {
 			if (default_can_add_node(nd))
 				return TRUE;
 		}
@@ -199,8 +199,8 @@ static gboolean default_can_add_node(Pur
 		if (empty)
 			return TRUE;  /* If we want to see empty groups, we can show any group */
 
-		for (nd = purple_blist_node_get_first_child(node);
-				nd; nd = purple_blist_node_get_sibling_next(nd)) {
+		for (nd = purple_blist_node_first_child(node);
+				nd; nd = purple_blist_node_next(nd)) {
 			if (default_can_add_node(nd))
 				return TRUE;
 		}
@@ -216,7 +216,7 @@ static gpointer default_find_parent(Purp
 {
 	gpointer ret = NULL;
 	if(!PURPLE_IS_GROUP(node)){
-		ret = purple_blist_node_get_parent(node);
+		ret = purple_blist_node_parent(node);
 	}
 	if (ret)
 		add_node(ret, ggblist);
@@ -244,7 +244,7 @@ static gboolean default_create_tooltip(g
 
 		title = g_strdup(name);
 		tooltip_for_buddy(pr, str, TRUE);
-		for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) {
+		for (node = purple_blist_node_first_child(node); node; node = purple_blist_node_next(node)) {
 			PurpleBuddy *buddy = (PurpleBuddy*)node;
 			if (offline) {
 				int value = purple_blist_node_get_int(node, "last_seen");
@@ -270,8 +270,8 @@ static gboolean default_create_tooltip(g
 		PurpleGroup *group = (PurpleGroup *)node;
 
 		g_string_append_printf(str, _("Online: %d\nTotal: %d"),
-						purple_blist_get_group_online_count(group),
-						purple_blist_get_group_size(group, FALSE));
+						purple_group_get_online(group),
+						purple_group_get_size(group, FALSE));
 
 		title = g_strdup(purple_group_get_name(group));
 	} else if (PURPLE_IS_CHAT(node)) {
@@ -396,8 +396,8 @@ get_blist_node_flag(PurpleBlistNode *nod
 		 * API addition would be necessary */
 #if 0
 		if (!gnt_tree_get_expanded(GNT_TREE(ggblist->tree), node)) {
-			for (node = purple_blist_node_get_first_child(node); node;
-					node = purple_blist_node_get_sibling_next(node)) {
+			for (node = purple_blist_node_first_child(node); node;
+					node = purple_blist_node_next(node)) {
 				PurpleBlistNode *pnode;
 				pnode = purple_contact_get_priority_buddy((PurpleContact*)node);
 				fnode = purple_blist_node_get_ui_data(node);
@@ -425,8 +425,8 @@ is_contact_online(PurpleContact *contact
 is_contact_online(PurpleContact *contact)
 {
 	PurpleBlistNode *node;
-	for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node;
-			node = purple_blist_node_get_sibling_next(node)) {
+	for (node = purple_blist_node_first_child(((PurpleBlistNode*)contact)); node;
+			node = purple_blist_node_next(node)) {
 		FinchBlistNode *fnode = purple_blist_node_get_ui_data(node);
 		if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) ||
 				(fnode && fnode->signed_timer))
@@ -439,8 +439,8 @@ is_group_online(PurpleGroup *group)
 is_group_online(PurpleGroup *group)
 {
 	PurpleBlistNode *node;
-	for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)group)); node;
-			node = purple_blist_node_get_sibling_next(node)) {
+	for (node = purple_blist_node_child(((PurpleBlistNode*)group)); node;
+			node = purple_blist_node_next(node)) {
 		if (PURPLE_IS_CHAT(node) &&
 				purple_account_is_connected(((PurpleChat *)node)->account))
 			return TRUE;
@@ -508,9 +508,9 @@ node_remove(PurpleBlistNode *node)
 	if (ggblist->tagged)
 		ggblist->tagged = g_list_remove(ggblist->tagged, node);
 
-	parent = purple_blist_node_get_parent(node);
-	for (node = purple_blist_node_get_first_child(node); node;
-			node = purple_blist_node_get_sibling_next(node))
+	parent = purple_blist_node_parent(node);
+	for (node = purple_blist_node_first_child(node); node;
+			node = purple_blist_node_next(node))
 		node_remove(node);
 
 	if (parent) {
@@ -550,13 +550,13 @@ node_update(PurpleBlistNode *node)
 	if (PURPLE_IS_BUDDY(node)) {
 		PurpleBuddy *buddy = (PurpleBuddy*)node;
 		add_node((PurpleBlistNode*)buddy, purple_blist_get_ui_data());
-		node_update(purple_blist_node_get_parent(node));
+		node_update(purple_blist_node_parent(node));
 	} else if (PURPLE_IS_CHAT(node)) {
 		add_node(node, purple_blist_get_ui_data());
 	} else if (PURPLE_IS_CONTACT(node)) {
 		if (purple_blist_node_get_ui_data(node)== NULL) {
 			/* The core seems to expect the UI to add the buddies. */
-			for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node))
+			for (node = purple_blist_node_first_child(node); node; node = purple_blist_node_next(node))
 				add_node(node, purple_blist_get_ui_data());
 		}
 	} else if (PURPLE_IS_GROUP(node)) {
@@ -1358,8 +1358,8 @@ remove_contact(PurpleContact *contact)
 	PurpleGroup *group;
 
 	cnode = (PurpleBlistNode *)contact;
-	group = (PurpleGroup*)purple_blist_node_get_parent(cnode);
-	for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = purple_blist_node_get_sibling_next(bnode)) {
+	group = (PurpleGroup*)purple_blist_node_parent(cnode);
+	for (bnode = purple_blist_node_first_child(cnode); bnode; bnode = purple_blist_node_next(bnode)) {
 		PurpleBuddy *buddy = (PurpleBuddy*)bnode;
 		PurpleAccount *account = purple_buddy_get_account(buddy);
 		if (purple_account_is_connected(account))
@@ -1465,34 +1465,34 @@ remove_group(PurpleGroup *group)
 {
 	PurpleBlistNode *cnode, *bnode;
 
-	cnode = purple_blist_node_get_first_child(((PurpleBlistNode*)group));
+	cnode = purple_blist_node_first_child(((PurpleBlistNode*)group));
 
 	while (cnode) {
 		if (PURPLE_IS_CONTACT(cnode)) {
-			bnode = purple_blist_node_get_first_child(cnode);
-			cnode = purple_blist_node_get_sibling_next(cnode);
+			bnode = purple_blist_node_first_child(cnode);
+			cnode = purple_blist_node_next(cnode);
 			while (bnode) {
 				PurpleBuddy *buddy;
 				if (PURPLE_IS_BUDDY(bnode)) {
 					PurpleAccount *account;
 					buddy = (PurpleBuddy*)bnode;
-					bnode = purple_blist_node_get_sibling_next(bnode);
+					bnode = purple_blist_node_next(bnode);
 					account = purple_buddy_get_account(buddy);
 					if (purple_account_is_connected(account)) {
 						purple_account_remove_buddy(account, buddy, group);
 						purple_blist_remove_buddy(buddy);
 					}
 				} else {
-					bnode = purple_blist_node_get_sibling_next(bnode);
+					bnode = purple_blist_node_next(bnode);
 				}
 			}
 		} else if (PURPLE_IS_CHAT(cnode)) {
 			PurpleChat *chat = (PurpleChat *)cnode;
-			cnode = purple_blist_node_get_sibling_next(cnode);
+			cnode = purple_blist_node_next(cnode);
 			if (purple_account_is_connected(purple_chat_get_account(chat)))
 				purple_blist_remove_chat(chat);
 		} else {
-			cnode = purple_blist_node_get_sibling_next(cnode);
+			cnode = purple_blist_node_next(cnode);
 		}
 	}
 
@@ -1526,7 +1526,7 @@ finch_blist_remove_node_cb(PurpleBlistNo
 	if (PURPLE_IS_CONTACT(node)) {
 		PurpleContact *c = (PurpleContact*)node;
 		name = purple_contact_get_alias(c);
-		if (c->totalsize > 1)
+		if (purple_contact_get_totalsize(c) > 1)
 			sec = _("Removing this contact will also remove all the buddies in the contact");
 	} else if (PURPLE_IS_BUDDY(node)) {
 		name = purple_buddy_get_name((PurpleBuddy*)node);
@@ -1585,12 +1585,12 @@ finch_blist_place_tagged(PurpleBlistNode
 	if (PURPLE_IS_GROUP(target))
 		tg = (PurpleGroup*)target;
 	else if (PURPLE_IS_BUDDY(target)) {
-		tc = (PurpleContact*)purple_blist_node_get_parent(target);
-		tg = (PurpleGroup*)purple_blist_node_get_parent((PurpleBlistNode*)tc);
+		tc = (PurpleContact*)purple_blist_node_parent(target);
+		tg = (PurpleGroup*)purple_blist_node_parent((PurpleBlistNode*)tc);
 	} else {
 		if (PURPLE_IS_CONTACT(target))
 			tc = (PurpleContact*)target;
-		tg = (PurpleGroup*)purple_blist_node_get_parent(target);
+		tg = (PurpleGroup*)purple_blist_node_parent(target);
 	}
 
 	if (ggblist->tagged) {
@@ -2355,7 +2355,7 @@ blist_node_compare_position(PurpleBlistN
 static int
 blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2)
 {
-	while ((n1 = purple_blist_node_get_sibling_prev(n1)) != NULL)
+	while ((n1 = purple_blist_node_prev(n1)) != NULL)
 		if (n1 == n2)
 			return 1;
 	return -1;
@@ -2425,7 +2425,7 @@ get_contact_log_size(PurpleBlistNode *c)
 	int log = 0;
 	PurpleBlistNode *node;
 
-	for (node = purple_blist_node_get_first_child(c); node; node = purple_blist_node_get_sibling_next(node)) {
+	for (node = purple_blist_node_first_child(c); node; node = purple_blist_node_next(node)) {
 		PurpleBuddy *b = (PurpleBuddy*)node;
 		log += purple_log_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b),
 				purple_buddy_get_account(b));
@@ -2506,8 +2506,8 @@ buddy_recent_signed_on_off(gpointer data
 		node_remove(node);
 	} else {
 		update_node_display(node, ggblist);
-		if (purple_blist_node_get_parent(node) && PURPLE_IS_CONTACT(purple_blist_node_get_parent(node)))
-			update_node_display(purple_blist_node_get_parent(node), ggblist);
+		if (purple_blist_node_parent(node) && PURPLE_IS_CONTACT(purple_blist_node_parent(node)))
+			update_node_display(purple_blist_node_parent(node), ggblist);
 	}
 
 	return FALSE;
@@ -2525,8 +2525,8 @@ buddy_signed_on_off_cb(gpointer data)
 		purple_timeout_remove(fnode->signed_timer);
 	fnode->signed_timer = purple_timeout_add_seconds(6, (GSourceFunc)buddy_recent_signed_on_off, data);
 	update_node_display(node, ggblist);
-	if (purple_blist_node_get_parent(node) && PURPLE_IS_CONTACT(purple_blist_node_get_parent(node)))
-		update_node_display(purple_blist_node_get_parent(node), ggblist);
+	if (purple_blist_node_parent(node) && PURPLE_IS_CONTACT(purple_blist_node_parent(node)))
+		update_node_display(purple_blist_node_parent(node), ggblist);
 	return FALSE;
 }
 


More information about the Commits mailing list