seoz pushed a commit to branch master.

http://git.enlightenment.org/tools/elm-theme-viewer.git/commit/?id=73ca0904601be181f0b4649369991774ecf52d0e

commit 73ca0904601be181f0b4649369991774ecf52d0e
Author: Daniel Juyung Seo <[email protected]>
Date:   Fri Jan 16 06:11:49 2015 +0900

    theme: Make theme parsing logic more efficient and put default style in the 
front.
---
 src/bin/theme.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/bin/theme.c b/src/bin/theme.c
index 59712ba..97de9c4 100644
--- a/src/bin/theme.c
+++ b/src/bin/theme.c
@@ -63,10 +63,13 @@ theme_unset(const char *edje_file)
 static int
 _style_compare_cb(const void *data1, const void *data2)
 {
-   const Widget_Data_Style *wds1 = data1;
-   const Widget_Data_Style *wds2 = data2;
+   const char *txt1 = data1;
+   const char *txt2 = data2;
 
-   return strcmp(wds1->style, wds2->style);
+   if (!txt1) return 1;
+   if (!txt2) return -1;
+
+   return strcmp(txt1, txt2);
 }
 
 void
@@ -85,6 +88,8 @@ theme_load(const char *edje_file)
    groups = edje_file_collection_list(edje_file);
    if (!groups) return;
 
+   groups = eina_list_sort(groups, eina_list_count(groups), cmp_func);
+
    EINA_LIST_FOREACH(groups, l, group)
      {
         strncpy(buf, group, sizeof(buf) - 1);
@@ -125,7 +130,10 @@ theme_load(const char *edje_file)
         wds->simple = eina_stringshare_add(
            widget_style_filter(wd->type, style));
 
-        wd->styles = eina_list_sorted_insert(wd->styles, cmp_func, wds);
+        if (!strcmp("default", wds->simple))
+          wd->styles = eina_list_prepend(wd->styles, wds);
+        else
+          wd->styles = eina_list_append(wd->styles, wds);
      }
 
    edje_file_collection_list_free(groups);

-- 


Reply via email to