Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entrance

Dir     : e17/apps/entrance/src/client


Modified Files:
        entrance_config.c entrance_config.h 


Log Message:
remember n users, or don't remember at allis optional via the system config
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- entrance_config.c   3 Mar 2004 16:13:10 -0000       1.16
+++ entrance_config.c   3 Mar 2004 19:31:37 -0000       1.17
@@ -110,6 +110,10 @@
    {
       syslog(LOG_WARNING, "Warning: No users found.");
    }
+   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;
 
    /* session hash and font list */
    if (e_db_int_get(db, "/entrance/session/count", &num_session))
@@ -257,25 +261,41 @@
 
 /**
  * entrance_config_user_list_write : Write out the possibly reordered user
- * list into the config db.  This still needs fixing.
- * FIXME: Nuke all old keys from the db relating to /entrance/user
- * FIXME: Check another config parameter whether we should write or not
- * FIXME: Check another config parameter so we only write n user
+ * list into the config db.
  * @e - a pointer to the config struct we want to write the user list for
  */
 void
 entrance_config_user_list_write(Entrance_Config * e)
 {
    int i = 0;
+   int count = 0;
    Evas_List *l = NULL;
    E_DB_File *db = NULL;
    Entrance_User *eu = NULL;
+   char **old_keys = NULL;
    char file[PATH_MAX], buf[PATH_MAX];
 
    snprintf(file, PATH_MAX, "%s/entrance_config.db", PACKAGE_CFG_DIR);
+   if (!e->users.remember)
+      return;
    if ((db = e_db_open(file)))
    {
-      for (l = e->users.keys; l; l = l->next, i++)
+      if ((old_keys = e_db_match_keys(db, "/entrance/user/", &count)))
+      {
+         for (i = 0; i < count; i++)
+         {
+            e_db_data_del(db, old_keys[i]);
+            free(old_keys[i]);
+         }
+         free(old_keys);
+         e_db_close(db);
+         e_db_flush();
+      }
+   }
+   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 = (Entrance_User *) l->data))
          {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/entrance_config.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- entrance_config.h   3 Mar 2004 18:16:15 -0000       1.11
+++ entrance_config.h   3 Mar 2004 19:31:37 -0000       1.12
@@ -79,6 +79,8 @@
     */
    struct
    {
+      int remember;
+      int remember_n;
       Evas_Hash *hash;
       Evas_List *keys;
    } users;




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to