Blame SOURCES/gnome-contacts-3.8.2-show-address-fields.patch

9b4745
From 23ba9b75ee77fc3eebfec7daffef9310063b3fb0 Mon Sep 17 00:00:00 2001
9b4745
From: David King <dking@redhat.com>
9b4745
Date: Wed, 17 Dec 2014 14:25:17 +0000
9b4745
Subject: [PATCH] Show address fields when adding the first contact
9b4745
9b4745
The new contact dialog iterates over the list of address fields, which
9b4745
are declared as static in the Contact class. Static data in Vala is
9b4745
implemented by initializing the data during class_init(), or in other
9b4745
words, the first time that the class is instantiated. When adding the
9b4745
first contact, there are no instances of Contact, and so the address
9b4745
fields have not been initialized. This leads to a blank space in the new
9b4745
contact dialog, where the list of address fields should be.
9b4745
9b4745
Ensure that class_init() of the Contact class has been called by
9b4745
calling g_type_class_ref() on the Type before iterating over the address
9b4745
fields.
9b4745
9b4745
https://bugzilla.gnome.org/show_bug.cgi?id=702810
9b4745
---
9b4745
 src/contacts-new-contact-dialog.vala | 8 ++++++++
9b4745
 1 file changed, 8 insertions(+)
9b4745
9b4745
diff --git a/src/contacts-new-contact-dialog.vala b/src/contacts-new-contact-dialog.vala
9b4745
index 816c863..c98f305 100644
9b4745
--- a/src/contacts-new-contact-dialog.vala
9b4745
+++ b/src/contacts-new-contact-dialog.vala
9b4745
@@ -176,6 +176,14 @@ public class Contacts.NewContactDialog : Dialog {
9b4745
     sub_grid.set_hexpand (true);
9b4745
     entries.add (sub_grid);
9b4745
 
9b4745
+    /* Ensure that class_init() of Contact has been called, to initialize the
9b4745
+     * static members, including postal_element_props. */
9b4745
+    var contact_type = Type.from_name ("ContactsContact");
9b4745
+    if (contact_type != 0) {
9b4745
+      // Type has been registered, make sure that class_init() has been called.
9b4745
+      contact_type.class_ref ();
9b4745
+    }
9b4745
+
9b4745
     for (int i = 0; i < Contact.postal_element_props.length; i++) {
9b4745
       var entry = new Entry ();
9b4745
       entry.set ("placeholder-text", Contact.postal_element_names[i]);
9b4745
-- 
9b4745
1.8.3.1
9b4745