[gnome-contacts] ContactEditor: update has_nickname_row properly



commit 8ffe4462e885a4ec0da11912410718894b48c03c
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Mon Apr 7 01:10:03 2014 -0400

    ContactEditor: update has_nickname_row properly
    
    Removed hack. This code can still be improved but that will come
    eventually, when we implement inline contact creation

 src/contacts-contact-editor.vala |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/contacts-contact-editor.vala b/src/contacts-contact-editor.vala
index 9c83fa7..a60609b 100644
--- a/src/contacts-contact-editor.vala
+++ b/src/contacts-contact-editor.vala
@@ -301,15 +301,8 @@ public class Contacts.ContactEditor : Grid {
     value_entry.changed.connect (() => {
        set_field_changed (row);
       });
-    delete_button.clicked.connect (() => {
+    delete_button.clicked.connect_after (() => {
        remove_row (row);
-
-       /* hacky, ugly way of doing this */
-       /* because this func is called with details = null */
-       /* only when setting a nickname field */
-       if (details == null) {
-         has_nickname_row = false;
-       }
       });
 
     value_entry.map.connect (() => {
@@ -556,6 +549,11 @@ public class Contacts.ContactEditor : Grid {
       }
       if (! rows.is_empty) {
        has_nickname_row = true;
+       var delete_button = get_child_at (3, row - 1) as Button;
+       delete_button.clicked.connect (() => {
+           has_nickname_row = false;
+         });
+
        if (writable_personas[p].has_key (prop_name)) {
          foreach (var entry in rows.entries) {
            writable_personas[p][prop_name].rows.set (entry.key, entry.value);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]