mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-11-17 16:05:36 +00:00
History: use HdyAvatar
This disables the custom avatar. It will be added back later. Signed-off-by: Julian Sparber <julian@sparber.net>
This commit is contained in:
parent
63e5bc8504
commit
4f03ab0441
2 changed files with 14 additions and 57 deletions
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "calls-call-record-row.h"
|
#include "calls-call-record-row.h"
|
||||||
#include "calls-best-match.h"
|
#include "calls-best-match.h"
|
||||||
|
#include "contrib/hdy-avatar.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
@ -34,14 +35,11 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
#define AVATAR_SIZE 32
|
|
||||||
|
|
||||||
|
|
||||||
struct _CallsCallRecordRow
|
struct _CallsCallRecordRow
|
||||||
{
|
{
|
||||||
GtkListBoxRow parent_instance;
|
GtkListBoxRow parent_instance;
|
||||||
|
|
||||||
GtkImage *avatar;
|
GtkWidget *avatar;
|
||||||
GtkImage *type;
|
GtkImage *type;
|
||||||
GtkLabel *target;
|
GtkLabel *target;
|
||||||
GtkLabel *time;
|
GtkLabel *time;
|
||||||
|
@ -347,53 +345,11 @@ contact_name_cb (CallsCallRecordRow *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_avatar (CallsCallRecordRow *self,
|
avatar_text_changed_cb (HdyAvatar *avatar)
|
||||||
GdkPixbuf *avatar)
|
|
||||||
{
|
{
|
||||||
if (avatar)
|
const gchar *text = hdy_avatar_get_text (avatar);
|
||||||
{
|
hdy_avatar_set_show_initials (avatar, !g_ascii_isdigit (*text) && !strchr("#*+", *text));
|
||||||
gtk_image_set_from_pixbuf (self->avatar, avatar);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_image_set_from_icon_name (self->avatar,
|
|
||||||
"avatar-default-symbolic",
|
|
||||||
GTK_ICON_SIZE_DND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
contact_avatar_cb (CallsCallRecordRow *self,
|
|
||||||
gint size,
|
|
||||||
GdkPixbuf *avatar,
|
|
||||||
CallsBestMatch *contact)
|
|
||||||
{
|
|
||||||
if (size != AVATAR_SIZE)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_avatar (self, avatar);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
request_contact_avatar (CallsCallRecordRow *self)
|
|
||||||
{
|
|
||||||
GdkPixbuf *avatar;
|
|
||||||
|
|
||||||
if (!self->contact)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
avatar = calls_best_match_request_avatar
|
|
||||||
(self->contact, AVATAR_SIZE);
|
|
||||||
|
|
||||||
set_avatar (self, avatar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -432,10 +388,6 @@ setup_contact (CallsCallRecordRow *self)
|
||||||
"notify::name",
|
"notify::name",
|
||||||
G_CALLBACK (contact_name_cb),
|
G_CALLBACK (contact_name_cb),
|
||||||
self);
|
self);
|
||||||
g_signal_connect_swapped (self->contact,
|
|
||||||
"avatar",
|
|
||||||
G_CALLBACK (contact_avatar_cb),
|
|
||||||
self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,7 +447,6 @@ constructed (GObject *object)
|
||||||
|
|
||||||
setup_contact (self);
|
setup_contact (self);
|
||||||
contact_name_cb (self);
|
contact_name_cb (self);
|
||||||
request_contact_avatar (self);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (calls_call_record_row_parent_class)->constructed (object);
|
G_OBJECT_CLASS (calls_call_record_row_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
@ -579,6 +530,11 @@ static void
|
||||||
calls_call_record_row_init (CallsCallRecordRow *self)
|
calls_call_record_row_init (CallsCallRecordRow *self)
|
||||||
{
|
{
|
||||||
gtk_widget_init_template (GTK_WIDGET (self));
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
|
g_signal_connect (self->avatar,
|
||||||
|
"notify::text",
|
||||||
|
G_CALLBACK (avatar_text_changed_cb),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,15 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="avatar">
|
<object class="HdyAvatar" id="avatar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="margin_left">8</property>
|
<property name="margin_left">8</property>
|
||||||
<property name="margin_top">8</property>
|
<property name="margin_top">8</property>
|
||||||
<property name="margin_bottom">8</property>
|
<property name="margin_bottom">8</property>
|
||||||
<property name="icon-name">avatar-default-symbolic</property>
|
<property name="size">36</property>
|
||||||
<property name="icon-size">6</property>
|
<property name="text" bind-source="target" bind-property="label" bind-flags="sync-create"></property>
|
||||||
|
<property name="show-initials">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
|
|
Loading…
Reference in a new issue