Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : epplets

Dir     : e16/epplets/api


Modified Files:
        Makefile.am epplet.c epplet.h.in 


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/api/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- Makefile.am 31 Mar 2006 22:56:17 -0000      1.10
+++ Makefile.am 13 Apr 2006 08:26:31 -0000      1.11
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.10 2006/03/31 22:56:17 kwo Exp $
+# $Id: Makefile.am,v 1.11 2006/04/13 08:26:31 kwo Exp $
 
 lib_LTLIBRARIES = libepplet.la
 
@@ -7,7 +7,7 @@
 libepplet_la_DEPENDENCIES = $(top_builddir)/config.h epplet.h
 libepplet_la_LDFLAGS = -version-info 1:0:0
 
-INCLUDES = -I$(top_srcdir) $(X_CFLAGS)
+INCLUDES = -I$(top_srcdir) $(X_CFLAGS) -DEROOT=\"@[EMAIL PROTECTED]"
 
 LDADD = -L$(libdir) -L$(prefix)/lib $(LIBS) $(X_LIBS)
 
===================================================================
RCS file: /cvs/e/e16/epplets/api/epplet.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -3 -r1.135 -r1.136
--- epplet.c    12 Apr 2006 19:22:45 -0000      1.135
+++ epplet.c    13 Apr 2006 08:26:31 -0000      1.136
@@ -1976,7 +1976,7 @@
 }
 
 static char        *
-Estrdup(char *s)
+Estrdup(const char *s)
 {
    char               *ss;
    int                 len;
@@ -1989,6 +1989,28 @@
    return ss;
 }
 
+static char *
+Epplet_find_file(const char *name)
+{
+   char                s[1024];
+   struct stat         st;
+
+   if (!name)
+      return NULL;
+
+   /* Check if absolute path */
+   if (name[0] == '/')
+      return Estrdup(name);
+
+   /* Check if in epplet data dir */
+   Esnprintf(s, sizeof(s), "%s/%s", Epplet_data_dir(), name);
+   if (stat(s, &st) == 0)
+      return Estrdup(s);
+
+   /* Just dup and return */
+   return Estrdup(name);
+}
+
 void
 Epplet_paste_image(char *image, Window ww, int x, int y)
 {
@@ -2129,7 +2151,7 @@
    g->data = data;
    g->pmap = 0;
    g->mask = 0;
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    g->hilited = 0;
 
    attr.backing_store = NotUseful;
@@ -2702,7 +2724,7 @@
    g->pmap = 0;
    g->mask = 0;
    g->label = Estrdup(label);
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    g->hilited = 0;
    g->clicked = 0;
    g->pop = 0;
@@ -2915,7 +2937,7 @@
    g->mask = 0;
    g->val = val;
    g->label = Estrdup(label);
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    g->hilited = 0;
    g->clicked = 0;
    attr.backing_store = NotUseful;
@@ -3371,7 +3393,7 @@
    g->win = None;
    g->pw = 0;
    g->ph = 0;
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    Epplet_add_gad((Epplet_gadget) g);
    return (Epplet_gadget) g;
 }
@@ -3826,7 +3848,7 @@
    g->pmap = 0;
    g->mask = 0;
    g->label = Estrdup(label);
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    g->hilited = 0;
    g->clicked = 0;
    g->popped = 0;
@@ -3988,7 +4010,7 @@
    gg = (GadGeneral *) gadget;
    if (g->image)
       free(g->image);
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    g->w = w;
    g->h = h;
    if (gg->visible != 0)
@@ -4008,7 +4030,7 @@
    Epplet_draw_image(gadget, 1);
    if (g->image)
       free(g->image);
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    g->w = w;
    g->h = h;
    g->x = x;
@@ -5491,7 +5513,7 @@
    gg = (GadGeneral *) gadget;
    if (g->image)
       free(g->image);
-   g->image = Estrdup(image);
+   g->image = Epplet_find_file(image);
    if (gg->visible)
       Epplet_draw_button(gadget);
 }
===================================================================
RCS file: /cvs/e/e16/epplets/api/epplet.h.in,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- epplet.h.in 12 Apr 2006 19:22:45 -0000      1.55
+++ epplet.h.in 13 Apr 2006 08:26:31 -0000      1.56
@@ -49,8 +49,6 @@
 
 #endif
 
-#define EROOT "@EROOT@"
-
 /****************************************************************************/
 /* Data structures & primitives                                             */
 /****************************************************************************/




-------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to