Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        prefs.c prefs.h 


Log Message:
Move the config db to ~/.e/apps/entice/
Add a directory for user themes
Add struct for maintaining user themes.

digitalfallout had lots of input :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/prefs.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- prefs.c     25 Oct 2003 03:24:16 -0000      1.10
+++ prefs.c     30 Nov 2003 20:13:37 -0000      1.11
@@ -114,20 +114,17 @@
 void
 entice_config_geometry_set(int x, int y, int w, int h)
 {
-   if (econfig)
+   if (econfig && econfig->db)
    {
-      char file[PATH_MAX];
-
       econfig->x = x;
       econfig->y = y;
       econfig->w = w;
       econfig->h = h;
 
-      snprintf(file, PATH_MAX, "%s/.entice.db", getenv("HOME"));
-      E_DB_INT_SET(file, "/entice/x", x);
-      E_DB_INT_SET(file, "/entice/y", y);
-      E_DB_INT_SET(file, "/entice/w", w);
-      E_DB_INT_SET(file, "/entice/h", h);
+      E_DB_INT_SET(econfig->db, "/entice/x", x);
+      E_DB_INT_SET(econfig->db, "/entice/y", y);
+      E_DB_INT_SET(econfig->db, "/entice/w", w);
+      E_DB_INT_SET(econfig->db, "/entice/h", h);
       e_db_flush();
    }
 }
@@ -175,16 +172,18 @@
       if ((econfig = entice_config_new()))
       {
          entice_keys_init();
-         snprintf(buf, PATH_MAX, "%s/.entice.db", getenv("HOME"));
 
+         snprintf(buf, PATH_MAX, "%s/.e/apps/entice/entice.db",
+                  getenv("HOME"));
+         econfig->db = strdup(buf);
          /* make sure we have a db, if not generate it */
-         if ((db = e_db_open_read(buf)) == NULL)
-            entice_config_generate_original_db(buf);
+         if ((db = e_db_open_read(econfig->db)) == NULL)
+            entice_config_generate_original_db(econfig->db);
          else
             e_db_close(db);
 
          /* now actually read the config */
-         if ((db = e_db_open_read(buf)))
+         if ((db = e_db_open_read(econfig->db)))
          {
             if ((str = e_db_str_get(db, "/entice/theme")))
             {
@@ -252,9 +251,13 @@
 entice_config_generate_original_db(char *filename)
 {
    int i, count;
+   struct stat status;
    char buf[PATH_MAX];
    E_DB_File *db = NULL;
 
+   char *dirs[] = { ".e", ".e/apps", ".e/apps/entice",
+      ".e/apps/entice/themes"
+   };
    char *signals[] = { "EnticeImageZoomIn", "EnticeImageZoomOut",
       "EnticeFullScreen",
       "EnticeImageNext", "EnticeImagePrev", "EnticeImageZoomDefault",
@@ -268,6 +271,13 @@
    };
    count = sizeof(signals) / sizeof(char *);
 
+   for (i = 0; i < 4; i++)
+   {
+      snprintf(buf, PATH_MAX, "%s/%s", getenv("HOME"), dirs[i]);
+      if (!stat(buf, &status))
+         continue;
+      mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
+   }
    if (filename)
    {
       if ((db = e_db_open(filename)))
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/prefs.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- prefs.h     18 Oct 2003 06:59:04 -0000      1.3
+++ prefs.h     30 Nov 2003 20:13:37 -0000      1.4
@@ -4,6 +4,8 @@
 #define SOFTWARE_X11 0
 #define GL_X11 1
 
+#include<Evas.h>
+
 /** 
  * _Entice_Config - there is a static struct of this type in
  * entice_config.c, add the attributes you want to be in the config
@@ -12,12 +14,17 @@
 struct _Entice_Config
 {
    char *theme;
+   char *db;
    int engine;
    struct
    {
       int image, font;
    } cache;
    int x, y, w, h;
+   struct {
+       Evas_List *list;
+       Evas_Hash *hash;
+   } themes;
 };
 typedef struct _Entice_Config Entice_Config;
 




-------------------------------------------------------
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

Reply via email to