[evolution/gnome-41] I#1623 - EMinicard: Hide fields same as the FileAs
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-41] I#1623 - EMinicard: Hide fields same as the FileAs
- Date: Fri, 17 Sep 2021 10:26:05 +0000 (UTC)
commit a912f69636e0a6f09c832dee059214d5d276734c
Author: Milan Crha <mcrha redhat com>
Date: Fri Sep 17 12:24:25 2021 +0200
I#1623 - EMinicard: Hide fields same as the FileAs
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1623
src/addressbook/gui/widgets/e-addressbook-reflow-adapter.c | 10 +++++-----
src/addressbook/gui/widgets/e-minicard.c | 12 ++++++------
2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
b/src/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 299dfcd01c..368303abb8 100644
--- a/src/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/src/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -157,7 +157,7 @@ addressbook_height (EReflowModel *erm,
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
EContactField field;
gint count = 0;
- gchar *string;
+ gchar *string, *file_as;
EContact *contact = (EContact *) e_addressbook_model_contact_at (priv->model, i);
PangoLayout *layout;
gint height;
@@ -165,9 +165,8 @@ addressbook_height (EReflowModel *erm,
layout = gtk_widget_create_pango_layout (
GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), "");
- string = e_contact_get (contact, E_CONTACT_FILE_AS);
- height = text_height (layout, string ? string : "") + 10.0;
- g_free (string);
+ file_as = e_contact_get (contact, E_CONTACT_FILE_AS);
+ height = text_height (layout, file_as ? file_as : "") + 10.0;
for (field = E_CONTACT_FULL_NAME;
field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) {
@@ -179,7 +178,7 @@ addressbook_height (EReflowModel *erm,
continue;
string = e_contact_get (contact, field);
- if (string && *string) {
+ if (string && *string && e_util_strcmp0 (string, file_as) != 0) {
gint this_height;
gint field_text_height;
@@ -199,6 +198,7 @@ addressbook_height (EReflowModel *erm,
height += 2;
g_object_unref (layout);
+ g_free (file_as);
return height;
}
diff --git a/src/addressbook/gui/widgets/e-minicard.c b/src/addressbook/gui/widgets/e-minicard.c
index 91c87eb7c3..ea5503a1c0 100644
--- a/src/addressbook/gui/widgets/e-minicard.c
+++ b/src/addressbook/gui/widgets/e-minicard.c
@@ -1014,13 +1014,13 @@ remodel (EMinicard *e_minicard)
gboolean email_rendered = 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) {
- file_as = e_contact_get (e_minicard->contact, E_CONTACT_FILE_AS);
gnome_canvas_item_set (
e_minicard->header_text,
"text", file_as ? file_as : "",
NULL);
- g_free (file_as);
}
if (e_minicard->contact && e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST))
@@ -1063,7 +1063,7 @@ remodel (EMinicard *e_minicard)
gchar *string;
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);
g_object_set (
minicard_field->label,
@@ -1095,7 +1095,7 @@ remodel (EMinicard *e_minicard)
g_list_free_full (email, (GDestroyNotify) e_vcard_attribute_free);
} else {
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);
count++;
@@ -1113,8 +1113,8 @@ remodel (EMinicard *e_minicard)
}
}
- g_list_foreach (list, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify) e_minicard_field_destroy);
+ g_free (file_as);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]