[gnome-contacts] Revert "Contacts: fix changing a Google Other contact into a My Contact"



commit eb0552945b0e65f923655535a174fe4657f5bdb7
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Nov 12 12:33:35 2012 +0100

    Revert "Contacts: fix changing a Google Other contact into a My Contact"
    
    This reverts commit 1b03e01d2a86ecff1e5aa45f2ec4767357c1ea90.
    
    We need a eds fix that is not availible in 3.6.

 src/contacts-contact-pane.vala |  123 +++++++++++++++-------------------------
 1 files changed, 46 insertions(+), 77 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 5e5ced5..511d8a5 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -1250,9 +1250,8 @@ class Contacts.AddressFieldSet : FieldSet {
 public class Contacts.PersonaSheet : Grid {
   public ContactPane pane;
   public Persona persona;
-  FieldRow? header;
+  FieldRow header;
   FieldRow footer;
-  int sheet_nr;
 
   static Type[] field_set_types = {
     typeof(LinkFieldSet),
@@ -1269,10 +1268,9 @@ public class Contacts.PersonaSheet : Grid {
   };
   FieldSet? field_sets[8]; // This is really the size of field_set_types
 
-  public PersonaSheet(ContactPane pane, Persona persona, int _sheet_nr) {
+  public PersonaSheet(ContactPane pane, Persona persona, int sheet_nr) {
     assert (field_sets.length == field_set_types.length);
 
-    this.sheet_nr = _sheet_nr;
     this.pane = pane;
     this.persona = persona;
 
@@ -1286,8 +1284,50 @@ public class Contacts.PersonaSheet : Grid {
       Contact.persona_has_writable_property (persona, "postal-addresses");
 
     if (!Contact.persona_is_main (persona) || sheet_nr > 0) {
-      this.build_header ();
-      row_nr = 1;
+      header = new FieldRow (pane.row_group, pane);
+
+      Label label;
+      var grid = header.pack_header_in_grid (Contact.format_persona_store_name_for_contact (persona), out label);
+
+      if (!editable) {
+	var image = new Image.from_icon_name ("changes-prevent-symbolic", IconSize.MENU);
+
+	label.set_hexpand (false);
+	image.get_style_context ().add_class ("dim-label");
+	image.set_hexpand (true);
+	image.set_halign (Align.START);
+	image.set_valign (Align.CENTER);
+	grid.add (image);
+      }
+
+      if (sheet_nr == 0) {
+	var b = new Button.with_label(_("Add to My Contacts"));
+	grid.add (b);
+
+	b.clicked.connect ( () => {
+	    link_contacts.begin (pane.contact, null, (obj, result) => {
+		link_contacts.end (result);
+		/* TODO: Support undo */
+	      });
+	  });
+      } else if (pane.contact.individual.personas.size > 1) {
+	var b = new Button.with_label(_("Unlink"));
+	grid.add (b);
+
+	b.clicked.connect ( () => {
+	    unlink_persona.begin (pane.contact, persona, (obj, result) => {
+		unlink_persona.end (result);
+		/* TODO: Support undo */
+		/* TODO: Ensure we don't get suggestion for this linkage again */
+	      });
+	  });
+      }
+
+      this.attach (header, 0, row_nr++, 1, 1);
+
+      header.clicked.connect ( () => {
+	  this.pane.enter_edit_mode (header);
+	});
     }
 
     for (int i = 0; i < field_set_types.length; i++) {
@@ -1316,65 +1356,6 @@ public class Contacts.PersonaSheet : Grid {
     persona.notify.disconnect(persona_notify_cb);
   }
 
-  private void build_header () {
-    bool editable = Contact.persona_has_writable_property (persona, "email-addresses") &&
-      Contact.persona_has_writable_property (persona, "phone-numbers") &&
-      Contact.persona_has_writable_property (persona, "postal-addresses");
-
-    header = new FieldRow (pane.row_group, pane);
-
-    Label label;
-    var grid = header.pack_header_in_grid (Contact.format_persona_store_name_for_contact (persona), out label);
-
-    if (!editable) {
-      var image = new Image.from_icon_name ("changes-prevent-symbolic", IconSize.MENU);
-
-      label.set_hexpand (false);
-      image.get_style_context ().add_class ("dim-label");
-      image.set_hexpand (true);
-      image.set_halign (Align.START);
-      image.set_valign (Align.CENTER);
-      grid.add (image);
-    }
-
-    if (sheet_nr == 0) {
-      var b = new Button.with_label(_("Add to My Contacts"));
-      grid.add (b);
-
-      if (persona.store.is_primary_store) {
-	// Google Other contact (otherwise it wouldn't be non-main while
-	// being in the primary store)
-	b.clicked.connect ( () => {
-	    (persona as Edsf.Persona).in_google_personal_group = true;
-	  });
-      } else {
-	b.clicked.connect ( () => {
-	    link_contacts.begin (pane.contact, null, (obj, result) => {
-		link_contacts.end (result);
-		/* TODO: Support undo */
-	      });
-	  });
-      }
-    } else if (pane.contact.individual.personas.size > 1) {
-      var b = new Button.with_label(_("Unlink"));
-      grid.add (b);
-
-      b.clicked.connect ( () => {
-	  unlink_persona.begin (pane.contact, persona, (obj, result) => {
-	      unlink_persona.end (result);
-	      /* TODO: Support undo */
-	      /* TODO: Ensure we don't get suggestion for this linkage again */
-	    });
-	});
-    }
-
-    this.attach (header, 0, 0, 1, 1);
-
-    header.clicked.connect ( () => {
-	this.pane.enter_edit_mode (header);
-      });
-  }
-
   private void add_detail () {
     pane.exit_edit_mode (true);
     var title = _("Select detail to add to %s").printf (pane.contact.display_name);
@@ -1460,18 +1441,6 @@ public class Contacts.PersonaSheet : Grid {
 	field_set.refresh_from_persona ();
       }
     }
-
-    if (name == "in-google-personal-group") {
-      bool is_main = Contact.persona_is_main (persona);
-
-      if ((!is_main || sheet_nr > 0) &&
-	  header == null) {
-	this.build_header ();
-      } else if (is_main && sheet_nr == 0 && header != null) {
-	header.destroy();
-	header = null;
-      }
-    }
   }
 }
 



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