Mercurial > pidgin.yaz
diff pidgin/gtkstatusbox.c @ 25895:a81f75025e14
propagate from branch 'im.pidgin.pidgin.2.5.5.veracode' (head 1744a346c5951c97b5d6ec102b49606f3dd918cc)
to branch 'im.pidgin.pidgin.2.5.6' (head 9fe90237b75569f21f8de666d690a38109709df0)
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 14 May 2009 21:17:11 +0000 |
parents | 9c0337d4b878 |
children | 01f1929d0936 |
line wrap: on
line diff
--- a/pidgin/gtkstatusbox.c Sun May 03 23:18:28 2009 +0000 +++ b/pidgin/gtkstatusbox.c Thu May 14 21:17:11 2009 +0000 @@ -417,16 +417,15 @@ PurpleStoredImage *img = NULL; if (filename != NULL) - { - gchar *contents; - gsize size; - if (g_file_get_contents(filename, &contents, &size, NULL)) - { - img = purple_imgstore_add(contents, size, filename); - } - } + img = purple_imgstore_new_from_file(filename); pidgin_status_box_set_buddy_icon(status_box, img); + if (img) + /* + * purple_imgstore_new gives us a reference and + * pidgin_status_box_set_buddy_icon also takes one. + */ + purple_imgstore_unref(img); } status_box->hand_cursor = gdk_cursor_new (GDK_HAND2); @@ -1496,6 +1495,13 @@ if (filename) data = pidgin_convert_buddy_icon(plug, filename, &len); img = purple_buddy_icons_set_account_icon(box->account, data, len); + if (img) + /* + * set_account_icon doesn't give us a reference, but we + * unref one below (for the other code path) + */ + purple_imgstore_ref(img); + purple_account_set_buddy_icon_path(box->account, filename); purple_account_set_bool(box->account, "use-global-buddyicon", (filename != NULL)); @@ -1515,7 +1521,7 @@ size_t len = 0; if (filename) data = pidgin_convert_buddy_icon(plug, filename, &len); - img = purple_buddy_icons_set_account_icon(account, data, len); + purple_buddy_icons_set_account_icon(account, data, len); purple_account_set_buddy_icon_path(account, filename); } } @@ -1523,17 +1529,12 @@ /* Even if no accounts were processed, load the icon that was set. */ if (filename != NULL) - { - gchar *contents; - gsize size; - if (g_file_get_contents(filename, &contents, &size, NULL)) - { - img = purple_imgstore_add(contents, size, filename); - } - } + img = purple_imgstore_new_from_file(filename); } pidgin_status_box_set_buddy_icon(box, img); + if (img) + purple_imgstore_unref(img); } static void