Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_desklock.c 


Log Message:
send signal to indicate that password is currently being checked
send signal in the event that an invalid password has been entered
update text to indicate current state
don't accept text input while authenticating (as the text gets whiped out if it 
was wrong once pam returns)

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_desklock.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- e_desklock.c        4 Apr 2007 11:43:36 -0000       1.37
+++ e_desklock.c        19 Apr 2007 03:44:47 -0000      1.38
@@ -8,6 +8,10 @@
 # include <limits.h>
 #endif
 
+#define E_DESKLOCK_STATE_DEFAULT 0
+#define E_DESKLOCK_STATE_CHECKING 1
+#define E_DESKLOCK_STATE_INVALID 2
+
 #define ELOCK_POPUP_LAYER 10000
 #define PASSWD_LEN 256
 
@@ -32,6 +36,7 @@
    Evas_List     *handlers;
    Ecore_X_Window  elock_grab_break_wnd;
    char                   passwd[PASSWD_LEN];
+   int            state;       
 };
 #ifdef HAVE_PAM
 struct _E_Desklock_Auth
@@ -72,6 +77,7 @@
 static void _e_desklock_delete();
 static int  _e_desklock_zone_num_get();
 static int _e_desklock_check_auth();
+static void _e_desklock_state_set(int state);
 
 #ifdef HAVE_PAM
 static int _e_desklock_cb_exit(void *data, int type, void *event);
@@ -395,7 +401,7 @@
    Ecore_X_Event_Key_Down *ev;
    
    ev = event;
-   if (ev->win != edd->elock_wnd) return 1;
+   if (ev->win != edd->elock_wnd || edd->state == E_DESKLOCK_STATE_CHECKING) 
return 1;
 
    if (!strcmp(ev->keysymbol, "Escape"))
      ;
@@ -560,12 +566,43 @@
 #ifdef HAVE_PAM
      }
 #endif
-   /* passowrd is definitely wrong */
+   /* password is definitely wrong */
+   _e_desklock_state_set(E_DESKLOCK_STATE_INVALID);
    memset(edd->passwd, 0, sizeof(char) * PASSWD_LEN);
    _e_desklock_passwd_update();
    return 0;
 }
 
+static void
+_e_desklock_state_set(int state)
+{
+   Evas_List *l;
+   const char *signal, *text;
+   if (!edd) return;
+
+   edd->state = state;
+   if (state == E_DESKLOCK_STATE_CHECKING)
+     {
+       signal = "e,state,checking";
+       text = "Authenticating...";
+     }
+   else if (state == E_DESKLOCK_STATE_INVALID)
+     {
+       signal = "e,state,invalid";
+       text = "The password you entered is invalid. Try again.";
+     }
+
+   for (l = edd->elock_wnd_list; l; l = l->next)
+     {
+       E_Desklock_Popup_Data *edp;
+       edp = l->data;
+       edje_object_signal_emit(edp->login_box, signal, "e.desklock");
+       edje_object_signal_emit(edp->bg_object, signal, "e.desklock");
+       edje_object_part_text_set(edp->login_box, "e.text.title", text);
+     }
+}
+
+
 #ifdef HAVE_PAM
 static int
 _e_desklock_cb_exit(void *data, int type, void *event)
@@ -598,6 +635,7 @@
        /* failed auth */
        else
          {
+            _e_desklock_state_set(E_DESKLOCK_STATE_INVALID);
             /* security - null out passwd string once we are done with it */
             memset(edd->passwd, 0, sizeof(char) * PASSWD_LEN);
             _e_desklock_passwd_update();
@@ -611,6 +649,7 @@
 static int
 _desklock_auth(char *passwd)
 {
+   _e_desklock_state_set(E_DESKLOCK_STATE_CHECKING);
    if ((_e_desklock_child_pid = fork()))
      {
        /* parent */



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to