Revert "Partial fix to S769 Launchpad bug 918418"
authorJavier Jardón <jjardon@gnome.org>
Thu, 26 Jan 2012 22:31:15 +0000 (22:31 +0000)
committerJavier Jardón <jjardon@gnome.org>
Thu, 26 Jan 2012 22:31:15 +0000 (22:31 +0000)
This commit doesnt fix the issue and also introduce more
regressions
This reverts commit 7b9848e69fb9bc8f4b9696ab2232190efa2b3a1d.

src/moonshot-identity-management-view.vala

index 30ee78c..beb6930 100644 (file)
@@ -483,6 +483,7 @@ class IdentityManagerView : Window {
                     }
                 }
             }
+
             /* If more than one candidate we dissasociate service from all ids */
             if (has_srv && candidates.length() > 1)
             {
@@ -491,7 +492,7 @@ class IdentityManagerView : Window {
                     int i = 0;
                     SList<string> services_list = null;
                     bool has_service = false;
-// this is problematic - 
+
                     foreach (string srv in id.services)
                     {
                         if (srv == request.service)
@@ -577,55 +578,54 @@ class IdentityManagerView : Window {
         return pspec.match_string (service);
     }
 
-    public void send_identity_cb (IdCard? identity)  //identity will be null if no matching card was found
+    public void send_identity_cb (IdCard identity)
     {
         return_if_fail (request_queue.length > 0);
 
         var request = this.request_queue.pop_head ();
         bool reset_password = false;
 
-        if (identity != null)
+        if (request.service != null && request.service != "")
         {
-            if (request.service != null && request.service != "")
-            {
-                string[] services = new string[identity.services.length + 1];
+            string[] services = new string[identity.services.length + 1];
 
-                for (int i = 0; i < identity.services.length; i++)
-                    services[i] = identity.services[i];
-    
-                services[identity.services.length] = request.service;
+            for (int i = 0; i < identity.services.length; i++)
+                services[i] = identity.services[i];
 
-                identity.services = services;
+            services[identity.services.length] = request.service;
 
-//            identities_manager.store_id_cards();
-            }
+            identity.services = services;
 
-            if (identity.password == null)
-            {
-                var dialog = new AddPasswordDialog ();
-                var result = dialog.run ();
-    
-                switch (result) {
-                case ResponseType.OK:
-                    identity.password = dialog.password;
-                    reset_password = ! dialog.remember;
-                    break;
-                default:
-                    identity = null;
-                    break;
-                }
+//            identities_manager.store_id_cards();
+        }
 
-                dialog.destroy ();
+        if (identity.password == null)
+        {
+            var dialog = new AddPasswordDialog ();
+            var result = dialog.run ();
+
+            switch (result) {
+            case ResponseType.OK:
+                identity.password = dialog.password;
+                reset_password = ! dialog.remember;
+                break;
+            default:
+                identity = null;
+                break;
             }
-            this.default_id_card = identity;
+
+            dialog.destroy ();
         }
 
         if (this.request_queue.is_empty())
             this.hide ();
 
+        if (identity != null)
+            this.default_id_card = identity;
+
         request.return_identity (identity);
-        if (reset_password && identity != null)
+
+        if (reset_password)
             identity.password = null;
 
         candidates = null;