From e09f2e10f80d4012301f1054b31d8cc17e9ebcd5 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Thu, 28 Jan 2021 19:10:03 +0100 Subject: [PATCH] CallsCallDisplay: use HdyAvatar --- src/calls-call-display.c | 18 ++++++++++-------- src/ui/call-display.ui | 9 ++++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/calls-call-display.c b/src/calls-call-display.c index fc71596..a806fc7 100644 --- a/src/calls-call-display.c +++ b/src/calls-call-display.c @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -43,7 +44,7 @@ struct _CallsCallDisplay guint timeout; GtkLabel *incoming_phone_call; - GtkBox *party_box; + HdyAvatar *avatar; GtkLabel *primary_contact_info; GtkLabel *secondary_contact_info; GtkLabel *status; @@ -315,12 +316,6 @@ calls_call_display_new (CallsCall *call) static void set_party (CallsCallDisplay *self) { - // FIXME: use HdyAvatar and the contact avatar - GtkWidget *image = gtk_image_new_from_icon_name ("avatar-default-symbolic", GTK_ICON_SIZE_DIALOG); - gtk_box_pack_end (self->party_box, image, TRUE, TRUE, 0); - gtk_image_set_pixel_size (GTK_IMAGE (image), 100); - gtk_widget_show (image); - self->contact = calls_call_get_contact (self->call); g_object_bind_property (self->contact, "name", @@ -335,6 +330,13 @@ set_party (CallsCallDisplay *self) self->secondary_contact_info, "visible", G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE); + g_object_bind_property (self->contact, "name", + self->avatar, "text", + G_BINDING_SYNC_CREATE); + + g_object_bind_property (self->contact, "has-individual", + self->avatar, "show-initials", + G_BINDING_SYNC_CREATE); } @@ -494,9 +496,9 @@ calls_call_display_class_init (CallsCallDisplayClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/calls/ui/call-display.ui"); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, incoming_phone_call); - gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, party_box); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, primary_contact_info); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, secondary_contact_info); + gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, avatar); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, status); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, controls); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, gsm_controls); diff --git a/src/ui/call-display.ui b/src/ui/call-display.ui index ad21c08..4c83d00 100644 --- a/src/ui/call-display.ui +++ b/src/ui/call-display.ui @@ -34,7 +34,7 @@ - + True False vertical @@ -59,6 +59,13 @@ 4 + + + True + False + 100 + +