Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_fm.c 


Log Message:


allow relative path for icon files in .desktops

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -3 -r1.230 -r1.231
--- e_fm.c      14 Dec 2007 16:32:20 -0000      1.230
+++ e_fm.c      18 Dec 2007 01:42:08 -0000      1.231
@@ -1108,11 +1108,43 @@
    if (ic->info.icon)
      {
        /* custom icon */
-       if (ic->info.icon[0] == '/')
+       if ((ic->info.icon[0] == '/') || 
+           (!strncmp(ic->info.icon, "./", 2)) ||
+           (!strncmp(ic->info.icon, "../", 3)))
          {
+            char *icfile = NULL;
+            
             /* path to icon file */
+            icfile = ic->info.icon;
+            if (!strncmp(ic->info.icon, "./", 2))
+              {
+                 /* relative path */
+                 snprintf(buf, sizeof(buf), "%s/%s",
+                          e_fm2_real_path_get(ic->info.fm),
+                          ic->info.icon + 2);
+                 icfile = buf;
+              }
+            else if (!strncmp(ic->info.icon, "../", 3))
+              {
+                 char *dirpath;
+                 
+                 /* relative path - parent */
+                 dirpath = strdup(e_fm2_real_path_get(ic->info.fm));
+                 if (dirpath)
+                   {
+                      p = strrchr(dirpath, '/');
+                      if (p)
+                        {
+                           *p = 0;
+                           snprintf(buf, sizeof(buf), "%s/%s", dirpath, 
+                                    ic->info.icon + 3);
+                           icfile = buf;
+                        }
+                      free(dirpath);
+                   }
+              }
             p = strrchr(ic->info.icon, '.');
-            if ((p) && (!strcmp(p, ".edj")))
+            if ((p) && (!strcasecmp(p, ".edj")))
               {
                  oic = edje_object_add(evas);
                  if (!edje_object_file_set(oic, ic->info.icon, "icon"))



-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to