[gnome-contacts] Implement remove for contacts details



commit b176966f468f58e2dcede47e2ae77a365a3aa9d4
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 30 15:58:42 2011 +0200

    Implement remove for contacts details

 src/contacts-contact-pane.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 86f92b1..347f4a9 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -333,6 +333,8 @@ public class Contacts.ContactPane : EventBox {
     combo.set_active (detail);
     layout.add_widget_label (combo);
     var entry = layout.add_entry (detail.value);
+    var remove_button = layout.add_remove ();
+    var row = layout.current_row;
     detail.set_data ("entry", entry);
     detail.set_data ("combo", combo);
     detail_set.add (detail);
@@ -345,6 +347,13 @@ public class Contacts.ContactPane : EventBox {
     combo.changed.connect ( () => {
 	update_edit_detail_type (detail_set, combo, property_name);
       });
+
+    remove_button.clicked.connect ( () => {
+	detail_set.remove (detail);
+	editing_persona.set (property_name, detail_set);
+	row.destroy ();
+      });
+
   }
   private void update_edit_details (ContactFrame image_frame, Persona persona) {
     layout.reset (false);
@@ -362,7 +371,6 @@ public class Contacts.ContactPane : EventBox {
 	  add_detail_editor (TypeSet.general,
 			     editing_emails, email,
 			     "email_addresses");
-	  layout.add_remove ();
 	}
       }
     }
@@ -390,7 +398,6 @@ public class Contacts.ContactPane : EventBox {
 	  add_detail_editor (TypeSet.phone,
 			     editing_phones, p,
 			     "phone_numbers");
-	  layout.add_remove ();
 	}
       }
     }



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