Commit 0bc8c7bc authored by Guido Gunther's avatar Guido Gunther
Browse files

calls-call-record-row: Print 'Anonymous caller' on empty numbers

If no number is present use `Anonymous caller` instead of an
empty label in the call history.

See: #144
parent 1ce13ba9
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#include <errno.h> #include <errno.h>
#define ANONYMOUS_CALLER _("Anonymous caller")
struct _CallsCallRecordRow struct _CallsCallRecordRow
{ {
GtkListBoxRow parent_instance; GtkListBoxRow parent_instance;
...@@ -339,15 +342,20 @@ contact_name_cb (CallsCallRecordRow *self) ...@@ -339,15 +342,20 @@ contact_name_cb (CallsCallRecordRow *self)
} }
else else
{ {
gchar *target; g_autofree gchar *target = NULL;
g_object_get (G_OBJECT (self->record), g_object_get (G_OBJECT (self->record),
"target", &target, "target", &target,
NULL); NULL);
if (!g_strcmp0 (target, ""))
{
gtk_label_set_text (self->target, ANONYMOUS_CALLER);
}
else
{
gtk_label_set_text (self->target, target); gtk_label_set_text (self->target, target);
}
g_free (target);
} }
} }
...@@ -355,7 +363,16 @@ static void ...@@ -355,7 +363,16 @@ static void
avatar_text_changed_cb (HdyAvatar *avatar) avatar_text_changed_cb (HdyAvatar *avatar)
{ {
const gchar *text = hdy_avatar_get_text (avatar); const gchar *text = hdy_avatar_get_text (avatar);
hdy_avatar_set_show_initials (avatar, !g_ascii_isdigit (*text) && !strchr("#*+", *text)); gboolean show_initials = TRUE;
if (strchr("#*+", *text)
|| g_ascii_isdigit (*text)
|| !g_strcmp0 (text, ANONYMOUS_CALLER))
{
show_initials = FALSE;
}
hdy_avatar_set_show_initials (avatar, show_initials);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment