Add an icon method to PurpleProtocolClass and port irc to it

Review Request #790 — Created July 8, 2021 and updated


This updates the pidgin_create_icon_from_protocol to check the new method first and then fall back to the existing list_icon method.

I opted for a 128x128px icon just kind of on a whim but figured higher resolution is better. We could pass a size parameter to icon function and then avoid some scaling, as the protocol could specify different resources, but then that means a new enum in libpurple that's very ui specific, but maybe that's fine.

I didn't move the svg because I removed some additional shadows that were in the original svg. If we want I can go back and do the remove but it was just easier for me at the moment.

Ran locally with an inverted icon to make sure pidgin was displaying the icon from the resource.

  • 1
  • 0
  • 0
  • 0
  • 1
Description From Last Updated
Maybe it should return a GIcon (implemented as a GLoadableIcon or something), that can return multiple sizes? QuLogic QuLogic
  1. Ship It!
  2. Admittedly I did not review this super in-depth, but I didn't see anything that jumped out at me in a cursory review.

  2. Maybe it should return a GIcon (implemented as a GLoadableIcon or something), that can return multiple sizes?

    1. We could just make it a GIcon and then the prpls can decide what they want to do. I assume most would use embeded resources to create the icon via g_bytes_icon_new and then gtk can resize it and stuff, although I'm not sure how difficult it'll be to use that in another ui, but it looks like that's where GLoadableIcon comes in so maybe that's the way to go?

    2. Part of my thinking was to pass a size enum or something along so that protocols who's icon's don't scale well for smaller sizes could use another icon or something.

    3. Right, that's what the GLoadableIcon interface provides.

    4. After digging into that a bit more it looks like protocol plugins would need to implement that to control file for the sizes. However, that also means a whole bunch of resource shennigans...

      However, we could create a PurpleIcon that would take a GResource and a path prefix to off load all of that. I'd opt for the PurpleIcon name so it can be reused for plugins and stuff too.