*** pidgin-libnotify.c 2009-11-17 14:48:39.000000000 +0100 --- pidgin-libnotify-new.c 2009-11-17 14:48:48.000000000 +0100 *************** *** 169,174 **** --- 169,201 ---- return icon; } + static GdkPixbuf * + pixbuf_from_custom_icon (PurpleStoredImage *buddy_icon) + { + GdkPixbuf *icon; + const guchar *data; + gsize len; + GdkPixbufLoader *loader; + + data = purple_imgstore_get_data(buddy_icon); + len = purple_imgstore_get_size(buddy_icon); + + loader = gdk_pixbuf_loader_new (); + gdk_pixbuf_loader_set_size (loader, 48, 48); + gdk_pixbuf_loader_write (loader, data, len, NULL); + gdk_pixbuf_loader_close (loader, NULL); + + icon = gdk_pixbuf_loader_get_pixbuf (loader); + + if (icon) { + g_object_ref (icon); + } + + g_object_unref (loader); + + return icon; + } + static void action_cb (NotifyNotification *notification, gchar *action, gpointer user_data) *************** *** 262,267 **** --- 289,295 ---- NotifyNotification *notification = NULL; GdkPixbuf *icon; PurpleBuddyIcon *buddy_icon; + PurpleStoredImage *custom_img; gchar *tr_body; PurpleContact *contact; *************** *** 292,304 **** title, tr_body, best_name (buddy)); g_free (tr_body); ! buddy_icon = purple_buddy_get_icon (buddy); ! if (buddy_icon) { ! icon = pixbuf_from_buddy_icon (buddy_icon); ! purple_debug_info (PLUGIN_ID, "notify(), has a buddy icon.\n"); } else { ! icon = pidgin_create_prpl_icon (buddy->account, 1); ! purple_debug_info (PLUGIN_ID, "notify(), has a prpl icon.\n"); } if (icon) { --- 320,338 ---- title, tr_body, best_name (buddy)); g_free (tr_body); ! custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); ! if (custom_img) { ! icon = pixbuf_from_custom_icon (custom_img); ! purple_debug_info (PLUGIN_ID, "notify(), has a custom buddy icon.\n"); } else { ! buddy_icon = purple_buddy_icons_find(buddy->account, buddy->name); ! if (buddy_icon) { ! icon = pixbuf_from_buddy_icon (buddy_icon); ! purple_debug_info (PLUGIN_ID, "notify(), has a buddy icon.\n"); ! } else { ! icon = pidgin_create_prpl_icon (buddy->account, 1); ! purple_debug_info (PLUGIN_ID, "notify(), has a prpl icon.\n"); ! } } if (icon) { *************** *** 316,322 **** notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); ! notify_notification_add_action (notification, "show", _("Show"), action_cb, NULL, NULL); if (!notify_notification_show (notification, NULL)) { purple_debug_error (PLUGIN_ID, "notify(), failed to send notification\n"); --- 350,356 ---- notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); ! //notify_notification_add_action (notification, "show", _("Show"), action_cb, NULL, NULL); if (!notify_notification_show (notification, NULL)) { purple_debug_error (PLUGIN_ID, "notify(), failed to send notification\n");