1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-05-21 20:49:29 +00:00

calls-contacts-row: AdwAvatar API changes

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/migrating-libhandy-1-4-to-libadwaita.html#adapt-to-adwavatar-api-changes

This is *not* ideal, since it relies on Folks returning a GFileIcon
internally, and it's also blocking. However, better to use something
simple that compiles and works to begin with.

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
Anton Lazarev 2023-12-16 11:18:24 -08:00
parent 27c2f62dc1
commit 011d8a29b7

View file

@ -90,7 +90,9 @@ static void
avatar_changed_cb (CallsContactsRow *self)
{
FolksAvatarDetails *avatar_details;
GLoadableIcon *icon;
GLoadableIcon *loadable_icon;
g_autoptr (GdkTexture) icon = NULL;
g_autoptr (GError) error = NULL;
g_assert (FOLKS_IS_INDIVIDUAL (self->item));
@ -98,12 +100,18 @@ avatar_changed_cb (CallsContactsRow *self)
if (avatar_details == NULL)
return;
icon = folks_avatar_details_get_avatar (avatar_details);
if (icon == NULL)
loadable_icon = folks_avatar_details_get_avatar (avatar_details);
if (!G_IS_FILE_ICON (loadable_icon)) {
return;
}
adw_avatar_set_loadable_icon (ADW_AVATAR (self->avatar), icon);
icon = gdk_texture_new_from_file (g_file_icon_get_file (G_FILE_ICON (loadable_icon)), &error);
if (icon == NULL) {
g_print ("Failed to load avatar icon: %s", error->message);
return;
}
adw_avatar_set_custom_image (ADW_AVATAR (self->avatar), GDK_PAINTABLE (icon));
}
static void