I#1609 - EMinicard: Hide Nickname, when matches Full name
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1609
This commit is contained in:
@ -175,6 +175,9 @@ addressbook_height (EReflowModel *erm,
|
||||
if (field == E_CONTACT_FAMILY_NAME || field == E_CONTACT_GIVEN_NAME)
|
||||
continue;
|
||||
|
||||
if (field == E_CONTACT_NICKNAME && eab_fullname_matches_nickname (contact))
|
||||
continue;
|
||||
|
||||
string = e_contact_get (contact, field);
|
||||
if (string && *string) {
|
||||
gint this_height;
|
||||
|
@ -1046,6 +1046,9 @@ remodel (EMinicard *e_minicard)
|
||||
if (field == E_CONTACT_FULL_NAME && is_list)
|
||||
continue;
|
||||
|
||||
if (field == E_CONTACT_NICKNAME && eab_fullname_matches_nickname (e_minicard->contact))
|
||||
continue;
|
||||
|
||||
if (field == E_CONTACT_EMAIL_1 || field == E_CONTACT_EMAIL_2 || field == E_CONTACT_EMAIL_3 || field == E_CONTACT_EMAIL_4) {
|
||||
if (email_rendered)
|
||||
continue;
|
||||
|
@ -1114,3 +1114,22 @@ eab_format_address (EContact *contact,
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
eab_fullname_matches_nickname (EContact *contact)
|
||||
{
|
||||
gchar *nickname, *fullname;
|
||||
gboolean same;
|
||||
|
||||
g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
|
||||
|
||||
nickname = e_contact_get (contact, E_CONTACT_NICKNAME);
|
||||
fullname = e_contact_get (contact, E_CONTACT_FULL_NAME);
|
||||
same = g_strcmp0 (nickname && *nickname ? nickname : NULL,
|
||||
fullname && *fullname ? fullname : NULL) == 0;
|
||||
|
||||
g_free (nickname);
|
||||
g_free (fullname);
|
||||
|
||||
return same;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ ESource * eab_select_source (ESourceRegistry *registry,
|
||||
|
||||
gchar * eab_format_address (EContact *contact,
|
||||
EContactField address_type);
|
||||
gboolean eab_fullname_matches_nickname (EContact *contact);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Reference in New Issue
Block a user