summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2015-01-16 06:11:49 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2015-01-16 06:11:49 +0900
commit73ca0904601be181f0b4649369991774ecf52d0e (patch)
treee99fc0792f23fbaee551146ee5e3c394436b5d0a
parenta3e3452b1d6f994f8a85ba57e6e1096a0f3d2225 (diff)
theme: Make theme parsing logic more efficient and put default style in the front.
-rw-r--r--src/bin/theme.c16
1 files 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)
63static int 63static int
64_style_compare_cb(const void *data1, const void *data2) 64_style_compare_cb(const void *data1, const void *data2)
65{ 65{
66 const Widget_Data_Style *wds1 = data1; 66 const char *txt1 = data1;
67 const Widget_Data_Style *wds2 = data2; 67 const char *txt2 = data2;
68 68
69 return strcmp(wds1->style, wds2->style); 69 if (!txt1) return 1;
70 if (!txt2) return -1;
71
72 return strcmp(txt1, txt2);
70} 73}
71 74
72void 75void
@@ -85,6 +88,8 @@ theme_load(const char *edje_file)
85 groups = edje_file_collection_list(edje_file); 88 groups = edje_file_collection_list(edje_file);
86 if (!groups) return; 89 if (!groups) return;
87 90
91 groups = eina_list_sort(groups, eina_list_count(groups), cmp_func);
92
88 EINA_LIST_FOREACH(groups, l, group) 93 EINA_LIST_FOREACH(groups, l, group)
89 { 94 {
90 strncpy(buf, group, sizeof(buf) - 1); 95 strncpy(buf, group, sizeof(buf) - 1);
@@ -125,7 +130,10 @@ theme_load(const char *edje_file)
125 wds->simple = eina_stringshare_add( 130 wds->simple = eina_stringshare_add(
126 widget_style_filter(wd->type, style)); 131 widget_style_filter(wd->type, style));
127 132
128 wd->styles = eina_list_sorted_insert(wd->styles, cmp_func, wds); 133 if (!strcmp("default", wds->simple))
134 wd->styles = eina_list_prepend(wd->styles, wds);
135 else
136 wd->styles = eina_list_append(wd->styles, wds);
129 } 137 }
130 138
131 edje_file_collection_list_free(groups); 139 edje_file_collection_list_free(groups);