Fri, 26 Aug 2022 00:14:11 -0500
Make PidginAvatar use a GtkPicture instead of GtkImage
Testing Done:
Opened a conversation and verified the icon worked.
However, it's too big right now, but part of that is another issue with sizing in the conversation window.
Reviewed at https://reviews.imfreedom.org/r/1654/
| pidgin/pidginavatar.c | file | annotate | diff | comparison | revisions | |
| pidgin/resources/Avatar/avatar.ui | file | annotate | diff | comparison | revisions |
--- a/pidgin/pidginavatar.c Fri Aug 26 00:13:48 2022 -0500 +++ b/pidgin/pidginavatar.c Fri Aug 26 00:14:11 2022 -0500 @@ -260,6 +260,7 @@ pidgin_avatar_update(PidginAvatar *avatar) { PurpleAccount *account = NULL; GdkPixbufAnimation *animation = NULL; + GdkPixbuf *pixbuf = NULL; if(PURPLE_IS_BUDDY(avatar->buddy)) { animation = pidgin_avatar_find_buddy_icon(avatar->buddy, NULL); @@ -282,18 +283,13 @@ if(GDK_IS_PIXBUF_ANIMATION(avatar->animation)) { if(avatar->animate) { - gtk_image_set_from_pixbuf(GTK_IMAGE(avatar->icon), - GDK_PIXBUF(avatar->animation)); + pixbuf = GDK_PIXBUF(avatar->animation); } else { - GdkPixbuf *frame = NULL; + pixbuf = gdk_pixbuf_animation_get_static_image(avatar->animation); + } + } - frame = gdk_pixbuf_animation_get_static_image(avatar->animation); - - gtk_image_set_from_pixbuf(GTK_IMAGE(avatar->icon), frame); - } - } else { - gtk_image_clear(GTK_IMAGE(avatar->icon)); - } + gtk_picture_set_pixbuf(GTK_PICTURE(avatar->icon), pixbuf); g_clear_object(&animation); } @@ -444,12 +440,6 @@ gtk_widget_init_template(GTK_WIDGET(avatar)); - /* For development/design purposes, the avatar defaults to the - * "image-missing" icon. However, we don't want to display that to users, - * so we clear it during run time. - */ - gtk_image_clear(GTK_IMAGE(avatar->icon)); - /* Now setup our actions. */ group = g_simple_action_group_new(); g_action_map_add_action_entries(G_ACTION_MAP(group), actions,
--- a/pidgin/resources/Avatar/avatar.ui Fri Aug 26 00:13:48 2022 -0500 +++ b/pidgin/resources/Avatar/avatar.ui Fri Aug 26 00:14:11 2022 -0500 @@ -27,9 +27,11 @@ <!-- interface-copyright Pidgin Developers <devel@pidgin.im> --> <template class="PidginAvatar" parent="GtkBox"> <child> - <object class="GtkImage" id="icon"> - <property name="icon-name">image-missing</property> - <property name="icon_size">3</property> + <object class="GtkPicture" id="icon"> + <property name="height-request">64</property> + <property name="width-request">64</property> + <property name="content-fit">scale-down</property> + <property name="keep-aspect-ratio">1</property> </object> </child> <child>