Enlightenment CVS committal
Author : sebastid
Project : e17
Module : apps/entrance
Dir : e17/apps/entrance/src/client
Modified Files:
Makefile.am entrance.h entrance_config.c entrance_config.h
entrance_edit.c entrance_login.c entrance_session.c
entrance_session.h entrance_user.c main.c util.h
Log Message:
Those variables are only used by pam.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- Makefile.am 28 May 2005 09:31:14 -0000 1.16
+++ Makefile.am 16 Aug 2005 04:03:27 -0000 1.17
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-INCLUDES = @edje_cflags@ @ecore_cflags@ @edb_cflags@ @evas_cflags@ \
+INCLUDES = @edje_cflags@ @ecore_cflags@ @evas_cflags@ \
@esmart_cflags@
bin_PROGRAMS = entrance entrance_login entrance_edit
@@ -16,7 +16,7 @@
util.c util.h \
entrance.h main.c
-entrance_LDADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@ \
+entrance_LDADD = @edje_libs@ @ecore_libs@ @evas_libs@ \
@esmart_libs@ -lesmart_container -lesmart_text_entry
entrance_login_SOURCES = \
@@ -28,5 +28,5 @@
entrance_edit.c \
entrance_config.c entrance_user.c \
util.c entrance_x_session.c entrance_smart.c
-entrance_edit_LDADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@ \
+entrance_edit_LDADD = @edje_libs@ @ecore_libs@ @evas_libs@ \
@esmart_libs@ -lesmart_container -lesmart_text_entry
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- entrance.h 25 Oct 2003 04:50:28 -0000 1.7
+++ entrance.h 16 Aug 2005 04:03:27 -0000 1.8
@@ -1,12 +1,12 @@
#ifndef _ENTRANCE_H_
#define _ENTRANCE_H_
-#include"../config.h"
-#include<stdio.h>
-#include<stdlib.h>
-#include<limits.h>
-#include<string.h>
-#include<syslog.h>
+#include "../config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+#include <syslog.h>
#include "util.h"
#include "entrance_session.h"
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- entrance_config.c 23 Mar 2005 03:12:40 -0000 1.29
+++ entrance_config.c 16 Aug 2005 04:03:27 -0000 1.30
@@ -1,3 +1,5 @@
+#include <Ecore_Config.h>
+
#include "entrance.h"
#include "entrance_config.h"
#include "entrance_user.h"
@@ -8,8 +10,6 @@
@brief System-wide configuration options for various settings in Entrance
*/
-#define REMEMBER_USERS 3
-
Entrance_Config *
entrance_config_new(void)
{
@@ -24,13 +24,46 @@
}
/**
+ * _entrance_config_defaults_set - set default values for
+ * the Entrance_Config struct
+ */
+static void
+_entrance_config_defaults_set()
+{
+ ecore_config_string_default("/entrance/theme", "default.edj");
+ ecore_config_string_default("/entrance/pointer", PACKAGE_DATA_DIR
"/images/pointer.png");
+ ecore_config_string_default("/entrance/greeting/before", "Welcome to");
+ ecore_config_string_default("/entrance/greeting/after", "");
+ ecore_config_string_default("/entrance/date_format", "%x");
+ ecore_config_string_default("/entrance/time_format", "%X");
+
+ ecore_config_int_default("/entrance/autologin/mode", 0);
+ ecore_config_string_default("/entrance/autologin/user", "");
+
+ ecore_config_int_default("/entrance/user/remember", 1);
+ ecore_config_int_default("/entrance/user/remember_n", 5);
+ ecore_config_int_default("/entrance/user/count", 0);
+
+ ecore_config_int_default("/entrance/engine", 0);
+
+ ecore_config_int_default("/entrance/system/reboot", 1);
+ ecore_config_int_default("/entrance/system/halt", 1);
+
+ ecore_config_int_default("/entrance/session/count", 1);
+ ecore_config_string_default("/entrance/session/0/session", "default");
+ ecore_config_string_default("/entrance/session/0/title", "Default");
+ ecore_config_string_default("/entrance/session/0/icon", "default.png");
+
+ ecore_config_int_default("/entrance/auth", 1);
+}
+
+/**
* entrance_config_populate - populate the Entrance_Config struct with
- * the data provided by the valid E_DB_File
+ * the data from ecore_config
* @param e Valid Entrance_Config struct
- * @param db a valid E_DB_File handle opened for reading
*/
static void
-entrance_config_populate(Entrance_Config * e, E_DB_File * db)
+entrance_config_populate(Entrance_Config *e)
{
Entrance_User *eu = NULL;
char *user = NULL;
@@ -40,133 +73,74 @@
char *title = NULL;
Entrance_X_Session *exs;
- char *str;
- int i = 0, num_session = 0, num_user;
+ int i, num_session, num_user;
char buf[PATH_MAX];
- int num_fonts;
- if ((!e) || (!db))
- return;
+ if (!e) return;
/* strings 'n things */
- if ((str = e_db_str_get(db, "/entrance/theme")))
- e->theme = str;
- else
- e->theme = strdup("default.edj");
+ e->theme = ecore_config_string_get("/entrance/theme");
+ e->pointer = ecore_config_string_get("/entrance/pointer");
+ e->before.string = ecore_config_string_get("/entrance/greeting/before");
+ e->after.string = ecore_config_string_get("/entrance/greeting/after");
+ e->date.string = ecore_config_string_get("/entrance/date_format");
+ e->time.string = ecore_config_string_get("/entrance/time_format");
- if ((str = e_db_str_get(db, "/entrance/pointer")))
- e->pointer = str;
- else
- e->pointer = strdup(PACKAGE_DATA_DIR "/images/pointer.png");
+ e->autologin.mode = ecore_config_int_get("/entrance/autologin/mode");
+ e->autologin.username = ecore_config_string_get("/entrance/autologin/user");
- 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("");
+ e->users.remember = ecore_config_int_get("/entrance/user/remember");
+ e->users.remember_n = ecore_config_int_get("/entrance/user/remember_n");
- /* Use a boring default if there's no config for date/time */
- if ((str = e_db_str_get(db, "/entrance/date_format")))
- e->date.string = str;
- else
- /* e->date.string = strdup("%A %B %e, %Y"); */
- e->date.string = strdup("%x");
+ e->engine = ecore_config_int_get("/entrance/engine");
- if ((str = e_db_str_get(db, "/entrance/time_format")))
- e->time.string = str;
- else
- /* e->time.string = strdup("%l:%M:%S %p"); */
- e->time.string = strdup("%X");
+ e->reboot = ecore_config_int_get("/entrance/system/reboot");
+ e->halt = ecore_config_int_get("/entrance/system/halt");
- if (e_db_int_get(db, "/entrance/autologin/mode", &e->autologin.mode))
+ num_user = ecore_config_int_get("/entrance/user/count");
+ for (i = 0; i < num_user; i++)
{
- if (e->autologin.mode > 0)
- e->autologin.username = e_db_str_get(db, "/entrance/autologin/user");
- }
- /* ints */
- if (!e_db_int_get(db, "/entrance/user/remember", &e->users.remember))
- e->users.remember = 1;
- if (!e_db_int_get(db, "/entrance/user/remember_n", &e->users.remember_n))
- e->users.remember_n = 5;
- if (!e_db_int_get(db, "/entrance/engine", &e->engine))
- e->engine = 0;
- if (!e_db_int_get(db, "/entrance/system/reboot", &(e->reboot)))
- e->reboot = 0;
- if (!e_db_int_get(db, "/entrance/system/halt", &(e->halt)))
- e->halt = 0;
- if (e_db_int_get(db, "/entrance/user/count", &num_user))
- {
- for (i = 0; i < num_user; i++)
+ snprintf(buf, PATH_MAX, "/entrance/user/%d/user", i);
+ if ((user = ecore_config_string_get(buf)))
{
- snprintf(buf, PATH_MAX, "/entrance/user/%d/user", i);
- if ((user = e_db_str_get(db, buf)))
- {
- snprintf(buf, PATH_MAX, "/entrance/user/%d/icon", i);
- icon = e_db_str_get(db, buf);
- snprintf(buf, PATH_MAX, "/entrance/user/%d/session", i);
- session = e_db_str_get(db, buf);
+ snprintf(buf, PATH_MAX, "/entrance/user/%d/icon", i);
+ icon = ecore_config_string_get(buf);
+ snprintf(buf, PATH_MAX, "/entrance/user/%d/session", i);
+ session = ecore_config_string_get(buf);
+
+ printf("%s %s %s\n", user, icon, session);
- if ((eu = entrance_user_new(user, icon, session)))
- {
- e->users.hash = evas_hash_add(e->users.hash, user, eu);
- e->users.keys = evas_list_append(e->users.keys, eu->name);
- }
- else
- {
- free(user);
- if (icon)
- free(icon);
- if (session)
- free(session);
- }
+ if ((eu = entrance_user_new(user, icon, session)))
+ {
+ e->users.hash = evas_hash_add(e->users.hash, user, eu);
+ e->users.keys = evas_list_append(e->users.keys, eu->name);
}
- }
- /* FIXME syslog(LOG_NORMAL, "Loaded %d users", num_user) */
- }
- else
- {
- syslog(LOG_WARNING, "Warning: No users found.");
- }
-
- /* session hash and font list */
- if (e_db_int_get(db, "/entrance/session/count", &num_session))
- {
- for (i = 0; i < num_session; i++)
- {
- snprintf(buf, PATH_MAX, "/entrance/session/%d/title", i);
- title = e_db_str_get(db, buf);
- snprintf(buf, PATH_MAX, "/entrance/session/%d/session", i);
- session = e_db_str_get(db, buf);
- snprintf(buf, PATH_MAX, "/entrance/session/%d/icon", i);
- icon = e_db_str_get(db, buf);
-
- if ((exs = entrance_x_session_new(title, icon, session)))
+ else
{
- e->sessions.keys = evas_list_append(e->sessions.keys, title);
- e->sessions.hash =
- evas_hash_add(e->sessions.hash, exs->name, exs);
+ free(user);
+ if (icon)
+ free(icon);
+ if (session)
+ free(session);
}
}
}
- /*
- * FIXME: With embedded fonts in your edjes, do we even wanna bother with
- * the font path nightmare anymore ? Unless we use etox or something ...
- */
- if (e_db_int_get(db, "/entrance/fonts/count", &num_fonts))
- {
- 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);
- }
+ num_session = ecore_config_int_get("/entrance/session/count");
+ for (i = 0; i < num_session; i++)
+ {
+ snprintf(buf, PATH_MAX, "/entrance/session/%d/title", i);
+ title = ecore_config_string_get(buf);
+ snprintf(buf, PATH_MAX, "/entrance/session/%d/session", i);
+ session = ecore_config_string_get(buf);
+ snprintf(buf, PATH_MAX, "/entrance/session/%d/icon", i);
+ icon = ecore_config_string_get(buf);
+
+ if ((exs = entrance_x_session_new(title, icon, session)))
+ {
+ e->sessions.keys = evas_list_append(e->sessions.keys, title);
+ e->sessions.hash =
+ evas_hash_add(e->sessions.hash, exs->name, exs);
}
}
@@ -181,11 +155,8 @@
e->display.h = 1;
#endif
-
/* auth info */
-
- if (!e_db_int_get(db, "/entrance/auth", &(e->auth)))
- e->auth = 0;
+ e->auth = ecore_config_int_get("/entrance/auth");
if (e->auth != ENTRANCE_USE_PAM)
{
/* check whether /etc/shadow can be used for authentication */
@@ -214,20 +185,16 @@
* @return a valid Entrance_Config file, or NULL on error
*/
Entrance_Config *
-entrance_config_parse(char *file)
+entrance_config_load(char *file)
{
Entrance_Config *e = NULL;
if (file)
{
- E_DB_File *db;
-
- if ((db = e_db_open_read(file)))
- {
- e = entrance_config_new();
- entrance_config_populate(e, db);
- e_db_close(db);
- }
+ e = entrance_config_new();
+ _entrance_config_defaults_set();
+ ecore_config_file_load(file);
+ entrance_config_populate(e);
}
return (e);
}
@@ -302,7 +269,7 @@
}
void
-entrance_config_edb_save(Entrance_Config * e, E_DB_File * db)
+entrance_config_store(Entrance_Config *e)
{
int i = 0;
char buf[PATH_MAX];
@@ -329,28 +296,28 @@
for (i = 0; i < ssize; i++)
{
- e_db_str_set(db, strings[i], values[i]);
+ ecore_config_string_set(strings[i], values[i]);
}
for (i = 0; i < intsize; i++)
{
- e_db_int_set(db, intstrings[i], intvalues[i]);
+ ecore_config_int_set(intstrings[i], intvalues[i]);
}
for (i = 0, l = e->users.keys; l; l = l->next, i++)
{
if ((eu = evas_hash_find(e->users.hash, (char *) l->data)))
{
snprintf(buf, PATH_MAX, "/entrance/user/%d/user", i);
- e_db_str_set(db, buf, eu->name);
+ ecore_config_string_set(buf, eu->name);
snprintf(buf, PATH_MAX, "/entrance/user/%d/session", i);
- e_db_str_set(db, buf, eu->session);
+ ecore_config_string_set(buf, eu->session);
snprintf(buf, PATH_MAX, "/entrance/user/%d/icon", i);
- e_db_str_set(db, buf, eu->icon);
+ ecore_config_string_set(buf, eu->icon);
}
else
i--;
}
snprintf(buf, PATH_MAX, "/entrance/user/count");
- e_db_int_set(db, buf, i);
+ ecore_config_int_set(buf, i);
for (i = 0, l = e->sessions.keys; l; l = l->next, i++)
{
if (l->data)
@@ -358,40 +325,25 @@
if ((exs = evas_hash_find(e->sessions.hash, (char *) l->data)))
{
snprintf(buf, PATH_MAX, "/entrance/session/%d/title", i);
- e_db_str_set(db, buf, exs->name);
+ ecore_config_string_set(buf, exs->name);
snprintf(buf, PATH_MAX, "/entrance/session/%d/session", i);
- e_db_str_set(db, buf, exs->session);
+ ecore_config_string_set(buf, exs->session);
snprintf(buf, PATH_MAX, "/entrance/session/%d/icon", i);
- e_db_str_set(db, buf, exs->icon);
+ ecore_config_string_set(buf, exs->icon);
}
}
}
snprintf(buf, PATH_MAX, "/entrance/session/count");
- e_db_int_set(db, buf, i);
+ ecore_config_int_set(buf, i);
}
int
-entrance_config_save(Entrance_Config * e, const char *file)
+entrance_config_save(Entrance_Config *e, const char *file)
{
if (file)
{
- char buf[PATH_MAX];
- E_DB_File *db = NULL;
-
- snprintf(buf, PATH_MAX, "%s.tmp.db", file);
- if ((db = e_db_open(buf)))
- {
- entrance_config_edb_save(e, db);
- e_db_close(db);
- e_db_flush();
- return (rename(buf, file));
- }
-#if 0
- else
- {
- entrance_config_print(e);
- }
-#endif
+ entrance_config_store(e);
+ ecore_config_file_save(file);
}
return (1);
}
@@ -429,70 +381,42 @@
* @e - a pointer to the config struct we want to write the user list for
*/
void
-entrance_config_user_list_write(Entrance_Config * e)
+entrance_config_user_list_save(Entrance_Config * e, const char *file)
{
int i = 0;
Evas_List *l = NULL;
- E_DB_File *db = NULL;
Entrance_User *eu = NULL;
- char file[PATH_MAX], buf[PATH_MAX];
+ char buf[PATH_MAX];
- snprintf(file, PATH_MAX, "%s/entrance_config.db", PACKAGE_CFG_DIR);
- if (!e->users.remember)
- return;
-/* FIXME: I guess we can't free up old strings like this. */
-#if 0
- if ((db = e_db_open(file)))
+ if (!e->users.remember) return;
+
+ for (i = 0, l = e->users.keys; l && i < e->users.remember_n;
+ l = l->next, i++)
{
- if ((old_keys = e_db_match_keys(db, "/entrance/user/", &count)))
+ if ((eu = evas_hash_find(e->users.hash, (char *) l->data)))
{
- for (i = 0; i < count; i++)
+ if (eu->name)
{
- fprintf(stderr, "Nuking %s\n", old_keys[i]);
- e_db_data_del(db, old_keys[i]);
- free(old_keys[i]);
+ snprintf(buf, PATH_MAX, "/entrance/user/%d/user", i);
+ ecore_config_string_set(buf, eu->name);
}
- free(old_keys);
- e_db_close(db);
- e_db_flush();
- }
- }
-#endif
- if ((db = e_db_open(file)))
- {
- for (i = 0, l = e->users.keys; l && i < e->users.remember_n;
- l = l->next, i++)
- {
- if ((eu = evas_hash_find(e->users.hash, (char *) l->data)))
+ if (eu->session)
{
- if (eu->name)
- {
- snprintf(buf, PATH_MAX, "/entrance/user/%d/user", i);
- e_db_str_set(db, buf, eu->name);
- }
- if (eu->session)
- {
- snprintf(buf, PATH_MAX, "/entrance/user/%d/session", i);
- e_db_str_set(db, buf, eu->session);
- }
- if (eu->icon)
- {
- snprintf(buf, PATH_MAX, "/entrance/user/%d/icon", i);
- e_db_str_set(db, buf, eu->icon);
- }
+ snprintf(buf, PATH_MAX, "/entrance/user/%d/session", i);
+ ecore_config_string_set(buf, eu->session);
+ }
+ if (eu->icon)
+ {
+ snprintf(buf, PATH_MAX, "/entrance/user/%d/icon", i);
+ ecore_config_string_set(buf, eu->icon);
}
- else
- i--;
}
- snprintf(buf, PATH_MAX, "/entrance/user/count");
- e_db_int_set(db, buf, i);
- e_db_close(db);
- e_db_flush();
- }
- else
- {
- fprintf(stderr, "Unable to open %s, sure you're root?", file);
+ else
+ i--;
}
+ snprintf(buf, PATH_MAX, "/entrance/user/count");
+ ecore_config_int_set(buf, i);
+ ecore_config_file_save(file);
}
#if 0
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- entrance_config.h 27 Dec 2004 06:45:14 -0000 1.16
+++ entrance_config.h 16 Aug 2005 04:03:27 -0000 1.17
@@ -5,7 +5,6 @@
* @brief Struct Definitions and shared function declarations
*/
#include "../config.h"
-#include <Edb.h>
#include <Evas.h>
#include <stdio.h>
#include <string.h>
@@ -123,11 +122,11 @@
typedef struct _Entrance_Config Entrance_Config;
-Entrance_Config *entrance_config_parse(char *file);
+Entrance_Config *entrance_config_load(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);
-void entrance_config_user_list_write(Entrance_Config * e);
-int entrance_config_save(Entrance_Config * e, const char *file);
+void entrance_config_user_list_save(Entrance_Config * e, const char *file);
+int entrance_config_save(Entrance_Config * e, const char *file);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_edit.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- entrance_edit.c 23 Mar 2005 03:12:40 -0000 1.12
+++ entrance_edit.c 16 Aug 2005 04:03:27 -0000 1.13
@@ -9,6 +9,7 @@
#include <unistd.h>
#include <getopt.h>
#include <string.h>
+#include <Ecore_Config.h>
#include <Edje.h>
#include <Esmart/Esmart_Container.h>
#include <Esmart/Esmart_Text_Entry.h>
@@ -785,7 +786,7 @@
ecore_main_loop_quit();
else if (!strcmp("ecco,button,global,save", emission))
{
- snprintf(buf, PATH_MAX, "%s/entrance_config.db", PACKAGE_CFG_DIR);
+ snprintf(buf, PATH_MAX, "%s/entrance_config.cfg", PACKAGE_CFG_DIR);
if (!entrance_config_save(ecco.config, buf))
{
fprintf(stderr, "Wrote %s\n", buf);
@@ -1907,12 +1908,17 @@
/* Basic ecore initialization */
if (!ecore_init())
return (-1);
+ if (ecore_config_init("entrance") != ECORE_CONFIG_ERR_SUCC)
+ {
+ ecore_shutdown();
+ return -1;
+ }
ecore_app_args_set(argc, (const char **) argv);
if ((ecco.config =
- entrance_config_parse(PACKAGE_CFG_DIR "/entrance_config.db")) == NULL)
+ entrance_config_load(PACKAGE_CFG_DIR "/entrance_config.cfg")) == NULL)
{
- fprintf(stderr, "Unable to open %s/entrance_config.db\n",
+ fprintf(stderr, "Unable to open %s/entrance_config.cfg\n",
PACKAGE_CFG_DIR);
exit(1);
}
@@ -2033,6 +2039,7 @@
edje_shutdown();
ecore_evas_shutdown();
+ ecore_config_shutdown();
ecore_shutdown();
}
else
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_login.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- entrance_login.c 16 Aug 2005 03:55:42 -0000 1.4
+++ entrance_login.c 16 Aug 2005 04:03:27 -0000 1.5
@@ -33,10 +33,10 @@
main(int argc, char **argv)
{
pid_t pid = -1;
- char *user = NULL;
- char *display = NULL;
#ifdef HAVE_PAM
+ char *user = NULL;
+ char *display = NULL;
Entrance_Auth *e = NULL;
#endif
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -3 -r1.71 -r1.72
--- entrance_session.c 28 May 2005 09:31:14 -0000 1.71
+++ entrance_session.c 16 Aug 2005 04:03:27 -0000 1.72
@@ -1,6 +1,6 @@
#include "entrance.h"
#include "entrance_session.h"
-#include <X11/Xlib.h>
+#include <Ecore_Config.h>
#include <Esmart/Esmart_Container.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -35,16 +35,15 @@
entrance_session_new(const char *config, const char *display, int testing)
{
Entrance_Session *e;
- char *db;
-
- if (config)
- db = strdup(config);
- else
- db = strdup(PACKAGE_CFG_DIR "/entrance_config.db");
e = (Entrance_Session *) malloc(sizeof(struct _Entrance_Session));
memset(e, 0, sizeof(struct _Entrance_Session));
+ if (config)
+ e->db = strdup(config);
+ else
+ e->db = strdup(PACKAGE_CFG_DIR "/entrance_config.cfg");
+
openlog("entrance", LOG_NOWAIT, LOG_DAEMON);
if (!display)
{
@@ -59,16 +58,15 @@
e->display = strdup(display);
e->auth = entrance_auth_new();
- e->config = entrance_config_parse(db);
+ e->config = entrance_config_load(e->db);
if (!e->config)
{
- fprintf(stderr, "Could not load %s\n", db);
- syslog(LOG_CRIT, "Fatal Error: Unable to read config file %s.", db);
+ fprintf(stderr, "Could not load %s\n", e->db);
+ syslog(LOG_CRIT, "Fatal Error: Unable to read config file %s.", e->db);
exit(EXITCODE);
}
e->session = strdup("");
e->testing = testing;
- free(db);
return (e);
}
@@ -137,6 +135,11 @@
entrance_config_free(e->config);
e->config = NULL;
}
+ if (e->db)
+ {
+ free(e->db);
+ e->db = NULL;
+ }
if (e->ee)
{
ecore_evas_hide(e->ee);
@@ -417,10 +420,15 @@
e->display);
}
#endif
+
+ _entrance_session_user_list_fix(e);
+ ecore_config_shutdown();
+
/* avoid doubling up pam handles before the fork */
pwent = struct_passwd_dup(e->auth->pw);
entrance_auth_free(e->auth);
e->auth = NULL;
+
switch ((pid = fork()))
{
case 0:
@@ -450,7 +458,6 @@
snprintf(buf, sizeof(buf), "%s/entrance_login %i", PACKAGE_BIN_DIR,
(int) pid);
}
- _entrance_session_user_list_fix(e);
shell = strdup("/bin/sh");
/* this bypasses a race condition where entrance loses its x
connection before the wm gets it and x goes and resets itself */
@@ -732,10 +739,9 @@
if ((eu = evas_hash_find(e->config->users.hash, e->auth->user)))
{
e->config->users.keys =
- evas_list_prepend(evas_list_remove
- (e->config->users.keys, eu->name),
+ evas_list_prepend(evas_list_remove(e->config->users.keys,
eu->name),
eu->name);
- entrance_config_user_list_write(e->config);
+ entrance_config_user_list_save(e->config, e->db);
return;
}
}
@@ -747,7 +753,7 @@
evas_hash_add(e->config->users.hash, eu->name, eu);
e->config->users.keys =
evas_list_prepend(e->config->users.keys, eu->name);
- entrance_config_user_list_write(e->config);
+ entrance_config_user_list_save(e->config, e->db);
}
}
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- entrance_session.h 27 Dec 2004 06:45:14 -0000 1.22
+++ entrance_session.h 16 Aug 2005 04:03:27 -0000 1.23
@@ -1,16 +1,16 @@
#ifndef _ENTRANCE_SESSION_H
#define _ENTRANCE_SESSION_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>
-#include<unistd.h>
-#include<syslog.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>
+#include <unistd.h>
+#include <syslog.h>
/**
* @file entrance_session.h
* @brief Struct Definitions and shared function declarations
@@ -33,6 +33,7 @@
Evas_Object *session_container;
Entrance_Auth *auth; /* encapsulated auth info */
Entrance_Config *config; /* configuration options */
+ char *db; /* path to configuration db */
int authed; /* whether or not the user has authenticated
* or not */
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_user.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- entrance_user.c 10 Dec 2004 23:33:31 -0000 1.14
+++ entrance_user.c 16 Aug 2005 04:03:27 -0000 1.15
@@ -24,8 +24,8 @@
/**
* entrance_user_new - given a user, icon, and session, create a new
* Entrance_User instance. We don't copy the pointers here, simply use
- * them, it allows for us to pass in NULL, and easily use edb supplied data
- * w/o having to free it.
+ * them, it allows for us to pass in NULL, and easily use ecore_config
+ * supplied data w/o having to free it.
* @param user - the user's user id on the system
* @param icon - the user's "face" icon, an edje or eet
* @param session - the key into the session hash that this user considers
their
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/main.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- main.c 23 Mar 2005 03:12:40 -0000 1.72
+++ main.c 16 Aug 2005 04:03:27 -0000 1.73
@@ -12,6 +12,7 @@
#include <Edje.h>
#include <Esmart/Esmart_Text_Entry.h>
#include <Esmart/Esmart_Container.h>
+#include <Ecore_Config.h>
#include "entrance.h"
#include "entrance_session.h"
#include "entrance_x_session.h"
@@ -142,8 +143,8 @@
}
if (oo)
{
- selecto ? evas_object_focus_set(oo, 0) : evas_object_focus_set(o, 0);
- selecto ? evas_object_focus_set(o, 1) : evas_object_focus_set(oo, 1);
+ selecto ? evas_object_focus_set(oo, 0) : evas_object_focus_set(oo, 1);
+ selecto ? evas_object_focus_set(o, 1) : evas_object_focus_set(o, 0);
}
}
@@ -628,6 +629,11 @@
/* Basic ecore initialization */
if (!ecore_init())
return (-1);
+ if (ecore_config_init("entrance") != ECORE_CONFIG_ERR_SUCC)
+ {
+ ecore_shutdown();
+ return -1;
+ }
ecore_app_args_set(argc, (const char **) argv);
/* Set locale to user's environment */
@@ -995,6 +1001,7 @@
edje_shutdown();
ecore_evas_shutdown();
ecore_x_shutdown();
+ ecore_config_shutdown();
ecore_shutdown();
}
else
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/util.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- util.h 8 Mar 2004 16:59:00 -0000 1.3
+++ util.h 16 Aug 2005 04:03:27 -0000 1.4
@@ -1,15 +1,15 @@
#ifndef ENTRANCE_UTILS
#define ENTRANCE_UTILS
-#include<pwd.h>
-#include<grp.h>
-#include<paths.h>
-#include<stdio.h>
-#include<stdlib.h>
-#include<limits.h>
-#include<string.h>
-#include<unistd.h>
-#include<Evas.h>
+#include <pwd.h>
+#include <grp.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+#include <Evas.h>
#define ENTRANCE_DEBUG 0
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs