Enlightenment CVS committal

Author  : shorne
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_font.c e_font.h e_ipc_codec.c 


Log Message:
Use evas API to get font list
 * new api is much faster
 * may be a bit of a hack the way I get the evas (anyone have another way?)
 * I guess I am an author (now that I have fulfilled my dodgy code quota)

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_font.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- e_font.c    1 Apr 2006 09:24:56 -0000       1.19
+++ e_font.c    30 Apr 2006 11:54:04 -0000      1.20
@@ -8,8 +8,6 @@
  * - use e_path to search for available fonts
  */
 
-static Evas_List *_e_font_font_dir_available_get (Evas_List * available_fonts, 
const char *font_dir);
-
 static char _fn_buf[1024];
 
 EAPI int
@@ -91,34 +89,49 @@
 EAPI Evas_List *
 e_font_available_list(void)
 {
-   Evas_List *dir_list;
-   Evas_List *next;
-   Evas_List *available;   
+   Evas_List *evas_fonts;
+   Evas_List *e_fonts;
+   Evas_List *l;
+   E_Manager *man;
+   E_Container *con;
+   
+   man = e_manager_current_get();
+   if (!man) return NULL;
+   con = e_container_current_get(man);
+   if (!con) con = e_container_number_get(man, 0);
+   if (!con) return NULL;
 
-   dir_list = e_path_dir_list_get(path_fonts);
-   available = NULL;
-   for ( next = dir_list; next; next = next->next)
+   evas_fonts = evas_font_available_list(con->bg_evas);
+
+   e_fonts = NULL;
+   for (l = evas_fonts; l; l = l->next)
      {
-        E_Path_Dir *epd = next->data;
-       available = _e_font_font_dir_available_get(available, epd->dir);
-     }
-   
-   e_path_dir_list_free(dir_list);
-   return available;
+       E_Font_Available *efa;
+       const char *evas_font;
+       
+       efa = E_NEW(E_Font_Available, 1);
+       evas_font = l->data;
+       efa->name = evas_stringshare_add(evas_font);
+       e_fonts = evas_list_append(e_fonts, efa);
+     } 
+
+   evas_font_available_list_free(con->bg_evas, evas_fonts);
+
+   return e_fonts;
 }
 
 EAPI void
 e_font_available_list_free(Evas_List *available)
 {
    E_Font_Available *efa;
-   
+    
    while (available)
-     {
+     { 
        efa = available->data;
        available = evas_list_remove_list(available, available);
        if (efa->name) evas_stringshare_del(efa->name);
-       E_FREE(efa);    
-     }
+       E_FREE(efa);
+    }
 }
 
 EAPI void
@@ -330,43 +343,3 @@
    return _fn_buf;
 }
 
-static Evas_List *
-_e_font_font_dir_available_get(Evas_List *available_fonts, const char 
*font_dir)
-{
-   char buf[4096];
-   FILE *f;
-   
-   snprintf(buf, sizeof(buf), "%s/fonts.alias", font_dir);
-   f = fopen(buf, "r");
-   if (f)
-     {
-       char fname[4096], fdef[4096];
-       Evas_List *next;
-       
-       /* read font alias lines */
-       while (fscanf(f, "%4090s %[^\n]\n", fname, fdef) == 2)
-         {
-            E_Font_Available *efa;
-            
-            /* skip comments */
-            if ((fdef[0] == '!') || (fdef[0] == '#'))
-              continue;
-            
-            /* skip duplicates */
-            
-            for (next = available_fonts; next; next = evas_list_next(next))
-              {
-                 efa = (E_Font_Available *)evas_list_data(next);
-              
-                 if (!strcmp(efa->name, fname))
-                   continue;             
-              }
-               
-            efa = malloc(sizeof(E_Font_Available));
-            efa->name = evas_stringshare_add(fname);
-            available_fonts = evas_list_append(available_fonts, efa);
-         }
-       fclose (f);
-     }
-   return available_fonts;
-}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_font.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_font.h    2 Mar 2006 12:03:48 -0000       1.5
+++ e_font.h    30 Apr 2006 11:54:04 -0000      1.6
@@ -5,7 +5,7 @@
 
 typedef struct _E_Font_Default E_Font_Default;
 typedef struct _E_Font_Fallback E_Font_Fallback;
-typedef struct _E_Font_Fallback E_Font_Available;
+typedef struct _E_Font_Available E_Font_Available;
 
 #else
 #ifndef E_FONT_H
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_ipc_codec.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- e_ipc_codec.c       10 Mar 2006 05:48:46 -0000      1.15
+++ e_ipc_codec.c       30 Apr 2006 11:54:04 -0000      1.16
@@ -671,4 +671,5 @@
 
 /* local subsystem globals */
 
-#endif
\ No newline at end of file
+#endif
+




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to