Enlightenment CVS committal
Author : atmosphere
Project : e17
Module : apps/entrance
Dir : e17/apps/entrance/src/client
Modified Files:
entrance_auth.c entrance_auth.h entrance_config.c
entrance_config.h entrance_session.c entrance_session.h main.c
util.h
Log Message:
Client Code Tidying
* There were remnants of a very old coding style that's not consistent with
how people are coding on E these days, updated.
* Got rid of some redundant data, theme being in session and config
* Got rid of #define E_LOGIN_* that were who knows how old :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_auth.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- entrance_auth.c 21 Oct 2003 23:50:56 -0000 1.7
+++ entrance_auth.c 31 Oct 2003 04:39:52 -0000 1.8
@@ -19,7 +19,7 @@
struct pam_response **resp, void *appdata_ptr)
{
int replies = 0;
- Entrance_Auth e = appdata_ptr;
+ Entrance_Auth *e = appdata_ptr;
struct pam_response *reply = NULL;
reply =
@@ -60,12 +60,12 @@
/* entrance_auth_new
* Returns a 0'd out Entrance_Auth Struct
*/
-Entrance_Auth
+Entrance_Auth *
entrance_auth_new(void)
{
- Entrance_Auth e;
+ Entrance_Auth *e;
- e = (Entrance_Auth) malloc(sizeof(struct _Entrance_Auth));
+ e = (Entrance_Auth *) malloc(sizeof(struct _Entrance_Auth));
memset(e, 0, sizeof(struct _Entrance_Auth));
e->env = (char **) malloc(sizeof(char *) * 2);
e->env[0] = 0;
@@ -76,7 +76,7 @@
* @e the Entrance_Auth struct to be freed
*/
void
-entrance_auth_free(Entrance_Auth e)
+entrance_auth_free(Entrance_Auth * e)
{
#if HAVE_PAM
if (e->pam.handle)
@@ -100,7 +100,7 @@
* function and others.
*/
static int
-_entrance_auth_pam_initialize(Entrance_Auth e)
+_entrance_auth_pam_initialize(Entrance_Auth * e)
{
int pamerr;
@@ -157,7 +157,7 @@
* Returns - 0 on success, 1 on error
*/
int
-entrance_auth_cmp_pam(Entrance_Auth e)
+entrance_auth_cmp_pam(Entrance_Auth * e)
{
int result = 0;
int pamerr;
@@ -202,7 +202,7 @@
#endif
int
-entrance_auth_cmp_crypt(Entrance_Auth e, Entrance_Config cfg)
+entrance_auth_cmp_crypt(Entrance_Auth * e, Entrance_Config * cfg)
{
char *encrypted;
char *correct = e->pw->pw_passwd;
@@ -232,7 +232,7 @@
* Pass it a char* and it'll set it if it should
*/
void
-entrance_auth_set_pass(Entrance_Auth e, const char *str)
+entrance_auth_set_pass(Entrance_Auth * e, const char *str)
{
if (str)
snprintf(e->pass, PATH_MAX, "%s", str);
@@ -247,7 +247,7 @@
* to the passed in string, if they don't, e->user is unmodified.
*/
int
-entrance_auth_set_user(Entrance_Auth e, const char *str)
+entrance_auth_set_user(Entrance_Auth * e, const char *str)
{
int result = 0;
@@ -278,7 +278,7 @@
* I'm not sure if this is correct, but for now it works.
*/
void
-entrance_auth_setup_environment(Entrance_Auth e)
+entrance_auth_setup_environment(Entrance_Auth * e)
{
extern char **environ;
int size;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_auth.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- entrance_auth.h 14 Oct 2003 17:22:01 -0000 1.4
+++ entrance_auth.h 31 Oct 2003 04:39:52 -0000 1.5
@@ -1,5 +1,5 @@
-#ifndef _E_LOGIN_AUTH
-#define _E_LOGIN_AUTH
+#ifndef _ENTRANCE_AUTH
+#define _ENTRANCE_AUTH
#include "../config.h"
#include "entrance_config.h"
@@ -50,18 +50,18 @@
char pass[PATH_MAX];
char **env;
};
-typedef struct _Entrance_Auth *Entrance_Auth;
+typedef struct _Entrance_Auth Entrance_Auth;
-Entrance_Auth entrance_auth_new(void);
-void entrance_auth_free(Entrance_Auth e);
+Entrance_Auth *entrance_auth_new(void);
+void entrance_auth_free(Entrance_Auth * e);
/* 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, const char *str);
+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, const char *str);
/* 0 on success, 1 on no user by that name */
-int entrance_auth_set_user(Entrance_Auth e, const char *str);
-void entrance_auth_setup_environment(Entrance_Auth e);
+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.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- entrance_config.c 22 Oct 2003 12:09:56 -0000 1.11
+++ entrance_config.c 31 Oct 2003 04:39:52 -0000 1.12
@@ -3,12 +3,12 @@
#define REMEMBER_USERS 3
-Entrance_Config
+Entrance_Config *
entrance_config_new(void)
{
- Entrance_Config e;
+ Entrance_Config *e;
- e = (Entrance_Config) malloc(sizeof(struct _Entrance_Config));
+ e = (Entrance_Config *) malloc(sizeof(struct _Entrance_Config));
memset(e, 0, sizeof(struct _Entrance_Config));
e->screens.w = e->screens.h = e->display.w, e->display.h = 1;
@@ -17,7 +17,7 @@
}
static void
-entrance_config_populate(Entrance_Config e, E_DB_File * db)
+entrance_config_populate(Entrance_Config * e, E_DB_File * db)
{
char *str;
int i = 0, num_session = 0, num_user;
@@ -161,10 +161,10 @@
#endif
}
-Entrance_Config
+Entrance_Config *
entrance_config_parse(char *file)
{
- Entrance_Config e = NULL;
+ Entrance_Config *e = NULL;
if (file)
{
@@ -197,7 +197,7 @@
}*/
void
-entrance_config_free(Entrance_Config e)
+entrance_config_free(Entrance_Config * e)
{
if (e)
{
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- entrance_config.h 22 Oct 2003 06:58:15 -0000 1.8
+++ entrance_config.h 31 Oct 2003 04:39:52 -0000 1.9
@@ -88,23 +88,11 @@
} sessions;
};
-typedef struct _Entrance_Config *Entrance_Config;
+typedef struct _Entrance_Config Entrance_Config;
-#if 0
-struct _Entrance_User
-{
- char *name;
- char *img;
- int sys;
- // void *something
-};
-
-typedef struct _Entrance_User Entrance_User;
-#endif
-
-Entrance_Config entrance_config_parse(char *file);
-void entrance_config_print(Entrance_Config e);
-void entrance_config_free(Entrance_Config e);
-void entrance_config_prepend_recent_user(Entrance_Config e, char *str);
+Entrance_Config *entrance_config_parse(char *file);
+void entrance_config_print(Entrance_Config * e);
+void entrance_config_free(Entrance_Config * e);
+void entrance_config_prepend_recent_user(Entrance_Config * e, char *str);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- entrance_session.c 25 Oct 2003 05:42:57 -0000 1.19
+++ entrance_session.c 31 Oct 2003 04:39:52 -0000 1.20
@@ -11,9 +11,9 @@
extern void user_unselected_cb(void *data, Evas_Object * o,
const char *emission, const char *source);
static Evas_Object *_entrance_session_icon_load(Evas_Object * o, char *file);
-static Evas_Object *_entrance_session_load_session(Entrance_Session e,
+static Evas_Object *_entrance_session_load_session(Entrance_Session * e,
char *key);
-static Evas_Object *_entrance_session_user_load(Entrance_Session e,
+static Evas_Object *_entrance_session_user_load(Entrance_Session * e,
char *key);
/**
@@ -21,13 +21,12 @@
* Returns a valid Entrance_Session
* Also Allocates the auth, and parse the config struct
*/
-Entrance_Session
+Entrance_Session *
entrance_session_new(void)
{
- Entrance_Session e;
- char theme_path[PATH_MAX];
+ Entrance_Session *e;
- e = (Entrance_Session) malloc(sizeof(struct _Entrance_Session));
+ e = (Entrance_Session *) malloc(sizeof(struct _Entrance_Session));
memset(e, 0, sizeof(struct _Entrance_Session));
e->auth = entrance_auth_new();
@@ -38,9 +37,6 @@
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 = strdup(e->config->theme);
e->session = strdup("");
/* ?
e->theme->path = strdup(theme_path);
@@ -49,7 +45,7 @@
}
void
-entrance_session_ecore_evas_set(Entrance_Session e, Ecore_Evas * ee)
+entrance_session_ecore_evas_set(Entrance_Session * e, Ecore_Evas * ee)
{
Evas *evas = NULL;
@@ -75,14 +71,14 @@
* entrance_session_free: free the entrance session
*/
void
-entrance_session_free(Entrance_Session e)
+entrance_session_free(Entrance_Session * e)
{
if (e)
{
entrance_auth_free(e->auth);
entrance_config_free(e->config);
ecore_evas_free(e->ee);
- free(e->theme);
+ free(e->session);
free(e);
}
@@ -101,7 +97,7 @@
* @e - the Entrance_Session to be run
*/
void
-entrance_session_run(Entrance_Session e)
+entrance_session_run(Entrance_Session * e)
{
ecore_evas_show(e->ee);
ecore_main_loop_begin();
@@ -112,7 +108,7 @@
* Returns 0 on success errors otherwise
*/
int
-entrance_session_auth_user(Entrance_Session e)
+entrance_session_auth_user(Entrance_Session * e)
{
#ifdef HAVE_PAM
if (e->config->auth == ENTRANCE_USE_PAM)
@@ -126,10 +122,8 @@
* entrance_session_user_reset: forget what we know about the current user
*/
void
-entrance_session_user_reset(Entrance_Session e)
+entrance_session_user_reset(Entrance_Session * e)
{
- Evas_Object *obj = NULL;
-
if (e)
{
entrance_auth_free(e->auth);
@@ -145,7 +139,7 @@
* entrance_session_user_set: forget what we know about the current user
*/
void
-entrance_session_user_set(Entrance_Session e, char *key)
+entrance_session_user_set(Entrance_Session * e, char *key)
{
int result = 0;
const char *file = NULL;
@@ -217,7 +211,7 @@
}
void
-entrance_session_start_user_session(Entrance_Session e)
+entrance_session_start_user_session(Entrance_Session * e)
{
char buf[PATH_MAX];
char *session_key = NULL;
@@ -279,7 +273,7 @@
}
static void
-entrance_session_xsession_load(Entrance_Session e, char *key)
+entrance_session_xsession_load(Entrance_Session * e, char *key)
{
if (e && e->edje)
{
@@ -302,7 +296,7 @@
}
void
-entrance_session_xsession_set(Entrance_Session e, char *key)
+entrance_session_xsession_set(Entrance_Session * e, char *key)
{
char *str = NULL;
char buf[PATH_MAX];
@@ -326,7 +320,7 @@
}
void
-entrance_session_edje_object_set(Entrance_Session e, Evas_Object * obj)
+entrance_session_edje_object_set(Entrance_Session * e, Evas_Object * obj)
{
if (e)
{
@@ -337,7 +331,7 @@
}
void
-entrance_session_list_add(Entrance_Session e)
+entrance_session_list_add(Entrance_Session * e)
{
Evas_List *l = NULL;
char *key = NULL;
@@ -377,7 +371,7 @@
}
}
void
-entrance_session_user_list_add(Entrance_Session e)
+entrance_session_user_list_add(Entrance_Session * e)
{
Evas_Coord w, h;
char *key = NULL;
@@ -417,7 +411,7 @@
}
static Evas_Object *
-_entrance_session_user_load(Entrance_Session e, char *key)
+_entrance_session_user_load(Entrance_Session * e, char *key)
{
int result = 0;
char *icon = NULL;
@@ -505,7 +499,7 @@
}
static Evas_Object *
-_entrance_session_load_session(Entrance_Session e, char *key)
+_entrance_session_load_session(Entrance_Session * e, char *key)
{
int result = 0;
char *icon = NULL;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- entrance_session.h 22 Oct 2003 12:09:57 -0000 1.7
+++ entrance_session.h 31 Oct 2003 04:39:52 -0000 1.8
@@ -17,30 +17,29 @@
struct _Entrance_Session
{
- char *theme; /* Theme eet */
- char *session; /* Theme eet */
+ char *session;
Ecore_Evas *ee; /* the ecore_evas */
Evas_Object *edje; /* main theme edje */
- Entrance_Auth auth; /* encapsulated auth shit */
- Entrance_Config config; /* configuration options */
+ Entrance_Auth *auth; /* encapsulated auth shit */
+ Entrance_Config *config; /* configuration options */
- Evas_List *EntUsers;
int authed;
};
-typedef struct _Entrance_Session *Entrance_Session;
+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_run(Entrance_Session e);
-int entrance_session_auth_user(Entrance_Session e);
-void entrance_session_user_reset(Entrance_Session e);
-void entrance_session_user_set(Entrance_Session e, char *user);
-void entrance_session_start_user_session(Entrance_Session e);
-void entrance_session_xsession_set(Entrance_Session e, char *xsession);
-void entrance_session_edje_object_set(Entrance_Session e, Evas_Object * obj);
-void entrance_session_list_add(Entrance_Session e);
-void entrance_session_user_list_add(Entrance_Session e);
+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_run(Entrance_Session * e);
+int entrance_session_auth_user(Entrance_Session * e);
+void entrance_session_user_reset(Entrance_Session * e);
+void entrance_session_user_set(Entrance_Session * e, char *user);
+void entrance_session_start_user_session(Entrance_Session * e);
+void entrance_session_xsession_set(Entrance_Session * e, char *xsession);
+void entrance_session_edje_object_set(Entrance_Session * e,
+ Evas_Object * obj);
+void entrance_session_list_add(Entrance_Session * e);
+void entrance_session_user_list_add(Entrance_Session * e);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/main.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- main.c 25 Oct 2003 06:51:30 -0000 1.18
+++ main.c 31 Oct 2003 04:39:52 -0000 1.19
@@ -17,7 +17,7 @@
#define WINW 800
#define WINH 600
-static Entrance_Session session = NULL;
+static Entrance_Session *session = NULL;
/* Callbacks for entrance */
static char *
@@ -373,18 +373,23 @@
{
pid_t pid;
- switch(pid = fork()) {
- case 0:
- if(execl("/bin/sh", "/bin/sh", "-c", "/sbin/shutdown -r now", NULL)) {
- syslog(LOG_CRIT, "Reboot failed: Unable to execute /sbin/shutdown");
- exit(0);
- }
- case -1:
- syslog(LOG_CRIT, "Reboot failed: could not fork to execute shutdown
script");
- break;
- default:
- syslog(LOG_INFO, "The system is being rebooted");
- exit(EXITCODE);
+ switch (pid = fork())
+ {
+ case 0:
+ if (execl
+ ("/bin/sh", "/bin/sh", "-c", "/sbin/shutdown -r now", NULL))
+ {
+ syslog(LOG_CRIT,
+ "Reboot failed: Unable to execute /sbin/shutdown");
+ exit(0);
+ }
+ case -1:
+ syslog(LOG_CRIT,
+ "Reboot failed: could not fork to execute shutdown script");
+ break;
+ default:
+ syslog(LOG_INFO, "The system is being rebooted");
+ exit(EXITCODE);
}
}
}
@@ -404,20 +409,26 @@
const char *source)
{
pid_t pid;
+
if (session->config->halt.allow)
{
- switch(pid = fork()) {
- case 0:
- if(execl("/bin/sh", "/bin/sh", "-c", "/sbin/shutdown -h now", NULL)) {
- syslog(LOG_CRIT, "Shutdown failed: Unable to execute
/sbin/shutdown");
- exit(0);
- }
- case -1:
- syslog(LOG_CRIT, "Shutdown failed: could not fork to execute shutdown
script");
- break;
- default:
- syslog(LOG_INFO, "The system is being shut down");
- exit(EXITCODE);
+ switch (pid = fork())
+ {
+ case 0:
+ if (execl
+ ("/bin/sh", "/bin/sh", "-c", "/sbin/shutdown -h now", NULL))
+ {
+ syslog(LOG_CRIT,
+ "Shutdown failed: Unable to execute /sbin/shutdown");
+ exit(0);
+ }
+ case -1:
+ syslog(LOG_CRIT,
+ "Shutdown failed: could not fork to execute shutdown script");
+ break;
+ default:
+ syslog(LOG_INFO, "The system is being shut down");
+ exit(EXITCODE);
}
}
}
@@ -523,7 +534,7 @@
/* Load our theme as an edje */
edje = edje_object_add(evas);
snprintf(buf, PATH_MAX, "%s/themes/%s", PACKAGE_DATA_DIR,
- session->theme);
+ session->config->theme);
if (!edje_object_file_set(edje, buf, "Main"))
{
fprintf(stderr, "Failed to set %s\n", buf);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/util.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- util.h 31 Jan 2003 21:57:06 -0000 1.1
+++ util.h 31 Oct 2003 04:39:52 -0000 1.2
@@ -1,5 +1,5 @@
-#ifndef E_LOGIN_UTILS
-#define E_LOGIN_UTILS
+#ifndef ENTRANCE_UTILS
+#define ENTRANCE_UTILS
#include<pwd.h>
#include<grp.h>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs