fix HasNonTrivialIdentities
authorKevin Wasserman <krwasserman@hotmail.com>
Tue, 17 Sep 2013 16:45:52 +0000 (12:45 -0400)
committerKevin Wasserman <krwasserman@hotmail.com>
Tue, 17 Sep 2013 16:45:52 +0000 (12:45 -0400)
Now returns true when the current store either has a 'NoIdentity'
card with at least one rule or service, or any other identity.

src/moonshot-identities-manager.vala

index 51f9d64..e434503 100644 (file)
@@ -97,8 +97,16 @@ public class IdentityManagerModel : Object {
      }
 
      public bool HasNonTrivialIdentities() {
-         var identities = store.get_card_list();
-         return !identities.is_empty;
+         foreach (IdCard card in this.store.get_card_list()) {
+             // The 'NoIdentity' card is non-trivial if it has services or rules.
+             // All other cards are automatically non-trivial.
+             if ((!card.IsNoIdentity()) || 
+                 (card.services.length > 0) ||
+                 (card.rules.length > 0)) {
+                 return true;
+             }
+         }
+         return false;
      }