comparison src/blist.c @ 12476:18b16e801e6f

[gaim-migrate @ 14787] SF Patch #1379107 from evands 'Properly notify the UI when a buddy icon changes gaim_buddy_set_icon() currently does nothing if the incoming GaimBuddyIcon* is the same as buddy->icon. This is wrong, however, because gaim_buddy_icon_new() will recycle an existing GaimBuddyIcon* object for the buddy, replacing its data with the new buddy icon data, if possible. The recycling means that just because (icon == buddy->icon) we can't assume nothing has changed. This patch makes the "buddy-icon-changed" signal be sent and the gaim_blist_update_buddy_icon() function be called appropriately when the buddy icon changes. Call stack that gets us here from prpl code, for those keeping score at home: gaim_buddy_icons_set_for_user() -> gaim_buddy_icon_new() -> gaim_buddy_icon_set_data() -> gaim_buddy_icon_update() -> gaim_buddy_set_icon()' committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 13 Dec 2005 08:10:28 +0000
parents 8626cc8d0df9
children f1ee8a29bd69
comparison
equal deleted inserted replaced
12475:572d6d5da418 12476:18b16e801e6f
1120 void 1120 void
1121 gaim_buddy_set_icon(GaimBuddy *buddy, GaimBuddyIcon *icon) 1121 gaim_buddy_set_icon(GaimBuddy *buddy, GaimBuddyIcon *icon)
1122 { 1122 {
1123 g_return_if_fail(buddy != NULL); 1123 g_return_if_fail(buddy != NULL);
1124 1124
1125 if (buddy->icon == icon) 1125 if (buddy->icon != icon) {
1126 /* Don't need to do anything */ 1126 if (buddy->icon != NULL)
1127 return; 1127 gaim_buddy_icon_unref(buddy->icon);
1128 1128
1129 if (buddy->icon != NULL) 1129 buddy->icon = (icon != NULL ? gaim_buddy_icon_ref(icon) : NULL);
1130 gaim_buddy_icon_unref(buddy->icon); 1130 }
1131
1132 buddy->icon = (icon != NULL ? gaim_buddy_icon_ref(icon) : NULL);
1133 1131
1134 if (buddy->icon) 1132 if (buddy->icon)
1135 gaim_buddy_icon_cache(icon, buddy); 1133 gaim_buddy_icon_cache(icon, buddy);
1136 else 1134 else
1137 gaim_buddy_icon_uncache(buddy); 1135 gaim_buddy_icon_uncache(buddy);