Hi!
This is a patch to move entrance from edb to ecore_config. I know there
was some objections against using ecore_config, but I don't remember
them. I see no reason not to ditch edb since that would remove one
dependency, and ecore_config can do everything that edb can do.
If no one objects, I will commit it.
Sebastian
? ltmain.sh
? src/client/.entrance_config.c.swp
? src/client/.entrance_session.c.swp
? src/client/.main.c.swp
Index: README
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/README,v
retrieving revision 1.11
diff -u -r1.11 README
--- README 1 Jan 2004 08:15:27 -0000 1.11
+++ README 14 Aug 2005 12:28:02 -0000
@@ -47,9 +47,9 @@
To set up your sessions, edit the build_config.sh script in the data/config
directory before compiling to specify the names of the X sessions on your
machine. After installation, you will need to directly edit
-/etc/entrace_config.db using an EDB editor like edb_gtk_ed. The default
-sessions are designed to work on a Debian 3.0 installation, so you will
-likely need to update your db before Entrance can work for you. While
+/etc/entrace_config.cfg using an ecore_config editor like ecore_config. The
+default sessions are designed to work on a Debian 3.0 installation, so you
+will likely need to update your db before Entrance can work for you. While
adding sessions, please note that:
- A session without a path is assumed to be an Xsession name, and will be
Index: configure.in
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/configure.in,v
retrieving revision 1.42
diff -u -r1.42 configure.in
--- configure.in 30 Jul 2005 06:15:58 -0000 1.42
+++ configure.in 14 Aug 2005 12:28:02 -0000
@@ -41,10 +41,6 @@
fi
changequote([,])dnl
-AC_ARG_WITH(edb,
- [ --with-edb=DIR use edb in <DIR>],
- [ CFLAGS="$CFLAGS -I$withval/include"
- LIBS="-L$withval/lib $LIBS"])
AC_ARG_WITH(evas,
[ --with-evas=DIR use evas in <DIR>],
[ CFLAGS="$CFLAGS -I$withval/include"
@@ -58,80 +54,61 @@
[ CFLAGS="$CFLAGS -I$withval/include"
LIBS="-L$withval/lib $LIBS"])
-AC_PATH_GENERIC(edb, 1.0.3, [
- AC_SUBST(edb_libs)
- AC_SUBST(edb_cflags) ],
- AC_MSG_ERROR(Cannot find edb: Is edb-config in path?))
-edb_libs=`edb-config --libs`
-edb_cflags=`edb-config --cflags`
-AC_SUBST(edb_libs)
-AC_SUBST(edb_cflags)
-
-AC_PATH_GENERIC(evas, 1.0.0, [
- AC_SUBST(evas_libs)
- AC_SUBST(evas_cflags) ],
- AC_MSG_ERROR(Cannot find evas: Is evas-config in path?))
-evas_libs=`evas-config --libs`
-evas_cflags=`evas-config --cflags`
-
-AC_SUBST(evas_libs)
+AC_ARG_WITH(evas-config,
+[ --with-evas-config=EVAS_CONFIG use evas-config specified ],
+[
+ EVAS_CONFIG=$withval;
+ echo "using "$EVAS_CONFIG" for evas-config";
+],[
+ PROG="evas-config";
+ AC_PATH_PROG(EVAS_CONFIG, $PROG, "", $PATH)
+])
+evas_cflags=`$EVAS_CONFIG --cflags`
+evas_libs=`$EVAS_CONFIG --libs`
AC_SUBST(evas_cflags)
+AC_SUBST(evas_libs)
-have_ecore=no
-AC_CHECK_HEADER(Ecore.h,,
- AC_MSG_ERROR([Ecore.h not found! Have you installed Ecore?]))
-AC_CHECK_LIB(ecore, ecore_list_new,
- [have_ecore=yes],
- AC_MSG_ERROR([Ecore check failed! Make sure you have the latest version of
Ecore installed.]))
-
-have_ecore_evas=no
-AC_CHECK_HEADER(Ecore_Evas.h,,
- AC_MSG_ERROR([Ecore_Evas.h not found! Did you compile Ecore with Evas
support?]))
-
-AC_CHECK_LIB(ecore_evas, ecore_evas_init, [
- have_ecore_evas=yes],
- AC_MSG_ERROR([Cannot find Ecore_Evas!]))
-
-have_ecore_software_x11=no
-AC_CHECK_LIB(ecore_evas, ecore_evas_software_x11_new, [
- have_ecore_software_x11=yes],
- AC_MSG_ERROR([Ecore_Evas does not have Software/X11 support!]))
-
-have_ecore_gl_x11=no
-AC_CHECK_LIB(ecore_evas, ecore_evas_gl_x11_new, [
- have_ecore_gl_x11=yes
- AC_DEFINE(HAVE_ECORE_GL_X11, 1, [OpenGL support])])
-
-have_ecore_ipc=no
-AC_CHECK_HEADER(Ecore_Ipc.h,,
- AC_MSG_ERROR([Ecore_Ipc.h not found! Did you compile Ecore with IPC
support?]))
-
-AC_CHECK_LIB(ecore_ipc, ecore_ipc_init, [
- have_ecore_ipc=yes],
- AC_MSG_ERROR([Cannot find Ecore_Ipc!]))
-
-ecore_cflags=`ecore-config --cflags`
-ecore_libs=`ecore-config --libs`
-AC_SUBST(ecore_libs)
+AC_ARG_WITH(ecore-config,
+[ --with-ecore-config=ECORE_CONFIG use ecore-config specified ],
+[
+ ECORE_CONFIG=$withval;
+ echo "using "$ECORE_CONFIG" for ecore-config";
+],[
+ PROG="ecore-config";
+ AC_PATH_PROG(ECORE_CONFIG, $PROG, "", $PATH)
+])
+ecore_cflags=`$ECORE_CONFIG --cflags`
+ecore_libs=`$ECORE_CONFIG --libs`
AC_SUBST(ecore_cflags)
+AC_SUBST(ecore_libs)
-AC_PATH_GENERIC(edje, 0.5.0, [
- AC_SUBST(edje_libs)
- AC_SUBST(edje_cflags) ],
- AC_MSG_ERROR(Cannot find edje: Is edje-config in path?))
-edje_libs=`edje-config --libs`
-edje_cflags=`edje-config --cflags`
-AC_SUBST(edje_libs)
+AC_ARG_WITH(edje-config,
+[ --with-edje-config=EDJE_CONFIG use edje-config specified ],
+[
+ EDJE_CONFIG=$withval;
+ echo "using "$EDJE_CONFIG" for edje-config";
+],[
+ PROG="edje-config";
+ AC_PATH_PROG(EDJE_CONFIG, $PROG, "", $PATH)
+])
+edje_cflags=`$EDJE_CONFIG --cflags`
+edje_libs=`$EDJE_CONFIG --libs`
AC_SUBST(edje_cflags)
+AC_SUBST(edje_libs)
-AC_PATH_GENERIC(esmart, 0.9.0, [
- AC_SUBST(esmart_libs)
- AC_SUBST(esmart_cflags) ],
- AC_MSG_ERROR(Cannot find esmart: Is esmart-config in path?))
-esmart_libs=`esmart-config --libs`
-esmart_cflags=`esmart-config --cflags`
-AC_SUBST(esmart_libs)
+AC_ARG_WITH(esmart-config,
+[ --with-esmart-config=ESMART_CONFIG use esmart-config specified ],
+[
+ ESMART_CONFIG=$withval;
+ echo "using "$ESMART_CONFIG" for esmart-config";
+],[
+ PROG="esmart-config";
+ AC_PATH_PROG(ESMART_CONFIG, $PROG, "", $PATH)
+])
+esmart_cflags=`$ESMART_CONFIG --cflags`
+esmart_libs=`$ESMART_CONFIG --libs`
AC_SUBST(esmart_cflags)
+AC_SUBST(esmart_libs)
have_clearenv=no
AC_CHECK_LIB(c, clearenv, [
Index: entrance.spec
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/entrance.spec,v
retrieving revision 1.4
diff -u -r1.4 entrance.spec
--- entrance.spec 5 Jan 2005 05:05:25 -0000 1.4
+++ entrance.spec 14 Aug 2005 12:28:02 -0000
@@ -39,7 +39,7 @@
%files
%defattr(-, root, root)
%doc AUTHORS COPYING* README
-%{_sysconfdir}/entrance_config.db
+%{_sysconfdir}/entrance_config.cfg
%{_sysconfdir}/init.d/entrance
%{_sysconfdir}/pam.d/entrance
%{_bindir}/entrance
Index: data/config/.cvsignore
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/data/config/.cvsignore,v
retrieving revision 1.2
diff -u -r1.2 .cvsignore
--- data/config/.cvsignore 11 Jan 2004 08:27:17 -0000 1.2
+++ data/config/.cvsignore 14 Aug 2005 12:28:02 -0000
@@ -1,4 +1,4 @@
Makefile
Makefile.in
build_config.sh
-entrance_config.db
+entrance_config.cfg
Index: data/config/Makefile.am
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/data/config/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- data/config/Makefile.am 3 Dec 2004 11:26:25 -0000 1.3
+++ data/config/Makefile.am 14 Aug 2005 12:28:02 -0000
@@ -1,4 +1,4 @@
-DB = entrance_config.db
+DB = entrance_config.cfg
SCRIPT = build_config.sh
CLEANFILES = $(DB)
Index: data/config/build_config.sh.in
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/data/config/build_config.sh.in,v
retrieving revision 1.7
diff -u -r1.7 build_config.sh.in
--- data/config/build_config.sh.in 23 Mar 2005 15:14:03 -0000 1.7
+++ data/config/build_config.sh.in 14 Aug 2005 12:28:02 -0000
@@ -1,52 +1,52 @@
#!/bin/sh -e
-DB="./entrance_config.db"
+DB="./entrance_config.cfg"
rm -f $DB
# set auth to 1 for pam, 2 for shadow
-edb_ed $DB add /entrance/auth int @auth_mode@
+ecore_config $DB set /entrance/auth int @auth_mode@
# uncomment the below to enable experimental OpenGL hardware acceleration
-#edb_ed $DB add /entrance/engine int 1
-#edb_ed $DB add /entrance/xinerama/screens/w int 1
-#edb_ed $DB add /entrance/xinerama/screens/h int 1
-#edb_ed $DB add /entrance/xinerama/on/w int 1
-#edb_ed $DB add /entrance/xinerama/on/h int 1
-edb_ed $DB add /entrance/theme str "default.edj"
-edb_ed $DB add /entrance/date_format str "%A %B %e, %Y"
-edb_ed $DB add /entrance/time_format str "%l:%M:%S %p"
-#edb_ed $DB add /entrance/fonts/count int 2
-#edb_ed $DB add /entrance/fonts/0/str str "/usr/share/fonts/truetype/"
-#edb_ed $DB add /entrance/fonts/1/str str "/usr/X11R6/lib/X11/fonts/Truetype/"
-edb_ed $DB add /entrance/greeting/before str "Welcome to "
-edb_ed $DB add /entrance/greeting/after str ""
-edb_ed $DB add /entrance/session/count int 8
-edb_ed $DB add /entrance/session/0/session str "default"
-edb_ed $DB add /entrance/session/0/title str "Default"
-edb_ed $DB add /entrance/session/0/icon str "default.png"
-edb_ed $DB add /entrance/session/1/icon str "enlightenment.png"
-edb_ed $DB add /entrance/session/1/title str "Enlightenment"
-edb_ed $DB add /entrance/session/1/session str "Enlightenment"
-edb_ed $DB add /entrance/session/2/session str "kde"
-edb_ed $DB add /entrance/session/2/title str "KDE"
-edb_ed $DB add /entrance/session/2/icon str "kde.png"
-edb_ed $DB add /entrance/session/3/session str "gnome"
-edb_ed $DB add /entrance/session/3/title str "Gnome"
-edb_ed $DB add /entrance/session/3/icon str "gnome.png"
-edb_ed $DB add /entrance/session/4/session str "blackbox"
-edb_ed $DB add /entrance/session/4/title str "Blackbox"
-edb_ed $DB add /entrance/session/4/icon str "blackbox.png"
-edb_ed $DB add /entrance/session/5/session str "sawfish"
-edb_ed $DB add /entrance/session/5/title str "Sawfish"
-edb_ed $DB add /entrance/session/5/icon str "default.png"
-edb_ed $DB add /entrance/session/6/session str "xfce"
-edb_ed $DB add /entrance/session/6/title str "XFce"
-edb_ed $DB add /entrance/session/6/icon str "xfce.png"
-edb_ed $DB add /entrance/session/7/session str "failsafe"
-edb_ed $DB add /entrance/session/7/title str "Failsafe"
-edb_ed $DB add /entrance/session/7/icon str "failsafe.png"
-edb_ed $DB add /entrance/system/reboot int 1
-edb_ed $DB add /entrance/system/halt int 1
-edb_ed $DB add /entrance/user/remember int 1
-edb_ed $DB add /entrance/user/remember_n int 5
-edb_ed $DB add /entrance/autologin/mode int 0
-#edb_ed $DB add /entrance/autologin/user str "atmos"
+#ecore_config $DB set /entrance/engine int 1
+#ecore_config $DB set /entrance/xinerama/screens/w int 1
+#ecore_config $DB set /entrance/xinerama/screens/h int 1
+#ecore_config $DB set /entrance/xinerama/on/w int 1
+#ecore_config $DB set /entrance/xinerama/on/h int 1
+ecore_config $DB set /entrance/theme str "default.edj"
+ecore_config $DB set /entrance/date_format str "%A %B %e, %Y"
+ecore_config $DB set /entrance/time_format str "%l:%M:%S %p"
+#ecore_config $DB set /entrance/fonts/count int 2
+#ecore_config $DB set /entrance/fonts/0/str str "/usr/share/fonts/truetype/"
+#ecore_config $DB set /entrance/fonts/1/str str
"/usr/X11R6/lib/X11/fonts/Truetype/"
+ecore_config $DB set /entrance/greeting/before str "Welcome to"
+ecore_config $DB set /entrance/greeting/after str ""
+ecore_config $DB set /entrance/session/count int 8
+ecore_config $DB set /entrance/session/0/session str "default"
+ecore_config $DB set /entrance/session/0/title str "Default"
+ecore_config $DB set /entrance/session/0/icon str "default.png"
+ecore_config $DB set /entrance/session/1/icon str "enlightenment.png"
+ecore_config $DB set /entrance/session/1/title str "Enlightenment"
+ecore_config $DB set /entrance/session/1/session str "Enlightenment"
+ecore_config $DB set /entrance/session/2/session str "kde"
+ecore_config $DB set /entrance/session/2/title str "KDE"
+ecore_config $DB set /entrance/session/2/icon str "kde.png"
+ecore_config $DB set /entrance/session/3/session str "gnome"
+ecore_config $DB set /entrance/session/3/title str "Gnome"
+ecore_config $DB set /entrance/session/3/icon str "gnome.png"
+ecore_config $DB set /entrance/session/4/session str "blackbox"
+ecore_config $DB set /entrance/session/4/title str "Blackbox"
+ecore_config $DB set /entrance/session/4/icon str "blackbox.png"
+ecore_config $DB set /entrance/session/5/session str "sawfish"
+ecore_config $DB set /entrance/session/5/title str "Sawfish"
+ecore_config $DB set /entrance/session/5/icon str "default.png"
+ecore_config $DB set /entrance/session/6/session str "xfce"
+ecore_config $DB set /entrance/session/6/title str "XFce"
+ecore_config $DB set /entrance/session/6/icon str "xfce.png"
+ecore_config $DB set /entrance/session/7/session str "failsafe"
+ecore_config $DB set /entrance/session/7/title str "Failsafe"
+ecore_config $DB set /entrance/session/7/icon str "failsafe.png"
+ecore_config $DB set /entrance/system/reboot int 1
+ecore_config $DB set /entrance/system/halt int 1
+ecore_config $DB set /entrance/user/remember int 1
+ecore_config $DB set /entrance/user/remember_n int 5
+ecore_config $DB set /entrance/autologin/mode int 0
+#ecore_config $DB set /entrance/autologin/user str "atmos"
Index: debian/control
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/debian/control,v
retrieving revision 1.5
diff -u -r1.5 control
--- debian/control 29 Mar 2005 16:57:13 -0000 1.5
+++ debian/control 14 Aug 2005 12:28:03 -0000
@@ -2,7 +2,7 @@
Section: x11
Priority: optional
Maintainer: Sytse Wielinga <[EMAIL PROTECTED]>
-Build-Depends: libedb1-dev, libevas0-dev, libecore0-dev, libedje0-dev,
libpam0g-dev | libpam-dev, debhelper (>> 4.0.0)
+Build-Depends: libevas0-dev, libecore0-dev, libedje0-dev, libpam0g-dev |
libpam-dev, debhelper (>> 4.0.0)
Standards-Version: 3.6.1.0
Package: entrance
Index: src/client/Makefile.am
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/Makefile.am,v
retrieving revision 1.16
diff -u -r1.16 Makefile.am
--- src/client/Makefile.am 28 May 2005 09:31:14 -0000 1.16
+++ src/client/Makefile.am 14 Aug 2005 12:28:03 -0000
@@ -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
Index: src/client/entrance.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance.h,v
retrieving revision 1.7
diff -u -r1.7 entrance.h
--- src/client/entrance.h 25 Oct 2003 04:50:28 -0000 1.7
+++ src/client/entrance.h 14 Aug 2005 12:28:03 -0000
@@ -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"
Index: src/client/entrance_config.c
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.c,v
retrieving revision 1.29
diff -u -r1.29 entrance_config.c
--- src/client/entrance_config.c 23 Mar 2005 03:12:40 -0000 1.29
+++ src/client/entrance_config.c 14 Aug 2005 12:28:04 -0000
@@ -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
Index: src/client/entrance_config.h
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.h,v
retrieving revision 1.16
diff -u -r1.16 entrance_config.h
--- src/client/entrance_config.h 27 Dec 2004 06:45:14 -0000 1.16
+++ src/client/entrance_config.h 14 Aug 2005 12:28:04 -0000
@@ -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
Index: src/client/entrance_edit.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_edit.c,v
retrieving revision 1.12
diff -u -r1.12 entrance_edit.c
--- src/client/entrance_edit.c 23 Mar 2005 03:12:40 -0000 1.12
+++ src/client/entrance_edit.c 14 Aug 2005 12:28:05 -0000
@@ -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
Index: src/client/entrance_session.c
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.c,v
retrieving revision 1.71
diff -u -r1.71 entrance_session.c
--- src/client/entrance_session.c 28 May 2005 09:31:14 -0000 1.71
+++ src/client/entrance_session.c 14 Aug 2005 12:28:06 -0000
@@ -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);
}
}
}
Index: src/client/entrance_session.h
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_session.h,v
retrieving revision 1.22
diff -u -r1.22 entrance_session.h
--- src/client/entrance_session.h 27 Dec 2004 06:45:14 -0000 1.22
+++ src/client/entrance_session.h 14 Aug 2005 12:28:06 -0000
@@ -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 */
Index: src/client/entrance_user.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_user.c,v
retrieving revision 1.14
diff -u -r1.14 entrance_user.c
--- src/client/entrance_user.c 10 Dec 2004 23:33:31 -0000 1.14
+++ src/client/entrance_user.c 14 Aug 2005 12:28:06 -0000
@@ -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
Index: src/client/main.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/main.c,v
retrieving revision 1.72
diff -u -r1.72 main.c
--- src/client/main.c 23 Mar 2005 03:12:40 -0000 1.72
+++ src/client/main.c 14 Aug 2005 12:28:07 -0000
@@ -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
Index: src/daemon/Makefile.am
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/daemon/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- src/daemon/Makefile.am 30 May 2005 21:16:02 -0000 1.15
+++ src/daemon/Makefile.am 14 Aug 2005 12:28:07 -0000
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-INCLUDES = @X_CFLAGS@ @ecore_cflags@ @edb_cflags@
+INCLUDES = @X_CFLAGS@ @ecore_cflags@
sbin_PROGRAMS = entranced
bin_SCRIPTS = entrance_wrapper
@@ -8,4 +8,4 @@
entranced_SOURCES = \
auth.c auth.h Entranced.h ipc.c ipc.h md5.c md5.h spawner.c util.c
util.h
-entranced_LDADD = @X_LIBS@ -lXau @ecore_libs@ @edb_libs@
+entranced_LDADD = @X_LIBS@ -lXau @ecore_libs@
Index: src/daemon/md5.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/daemon/md5.c,v
retrieving revision 1.2
diff -u -r1.2 md5.c
--- src/daemon/md5.c 23 Mar 2004 01:31:59 -0000 1.2
+++ src/daemon/md5.c 14 Aug 2005 12:28:07 -0000
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include <string.h> /* for memcpy() */
#include "md5.h"