Mercurial > pidgin.yaz
comparison pidgin/gtkblist.c @ 20872:71d0989b7c25
Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 10 Oct 2007 04:11:52 +0000 |
parents | 58b9a33968e1 |
children | 2cf9156f4b85 7821fa7b22db fc80a99f6f40 6bbd66f67fa8 |
comparison
equal
deleted
inserted
replaced
20871:34fc2a999977 | 20872:71d0989b7c25 |
---|---|
5298 } | 5298 } |
5299 | 5299 |
5300 static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *node) | 5300 static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *node) |
5301 { | 5301 { |
5302 PurplePresence *presence; | 5302 PurplePresence *presence; |
5303 GdkPixbuf *status, *avatar, *emblem; | 5303 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; |
5304 char *mark; | 5304 char *mark; |
5305 char *idle = NULL; | 5305 char *idle = NULL; |
5306 gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; | 5306 gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; |
5307 gboolean selected = (gtkblist->selected_node == node); | 5307 gboolean selected = (gtkblist->selected_node == node); |
5308 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); | 5308 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); |
5309 presence = purple_buddy_get_presence(buddy); | 5309 presence = purple_buddy_get_presence(buddy); |
5310 | 5310 |
5311 if (editing_blist) | 5311 if (editing_blist) |
5312 return; | 5312 return; |
5313 | 5313 |
5314 status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, | 5314 status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, |
5315 PIDGIN_STATUS_ICON_SMALL); | 5315 PIDGIN_STATUS_ICON_SMALL); |
5316 | 5316 |
5317 /* Speed it up if we don't want buddy icons. */ | 5317 /* Speed it up if we don't want buddy icons. */ |
5318 if(biglist) | 5318 if(biglist) |
5354 dim_grey(), idle); | 5354 dim_grey(), idle); |
5355 g_free(idle); | 5355 g_free(idle); |
5356 idle = i2; | 5356 idle = i2; |
5357 } | 5357 } |
5358 } | 5358 } |
5359 | |
5360 prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL); | |
5359 | 5361 |
5360 gtk_tree_store_set(gtkblist->treemodel, iter, | 5362 gtk_tree_store_set(gtkblist->treemodel, iter, |
5361 STATUS_ICON_COLUMN, status, | 5363 STATUS_ICON_COLUMN, status, |
5362 STATUS_ICON_VISIBLE_COLUMN, TRUE, | 5364 STATUS_ICON_VISIBLE_COLUMN, TRUE, |
5363 NAME_COLUMN, mark, | 5365 NAME_COLUMN, mark, |
5365 IDLE_VISIBLE_COLUMN, !biglist && idle, | 5367 IDLE_VISIBLE_COLUMN, !biglist && idle, |
5366 BUDDY_ICON_COLUMN, avatar, | 5368 BUDDY_ICON_COLUMN, avatar, |
5367 BUDDY_ICON_VISIBLE_COLUMN, biglist, | 5369 BUDDY_ICON_VISIBLE_COLUMN, biglist, |
5368 EMBLEM_COLUMN, emblem, | 5370 EMBLEM_COLUMN, emblem, |
5369 EMBLEM_VISIBLE_COLUMN, (emblem != NULL), | 5371 EMBLEM_VISIBLE_COLUMN, (emblem != NULL), |
5370 PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL), | 5372 PROTOCOL_ICON_COLUMN, prpl_icon, |
5371 PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), | 5373 PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), |
5372 BGCOLOR_COLUMN, NULL, | 5374 BGCOLOR_COLUMN, NULL, |
5373 CONTACT_EXPANDER_COLUMN, NULL, | 5375 CONTACT_EXPANDER_COLUMN, NULL, |
5374 CONTACT_EXPANDER_VISIBLE_COLUMN, expanded, | 5376 CONTACT_EXPANDER_VISIBLE_COLUMN, expanded, |
5375 GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, | 5377 GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, |
5381 g_object_unref(emblem); | 5383 g_object_unref(emblem); |
5382 if(status) | 5384 if(status) |
5383 g_object_unref(status); | 5385 g_object_unref(status); |
5384 if(avatar) | 5386 if(avatar) |
5385 g_object_unref(avatar); | 5387 g_object_unref(avatar); |
5388 if(prpl_icon) | |
5389 g_object_unref(prpl_icon); | |
5386 } | 5390 } |
5387 | 5391 |
5388 /* This is a variation on the original gtk_blist_update_contact. Here we | 5392 /* This is a variation on the original gtk_blist_update_contact. Here we |
5389 can know in advance which buddy has changed so we can just update that */ | 5393 can know in advance which buddy has changed so we can just update that */ |
5390 static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node) | 5394 static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node) |
5501 | 5505 |
5502 chat = (PurpleChat*)node; | 5506 chat = (PurpleChat*)node; |
5503 | 5507 |
5504 if(purple_account_is_connected(chat->account)) { | 5508 if(purple_account_is_connected(chat->account)) { |
5505 GtkTreeIter iter; | 5509 GtkTreeIter iter; |
5506 GdkPixbuf *status; | 5510 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; |
5507 GdkPixbuf *avatar; | |
5508 GdkPixbuf *emblem; | |
5509 char *mark; | 5511 char *mark; |
5510 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); | 5512 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); |
5511 PidginBlistNode *ui; | 5513 PidginBlistNode *ui; |
5512 PurpleConversation *conv; | 5514 PurpleConversation *conv; |
5513 gboolean hidden; | 5515 gboolean hidden; |
5533 if (hidden) { | 5535 if (hidden) { |
5534 char *bold = g_strdup_printf("<b>%s</b>", mark); | 5536 char *bold = g_strdup_printf("<b>%s</b>", mark); |
5535 g_free(mark); | 5537 g_free(mark); |
5536 mark = bold; | 5538 mark = bold; |
5537 } | 5539 } |
5540 | |
5541 prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL); | |
5538 | 5542 |
5539 gtk_tree_store_set(gtkblist->treemodel, &iter, | 5543 gtk_tree_store_set(gtkblist->treemodel, &iter, |
5540 STATUS_ICON_COLUMN, status, | 5544 STATUS_ICON_COLUMN, status, |
5541 STATUS_ICON_VISIBLE_COLUMN, TRUE, | 5545 STATUS_ICON_VISIBLE_COLUMN, TRUE, |
5542 BUDDY_ICON_COLUMN, avatar ? avatar : gtkblist->empty_avatar, | 5546 BUDDY_ICON_COLUMN, avatar ? avatar : gtkblist->empty_avatar, |
5543 BUDDY_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"), | 5547 BUDDY_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"), |
5544 EMBLEM_COLUMN, emblem, | 5548 EMBLEM_COLUMN, emblem, |
5545 EMBLEM_VISIBLE_COLUMN, emblem != NULL, | 5549 EMBLEM_VISIBLE_COLUMN, emblem != NULL, |
5546 PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL), | 5550 PROTOCOL_ICON_COLUMN, prpl_icon, |
5547 PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), | 5551 PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), |
5548 NAME_COLUMN, mark, | 5552 NAME_COLUMN, mark, |
5549 GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, | 5553 GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, |
5550 -1); | 5554 -1); |
5551 | 5555 |
5554 g_object_unref(emblem); | 5558 g_object_unref(emblem); |
5555 if(status) | 5559 if(status) |
5556 g_object_unref(status); | 5560 g_object_unref(status); |
5557 if(avatar) | 5561 if(avatar) |
5558 g_object_unref(avatar); | 5562 g_object_unref(avatar); |
5563 if(prpl_icon) | |
5564 g_object_unref(prpl_icon); | |
5559 } else { | 5565 } else { |
5560 pidgin_blist_hide_node(list, node, TRUE); | 5566 pidgin_blist_hide_node(list, node, TRUE); |
5561 } | 5567 } |
5562 } | 5568 } |
5563 | 5569 |