[gnome-contacts] Fixed: Unlinked account from LinkedAccounts dialog.



commit 6de1393a4f08ea0cb7e6214ed92f48eb2d7d29af
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Wed Feb 13 23:59:01 2013 -0500

    Fixed: Unlinked account from LinkedAccounts dialog.
    
    I'm not pretty sure about this fix. It doesn't look
    too stable to me. Link/unlink is kinda magical. It needs
    test and better implementation.

 src/contacts-contact-pane.vala           |    9 ++++++++-
 src/contacts-linked-accounts-dialog.vala |   15 ++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 3a87cf8..78fbfbe 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -462,7 +462,14 @@ public class Contacts.ContactPane : Notebook {
 
   void linked_accounts () {
     var dialog = new LinkedAccountsDialog (contact);
-    dialog.show_all ();
+    var result = dialog.run ();
+    if (result == ResponseType.CLOSE &&
+       dialog.any_unlinked) {
+      /* update edited contact if any_unlinked */
+      set_edit_mode (false);
+      set_edit_mode (true);
+    }
+    dialog.destroy ();
   }
 
   void delete_contact () {
diff --git a/src/contacts-linked-accounts-dialog.vala b/src/contacts-linked-accounts-dialog.vala
index 5ae6d57..ebe8557 100644
--- a/src/contacts-linked-accounts-dialog.vala
+++ b/src/contacts-linked-accounts-dialog.vala
@@ -20,11 +20,15 @@ using Gtk;
 using Folks;
 
 public class Contacts.LinkedAccountsDialog : Dialog {
-  private Contact contact;
-  private Egg.ListBox linked_accounts_view;
+  Contact contact;
+  Egg.ListBox linked_accounts_view;
+
+  public bool any_unlinked;
 
   public LinkedAccountsDialog (Contact contact) {
     this.contact = contact;
+    any_unlinked = false;
+
     set_title (_("%s - Linked Accounts").printf (contact.display_name));
     set_transient_for (App.app.window);
     set_modal (true);
@@ -111,6 +115,8 @@ public class Contacts.LinkedAccountsDialog : Dialog {
                sep.destroy ();
 
              row_grid.destroy ();
+
+             any_unlinked = true;
              /* TODO: Support undo */
              /* TODO: Ensure we don't get suggestion for this linkage again */
            });
@@ -126,10 +132,5 @@ public class Contacts.LinkedAccountsDialog : Dialog {
        row_grid.set_data ("separator", sep);
       }
     }
-
-    /* signals */
-    response.connect ( (response_id) => {
-       this.destroy ();
-      });
   }
 }


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