Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : epplets

Dir     : e16/epplets/epplets


Modified Files:
        E-Biff.c E-Clock.c E-Magic.c E-MoonClock.c E-Mountbox.c 
        E-OpenGL-Demo.c E-Power.c E-SD.c E-ScreenSave.c 
        E-ScreenShoot.c E-Toolbox.c E-UrlWatch.c 


Log Message:
Pass data install path by function call in stead of by EROOT in epplet.h.
Look up images in epplet data dir.

===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-Biff.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- E-Biff.c    8 Apr 2002 20:42:46 -0000       1.23
+++ E-Biff.c    13 Apr 2006 08:26:31 -0000      1.24
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: E-Biff.c,v 1.23 2002/04/08 20:42:46 mej 
Exp $";
+static const char cvs_ident[] = "$Id: E-Biff.c,v 1.24 2006/04/13 08:26:31 kwo 
Exp $";
 
 #include <stdio.h>
 #include <sys/time.h>
@@ -36,9 +36,9 @@
 #define MAIL_PATH       "/var/spool/mail"
 #define MAIL_PROG       "Eterm -t mutt"
 #define POLL_INTERVAL   "2.0"
-#define NOMAIL_IMAGE    EROOT "/epplet_data/E-Biff/nomail.png"
-#define NEWMAIL_IMAGE   EROOT "/epplet_data/E-Biff/newmail.png"
-#define SEVEN_IMAGE     EROOT "/epplet_data/E-Biff/7of9.png"
+#define NOMAIL_IMAGE    "nomail.png"
+#define NEWMAIL_IMAGE   "newmail.png"
+#define SEVEN_IMAGE     "7of9.png"
 
 #if 0
 #  define D(x) do {printf("%10s | %7d:  [debug] ", __FILE__, __LINE__); printf 
x; fflush(stdout);} while (0)
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-Clock.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- E-Clock.c   3 Dec 1999 19:52:28 -0000       1.11
+++ E-Clock.c   13 Apr 2006 08:26:31 -0000      1.12
@@ -127,8 +127,7 @@
    b_help = Epplet_create_button(NULL, NULL,
                                 34, 2, 0, 0, "HELP", win, NULL,
                                 cb_help, NULL);
-   Epplet_gadget_show(Epplet_create_image(2, 2, 44, 44, 
-                                         EROOT 
"/epplet_data/E-Clock/E-Clock-Image.png"));
+   Epplet_gadget_show(Epplet_create_image(2, 2, 44, 44, "E-Clock-Image.png"));
    Epplet_register_focus_in_handler(cb_in, NULL);
    Epplet_register_focus_out_handler(cb_out, NULL);
    Epplet_register_expose_handler(cb_expose, NULL);
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-Magic.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- E-Magic.c   5 Jan 2000 16:24:00 -0000       1.3
+++ E-Magic.c   13 Apr 2006 08:26:31 -0000      1.4
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: E-Magic.c,v 1.3 2000/01/05 16:24:00 mej 
Exp $";
+static const char cvs_ident[] = "$Id: E-Magic.c,v 1.4 2006/04/13 08:26:31 kwo 
Exp $";
 
 #include <stdio.h>
 #include <sys/time.h>
@@ -42,8 +42,6 @@
 #define BEGMATCH(a, b)  (!strncasecmp((a), (b), (sizeof(b) - 1)))
 #define NONULL(x)       ((x) ? (x) : (""))
 
-#define DATA_ROOT EROOT "/epplet_data/E-Magic"
-
 Epplet_gadget close_button, cfg_button, picture, label;
 Epplet_gadget cfg_tb_image, cfg_tb_delay, cfg_tb_ans_file;
 unsigned long idx = 0, cnt = 0;
@@ -305,13 +303,13 @@
 static void
 parse_config(void)
 {
+  char buff[1024], *s, ss[1024];
 
-  char buff[1024], *s;
-
-  image = Epplet_query_config_def("image", DATA_ROOT "/8ball.png");
+  image = Epplet_query_config_def("image", "8ball.png");
 
-  ans_file = Epplet_query_config_def("answers", DATA_ROOT "/answers.txt");
-  if (!parse_answers(ans_file) && !parse_answers(ans_file = DATA_ROOT 
"/answers.txt")) {
+  Esnprintf(ss, sizeof(ss), "%s/answers.txt", Epplet_data_dir());
+  ans_file = Epplet_query_config_def("answers", ss);
+  if (!parse_answers(ans_file) && !parse_answers(ans_file = ss)) {
     /* Couldn't find the answers.  Exit. */
     Esnprintf(buff, sizeof(buff), "E-Magic:  Missing/invalid answers file 
\"%s\"", ans_file);
     Epplet_dialog_ok(buff);
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-MoonClock.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- E-MoonClock.c       27 Jun 2002 18:35:52 -0000      1.11
+++ E-MoonClock.c       13 Apr 2006 08:26:31 -0000      1.12
@@ -34,7 +34,7 @@
 #include "CalcEphem.h"
 
 Epplet_gadget close_button, help_button, moon_pixmap;
-char *moon_image = EROOT "/epplet_data/E-MoonClock/E-MoonClock-01.png";
+char *moon_image = "E-MoonClock-01.png";
 double interval = 1000.0;
 
 static void close_cb(void *data);
@@ -74,7 +74,7 @@
   if (ImageNumber > 59)
     ImageNumber = 0;
 
-  Esnprintf(buf, sizeof(buf), EROOT 
"/epplet_data/E-MoonClock/E-MoonClock-%02d.png", ImageNumber);
+  Esnprintf(buf, sizeof(buf), "E-MoonClock-%02d.png", ImageNumber);
   moon_pixmap = Epplet_create_image(2, 2, 43, 43, buf);
   Epplet_gadget_show(moon_pixmap);
 
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-Mountbox.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- E-Mountbox.c        12 Apr 2006 23:02:29 -0000      1.26
+++ E-Mountbox.c        13 Apr 2006 08:26:31 -0000      1.27
@@ -28,22 +28,22 @@
 #define PROCMOUNTS "/proc/mounts"
 #define ETCMTAB    "/etc/mtab"
 
-#define __BG_IMAGE EROOT"/epplet_data/E-Mountbox/E-Mountbox-bg.png"
-#define __DEFAULT  EROOT"/epplet_data/E-Mountbox/E-Mountbox-blockdev.png"
+#define __BG_IMAGE "E-Mountbox-bg.png"
+#define __DEFAULT  "E-Mountbox-blockdev.png"
 
 ConfigItem defaults[] = {
-  {"BG_IMAGE",   EROOT"/epplet_data/E-Mountbox/E-Mountbox-bg.png"},
-  {"DEFAULT",    EROOT"/epplet_data/E-Mountbox/E-Mountbox-blockdev.png"},
+  {"BG_IMAGE",   "E-Mountbox-bg.png"},
+  {"DEFAULT",    "E-Mountbox-blockdev.png"},
   {"EJECT_MODE", "2"},
   {"DO_POLL",    "1"},
   {"POLLINTVAL", "5"}
 };
 
 char *default_types[] = {
-  "cd   "EROOT"/epplet_data/E-Mountbox/E-Mountbox-cd.png",
-  "fd   "EROOT"/epplet_data/E-Mountbox/E-Mountbox-floppy.png",
-  "zip  "EROOT"/epplet_data/E-Mountbox/E-Mountbox-zip.png",
-  "jazz "EROOT"/epplet_data/E-Mountbox/E-Mountbox-jazz.png"
+  "cd   E-Mountbox-cd.png",
+  "fd   E-Mountbox-floppy.png",
+  "zip  E-Mountbox-zip.png",
+  "jazz E-Mountbox-jazz.png"
 };
 
 typedef enum eject_mode
@@ -178,7 +178,6 @@
 error_exit(void)
 {
   Esync();
-  Epplet_cleanup();
   exit(1);
 }
 
@@ -872,7 +871,12 @@
                    {
                      tmp_image = imlib_load_image(s);  
                      if (!tmp_image)
-                       tmp_image = imlib_load_image(__DEFAULT);  
+                       {
+                         char buf[1024];
+                         Esnprintf(buf, sizeof(buf), "%s/%s",
+                                   Epplet_data_dir(), __DEFAULT);
+                         tmp_image = imlib_load_image(buf);  
+                       }
                      if (!tmp_image)
                        {
                          Epplet_dialog_ok("  E-Mountbox could not load a 
default icon\n  "
@@ -1623,14 +1627,17 @@
   int         i, j, k, linear, linear_w;
   Imlib_Image *tmp = NULL;
   Tile       *tile;
-  char       *s = NULL;
+  char       *s = NULL, buf[1024];
   unsigned char *widescreen_data, *widescreen_canvas_data, *tile_data, 
*bg_data;
 
   s = Epplet_query_config("BG_IMAGE");
 
   tmp = imlib_load_image(s);  
   if (!tmp)
-    tmp = imlib_load_image(__BG_IMAGE);  
+    {
+      Esnprintf(buf, sizeof(buf), "%s/%s", Epplet_data_dir(), __BG_IMAGE);
+      tmp = imlib_load_image(buf);  
+    }
   if (!tmp)
     {
       /* Even the fallbacks didn't work.  If we don't exit
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-OpenGL-Demo.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- E-OpenGL-Demo.c     3 Mar 2000 22:45:02 -0000       1.25
+++ E-OpenGL-Demo.c     13 Apr 2006 08:26:31 -0000      1.26
@@ -386,6 +386,8 @@
 int
 main(int argc, char **argv)
 {
+       char buf[1024];
+
        GLXContext cx;
        int prio;
        Epplet_gadget objectPopup, lightingPopup, texturePopup;
@@ -467,9 +469,10 @@
        glEnable(GL_DEPTH_TEST);
 
        /* Lets load teh texture */
-  if((textureFile = fopen(EROOT "/epplet_data/E-OpenGL-Demo/cube_texture.RGB", 
"rb")) == NULL)
-       printf("Failed to load the cube texture file!\n");
-       else {
+       Esnprintf(buf, sizeof(buf), "%s/cube_texture.RGB", Epplet_data_dir());
+       if((textureFile = fopen(buf, "rb")) == NULL) {
+               printf("Failed to load the cube texture file!\n");
+       } else {
                fread(textureArray, sizeof(GLubyte), 3*64*64, textureFile);
                fclose(textureFile);
 
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-Power.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- E-Power.c   31 Mar 2006 22:56:17 -0000      1.20
+++ E-Power.c   13 Apr 2006 08:26:31 -0000      1.21
@@ -204,8 +204,7 @@
 
    /* Display current status */
    Epplet_change_label(label, current_status);
-   sprintf(current_status, EROOT "/epplet_data/E-Power//E-Power-Bat-%i.png",
-           ((bat_val + 5) / 10) * 10);
+   sprintf(current_status, "E-Power-Bat-%i.png", ((bat_val + 5) / 10) * 10);
    Epplet_change_image(image, 44, 24, current_status);
    Epplet_timer(cb_timer, NULL, 5.0, "TIMER");
 
@@ -298,8 +297,7 @@
           }
         Epplet_change_label(label, s);
 
-        sprintf(s, EROOT "/epplet_data/E-Power//E-Power-Bat-%i.png",
-                ((bat_val + 5) / 10) * 10);
+        sprintf(s, "E-Power-Bat-%i.png", ((bat_val + 5) / 10) * 10);
         Epplet_change_image(image, 44, 24, s);
         Epplet_timer(cb_timer, NULL, 30.0, "TIMER");
 
@@ -382,10 +380,8 @@
    b_sleep = Epplet_create_button(NULL, NULL,
                                   34, 34, 0, 0, "STOP", 0, NULL,
                                   cb_sleep, NULL);
-   Epplet_gadget_show(image =
-                      Epplet_create_image
-                      (2, 2, 44, 24,
-                       EROOT "/epplet_data/E-Power/E-Power-Bat-100.png"));
+   Epplet_gadget_show(image = Epplet_create_image(2, 2, 44, 24,
+                                                  "E-Power-Bat-100.png"));
    Epplet_gadget_show(label =
                       Epplet_create_label(2, 28, "APM, ACPI\nmissing", 1));
    Epplet_register_focus_in_handler(cb_in, NULL);
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-SD.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- E-SD.c      12 Apr 2006 23:02:29 -0000      1.20
+++ E-SD.c      13 Apr 2006 08:26:31 -0000      1.21
@@ -488,9 +488,7 @@
   Epplet_gadget_show (rbar =
                      Epplet_create_vbar (34, 18, 12, 28, 1, &esd.vol_r));
   Epplet_gadget_show (standby =
-                     Epplet_create_togglebutton (NULL,
-                                                 EROOT
-                                                 
"/epplet_data/E-SD/E-SD_standby.png",
+                     Epplet_create_togglebutton (NULL, "E-SD_standby.png",
                                                  18, 18, 12, 12,
                                                  &esd.standby, standby_cb,
                                                  NULL));
@@ -546,9 +544,7 @@
                          (void *) (&(cloak_delays[10])));
 
   Epplet_gadget_show (btn_ctimer =
-                     Epplet_create_popupbutton (NULL,
-                                                EROOT
-                                                
"/epplet_data/E-SD/E-SD_minitime.png",
+                     Epplet_create_popupbutton (NULL, "E-SD_minitime.png",
                                                 18, 31, 12, 12, NULL,
                                                 ctimer_p));
 
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-ScreenSave.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- E-ScreenSave.c      12 Apr 2006 23:02:29 -0000      1.26
+++ E-ScreenSave.c      13 Apr 2006 08:26:31 -0000      1.27
@@ -625,20 +625,14 @@
                                            2, 12, 12, "CONFIGURE", 0, NULL,
                                            cb_config, NULL));
   Epplet_gadget_show (btn_col =
-                     Epplet_create_popupbutton (NULL,
-                                                EROOT
-                                                
"/epplet_data/E-ScreenShoot/E-ScreenShoot_col.png",
+                     Epplet_create_popupbutton (NULL, 
"../E-ScreenShoot/E-ScreenShoot_col.png",
                                                 2, 17, 13, 13, NULL, col_p));
   Epplet_gadget_show (btn_ctimer =
-                     Epplet_create_popupbutton (NULL,
-                                                EROOT
-                                                
"/epplet_data/E-ScreenShoot/E-ScreenShoot_minitime.png",
+                     Epplet_create_popupbutton (NULL, 
"../E-ScreenShoot/E-ScreenShoot_minitime.png",
                                                 17, 17, 13, 13, NULL,
                                                 ctimer_p));
   Epplet_gadget_show (btn_stimer =
-                     Epplet_create_popupbutton (NULL,
-                                                EROOT
-                                                
"/epplet_data/E-ScreenShoot/E-ScreenShoot_minitime2.png",
+                     Epplet_create_popupbutton (NULL, 
"../E-ScreenShoot/E-ScreenShoot_minitime2.png",
                                                 33, 17, 13, 13, NULL,
                                                 stimer_p));
   da = Epplet_create_drawingarea (2, 2, 44, 44);
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-ScreenShoot.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- E-ScreenShoot.c     12 Apr 2006 23:02:29 -0000      1.29
+++ E-ScreenShoot.c     13 Apr 2006 08:26:31 -0000      1.30
@@ -855,15 +855,11 @@
                       Epplet_create_button(NULL, NULL, 18, 2, 0, 0, "HELP", 0,
                                            NULL, cb_help, NULL));
    Epplet_gadget_show(btn_shoot =
-                      Epplet_create_button(NULL,
-                                           EROOT
-                                           
"/epplet_data/E-ScreenShoot/E-ScreenShoot_shoot.png",
+                      Epplet_create_button(NULL, "E-ScreenShoot_shoot.png",
                                            23, 31, 22, 13, 0, 0, NULL,
                                            cb_shoot, NULL));
    Epplet_gadget_show(tog_win =
-                      Epplet_create_togglebutton(NULL,
-                                                 EROOT
-                                                 
"/epplet_data/E-ScreenShoot/E-ScreenShoot_win.png",
+                      Epplet_create_togglebutton(NULL, "E-ScreenShoot_win.png",
                                                  11, 17, 10, 13, &opt.win,
                                                  NULL, NULL));
    Epplet_gadget_show(sldr_qual =
@@ -991,21 +987,15 @@
                                            NULL));
 
    Epplet_gadget_show(btn_col =
-                      Epplet_create_popupbutton(NULL,
-                                                EROOT
-                                                
"/epplet_data/E-ScreenShoot/E-ScreenShoot_col.png",
+                      Epplet_create_popupbutton(NULL, "E-ScreenShoot_col.png",
                                                 11, 31, 10, 13, NULL, col_p));
    Epplet_gadget_show(btn_ctimer =
-                      Epplet_create_popupbutton(NULL,
-                                                EROOT
-                                                
"/epplet_data/E-ScreenShoot/E-ScreenShoot_minitime.png",
+                      Epplet_create_popupbutton(NULL, 
"E-ScreenShoot_minitime.png",
                                                 23, 17, 10, 13, NULL,
                                                 ctimer_p));
 
    Epplet_gadget_show(btn_stimer =
-                      Epplet_create_popupbutton(NULL,
-                                                EROOT
-                                                
"/epplet_data/E-ScreenShoot/E-ScreenShoot_minitime2.png",
+                      Epplet_create_popupbutton(NULL, 
"E-ScreenShoot_minitime2.png",
                                                 35, 17, 10, 13, NULL,
                                                 stimer_p));
 
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-Toolbox.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- E-Toolbox.c 2 Aug 2000 02:02:32 -0000       1.12
+++ E-Toolbox.c 13 Apr 2006 08:26:31 -0000      1.13
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: E-Toolbox.c,v 1.12 2000/08/02 02:02:32 
mej Exp $";
+static const char cvs_ident[] = "$Id: E-Toolbox.c,v 1.13 2006/04/13 08:26:31 
kwo Exp $";
 
 #include <stdio.h>
 #include <sys/time.h>
@@ -39,7 +39,6 @@
 # define __attribute__(x)
 #endif
 
-#define DATA_DIR      EROOT "/epplet_data/E-Toolbox/"
 #define ACT_EXIT      "<exit>"
 #define ACT_CONFIG    "<config>"
 #define ACT_SHADE     "<shade>"
@@ -117,7 +116,7 @@
 static void
 create_gadget(int n)
 {
-  char *std = NULL, *pbuff, *s = NULL;
+  char *std = NULL, *pbuff;
 
   if (*(buttons[n].image) == '<') {
     std = strdup(buttons[n].image + 1);
@@ -129,11 +128,7 @@
       }
     }
   }
-  if (*(buttons[n].image) && *(buttons[n].image) != '<' && 
!strchr(buttons[n].image, '/')) {
-    s = buttons[n].image;
-    buttons[n].image = (char *) malloc(sizeof(DATA_DIR) + strlen(s) + 1);
-    sprintf(buttons[n].image, DATA_DIR "%s", s);
-  }
+
   if (!strcasecmp(buttons[n].prog, "<popup>")) {
     buttons[n].gad = Epplet_create_popup();
     Epplet_gadget_show(Epplet_create_popupbutton(buttons[n].label, 
buttons[n].image,
@@ -154,10 +149,6 @@
   if (std) {
     free(std);
   }
-  if (s) {
-    free(buttons[n].image);
-    buttons[n].image = s;
-  }
 }
 
 static void
@@ -486,11 +477,12 @@
 static void
 parse_config(void) {
 
-  char *tmp, buff[40];
+  char *tmp, buff[1024];
   int new_w, new_h;
 
   if (Epplet_query_config("button_0") == NULL) {
-    Epplet_load_config_file(DATA_DIR "default.cfg");
+    Esnprintf(buff, sizeof(buff), "%s/default.cfg", Epplet_data_dir());
+    Epplet_load_config_file(buff);
   }
   new_w = w;
   new_h = h;
===================================================================
RCS file: /cvs/e/e16/epplets/epplets/E-UrlWatch.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- E-UrlWatch.c        27 Jun 2002 18:35:52 -0000      1.29
+++ E-UrlWatch.c        13 Apr 2006 08:26:31 -0000      1.30
@@ -72,7 +72,8 @@
 {
   /* This reloads our config. */
   char *home = getenv ("HOME");
-  char buf[256];
+  char buf[1024];
+
   opt.save_urls = atoi (Epplet_query_config_def ("SAVE_URLS", "1"));
   opt.check_url_file = atoi (Epplet_query_config_def ("CHECK_URL_FILE", "1"));
   opt.always_show_file_urls =
@@ -106,10 +107,9 @@
   opt.url_file = _Strdup (Epplet_query_config_def ("URL_CHECK_FILE", buf));
   if (opt.new_url_command)
     free (opt.new_url_command);
+  Esnprintf(buf, sizeof(buf), "esdplay %s/wooeep.wav &", Epplet_data_dir());
   opt.new_url_command =
-    _Strdup (Epplet_query_config_def
-            ("NEW_URL_COMMAND",
-             "esdplay " EROOT "/epplet_data/E-UrlWatch/wooeep.wav &"));
+    _Strdup (Epplet_query_config_def ("NEW_URL_COMMAND", buf));
 }
 
 static void




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to