Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : apps/expedite

Dir     : e17/apps/expedite/src/bin


Modified Files:
        engine_gl_x11.c main.c ui.c 


Log Message:
Add the check of environment variables EXPEDITE_FONTS_DIR
and EXPEDITE_DATA_DIR to locate the path of the fonts and
png files respectively

Fix a typo



===================================================================
RCS file: /cvs/e/e17/apps/expedite/src/bin/engine_gl_x11.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- engine_gl_x11.c     11 Apr 2007 11:58:32 -0000      1.1
+++ engine_gl_x11.c     17 Oct 2007 11:07:13 -0000      1.2
@@ -46,7 +46,7 @@
    einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(evas);
    if (!einfo)
      {
-       printf("Evas does not support the Software X11 Engine\n");
+       printf("Evas does not support the OpenGL X11 Engine\n");
        return 0;
      }
    
===================================================================
RCS file: /cvs/e/e17/apps/expedite/src/bin/main.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- main.c      8 Oct 2007 19:24:22 -0000       1.10
+++ main.c      17 Oct 2007 11:07:13 -0000      1.11
@@ -1131,6 +1131,8 @@
 static void
 _engine_args(int argc, char **argv)
 {
+   char buf[4096];
+   char *prefix;
    int profile_ok;
    
    /* FIXME: parse args for geometry, engine etc. */
@@ -1170,6 +1172,12 @@
                );
        exit(-1);
      }
+
+   prefix = getenv("EXPEDITE_FONTS_DIR");
+   if (!prefix)
+     strcpy(buf, PACKAGE_DATA_DIR"/data");
+   else
+     snprintf(buf, 4096, "%s", prefix);
    
    evas_output_size_set(evas, win_w, win_h);
    evas_output_viewport_set(evas, 0, 0, win_w, win_h);
@@ -1180,7 +1188,7 @@
    evas_key_lock_add(evas, "Caps_Lock");
    evas_key_lock_add(evas, "Num_Lock");
    evas_key_lock_add(evas, "Scroll_Lock");
-   evas_font_path_append(evas, PACKAGE_DATA_DIR"/data");
+   evas_font_path_append(evas, buf);
    evas_image_cache_set(evas, 0 * 1024 * 1024);
    evas_font_cache_set(evas, 0 * 1024 * 1024);
 }
===================================================================
RCS file: /cvs/e/e17/apps/expedite/src/bin/ui.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ui.c        3 Oct 2007 08:55:25 -0000       1.3
+++ ui.c        17 Oct 2007 11:07:13 -0000      1.4
@@ -10,6 +10,7 @@
 static double t_loop = 0.0;
 static int    f_start = 0;
 static int    f_loop = 0;
+static char   data_dir[4096];
 
 typedef struct _Menu_Item Menu_Item;
 
@@ -205,12 +206,11 @@
 static void
 _ui_menu_item_add(char *icon, char *text, void (*func) (void))
 {
-   Menu_Item *mi;
    char buf[4096];
+   Menu_Item *mi;
    
    mi = malloc(sizeof(Menu_Item));
-   strcpy(buf, PACKAGE_DATA_DIR"/data/");
-   strcat(buf, icon);
+   snprintf(buf, 4096, "%s%s", data_dir, icon);
    mi->o_icon = evas_object_image_add(evas);
    evas_object_image_file_set(mi->o_icon, buf, NULL);
    evas_object_resize(mi->o_icon, 32, 32);
@@ -225,8 +225,16 @@
 static void
 _ui_setup(void)
 {
+   char  buf[4096];
    Evas_Object *o;
    Evas_Coord x, y, w, h;
+   char *prefix;
+
+   prefix = getenv("EXPEDITE_DATA_DIR");
+   if (!prefix)
+     strcpy(data_dir, PACKAGE_DATA_DIR"/data/");
+   else
+     snprintf(data_dir, 4096, "%s/", prefix);
    
    o = evas_object_rectangle_add(evas);
    evas_object_move(o, 0, 0);
@@ -289,7 +297,8 @@
    
    o = evas_object_image_add(evas);
    evas_object_move(o, (win_w - 120) / 2, ((win_h - 160) / 2));
-   evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
+   snprintf(buf, 4096, "%s%s", data_dir, "logo.png");
+   evas_object_image_file_set(o, buf, NULL);
    evas_object_image_fill_set(o, 0, 0, 120, 160);
    evas_object_resize(o, 120, 160);
    evas_object_layer_set(o, -98);
@@ -306,14 +315,16 @@
    
    o = evas_object_image_add(evas);
    evas_object_move(o, 0, 0);
-   evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/icon_sel.png", NULL);
+   snprintf(buf, 4096, "%s%s", data_dir, "icon_sel.png");
+   evas_object_image_file_set(o, buf, NULL);
    evas_object_resize(o, 56, 56);
    evas_object_image_fill_set(o, 0, 0, 56, 56);
    o_menu_icon_sel = o;
 
    o = evas_object_image_add(evas);
    evas_object_move(o, 0, 0);
-   evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/text_sel.png", NULL);
+   snprintf(buf, 4096, "%s%s", data_dir, "text_sel.png");
+   evas_object_image_file_set(o, buf, NULL);
    evas_object_resize(o, 96, 32);
    evas_object_image_fill_set(o, 0, 0, 96, 32);
    evas_object_image_border_set(o, 8, 8, 8, 8);
@@ -321,7 +332,8 @@
 
    o = evas_object_image_add(evas);
    evas_object_move(o, 0, 0);
-   evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/icon_sel2.png", NULL);
+   snprintf(buf, 4096, "%s%s", data_dir, "icon_sel2.png");
+   evas_object_image_file_set(o, buf, NULL);
    evas_object_resize(o, 56, 41);
    evas_object_image_fill_set(o, 0, 0, 56, 41);
    o_menu_icon_sel2 = o;
@@ -427,12 +439,12 @@
        tr = tt;
        for (i = 0, l = menu; l; l = l->next, i++)
          {
+            char buf[4096];
             Menu_Item *mi;
             Evas_Coord x, y, w, h, tw, th;
             Evas_Coord len;
             double a;
             Evas_Object *o;
-            char buf[4096];
             
             mi = l->data;
             o = mi->o_icon;
@@ -490,8 +502,7 @@
                  evas_object_color_set(o, a, a, a, a);
                  
                  o = o_menu_icon;
-                 strcpy(buf, PACKAGE_DATA_DIR"/data/");
-                 strcat(buf, mi->icon);
+                 snprintf(buf, 4096, "%s%s", data_dir, mi->icon);
                  evas_object_image_file_set(o, buf, NULL);
                  evas_object_color_set(o, a / 2, a / 2, a / 2, a / 2);
               }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to