Enlightenment CVS committal

Author  : codewarrior
Project : e17
Module  : apps/e_utils

Dir     : e17/apps/e_utils/src/bin/emblem


Modified Files:
        Emblem.h emblem_ui.c main.c 


Log Message:
support for theme switing using -theme flag
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/emblem/Emblem.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Emblem.h    9 Feb 2005 16:39:16 -0000       1.1
+++ Emblem.h    14 May 2005 10:33:47 -0000      1.2
@@ -18,7 +18,8 @@
 struct Emblem
 {
     char *display;
-
+    char *theme;
+   
     struct {
         Ecore_Evas *ee;
         Evas *evas;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/emblem/emblem_ui.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- emblem_ui.c 9 Apr 2005 06:10:46 -0000       1.9
+++ emblem_ui.c 14 May 2005 10:33:47 -0000      1.10
@@ -69,8 +69,7 @@
     em->gui.evas = evas;
 
     o = edje_object_add(evas);
-    if (!edje_object_file_set(o,
-                PACKAGE_DATA_DIR"/data/emblem/default.edj", "Main"))
+    if (!edje_object_file_set(o, em->theme, "Main"))
     {
         printf("Unable to locate theme\n");
         return 0;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/emblem/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- main.c      9 Feb 2005 16:39:16 -0000       1.1
+++ main.c      14 May 2005 10:33:47 -0000      1.2
@@ -44,16 +44,49 @@
                 printf("Missing argument to -display\n");
                 goto ECORE_SHUTDOWN;
             }
-        }        
+        }      
+
+       if (!strcmp(argv[i], "-theme"))
+       {
+          if (++i < argc)
+              em->theme = strdup(argv[i]);
+          else
+          {
+               printf("Missing argument to -theme\n");
+               goto ECORE_SHUTDOWN;
+          }
+       }
     }
 
+    if (!em->theme)
+    {
+       em->theme = strdup(PACKAGE_DATA_DIR"/data/emblem/default.edj");
+    }
+    else
+    {
+       if(!ecore_file_exists(em->theme))
+       {
+               char theme[PATH_MAX];
+               snprintf(theme, sizeof(theme), 
PACKAGE_DATA_DIR"/data/emblem/%s", em->theme);
+               if(ecore_file_exists(theme))
+               {
+                       em->theme = strdup(theme);
+               }
+               else
+               {
+                       em->theme = 
strdup(PACKAGE_DATA_DIR"/data/emblem/default.edj");
+                       fprintf(stderr, "Theme does not exist! Falling back to 
default theme\n");
+               }
+       }
+       
+    }
     /* if no display given grab the env var */
     if (!em->display)
     {
         char *tmp = getenv("DISPLAY");
         if (tmp) em->display = strdup(tmp);
     }
-
+   
     /* make sure the display var is of the form name:0.0 or :0.0 */
     if (em->display)
     {




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to