summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2018-04-25 21:03:46 +0200
committerNiels De Graef <nielsdegraef@gmail.com>2018-05-08 00:21:11 +0200
commit0aef494ee5e3b8af707b8639a2d3337e1c063b5a (patch)
treee1c545066310a59a3c10ecb2201936eec1cb6e0a
parent86a648f47a7504f95d28ea3af102797e905a1d9b (diff)
downloadgnome-contacts-0aef494ee5e3b8af707b8639a2d3337e1c063b5a.tar.gz
ContactSheet: solve Critical with an empty first persona.
-rw-r--r--src/contacts-contact-sheet.vala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 37ff5c3..3a45840 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -112,11 +112,11 @@ public class Contacts.ContactSheet : ContactForm {
create_name_label ();
this.last_row += 3; // Name/Avatar takes up 3 rows
- bool is_first_persona = true;
var personas = this.contact.get_personas_for_display ();
/* Cause personas are sorted properly I can do this */
foreach (var p in personas) {
+ bool is_first_persona = (this.last_row == 3);
int persona_store_pos = this.last_row;
if (!is_first_persona) {
this.container_grid.attach (create_persona_store_label (p), 0, this.last_row, 3);
@@ -126,12 +126,12 @@ public class Contacts.ContactSheet : ContactForm {
foreach (var prop in ContactForm.SORTED_PROPERTIES)
add_row_for_property (p, prop);
- if (this.last_row != 3)
- is_first_persona = false;
-
// Nothing to show in the persona: don't mention it
- if (this.last_row == persona_store_pos + 1)
- get_child_at (0, persona_store_pos).destroy ();
+ bool is_empty_persona = (this.last_row == persona_store_pos + 1);
+ if (!is_first_persona && is_empty_persona) {
+ this.container_grid.remove_row (persona_store_pos);
+ this.last_row--;
+ }
}
show_all ();