I#1623 - EMinicard: Hide fields same as the FileAs
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1623
This commit is contained in:
@ -157,7 +157,7 @@ addressbook_height (EReflowModel *erm,
|
|||||||
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
|
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
|
||||||
EContactField field;
|
EContactField field;
|
||||||
gint count = 0;
|
gint count = 0;
|
||||||
gchar *string;
|
gchar *string, *file_as;
|
||||||
EContact *contact = (EContact *) e_addressbook_model_contact_at (priv->model, i);
|
EContact *contact = (EContact *) e_addressbook_model_contact_at (priv->model, i);
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
gint height;
|
gint height;
|
||||||
@ -165,9 +165,8 @@ addressbook_height (EReflowModel *erm,
|
|||||||
layout = gtk_widget_create_pango_layout (
|
layout = gtk_widget_create_pango_layout (
|
||||||
GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), "");
|
GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), "");
|
||||||
|
|
||||||
string = e_contact_get (contact, E_CONTACT_FILE_AS);
|
file_as = e_contact_get (contact, E_CONTACT_FILE_AS);
|
||||||
height = text_height (layout, string ? string : "") + 10.0;
|
height = text_height (layout, file_as ? file_as : "") + 10.0;
|
||||||
g_free (string);
|
|
||||||
|
|
||||||
for (field = E_CONTACT_FULL_NAME;
|
for (field = E_CONTACT_FULL_NAME;
|
||||||
field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) {
|
field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) {
|
||||||
@ -179,7 +178,7 @@ addressbook_height (EReflowModel *erm,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
string = e_contact_get (contact, field);
|
string = e_contact_get (contact, field);
|
||||||
if (string && *string) {
|
if (string && *string && e_util_strcmp0 (string, file_as) != 0) {
|
||||||
gint this_height;
|
gint this_height;
|
||||||
gint field_text_height;
|
gint field_text_height;
|
||||||
|
|
||||||
@ -199,6 +198,7 @@ addressbook_height (EReflowModel *erm,
|
|||||||
height += 2;
|
height += 2;
|
||||||
|
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
|
g_free (file_as);
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
@ -1014,13 +1014,13 @@ remodel (EMinicard *e_minicard)
|
|||||||
gboolean email_rendered = FALSE;
|
gboolean email_rendered = FALSE;
|
||||||
gboolean has_voice = FALSE, has_fax = FALSE;
|
gboolean has_voice = FALSE, has_fax = FALSE;
|
||||||
|
|
||||||
|
file_as = e_contact_get (e_minicard->contact, E_CONTACT_FILE_AS);
|
||||||
|
|
||||||
if (e_minicard->header_text) {
|
if (e_minicard->header_text) {
|
||||||
file_as = e_contact_get (e_minicard->contact, E_CONTACT_FILE_AS);
|
|
||||||
gnome_canvas_item_set (
|
gnome_canvas_item_set (
|
||||||
e_minicard->header_text,
|
e_minicard->header_text,
|
||||||
"text", file_as ? file_as : "",
|
"text", file_as ? file_as : "",
|
||||||
NULL);
|
NULL);
|
||||||
g_free (file_as);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e_minicard->contact && e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST))
|
if (e_minicard->contact && e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST))
|
||||||
@ -1063,7 +1063,7 @@ remodel (EMinicard *e_minicard)
|
|||||||
gchar *string;
|
gchar *string;
|
||||||
|
|
||||||
string = e_contact_get (e_minicard->contact, field);
|
string = e_contact_get (e_minicard->contact, field);
|
||||||
if (string && *string) {
|
if (string && *string && e_util_strcmp0 (string, file_as) != 0) {
|
||||||
e_minicard->fields = g_list_append (e_minicard->fields, minicard_field);
|
e_minicard->fields = g_list_append (e_minicard->fields, minicard_field);
|
||||||
g_object_set (
|
g_object_set (
|
||||||
minicard_field->label,
|
minicard_field->label,
|
||||||
@ -1095,7 +1095,7 @@ remodel (EMinicard *e_minicard)
|
|||||||
g_list_free_full (email, (GDestroyNotify) e_vcard_attribute_free);
|
g_list_free_full (email, (GDestroyNotify) e_vcard_attribute_free);
|
||||||
} else {
|
} else {
|
||||||
string = e_contact_get (e_minicard->contact, field);
|
string = e_contact_get (e_minicard->contact, field);
|
||||||
if (string && *string) {
|
if (string && *string && e_util_strcmp0 (string, file_as) != 0) {
|
||||||
add_field (e_minicard, field, left_width);
|
add_field (e_minicard, field, left_width);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
@ -1113,8 +1113,8 @@ remodel (EMinicard *e_minicard)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_foreach (list, (GFunc) e_minicard_field_destroy, NULL);
|
g_list_free_full (list, (GDestroyNotify) e_minicard_field_destroy);
|
||||||
g_list_free (list);
|
g_free (file_as);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user