gobjectification: aa1c6b5b: Some more fixes for broken code.

sadrul at pidgin.im sadrul at pidgin.im
Tue Jul 6 01:57:20 EDT 2010


----------------------------------------------------------------------
Revision: aa1c6b5b25ea9d08c5cad53eed96664dd80b6c25
Parent:   a4c3df04fe77dad54c29393726ab20b085ac8131
Author:   sadrul at pidgin.im
Date:     07/06/10 01:37:10
Branch:   im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/aa1c6b5b25ea9d08c5cad53eed96664dd80b6c25

Changelog: 

Some more fixes for broken code.

Changes against parent a4c3df04fe77dad54c29393726ab20b085ac8131

  patched  libpurple/blist-node.c
  patched  libpurple/blist.c
  patched  libpurple/contact.c
  patched  libpurple/group.c

-------------- next part --------------
============================================================
--- libpurple/blist.c	8f952edc2ff49d1604c784afe08e8970215936c2
+++ libpurple/blist.c	acb1164af26af2248cbf9e800def969e0a393c07
@@ -426,7 +426,7 @@ purple_blist_get_root()
 PurpleBlistNode *
 purple_blist_get_root()
 {
-	return PURPLE_BLIST_NODE(PURPLE_BLIST);
+	return PURPLE_BLIST_NODE(PURPLE_BLIST->node);
 }
 
 void *
============================================================
--- libpurple/blist-node.c	3d5629f1e4d8be1afb34ad94a4ab5f7d8f6fcc68
+++ libpurple/blist-node.c	957871edfc3bedb17d390ab45c4c5f6d6d22e376
@@ -568,9 +568,8 @@ purple_blist_node_add_sibling(PurpleBlis
 
 	g_return_if_fail(PURPLE_IS_BLIST_NODE(child));
 	g_return_if_fail(PURPLE_IS_BLIST_NODE(location));
-	g_return_if_fail(PURPLE_IS_BLIST_NODE(location->parent));
 
-	klass = PURPLE_GET_BLIST_NODE_CLASS(location->parent);
+	klass = PURPLE_GET_BLIST_NODE_CLASS(location);
 	if(klass && klass->add_sibling)
 		klass->add_sibling(child, location);
 }
============================================================
--- libpurple/contact.c	4f5b91cc1efda96505a9075f0a539af516c9b152
+++ libpurple/contact.c	8181dcd2bfb0ef1e0a0b65004664a031d51e8f9a
@@ -395,6 +395,8 @@ purple_contact_child_updated(PurpleConta
 	} else {
 		priv->online--;
 	}
+
+	/* TODO: Need to fire a signal for the containing group can do whatever */
 }
 
 static void
@@ -411,16 +413,16 @@ purple_contact_add_helper(PurpleContact 
 	);
 
 	purple_contact_child_updated(contact, buddy);
-	/* Need to fire a signal for the containing group can do whatever */
 }
 
 static void
-purple_contact_add_buddy_child(PurpleBlistNode *parent, PurpleBlistNode *child)
+purple_contact_add_buddy_child(PurpleBlistNode *cnode, PurpleBlistNode *node)
 {
-	g_return_if_fail(PURPLE_IS_CONTACT(parent));
-	g_return_if_fail(PURPLE_IS_BUDDY(child));
+	g_return_if_fail(PURPLE_IS_CONTACT(cnode));
+	g_return_if_fail(PURPLE_IS_BUDDY(node));
 
-	purple_contact_add_helper(PURPLE_CONTACT(parent), PURPLE_BUDDY(child));
+	parent_class->add_child(cnode, node);
+	purple_contact_child_updated(PURPLE_CONTACT(cnode), PURPLE_BUDDY(node));
 }
 
 static void
@@ -493,7 +495,7 @@ purple_contact_class_init(PurpleContactC
 {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
 
-	parent_class = g_type_class_peek_parent(klass);
+	parent_class = PURPLE_BLIST_NODE_CLASS(klass);
 	parent_class->add_sibling = purple_contact_add_buddy_sibling;
 	parent_class->add_child = purple_contact_add_buddy_child;
 	parent_class->remove = purple_contact_remove_buddy;
@@ -501,6 +503,7 @@ purple_contact_class_init(PurpleContactC
 
 	g_type_class_add_private(klass, sizeof(PurpleContactPrivate));
 
+	parent_class = g_type_class_peek_parent(klass);
 	obj_class->finalize = purple_contact_finalize;
 }
 
============================================================
--- libpurple/group.c	3611bf43b3b35f55aaced8fbfb988f7a0269a819
+++ libpurple/group.c	e69b8e270669c02814fd8d04c801ea2ed1ac78c3
@@ -167,9 +167,14 @@ purple_group_add_child(PurpleBlistNode *
 	priv = PURPLE_GROUP_GET_PRIVATE(group);
 
 	if (PURPLE_IS_BUDDY(child)) {
-		/* TODO: Create a PurpleContact with 'child', then add the contact. */
+		/* Create a PurpleContact with 'child', then add the contact. */
+		PurpleBlistNode *contact = PURPLE_BLIST_NODE(purple_contact_new());
+		purple_blist_node_add_child(contact, child);
+		child = contact;
 	}
 
+	parent_class->add_child(parent, child);
+
 	if (PURPLE_IS_CHAT(child)) {
 		PurpleChat *chat = PURPLE_CHAT(child);
 		PurpleAccount *account = purple_chat_get_account(chat);
@@ -193,8 +198,6 @@ purple_group_add_child(PurpleBlistNode *
 	 *	- updated (TODO)
 	 */
 	g_signal_connect(G_OBJECT(child), "destroying", G_CALLBACK(group_child_destroyed), group);
-
-	parent_class->add_child(parent, child);
 }
 
 static void


More information about the Commits mailing list