pull up r20031 from trunk
authorTom Yu <tlyu@mit.edu>
Mon, 1 Oct 2007 23:54:23 +0000 (23:54 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 1 Oct 2007 23:54:23 +0000 (23:54 +0000)
 r20031@cathode-dark-space:  jaltman | 2007-10-01 01:27:29 -0400
 ticket: new
 subject: NIM: BUG: APP: notification icon state

 Currently, the notification icon that is created by Network Identity
 Manager indicates the status of all the known credentials.  If any
 credential belonging to any identity is expired or in a critical
 state, the icon will change color to indicate this.

 This patch changes the behavior to only indicate the status of
 credentials belonging to the default identity.  The expiration state
 of credentials that do not belong to the default identity no longer
 affect the appearance of the notification icon.

ticket: 5796
version_fixed: 1.6.3

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20072 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/identity/ui/credwnd.c

index e58786363a72b3369ebbe59f4513331c1e9779df..913503f04c10d37d67f258573f2dff2450c139d2 100644 (file)
@@ -1445,7 +1445,6 @@ cw_update_outline(khui_credwnd_tbl * tbl)
     khm_size cbbuf;
     khm_int32 flags;
     int selected;
-    khm_int32 expstate = 0;
 
     /*  this is called after calling cw_update_creds, so we assume
         that the credentials are all loaded and sorted according to
@@ -1715,7 +1714,6 @@ cw_update_outline(khui_credwnd_tbl * tbl)
                 if (flags) {
                     ol->flags |= flags;
                     ol->flags |= KHUI_CW_O_SHOWFLAG;
-                   expstate |= flags;
                 } else if (grouping[j] == tbl->n_cols - 1) {
                     /* if we aren't showing any creds under this
                        outline level, we should also show any
@@ -1994,17 +1992,34 @@ cw_update_outline(khui_credwnd_tbl * tbl)
         tbl->cursor_row = 0;
 
 _exit:
-    /* note that the expstate is derived from whether or not 
-     * we have expiration states set for any active identities */
-    if (n_creds == 0)
-        khm_notify_icon_expstate(KHM_NOTIF_EMPTY);
-    else if ((expstate & CW_EXPSTATE_EXPIRED) == CW_EXPSTATE_EXPIRED)
-        khm_notify_icon_expstate(KHM_NOTIF_EXP);
-    else if ((expstate & CW_EXPSTATE_WARN) == CW_EXPSTATE_WARN ||
-             (expstate & CW_EXPSTATE_CRITICAL) == CW_EXPSTATE_CRITICAL)
-        khm_notify_icon_expstate(KHM_NOTIF_WARN);
-    else
-        khm_notify_icon_expstate(KHM_NOTIF_OK);
+
+    {
+        khm_handle def_ident = NULL;
+        khm_int32 def_expstate = 0;
+        khm_boolean def_empty = TRUE;
+
+        kcdb_identity_get_default(&def_ident);
+        if (def_ident) {
+            khui_credwnd_ident * cwi;
+
+            cwi = cw_find_ident(tbl, def_ident);
+            if (cwi) {
+                def_empty = (cwi->id_credcount == 0);
+            }
+
+            def_expstate = cw_get_buf_exp_flags(tbl, def_ident);
+        }
+
+        if (def_empty)
+            khm_notify_icon_expstate(KHM_NOTIF_EMPTY);
+        else if ((def_expstate & CW_EXPSTATE_EXPIRED) == CW_EXPSTATE_EXPIRED)
+            khm_notify_icon_expstate(KHM_NOTIF_EXP);
+        else if ((def_expstate & CW_EXPSTATE_WARN) == CW_EXPSTATE_WARN ||
+                 (def_expstate & CW_EXPSTATE_CRITICAL) == CW_EXPSTATE_CRITICAL)
+            khm_notify_icon_expstate(KHM_NOTIF_WARN);
+        else
+            khm_notify_icon_expstate(KHM_NOTIF_OK);
+    }
 }
 
 void