Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entrance

Dir     : e17/apps/entrance/src/client


Modified Files:
        Makefile.am entrance.h entrance_auth.c entrance_auth.h 
        entrance_config.c entrance_config.h entrance_session.c 
        entrance_session.h main.c 
Added Files:
        EvasTextEntry.c EvasTextEntry.h 
Removed Files:
        entrance_fx.c entrance_fx.h entrance_theme.c entrance_theme.h 
        events.c events.h intro.c sys_callbacks.c sys_callbacks.h 
        ui_callbacks.c ui_callbacks.h 


Log Message:
Ok, entrance is now using edje for it's themes.  This make the user
interface quite flexible.  For now check out src/client/main.c you don't
have to read code just check the comments or look at
data/themes/default/default.edc for the signals/parts you should define.
I'll hopefully have a tutorial up soon.

What's New:

* Post authentication animation is now possible.  Setup a program to trap
  a signal and run whatever you want.  Emit a signal back to entrance to
  let it know you're done.  
* All of the old functionality is implemented in with the exception of
  users's faces.  I think we should have a ~/.entrance.eet file, but it
  wasn't a priority.

What's Changed:

* The config subsystem changed a lot and is a little cleaner.
    - pointer is now specified in global config
    - For themeing reasons the system can map theme keys to the
      appropriate string XSession expects to launch that session.  This
      is now stored in a hash.
      (i.e. KDE -> kde)
    - Lots of stuff that was in the config is now stored in the entrance
      theme

What's Wrong:

Currently edje freezes in fullscreen mode when there's animation.  For
now I've left it running in an X window, where you'll see the theme
works fine.  Hopefully this will be fixed soon, possibly sooner now that
more than one person is affected by the weirdness =)

What Else:

If you have an understaning of edje or want to possibly get one could
you look through the code and ask questions/make comments.  Since edje
is rather young it'd be nice to have bad habits caught early, as they
make bad examples.



===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Makefile.am 26 May 2003 20:02:31 -0000      1.3
+++ Makefile.am 25 Jul 2003 05:20:02 -0000      1.4
@@ -1,21 +1,15 @@
 ## Process this file with automake to produce Makefile.in
 
-INCLUDES = @ebg_cflags@ @ecore_cflags@ @edb_cflags@ @evas_cflags@
+INCLUDES = @edje_cflags@ @ecore_cflags@ @edb_cflags@ @evas_cflags@
 
 bin_PROGRAMS = entrance
 
 entrance_SOURCES = \
-       sys_callbacks.c sys_callbacks.h \
        entrance_auth.c entrance_auth.h \
        entrance_session.c entrance_session.h \
        entrance_config.c entrance_config.h \
-       entrance_theme.c entrance_theme.h \
-       entrance_fx.c entrance_fx.h \
-       ui_callbacks.c ui_callbacks.h \
-       events.c events.h \
+       EvasTextEntry.c EvasTextEntry.h \
        util.c util.h \
-       entrance.h \
-       intro.c \
        main.c 
 
-entrance_LDADD = @ebg_libs@ @ecore_libs@ @edb_libs@ @evas_libs@
+entrance_LDADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- entrance.h  24 May 2003 00:06:33 -0000      1.2
+++ entrance.h  25 Jul 2003 05:20:02 -0000      1.3
@@ -11,6 +11,6 @@
 #include "util.h"
 #include "entrance_session.h"
 
-#define X_TESTING 0
+#define X_TESTING 1
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_auth.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- entrance_auth.c     24 May 2003 00:06:33 -0000      1.2
+++ entrance_auth.c     25 Jul 2003 05:20:02 -0000      1.3
@@ -173,7 +173,7 @@
       else
       {
          pamerr = pam_setcred(e->pam.handle, 0);
-
+    
          if (pamerr == PAM_SUCCESS)
             result = AUTH_SUCCESS;
          else
@@ -207,7 +207,7 @@
    char *correct = e->pw->pw_passwd;
    struct spwd *sp;
    
-   if (cfg->use_shadow_auth)
+   if (cfg->auth == ENTRANCE_USE_SHADOW)
    {
       sp = getspnam(e->pw->pw_name);
       endspent();
@@ -229,7 +229,7 @@
  * Pass it a char* and it'll set it if it should
  */
 void
-entrance_auth_set_pass(Entrance_Auth e, char *str)
+entrance_auth_set_pass(Entrance_Auth e, const char *str)
 {
    if (str)
       snprintf(e->pass, PATH_MAX, "%s", str);
@@ -244,7 +244,7 @@
  * to the passed in string, if they don't, e->user is unmodified.
  */
 int
-entrance_auth_set_user(Entrance_Auth e, char *str)
+entrance_auth_set_user(Entrance_Auth e, const char *str)
 {
    int result = 0;
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_auth.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- entrance_auth.h     24 May 2003 00:06:33 -0000      1.2
+++ entrance_auth.h     25 Jul 2003 05:20:02 -0000      1.3
@@ -59,10 +59,10 @@
 /* 0 on success, 1 on failure */
 int entrance_auth_cmp_pam(Entrance_Auth e);
 int entrance_auth_cmp_crypt(Entrance_Auth e, Entrance_Config cfg);
-void entrance_auth_set_pass(Entrance_Auth e, char *str);
+void entrance_auth_set_pass(Entrance_Auth e, const char *str);
 
 /* 0 on success, 1 on no user by that name */
-int entrance_auth_set_user(Entrance_Auth e, char *str);
+int entrance_auth_set_user(Entrance_Auth e, const char *str);
 void entrance_auth_setup_environment(Entrance_Auth e);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- entrance_config.c   30 May 2003 00:24:17 -0000      1.5
+++ entrance_config.c   25 Jul 2003 05:20:02 -0000      1.6
@@ -16,37 +16,46 @@
    return (e);
 }
 
-static char *
-get_hostname(void)
-{
-   char buf[255];               /* some standard somewhere limits hostname
-                                   lengths to this */
-   char *result = NULL;
-
-   if (!(gethostname(buf, 255)))
-      result = strdup(buf);
-   else
-      result = strdup("Localhost");
-   return (result);
-}
-
-
 static void
 entrance_config_populate(Entrance_Config e, E_DB_File * db)
 {
    char *str;
-   Evas_List *l = NULL;
-   int i = 0, num_session = 0, def = 0;
+   int i = 0, num_session = 0;
    char buf[PATH_MAX];
-   Entrance_Session_Type *st = NULL;
-
-   Evas_List *U = NULL;
-   Entrance_User *eu = NULL;
-   int num_user;
+   int num_fonts;
 
    if ((!e) || (!db))
       return;
 
+   /* strings 'n things */
+   if ((str = e_db_str_get(db, "/entrance/theme")))
+      e->theme = str;
+   else
+      e->theme = strdup("default.eet");
+
+   if ((str = e_db_str_get(db, "/entrance/pointer")))
+       e->pointer = str;
+   else
+       e->pointer = strdup(PACKAGE_DATA_DIR"/images/pointer.png");
+
+   if ((str = e_db_str_get(db, "/entrance/greeting/before")))
+      e->before.string = str;
+   else
+      e->before.string = strdup("Welcome to ");
+   if ((str = e_db_str_get(db, "/entrance/greeting/after")))
+      e->after.string = str;
+   else
+      e->after.string = strdup(":");
+   if ((str = e_db_str_get(db, "/entrance/date_format")))
+          e->date.string = str;
+   else
+          e->date.string = strdup("%A %B %e, %Y");
+
+   if ((str = e_db_str_get(db, "/entrance/time_format")))
+          e->time.string = str;
+   else
+          e->time.string = strdup("%l:%M:%S %p");
+#if 0
    if (e_db_int_get(db, "/entrance/user/count", &num_user))
    {
       for (i = 0; i < num_user; i++)
@@ -71,74 +80,40 @@
       e->users = NULL;
       syslog(LOG_WARNING, "Warning: No users found.");
    }
+#endif
 
-
-   st = (Entrance_Session_Type *) malloc(sizeof(Entrance_Session_Type));
-   memset(st, 0, sizeof(Entrance_Session_Type));
-   st->name = "Default";
-   st->path = "default";
-   st->icon = PACKAGE_DATA_DIR "/images/sessions/default.png";
-   l = evas_list_append(l, st);
-
-   if (!e_db_int_get(db, "/entrance/session/default", &def))
-      def = 0;
-
+   /* session hash and font list */
    if (e_db_int_get(db, "/entrance/session/count", &num_session))
    {
+       char *key = NULL;
+       char *value = NULL;
+
       for (i = 0; i < num_session; i++)
       {
-         st = (Entrance_Session_Type *) malloc(sizeof(Entrance_Session_Type));
-         memset(st, 0, sizeof(Entrance_Session_Type));
-
-         snprintf(buf, PATH_MAX, "/entrance/session/%d/name", i);
-         st->name = e_db_str_get(db, buf);
-         snprintf(buf, PATH_MAX, "/entrance/session/%d/path", i);
-         st->path = e_db_str_get(db, buf);
-         snprintf(buf, PATH_MAX, "/entrance/session/%d/icon", i);
-         str = e_db_str_get(db, buf);
-         snprintf(buf, PATH_MAX, "%s/images/sessions/%s",
-                  PACKAGE_DATA_DIR, str);
-         st->icon = strdup(buf);
-         l = evas_list_append(l, st);
-
-         if (i == def)
-         {
-            e->default_session = st;
-            e->default_index = i;
-         }
+         snprintf(buf, PATH_MAX, "/entrance/session/%d/value", i);
+         value = e_db_str_get(db, buf);
+         snprintf(buf, PATH_MAX, "/entrance/session/%d/key", i);
+         key = e_db_str_get(db, buf);
+       
+        e->sessions = evas_hash_add(e->sessions, key, value);
+        free(key);
       }
-      e->sessions = l;
    }
-   else
+   if (e_db_int_get(db, "/entrance/fonts/count", &num_fonts))
    {
-      evas_list_append(e->sessions, NULL);
-      e->sessions = NULL;
-      syslog(LOG_WARNING, "Warning: No sessions found, using default.");
+      char *value = NULL;
+      for (i = 0; i < num_fonts; i++)
+      {
+         snprintf(buf, PATH_MAX, "/entrance/fonts/%d/str", i);
+         if((value = e_db_str_get(db, buf)))
+        {
+            e->fonts = evas_list_append(e->fonts, value);
+        }
+       
+      }
    }
 
-   if ((str = e_db_str_get(db, "/entrance/theme")))
-      e->theme = str;
-   else
-      e->theme = strdup("BlueCrystal");
-
-   if ((str = e_db_str_get(db, "/entrance/welcome")))
-      e->welcome = str;
-   else
-      e->welcome = strdup("Enter your username");
-
-   if ((str = e_db_str_get(db, "/entrance/passwd")))
-      e->passwd = str;
-   else
-      e->passwd = strdup("Enter your password...");
-
-   if ((str = e_db_str_get(db, "/entrance/greeting")))
-      e->greeting = str;
-   else
-      e->greeting = strdup("Welcome to");
-
-   if (!e_db_int_get(db, "/entrance/passwd_echo", &(e->passwd_echo)))
-      e->passwd_echo = 1;
-
+#if 0
    if (!e_db_int_get(db, "/entrance/xinerama/screens/w", &(e->screens.w)))
       e->screens.w = 1;
    if (!e_db_int_get(db, "/entrance/xinerama/screens/h", &(e->screens.h)))
@@ -147,37 +122,23 @@
       e->display.w = 1;
    if (!e_db_int_get(db, "/entrance/xinerama/on/h", &(e->display.h)))
       e->display.h = 1;
+#endif
 
-   str = get_hostname();
-   snprintf(buf, PATH_MAX, "%s %s", e->greeting, str);
-   free(e->greeting);
-   free(str);
-   e->greeting = strdup(buf);
-
-   /* get the format strings used to display the current date and time */ 
-   if ((str = e_db_str_get(db, "/entrance/date_format")))
-          e->date_format = str;
-   else
-          e->date_format = strdup("%A %B %e, %Y");
-
-   if ((str = e_db_str_get(db, "/entrance/time_format")))
-          e->time_format = str;
-   else
-          e->time_format = strdup("%l:%M:%S %p");
-
-   if (!e_db_int_get(db, "/entrance/use_pam_auth", &(e->use_pam_auth)))
-      e->use_pam_auth = 0;
 
-   if (!e->use_pam_auth)
-   {
-      /* check whether /etc/shadow can be used for authentication */
-         if (!access("/etc/shadow", R_OK))
-                 e->use_shadow_auth = 1;
-         else if (!access("/etc/shadow", F_OK))
-      {
+   /* auth info */
+   if (!e_db_int_get(db, "/entrance/auth", &(e->auth)))
+      e->auth = 0;
+
+   if (e->auth != ENTRANCE_USE_PAM)
+   {
+       /* check whether /etc/shadow can be used for authentication */
+       if (!access("/etc/shadow", R_OK))
+          e->auth = ENTRANCE_USE_SHADOW;
+       else if (!access("/etc/shadow", F_OK))
+       {
          syslog(LOG_CRIT, "/etc/shadow was found but couldn't be read. Run entrance 
as root.");
          exit(-1);
-      }
+       }
    }
 #ifndef HAVE_PAM
    else
@@ -225,17 +186,18 @@
 {
    if (e)
    {
-      if (e->passwd)
-         free(e->passwd);
-      if (e->welcome)
-         free(e->welcome);
       if (e->theme)
          free(e->theme);
-         if (e->date_format)
-                 free(e->date_format);
-         if (e->time_format)
-                 free(e->time_format);
-
+      if (e->pointer)
+         free(e->pointer);
+      if (e->date.string)
+         free(e->date.string);
+      if (e->time.string)
+         free(e->time.string);
+      if(e->before.string) 
+         free(e->before.string);
+      if(e->after.string) 
+         free(e->after.string);
       free(e);
    }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- entrance_config.h   24 May 2003 00:06:33 -0000      1.4
+++ entrance_config.h   25 Jul 2003 05:20:02 -0000      1.5
@@ -12,29 +12,65 @@
 #include <unistd.h>
 #include <syslog.h>
 
+#define ENTRANCE_USE_PAM 1
+#define ENTRANCE_USE_SHADOW 2
+
 struct _Entrance_Config
 {
-   char *welcome, *passwd, *greeting;
+   /**
+    * theme - the theme we want entrance ui to use
+    */
+   char *theme;
+   /**
+    * pointer - path to the file on disk we want to use as the pointer
+    */
+   char *pointer;
+   
+   /**
+    * before - the string before the hostname in "EntranceHostname"
+    * after - the string to append after hostname in "EntranceHostname"
+    * date - the date format fed to strftime for "EntranceDate"
+    * time - the time format fed to strftime for "EntranceTime"
+    */
+   struct {
+       char *string;
+   } before, after, date, time;
 
-   int passwd_echo;
-   struct
-   {
+   /**
+    * don't know how applicable these are anymore, since layout is left
+    * up to the edje the variables are currently unused
+    */
+   struct {
       int w, h;
-   }
-   screens, display;            /* screens are the number of display */
-   /* display is the screen for the "center" */
+   } screens, display;            
+
+   /**
+    * ENTRANCE_USE_PAM - if set to use pam authentication
+    * ENTRANCE_USE_SHADOW- if set to use shadow auth if pam is not avail
+    */
+   int auth;
+
+   struct {
+       int allow;
+   } reboot, halt;
+
+   /**
+    * fonts - available font paths for fonts
+    */
+   Evas_List *fonts;
+   /**
+    * users - users known to the system
+    */
    Evas_List *users;
-   Evas_List *sessions;
-   int default_index;
-   void *default_session;
-   char *theme;
-   char *date_format, *time_format;
-   int use_pam_auth;
-   int use_shadow_auth;
+   /**
+    * sessions - a themable string to xsession string hash
+    */
+   Evas_Hash *sessions;
 };
 
 typedef struct _Entrance_Config *Entrance_Config;
 
+#if 0
 struct _Entrance_User
 {
    char *name;
@@ -44,7 +80,7 @@
 };
 
 typedef struct _Entrance_User Entrance_User;
-
+#endif
 
 Entrance_Config entrance_config_parse(char *file);
 void entrance_config_print(Entrance_Config e);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- entrance_session.c  24 May 2003 00:06:33 -0000      1.7
+++ entrance_session.c  25 Jul 2003 05:20:02 -0000      1.8
@@ -1,11 +1,6 @@
-#include"entrance_session.h"
-#include"sys_callbacks.h"
-#include "ui_callbacks.h"
-#include <Evas_Engine_Software_X11.h>
-
-extern void intro_init(Entrance_Session e);
-
-#define RENDER_METHOD RENDER_METHOD_ALPHA_SOFTWARE
+#include "entrance.h"
+#include "entrance_session.h"
+#include <X11/Xlib.h>
 
 /**
  * entrance_session_new: allocate a new  Entrance_Session
@@ -24,23 +19,38 @@
    e->config = entrance_config_parse(PACKAGE_CFG_DIR "/entrance_config.db");
    if (!e->config)
    {
+       fprintf(stderr, "%s\n", PACKAGE_CFG_DIR "/entrance_config.db");
       syslog(LOG_CRIT, "Fatal Error: Unable to read configuration.");
       exit(1);
    }
    snprintf(theme_path, PATH_MAX, PACKAGE_DATA_DIR "/themes/%s",
             e->config->theme);
-   e->theme = entrance_theme_parse(e->config->theme, theme_path);
-   if (!e->theme)
-   {
-      syslog(LOG_CRIT, "Fatal Error: Unable to load specified theme.");
-      exit(1);
-   }
-   e->theme->name = strdup(e->config->theme);
+   e->theme = strdup(e->config->theme);
+/* ?
    e->theme->path = strdup(theme_path);
-
-   return (e);
+*/
+   return(e);
 }
 
+void
+entrance_session_ecore_evas_set(Entrance_Session e, Ecore_Evas *ee)
+{
+   Evas *evas  = NULL;
+   if(!e || !ee) return;
+   
+    e->ee = ee;
+    if((evas = ecore_evas_get(ee)))
+    {
+       Evas_List *l;
+       /* free the font list when we're done */
+       for(l = e->config->fonts; l; l = l->next)
+       {
+           evas_font_path_append(evas, (char*)l->data);
+           free(l->data);
+       }
+       e->config->fonts = evas_list_free(e->config->fonts);
+    }
+}
 
 /**
  * entrance_session_free: free the entrance session
@@ -52,312 +62,30 @@
    {
       entrance_auth_free(e->auth);
       entrance_config_free(e->config);
-      evas_object_del(e->pointer);
-      e_bg_free(e->bg);
-      evas_free(e->evas);
-      ecore_window_destroy(e->main_win);
-      free(e);
-   }
-}
-
-static void
-init_session_list(Entrance_Session e)
-{
-   int ix, iy, i = 0;
-   double px, py;
-   Evas_List *l;
-   Evas_Object *li;
-   Entrance_Theme t = e->theme;
-   char buf[PATH_MAX];
+      ecore_evas_free(e->ee);
+      free(e->theme);
 
-   px =
-      (t->session_list.pos.x * (double) e->geom.w) +
-      (double) t->session_list.offset.x;
-   py =
-      (t->session_list.pos.y * (double) e->geom.h) +
-      (double) t->session_list.offset.y;
-
-   /* Build session list */
-   ix = (int) (px + 20.0);
-   iy = (int) (py + 20.0);
-
-   /* TODO: Add a theme option for session list margin (as if we don't have
-      enough theme options! */
-
-   e->listitems = NULL;
-/*   for(l = e->config->sessions; 
-       l && iy <= (int) py + t->session_list.size.h 
-                           - 20 - t->session_list.font.size;
-       l = l->next) */
-   for (l = e->config->sessions; l; l = l->next)
-   {
-      char *session_name =
-         ((Entrance_Session_Type *) evas_list_data(l))->name;
-      li = evas_object_text_add(e->evas);
-      snprintf(buf, PATH_MAX, "session_list_item_%d", i);
-      evas_object_name_set(li, buf);
-      THEME_SETFONT(li, t->session_list);
-      THEME_SETCOLOR(li, t->session_list.color);
-      evas_object_text_text_set(li, session_name);
-      evas_object_layer_set(li, 25);
-      evas_object_move(li, (double) ix, (double) iy);
-      evas_object_resize(li, (double) t->session_list.size.w - 40.0,
-                         (double) t->session_list.font.size + 7.0);
-      /* Callbacks */
-      evas_object_event_callback_add(li, EVAS_CALLBACK_MOUSE_UP,
-                                     session_list_clicked_cb, e);
-      evas_object_event_callback_add(li, EVAS_CALLBACK_MOUSE_IN,
-                                     session_list_mousein_cb, e);
-      evas_object_event_callback_add(li, EVAS_CALLBACK_MOUSE_OUT,
-                                     session_list_mouseout_cb, e);
-      e->listitems = evas_list_append(e->listitems, li);
-      iy += e->theme->session_list.font.size + 8;
-      ++i;
+      free(e);
    }
-
-   /* Session List Box */
-   e->listbox = evas_object_rectangle_add(e->evas);
-   evas_object_name_set(e->listbox, "session_list_box");
-   evas_object_move(e->listbox, px, py);
-   iy = 40 + (t->session_list.font.size + 8) * evas_list_count(e->listitems);
-   evas_object_resize(e->listbox, (double) t->session_list.size.w,
-                      (double) iy);
-   THEME_SETCOLOR(e->listbox, t->session_list.box_color);
-   evas_object_layer_set(e->listbox, 4);
-
-   /* Set default session */ ;
-   l = e->config->sessions;
-   if (e->config->default_session)
-      e->session = e->config->default_session;
-   else if (l)
-      e->session = evas_list_data(l);
-   else
-      e->session = NULL;
-
-   e->session_index = e->config->default_index;
-
-   e->EntUsers = e->config->users;
-
 }
 
+#if 0
 static void
-init_session_selector(Entrance_Session e)
+init_user_edje(Entrance_Session e, char *user)
 {
-   Entrance_Theme t = e->theme;
-
-   /* Selected Session Text */
-   e->sessiontext = evas_object_text_add(e->evas);
-   THEME_SETFONT(e->sessiontext, t->selected_session.text);
-   evas_object_text_text_set(e->sessiontext, e->session->name);
-   evas_object_layer_set(e->sessiontext, 9);
-   evas_object_name_set(e->sessiontext, "session_selector");
-   THEME_SETCOLOR(e->sessiontext, t->selected_session.text.color);
-   THEME_MOVE(e->sessiontext, t->selected_session.text, e->geom);
-   evas_object_event_callback_add(e->sessiontext, EVAS_CALLBACK_MOUSE_UP,
-                                  session_selector_clicked_cb, e);
-   evas_object_event_callback_add(e->sessiontext, EVAS_CALLBACK_MOUSE_IN,
-                                  session_selector_mousein_cb, e);
-   evas_object_event_callback_add(e->sessiontext, EVAS_CALLBACK_MOUSE_OUT,
-                                  session_selector_mouseout_cb, e);
-   evas_object_show(e->sessiontext);
-
-   e->sessionicon = evas_object_image_add(e->evas);
-   evas_object_name_set(e->sessionicon, "session_icon");
-   evas_object_image_file_set(e->sessionicon, e->session->icon, NULL);
-   THEME_MOVE(e->sessionicon, t->selected_session.icon, e->geom);
-   THEME_IMAGE_RESIZE(e->sessionicon, t->selected_session.icon);
-   evas_object_layer_set(e->sessionicon, 9);
-   evas_object_show(e->sessionicon);
-}
-
-static void
-init_login_face(Entrance_Session e)
-{
-   Entrance_Theme t = e->theme;
-
-   e->face = evas_object_image_add(e->evas);
-   evas_object_name_set(e->face, "login_face");
-   THEME_MOVE(e->face, t->face, e->geom);
-   THEME_IMAGE_RESIZE(e->face, t->face);
-   evas_object_layer_set(e->face, 20);
-   evas_object_image_border_set(e->face, t->face.border, t->face.border,
-                                t->face.border, t->face.border);
-   /* FIXME: Darn, yet another theme option that needs to be added */
-   evas_object_color_set(e->face, 255, 255, 255, 255);
-
-   /* Shadow */
-   e->face_shadow = evas_object_rectangle_add(e->evas);
-   evas_object_name_set(e->face_shadow, "login_face_shadow");
-   THEME_RESIZE(e->face_shadow, t->face);
-   evas_object_move(e->face_shadow,
-                    (t->face.pos.x * (double) e->geom.w) +
-                    (double) t->face.offset.x + 5,
-                    (t->face.pos.y * (double) e->geom.h) +
-                    (double) t->face.offset.y + 5);
-   evas_object_color_set(e->face_shadow, 0, 0, 0, 128);
-   evas_object_layer_set(e->face_shadow, 19);
-}
-
-static void
-init_info_section(Entrance_Session e)
-{
-   Entrance_Theme t = e->theme;
-
-   /* Greeting message/hostname */
-   e->hostname = evas_object_text_add(e->evas);
-   evas_object_text_text_set(e->hostname, e->config->greeting);
-   evas_object_name_set(e->hostname, "info_hostname");
-   THEME_SETFONT(e->hostname, t->hostname);
-   THEME_SETCOLOR(e->hostname, t->hostname.color);
-   THEME_MOVE(e->hostname, t->hostname, e->geom);
-   evas_object_layer_set(e->hostname, 10);
-   evas_object_show(e->hostname);
-
-   /* Date */
-   e->date = evas_object_text_add(e->evas);
-   evas_object_name_set(e->date, "info_date");
-   evas_object_text_text_set(e->date, "");
-   THEME_SETFONT(e->date, t->date);
-   THEME_SETCOLOR(e->date, t->date.color);
-   THEME_MOVE(e->date, t->date, e->geom);
-   evas_object_layer_set(e->date, 10);
-   evas_object_show(e->date);
-   ecore_add_event_timer("date_update", 0.1, entrance_update_time_cb, 0, e);
-
-   /* Time */
-   e->time = evas_object_text_add(e->evas);
-   evas_object_name_set(e->time, "info_time");
-   evas_object_text_text_set(e->time, "");
-   THEME_SETFONT(e->time, t->time);
-   THEME_SETCOLOR(e->time, t->time.color);
-   THEME_MOVE(e->time, t->time, e->geom);
-   evas_object_layer_set(e->time, 10);
-   evas_object_show(e->time);
-   ecore_add_event_timer("time_update", 0.1, entrance_update_time_cb, 1, e);
+    fprintf(stderr, "I should load /home/%s/.entrance.eet\n", user);
 }
-
-static void
-entrance_window_prepare(Entrance_Session e)
-{
-   int iw, ih;
-
-   e->bg = NULL;
-
-   /* Set up the background */
-   /* Try theme first */
-   if ((e->theme) && (e->theme->bg))
-      e->bg = e_bg_load(e->theme->bg);
-   /* Then try default */
-   if (!e->bg)
-      e->bg = e_bg_load(PACKAGE_DATA_DIR "/bgs/entrance.bg.db");
-   /* Bilious barnacles! Blank background. */
-   if (!e->bg)
-      e->bg = e_bg_new();
-
-   e_bg_add_to_evas(e->bg, e->evas);
-   e_bg_resize(e->bg, e->geom.w, e->geom.h);
-   e_bg_set_layer(e->bg, 0);
-   e_bg_show(e->bg);
-
-   /* Graphical Pointer */
-   e->pointer = evas_object_image_add(e->evas);
-   evas_object_image_file_set(e->pointer, e->theme->pointer, NULL);
-   evas_object_image_size_get(e->pointer, &iw, &ih);
-   evas_object_resize(e->pointer, iw, ih);
-   evas_object_image_fill_set(e->pointer, 0.0, 0.0, (double) iw, (double) ih);
-   evas_object_layer_set(e->pointer, 2000);
-   evas_object_pass_events_set(e->pointer, 1);
-   evas_object_show(e->pointer);
-}
-
+#endif
 
 /**
- * entrance_session_init: Initialize the session by taking over the screen
- * @e - the Entrance_Session to be initialized
+ * entrance_session_run: Be a login dm
+ * @e - the Entrance_Session to be run
  */
 void
-entrance_session_init(Entrance_Session e)
+entrance_session_run(Entrance_Session e)
 {
-   Evas_Engine_Info_Software_X11 *einfo;
-   XSetWindowAttributes att;
-   Window window;
-   Display *disp;
-   Window win, ewin;
-   Evas *evas;
-
-   if (!e)
-      exit(1);
-
-#if X_TESTING
-   win = ecore_window_new(0, 0, 0, 800, 600);
-   ecore_window_set_events(win, XEV_CONFIGURE | XEV_PROPERTY);
-   ecore_window_set_name_class(win, "Entrance Test", "Main");
-   e->geom.w = 800;
-   e->geom.h = 600;
-#else
-   ecore_window_get_geometry(ecore_window_root(), NULL, NULL, &e->geom.w,
-                             &e->geom.h);
-   win = ecore_window_root();
-#endif
-
-   ecore_window_move(win, 0, 0);
-
-   evas = evas_new();
-   evas_output_method_set(evas, evas_render_method_lookup("software_x11"));
-   evas_output_size_set(evas, e->geom.w, e->geom.h);
-   evas_output_viewport_set(evas, 0, 0, e->geom.w, e->geom.h);
-
-
-   /* the following is specific to the engine */
-   einfo = (Evas_Engine_Info_Software_X11 *) evas_engine_info_get(evas);
-   disp = ecore_display_get();
-
-   einfo->info.display = disp;
-   einfo->info.visual = DefaultVisual(disp, DefaultScreen(disp));
-   einfo->info.colormap = DefaultColormap(disp, DefaultScreen(disp));
-   att.background_pixmap = None;
-   att.colormap = DefaultColormap(disp, DefaultScreen(disp));
-   att.border_pixel = 0;
-   att.event_mask = 0;
-   window =
-      XCreateWindow(disp, win, 0, 0, e->geom.w, e->geom.h, 0,
-                    DefaultDepth(disp, DefaultScreen(disp)), InputOutput,
-                    einfo->info.visual,
-                    CWColormap | CWBorderPixel | CWEventMask | CWBackPixmap,
-                    &att);
-
-   einfo->info.drawable = window;
-   einfo->info.depth = DefaultDepth(disp, DefaultScreen(disp));
-   einfo->info.rotation = 0;
-   einfo->info.debug = 0;
-   evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);
-
-   ewin = einfo->info.drawable;
-   ecore_window_set_events(ewin,
-                           XEV_EXPOSE | XEV_BUTTON | XEV_MOUSE_MOVE |
-                           XEV_KEY);
-
-   evas_image_cache_set(evas, 0);
-   evas_font_cache_set(evas, 0);
-   evas_font_path_append(evas, PACKAGE_DATA_DIR "/fonts/");
-   if (e->theme && e->theme->path)
-      evas_font_path_append(evas, e->theme->path);
-
-   ecore_window_show(ewin);
-   ecore_window_show(win);
-   ecore_set_blank_pointer(win);
-   e->evas = evas;
-
-   /* Initialize the UI */
-   entrance_window_prepare(e);
-   init_session_list(e);
-   init_session_selector(e);
-   init_login_face(e);
-   init_info_section(e);
-
-   e->ewin = ewin;
-   e->main_win = win;
-   intro_init(e);
+    ecore_evas_show(e->ee);
+    ecore_main_loop_begin();
 }
 
 /**
@@ -368,7 +96,7 @@
 entrance_session_auth_user(Entrance_Session e)
 {
 #ifdef HAVE_PAM
-   if (e->config->use_pam_auth)
+   if (e->config->auth == ENTRANCE_USE_PAM)
       return (entrance_auth_cmp_pam(e->auth));
    else
 #endif
@@ -383,4 +111,53 @@
 {
    entrance_auth_free(e->auth);
    e->auth = entrance_auth_new();
+}
+void
+entrance_session_start_user_session(Entrance_Session e)
+{
+   char buf[PATH_MAX];
+   char *session_key = NULL;
+   
+   entrance_auth_setup_environment(e->auth);
+
+   if((session_key = (char*)evas_hash_find(e->config->sessions, e->session)))
+       snprintf(buf, PATH_MAX, "/etc/X11/Xsession %s", session_key);
+   else
+       snprintf(buf, PATH_MAX, "/etc/X11/Xsession");   /* Default session */
+   /* If a path was specified for the session, use that path instead of
+      passing the session name to Xsession */
+
+#if X_TESTING
+   snprintf(buf, PATH_MAX, "/usr/X11R6/bin/xterm");
+#endif
+
+   syslog(LOG_CRIT, "Executing %s", buf);
+
+   ecore_evas_shutdown();
+
+   syslog(LOG_NOTICE, "Starting session for user \"%s\".", e->auth->user);
+
+#ifdef HAVE_PAM
+   if (e->config->auth == ENTRANCE_USE_PAM)
+   {
+      /* Tell PAM that session has begun */
+      if (pam_open_session(e->auth->pam.handle, 0) != PAM_SUCCESS)
+      {
+        syslog(LOG_CRIT, "Unable to open PAM session. Aborting.");
+        exit(1);
+      }
+   }
+#endif
+   
+   if (initgroups(e->auth->pw->pw_name, e->auth->pw->pw_gid))
+      syslog(LOG_CRIT, "Unable to initialize group (is entrance running as root?).");
+
+   if (setgid(e->auth->pw->pw_gid))
+      syslog(LOG_CRIT, "Unable to set group id.");
+         
+   if (setuid(e->auth->pw->pw_uid))
+      syslog(LOG_CRIT, "Unable to set user id.");
+
+   entrance_auth_free(e->auth);        /* clear users's password out of memory */
+   execl("/bin/sh", "/bin/sh", "-c", buf, NULL);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- entrance_session.h  24 May 2003 00:06:33 -0000      1.3
+++ entrance_session.h  25 Jul 2003 05:20:02 -0000      1.4
@@ -1,9 +1,11 @@
 #ifndef _ENTRANCE_SESSION_H
 #define _ENTRANCE_SESSION_H
 
-#include<Ebg.h>
+#include<Edje.h>
 #include<Evas.h>
 #include<Ecore.h>
+#include<Ecore_X.h>
+#include<Ecore_Evas.h>
 #include<stdio.h>
 #include<limits.h>
 #include<string.h>
@@ -12,62 +14,27 @@
 
 #include "entrance_auth.h"
 #include "entrance_config.h"
-#include "entrance_theme.h"
-
-struct _Entrance_Session_Type
-{
-   char *name;
-   char *path;
-   char *icon;
-};
-
-typedef struct _Entrance_Session_Type Entrance_Session_Type;
 
 struct _Entrance_Session
 {
-   Evas *evas;                  /* the evas being used in the X session */
-   Evas_Object *pointer;        /* object for the pointer in the evas */
-   Evas_Object *listbox;        /* Background for session list */
-   Evas_List *listitems;        /* Items in session list */
-   Evas_Object *sessiontext;
-   Evas_Object *sessionicon;
-   Evas_Object *face, *face_shadow;
-   Evas_Object *entrybox;
-
-   Evas_Object *date;
-   Evas_Object *time;
-   Evas_Object *hostname;
-
-   E_Background bg;             /* ebg in the evas */
+   char *theme;                        /* Theme eet */
+   char *session;                      /* Theme eet */
+   Ecore_Evas *ee;              /* the ecore_evas */
    Entrance_Auth auth;          /* encapsulated auth shit */
    Entrance_Config config;      /* configuration options */
-   Entrance_Theme theme;        /* Theme data */
-   Window main_win, ewin;       /* window ids */
-
-   struct
-   {
-      int w, h;
-   }
-   geom;                        /* the height/width of the evas */
-
-   Entrance_Session_Type *session;     /* The 
-          session 
-          to 
-          load 
-        */
-   int session_index;
 
-   Evas_List *users;            /* recent users */
    Evas_List *EntUsers;
-
-   /* find a way to have plugins running */
+   int authed;
 };
 
 typedef struct _Entrance_Session *Entrance_Session;
 
 Entrance_Session entrance_session_new(void);
+void entrance_session_ecore_evas_set(Entrance_Session e, Ecore_Evas *ee);
 void entrance_session_free(Entrance_Session e);
-void entrance_session_init(Entrance_Session e);
+void entrance_session_run(Entrance_Session e);
 int entrance_session_auth_user(Entrance_Session e);
 void entrance_session_reset_user(Entrance_Session e);
+void entrance_session_start_user_session(Entrance_Session e);
+
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- main.c      24 May 2003 00:06:33 -0000      1.2
+++ main.c      25 Jul 2003 05:20:02 -0000      1.3
@@ -1,47 +1,537 @@
+/**
+ * Corey Donohoe <[EMAIL PROTECTED]>
+ * filename: main.c
+ * Project: Entrance
+ * July 11, 2003
+ * 
+ * Themes are edjes(eet files) and work like this:
+ * 1. A Parts Collection Must be Present, Titled "main"
+ * 2. Entrance makes use of the Parts of main.  If the required column is
+ *    set to No it is an optional feature for the themer.
+ * -------------------------------------------------------------------------
+ * | Key(state1, state2, ... , staten)         | Type         |  Required |
+ * -------------------------------------------------------------------------
+ * | EntrancePassMessage                       | TEXT         | Yes       |
+ * -------------------------------------------------------------------------
+ * | EntranceUserMessage                       | TEXT         | Yes       |
+ * -------------------------------------------------------------------------
+ * | EntrancePassEntry                                 | TEXT         | Yes       |
+ * -------------------------------------------------------------------------
+ * | EntranceUserEntry                                 | TEXT         | Yes       |
+ * -------------------------------------------------------------------------
+ * | EntranceDate(default)                     | TEXT         | No        |
+ * -------------------------------------------------------------------------
+ * | EntranceTime(default)                     | TEXT         | No        |
+ * -------------------------------------------------------------------------
+ * | EntranceHostname(default)                 | TEXT         | No        |
+ * -------------------------------------------------------------------------
+ * | EntranceSession (default, foo, bar)        | TEXT        | No        |
+ * -------------------------------------------------------------------------
+ *
+ * 3. The following signals need to be defined in programs.
+ * -------------------------------------------------------------------------
+ * | Signal                 | Type                                    | Req
+ * -------------------------------------------------------------------------
+ * | EntranceUserAuthSuccess | SIGNAL_EMIT                            | Yes
+ * |                        |  "EntranceUserAuthSuccessDone" ""       |        
+ * -------------------------------------------------------------------------
+ * | EntranceUserFail         |                                       | No
+ * -------------------------------------------------------------------------
+ * | EntranceUserAuthFail      |                                      | No 
+ * -------------------------------------------------------------------------
+ * | EntranceUserAuth          | Theme Specific                               | No
+ * -------------------------------------------------------------------------
+ * | EntranceInputUserFocusIn  | SIGNAL_EMIT "In" "EntranceUserEntry"  | Yes 
+ * -------------------------------------------------------------------------
+ * | EntranceInputUserFocusOut | SIGNAL_EMIT "Out" "EntranceUserEntry" | Yes 
+ * -------------------------------------------------------------------------
+ * | EntranceInputPassFocusIn  | SIGNAL_EMIT "In" "EntrancePassEntry"  | Yes 
+ * -------------------------------------------------------------------------
+ * | EntranceInputPassFocusOut | SIGNAL_EMIT "Out" "EntrancePassEntry" | Yes 
+ * -------------------------------------------------------------------------
+ * | EntranceSystemReboot      |                                       | No 
+ * -------------------------------------------------------------------------
+ * | EntranceSystemHalt               |                                        | No 
+ * -------------------------------------------------------------------------
+ * 
+ */
+#include<time.h>
 #include "entrance.h"
-#include "events.h"
+#include "entrance_session.h"
+#include "EvasTextEntry.h"
 
-void
-setup(void)
+#define WINW 800
+#define WINH 600
+
+static Entrance_Session session = NULL;
+
+/* Callbacks for shit */
+static char *
+get_my_hostname(void)
+{
+   char buf[255];               /* some standard somewhere limits hostname
+                                   lengths to this */
+   char message[PATH_MAX];
+
+   char *result = NULL;
+
+   if (!(gethostname(buf, 255)))
+   {
+       snprintf(message, PATH_MAX, "%s%s%s", session->config->before.string,
+              buf, session->config->after.string);
+   }
+   else
+       snprintf(message, PATH_MAX, "%s Localhost %s", 
+              session->config->before.string, 
+              session->config->after.string);
+   result = strdup(message);
+   return (result);
+}
+
+/**
+ * exit_cb - waht to do if we kill it or something?
+ * @data - no clue
+ * @ev_type - kill event ?
+ * @ev - event data
+ * Obviously I want to exit here.
+ */
+static int
+exit_cb(void *data, int ev_type, void *ev)
+{
+    ecore_main_loop_quit();
+    exit(0);
+}
+
+/**
+ * window_del_cb - what to do when we receive a window delete event
+ * @ee - the Ecore_Evas that received the event
+ */
+static void 
+window_del_cb(Ecore_Evas *ee)
+{
+    ecore_main_loop_quit();
+    exit(0);
+}
+
+/**
+ * window_resize_cb - handle when the ecore_evas needs to be resized
+ * @ee - The Ecore_Evas we're resizing 
+ */
+static void
+window_resize_cb(Ecore_Evas *ee)
+{
+    Evas_Object *o = NULL;
+    
+    if((o = evas_object_name_find(ecore_evas_get(ee), "ui")))
+    {
+       int w, h;
+       ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
+       evas_object_resize(o, w, h);
+    }
+}
+
+/**
+ * focus_swap - swap key input focus between the password and user
+ * entries
+ * @o - the object we want to swap focus with
+ * @selecto - whether to focus on o, or the other entry
+ */ 
+static void
+focus_swap(Evas_Object *o, int selecto)
+{
+    Evas_Object *oo = NULL;
+    Evas_Text_Entry *e = NULL;
+           
+    if((e = evas_object_smart_data_get(o)))
+    {
+       if(!strcmp(e->edje.part, "EntrancePassEntry"))
+       {
+           if((oo = evas_object_name_find(evas_object_evas_get(o), 
+                                           "EntranceUserEntry")))
+           {
+               evas_text_entry_text_set(oo, "");
+           }
+           evas_text_entry_text_set(o, "");
+       }
+       else if(!strcmp(e->edje.part, "EntranceUserEntry"))
+       {
+           oo = evas_object_name_find(evas_object_evas_get(o), 
+                                           "EntrancePassEntry");
+       }
+    }
+    if(oo)
+    {
+       selecto ? 
+           evas_text_entry_focus_set(oo, 0) : evas_text_entry_focus_set(o, 0);
+       
+       selecto ? 
+           evas_text_entry_focus_set(o, 1): evas_text_entry_focus_set(oo, 1);
+    }
+}
+/**
+ * interp_return_key - when Enter is hit on the keyboard we end up here
+ * @data - The smart object that is this Entry
+ * @str - The string that was in the buffer when Enter was pressed
+ */
+static void
+interp_return_key(void *data, const char *str)
+{
+    Evas_Object *o = NULL;
+    Evas_Text_Entry *e = NULL;
+   
+    o = (Evas_Object*)data;
+       
+    if((e = evas_object_smart_data_get(o)))
+    {
+       if(!strcmp(e->edje.part, "EntranceUserEntry"))
+       {
+           if(!entrance_auth_set_user(session->auth, str))
+           {
+               edje_object_signal_emit(e->edje.o,
+                                   "EntranceUserAuth", "");
+               focus_swap(o, 0);
+           }
+           else
+           {
+               evas_text_entry_text_set(o, "");
+               entrance_session_reset_user(session);
+               edje_object_signal_emit(e->edje.o,
+                                   "EntranceUserFail", "");
+               focus_swap(o, 1);
+           }
+       }
+       if(!strcmp(e->edje.part, "EntrancePassEntry"))
+       {
+           if(session->auth->user && strlen(session->auth->user) > 0)
+           {
+               const char *sessionname = NULL;
+               entrance_auth_set_pass(session->auth, str);
+               if(edje_object_part_exists(e->edje.o, "EntranceSession"))
+               {
+                   sessionname = edje_object_part_text_get(e->edje.o, 
+                                                        "EntranceSession");
+                   if(session->session) free(session->session);
+                   session->session = strdup(sessionname);
+               }
+               if(!entrance_session_auth_user(session))
+               {
+                   edje_object_signal_emit(e->edje.o,
+                                           "EntranceUserAuthSuccess", "");
+                   session->authed = 1;
+               }
+               else
+               {
+                   entrance_session_reset_user(session);
+                   edje_object_signal_emit(e->edje.o,
+                               "EntranceUserAuthFail", "");
+                   focus_swap(o, 0);
+               }
+           }
+       }
+    }
+}
+/**
+ * focus - an edje signal emission 
+ * @data - the data passed when the callback was added
+ * @o - the evas object(Edje) that created the signal
+ * @emission - the signal "type" that was emitted
+ * @source - the signal originated from this "part"
+ */
+static void
+focus(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+    Evas_Object *oo = NULL;            /* in nexus this looks in infinity !*/
+    if((oo = (Evas_Object*)data))
+    {
+       if(!strcmp(emission, "In"))
+       {
+           if(!evas_text_entry_is_focused(oo))
+           {
+               evas_text_entry_focus_set(oo, 1);
+           }
+       }
+       else if(!strcmp(emission, "Out"))
+       {
+           if(evas_text_entry_is_focused(oo))
+           {
+               evas_text_entry_focus_set(oo, 1);
+               evas_text_entry_focus_set(oo, 0);
+           }
+       }
+       else
+           fprintf(stderr, "Unknown signal Emission(%s)", emission);
+    }
+}
+/**
+ * set_date - an edje signal emission 
+ * @data - the data passed when the callback was added
+ * @o - the evas object(Edje) that created the signal
+ * @emission - the signal "type" that was emitted
+ * @source - the signal originated from this "part"
+ * Attempt to set the Part named "EntranceDate" to the results of
+ * localtime.  This way the interval is configurable via a program in
+ * the theme and not statically bound to a value.  
+ */
+static void
+set_date(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+    if(edje_object_part_exists(o, "EntranceDate")) 
+    {
+       struct tm *now;
+       char buf[PATH_MAX];
+       time_t _t = time(NULL);
+
+       now = localtime(&_t);
+       strftime(buf, PATH_MAX, session->config->date.string, now);
+       edje_object_part_text_set(o, "EntranceDate", buf);
+    }
+}
+/**
+ * set_time - an edje signal emission 
+ * @data - the data passed when the callback was added
+ * @o - the evas object(Edje) that created the signal
+ * @emission - the signal "type" that was emitted
+ * @source - the signal originated from this "part"
+ * Attempt to set the Part named "EntranceTime" to the results of
+ * localtime.  This way the interval is configurable via a program in
+ * the theme and not statically bound to a value.  
+ */
+static void
+set_time(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+    if(edje_object_part_exists(o, "EntranceTime")) 
+    {
+       struct tm *now;
+       char buf[PATH_MAX];
+       time_t _t = time(NULL);
+
+       now = localtime(&_t);
+       strftime(buf, PATH_MAX, session->config->time.string, now);
+       edje_object_part_text_set(o, "EntranceTime", buf);
+    }
+}
+
+/**
+ * done_cb - Executed when an EntranceAuthSuccessDone signal is emitted
+ * @data - the data passed when the callback was added
+ * @o - the evas object(Edje) that created the signal
+ * @emission - the signal "type" that was emitted
+ * @source - the signal originated from this "part"
+ * Attempt to set the Part named "EntranceTime" to the results of
+ * localtime.  This way the interval is configurable via a program in
+ * the theme and not statically bound to a value.  
+ */
+static void
+done_cb(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+    if(session->authed)
+    {
+       entrance_session_start_user_session(session);
+    }
+    else
+    {
+       exit(0);
+    }
+}
+
+/**
+ * reboot_cb - Executed when an EntranceSystemReboot signal is emitted
+ * @data - the data passed when the callback was added
+ * @o - the evas object(Edje) that created the signal
+ * @emission - the signal "type" that was emitted
+ * @source - the signal originated from this "part"
+ * Attempt to set the Part named "EntranceTime" to the results of
+ * localtime.  This way the interval is configurable via a program in
+ * the theme and not statically bound to a value.  
+ */
+static void
+reboot_cb(void *data, Evas_Object *o, const char *emission, const char *source)
 {
-   Entrance_Session e;
+    if(session->config->reboot.allow)
+    {
+       execl("/bin/sh", "/bin/sh", "-c", "init" "6", NULL);
+    }
+}
 
-   e = entrance_session_new();
-   entrance_session_init(e);
+/**
+ * shutdown_cb - Executed when an EntranceSystemHalt signal is emitted
+ * @data - the data passed when the callback was added
+ * @o - the evas object(Edje) that created the signal
+ * @emission - the signal "type" that was emitted
+ * @source - the signal originated from this "part"
+ * Attempt to set the Part named "EntranceTime" to the results of
+ * localtime.  This way the interval is configurable via a program in
+ * the theme and not statically bound to a value.  
+ */
+static void
+shutdown_cb(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+    if(session->config->halt.allow)
+    {
+       execl("/bin/sh", "/bin/sh", "-c", "init" "0", NULL);
+    }
+}
 
-   setup_events(e);
+/**
+ * timer_cb - we handle this iteration outside of the theme
+ */
+int
+timer_cb(void *data)
+{
+    Evas_Object *o = NULL;
+    if((o = (Evas_Object*)data))
+    {
+       set_date(NULL, o, NULL, NULL);
+       set_time(NULL, o, NULL, NULL);
+    }
+    return(1);
 }
 
+/**
+ * main - where it all starts !
+ */
 int
 main(int argc, char *argv[])
 {
-   char *disp;
-   
-   openlog("entrance", LOG_NOWAIT, LOG_DAEMON);
+    int i = 0;
+    char buf[PATH_MAX];
+    char *str = NULL;
+    Evas *evas = NULL; 
+    Ecore_Evas *e = NULL;
+    Ecore_Timer *timer = NULL;
+    Evas_Object *o = NULL, *edje = NULL;
+    double x, y, w, h;
+    char *entries[] = { "EntranceUserEntry", "EntrancePassEntry" };
+    int entries_count = 2;
 
-   if (!ecore_display_init(argv[1]))
-   {
-      disp = getenv("DISPLAY");
-         
-      if (disp)
-         syslog(LOG_CRIT, "Cannot initialize default display \"%s\". Exiting.", disp);
-      else
+   openlog("entrance", LOG_NOWAIT, LOG_DAEMON);
+    if(argv[1]) snprintf(buf, PATH_MAX, "%s", argv[1]);
+    /* Basic ecore initialization */
+    if(!ecore_init()) return(-1);
+    ecore_app_args_set(argc, (const char **)argv); 
+#if 0
+    if(!ecore_x_init(buf))
+    {
+       if((str = getenv("DISPLAY")))
+         syslog(LOG_CRIT, "Cannot initialize default display \"%s\". Exiting.", str);
+       else
          syslog(LOG_CRIT, "No DISPLAY variable set! Exiting.");
-      
-      exit(-1);
-   }
+       return(-1);
+    }
+#endif
+    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_cb, NULL);
+
+    session = entrance_session_new();
+    if(ecore_evas_init())
+    {
+       /* init edje and set frametime to 60 fps ? */
+       edje_init();
+       edje_frametime_set(1.0/60.0);
+
+       /* setup our ecore_evas */ 
+       e = ecore_evas_software_x11_new(NULL, 0, 0, 0, WINW, WINH);
+       ecore_evas_title_set(e, "Entrance --(Edje)--");
+       ecore_evas_callback_delete_request_set(e, window_del_cb);
+       ecore_evas_callback_resize_set(e, window_resize_cb);
+       ecore_evas_cursor_set(e, session->config->pointer, 12, 0, 0); 
+       ecore_evas_move(e, 0, 0);
+
+       /* Evas specific callbacks */
+       evas = ecore_evas_get(e);
+       evas_image_cache_set(evas, 8 * 1024 * 1024);
+       evas_font_cache_set(evas, 1 * 1024 * 1024);
+       evas_font_path_append(evas, PACKAGE_DATA_DIR"/fonts");
+       evas_key_modifier_add(evas, "Control_L");
+       evas_key_modifier_add(evas, "Control_R");
+       evas_key_modifier_add(evas, "Shift_L");
+       evas_key_modifier_add(evas, "Shift_R");
 
-   /* setup handlers for system signals */
-   ecore_event_signal_init();
-   /* setup the event filter */
-   ecore_event_filter_init();
-   /* setup the X event internals */
-   ecore_event_x_init();
+       /* Load our theme as an edje */
+       edje = edje_object_add(evas);
+       snprintf(buf, PATH_MAX, "%s/themes/%s", PACKAGE_DATA_DIR, 
+                                                 session->theme);
+       edje_object_file_set(edje, buf, "main");
+       evas_object_move(edje, 0, 0);
+       evas_object_resize(edje, WINW, WINH); 
+       evas_object_name_set(edje, "ui");
+       evas_object_layer_set(edje, 0);
+    
+       for(i = 0; i < entries_count; i++)
+       {
+           if(edje_object_part_exists(edje, entries[i]))
+           {
+               edje_object_part_geometry_get(edje, entries[i] , 
+                                               &x, &y, &w, &h);
+               o = evas_text_entry_new(evas);
+               evas_object_move(o, x, y);
+               evas_object_resize(o, w, h);
+               evas_object_layer_set(o, 1);
+               evas_text_entry_max_chars_set(o, 32);
+               evas_text_entry_is_password_set(o, i);
+               evas_object_name_set(o, entries[i]);
+               evas_text_entry_edje_part_set(o, edje, entries[i]);
+           
+               evas_text_entry_return_key_callback_set(o, interp_return_key, o);
 
-   setup();
+               edje_object_signal_callback_add(edje, "In", entries[i],
+                                               focus, o);
+       
+               edje_object_signal_callback_add(edje, "Out", entries[i],
+                                               focus, o);
+               edje_object_part_swallow(edje, entries[i], o);
+               evas_object_show(o);
+           }
+           o = NULL;
+       }
 
-   ecore_event_loop();
-   closelog();
+       /* See if we have a EntranceHostname part, set it */ 
+       if(edje_object_part_exists(edje, "EntranceHostname")) 
+       {
+           if ((str = get_my_hostname()))
+           {
+               edje_object_part_text_set(edje, "EntranceHostname", str);
+               free(str);
+           }
+       }
+       if(edje_object_part_exists(edje, "EntranceTime")) 
+       {
+           edje_object_signal_callback_add(edje, "Go", "EntranceTime",
+                                           set_time, o);
+           edje_object_signal_emit(edje, "Go", "EntranceTime");
+           timer = ecore_timer_add(0.5, timer_cb, edje);
+       }
+       if(edje_object_part_exists(edje, "EntranceDate")) 
+       {
+           edje_object_signal_callback_add(edje, "Go", "EntranceDate",
+                                           set_date, o);
+           edje_object_signal_emit(edje, "Go", "EntranceDate");
+           if(!timer) timer = ecore_timer_add(0.5, timer_cb, edje);
+       }
+       edje_object_signal_callback_add(edje, "EntranceUserAuthSuccessDone", "",
+                                       done_cb, e);
+       edje_object_signal_callback_add(edje, "EntranceSystemReboot", "", 
+                                       reboot_cb, e);
+       edje_object_signal_callback_add(edje, "EntranceSystemHalt", "", 
+                                       shutdown_cb, e);
+       /*
+        * It's useful to delay showing of your edje till all your
+        * callbacks have been added, otherwise show might trigger all
+        * the desired events 
+        */
+       evas_object_show(edje);
 
-   return (0);
+       /*
+       */
+#if X_TESTING
+           ecore_evas_resize(e, WINW, WINH);
+#else
+           ecore_evas_fullscreen_set(e, 1);
+#endif
+       
+       entrance_session_ecore_evas_set(session, e);
+       entrance_session_run(session);
+       entrance_session_free(session);
+       closelog();
+    }
+    return(0);
 }




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to