yoz pushed a commit to branch master.

commit 6da13be704d5527e0134fb031e052e6cf7a37094
Author: Michael Bouchaud <[email protected]>
Date:   Wed Sep 4 23:24:26 2013 +0200

    entrance: rearrange login with default system command
---
 data/entrance.conf            |  2 +-
 src/daemon/entrance_history.c | 21 +++++++++++++--------
 src/daemon/entrance_history.h |  4 +---
 src/daemon/entrance_session.c | 35 ++++++++++++++++++++++++++++++-----
 4 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/data/entrance.conf b/data/entrance.conf
index fe569f0..5d62373 100644
--- a/data/entrance.conf
+++ b/data/entrance.conf
@@ -15,7 +15,7 @@ group "Entrance_Config" struct {
     /* Commands executed when starting a session */
     value "session_start" string: "/usr/bin/sessreg -a -l :0.0";
     /* Command executed when login. Warning xsession must be set to 0 */
-    value "session_login" string: "/bin/bash -login $HOME/.xinitrc";
+    value "session_login" string: "/bin/bash -login";
     /* Commands executed when exiting a session */
     value "session_stop" string: "/usr/bin/sessreg -d -l :0.0";
 
diff --git a/src/daemon/entrance_history.c b/src/daemon/entrance_history.c
index 9a0a050..721e61c 100644
--- a/src/daemon/entrance_history.c
+++ b/src/daemon/entrance_history.c
@@ -33,6 +33,8 @@ entrance_history_init()
    EET_LOGIN_ADD(icon.group, EET_T_STRING);
    EET_LOGIN_ADD(background.path, EET_T_STRING);
    EET_LOGIN_ADD(background.group, EET_T_STRING);
+   EET_LOGIN_ADD(ignore_last_session, EET_T_UCHAR);
+
 #undef EET_LOGIN_ADD
 
    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_History);
@@ -110,15 +112,18 @@ entrance_history_push(const char *login, const char 
*session)
      {
         if (!strcmp(login, el->login))
           {
-             if (!session)
-               {
-                  eina_stringshare_del(el->session);
-                  el->session = NULL;
-               }
-             else if (el->session && strcmp(session, el->session))
+             if (!el->ignore_last_session)
                {
-                  eina_stringshare_replace(&el->session, session);
-                  _history_update = EINA_TRUE;
+                  if (!session)
+                    {
+                       eina_stringshare_del(el->session);
+                       el->session = NULL;
+                    }
+                  else if (el->session && strcmp(session, el->session))
+                    {
+                       eina_stringshare_replace(&el->session, session);
+                       _history_update = EINA_TRUE;
+                    }
                }
              break;
           }
diff --git a/src/daemon/entrance_history.h b/src/daemon/entrance_history.h
index 34237d6..9afd62c 100644
--- a/src/daemon/entrance_history.h
+++ b/src/daemon/entrance_history.h
@@ -26,13 +26,11 @@ struct _Entrance_Login
         const char *group;
      } icon;
    Entrance_Background background;
+   Eina_Bool ignore_last_session;
 };
 
 struct _Entrance_History
 {
-   const char *theme;
-   Eina_Bool vkbdscreen;
-   Entrance_Background background;
    Eina_List *history;
 };
 
diff --git a/src/daemon/entrance_session.c b/src/daemon/entrance_session.c
index 798636c..9cd56d7 100644
--- a/src/daemon/entrance_session.c
+++ b/src/daemon/entrance_session.c
@@ -335,8 +335,12 @@ entrance_session_login(const char *session, Eina_Bool push)
      }
    if (push) entrance_history_push(pwd->pw_name, session);
    cmd = _entrance_session_find_command(pwd->pw_dir, session);
-   PT("launching session ");
-   fprintf(stderr, "%s for user %s\n", session, _login);
+   if (!cmd)
+     {
+        PT("Error !!! No command to launch, can't open a session :'(\n");
+        return ECORE_CALLBACK_CANCEL;
+     }
+   PT("launching session %s for user %s\n", cmd, _login);
    _entrance_session_run(pwd, cmd, buf);
    return ECORE_CALLBACK_CANCEL;
 }
@@ -358,10 +362,31 @@ _entrance_session_find_command(const char *path, const 
char *session)
                }
           }
      }
-   snprintf(buf, sizeof(buf), "%s/%s", path, ".Xsession");
+   snprintf(buf, sizeof(buf), "%s/%s",
+            path, ".xinitrc");
+   if (ecore_file_can_exec(buf))
+     {
+        snprintf(buf, sizeof(buf), "%s %s/%s",
+                 entrance_config->command.session_login,
+                 path, ".xinitrc");
+        return eina_stringshare_add(buf);
+     }
+   snprintf(buf, sizeof(buf), "%s/%s",
+            path, ".Xsession");
    if (ecore_file_can_exec(buf))
-     return eina_stringshare_add(buf);
-   return (entrance_config->command.session_login);
+     {
+        snprintf(buf, sizeof(buf), "%s %s/%s",
+                 entrance_config->command.session_login,
+                 path, ".Xsession");
+        return eina_stringshare_add(buf);
+     }
+   if (ecore_file_exists("/etc/X11/xinit/xinitrc"))
+     {
+        snprintf(buf, sizeof(buf), "%s /etc/X11/xinit/xinitrc",
+                 entrance_config->command.session_login);
+        return eina_stringshare_add(buf);
+     }
+   return NULL;
 }
 
 char *

-- 

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk

Reply via email to