summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-03-15 12:01:56 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-03-15 12:11:00 +0900
commit04788dec692be385f0ce3c0a13f0d439a6bea79e (patch)
tree5567e5bd7d405d4f27f1b4fe435d1764246b51c5
parentd260dc3ec2e3e9f4475c08b89922f3599b4dcf93 (diff)
theme overlays - fix to prepend on overlay to be semantically consistent
@fix
-rw-r--r--src/lib/elm_theme.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/lib/elm_theme.c b/src/lib/elm_theme.c
index 58ff891b4..54a78abe4 100644
--- a/src/lib/elm_theme.c
+++ b/src/lib/elm_theme.c
@@ -28,17 +28,27 @@ _elm_theme_find_try(Elm_Theme *th, Eina_File *f, const char *group)
28static inline void 28static inline void
29_elm_theme_item_finalize(Elm_Theme_Files *files, 29_elm_theme_item_finalize(Elm_Theme_Files *files,
30 const char *item, 30 const char *item,
31 Eina_File *f) 31 Eina_File *f,
32 Eina_Bool prepend)
32{ 33{
33 if (!f) return ; 34 if (!f) return ;
34 35
35 files->items = eina_list_append(files->items, 36 if (prepend)
36 eina_stringshare_add(item)); 37 {
37 files->handles = eina_list_append(files->handles, f); 38 files->items = eina_list_prepend(files->items,
39 eina_stringshare_add(item));
40 files->handles = eina_list_prepend(files->handles, f);
41 }
42 else
43 {
44 files->items = eina_list_append(files->items,
45 eina_stringshare_add(item));
46 files->handles = eina_list_append(files->handles, f);
47 }
38} 48}
39 49
40static void 50static void
41_elm_theme_file_item_add(Elm_Theme_Files *files, const char *item) 51_elm_theme_file_item_add(Elm_Theme_Files *files, const char *item, Eina_Bool prepend)
42{ 52{
43 Eina_Strbuf *buf = NULL; 53 Eina_Strbuf *buf = NULL;
44 Eina_File *f = NULL; 54 Eina_File *f = NULL;
@@ -68,7 +78,7 @@ _elm_theme_file_item_add(Elm_Theme_Files *files, const char *item)
68 "%s/"ELEMENTARY_BASE_DIR"/themes/%s.edj", 78 "%s/"ELEMENTARY_BASE_DIR"/themes/%s.edj",
69 home, item); 79 home, item);
70 f = eina_file_open(eina_strbuf_string_get(buf), EINA_FALSE); 80 f = eina_file_open(eina_strbuf_string_get(buf), EINA_FALSE);
71 _elm_theme_item_finalize(files, item, f); 81 _elm_theme_item_finalize(files, item, f, prepend);
72 82
73 eina_strbuf_reset(buf); 83 eina_strbuf_reset(buf);
74 eina_strbuf_append_printf(buf, 84 eina_strbuf_append_printf(buf,
@@ -78,7 +88,7 @@ _elm_theme_file_item_add(Elm_Theme_Files *files, const char *item)
78 /* Finalize will be done by the common one */ 88 /* Finalize will be done by the common one */
79 } 89 }
80 90
81 _elm_theme_item_finalize(files, item, f); 91 _elm_theme_item_finalize(files, item, f, prepend);
82 92
83 on_error: 93 on_error:
84 if (buf) eina_strbuf_free(buf); 94 if (buf) eina_strbuf_free(buf);
@@ -435,7 +445,7 @@ _elm_theme_parse(Elm_Theme *th, const char *theme)
435 EINA_LIST_FREE(th->themes.handles, f) eina_file_close(f); 445 EINA_LIST_FREE(th->themes.handles, f) eina_file_close(f);
436 446
437 EINA_LIST_FREE(names, p) 447 EINA_LIST_FREE(names, p)
438 _elm_theme_file_item_add(&th->themes, p); 448 _elm_theme_file_item_add(&th->themes, p, EINA_FALSE);
439 return EINA_TRUE; 449 return EINA_TRUE;
440} 450}
441 451
@@ -457,7 +467,7 @@ elm_theme_new(void)
457 Elm_Theme *th = calloc(1, sizeof(Elm_Theme)); 467 Elm_Theme *th = calloc(1, sizeof(Elm_Theme));
458 if (!th) return NULL; 468 if (!th) return NULL;
459 th->ref = 1; 469 th->ref = 1;
460 _elm_theme_file_item_add(&th->themes, "default"); 470 _elm_theme_file_item_add(&th->themes, "default", EINA_FALSE);
461 themes = eina_list_append(themes, th); 471 themes = eina_list_append(themes, th);
462 return th; 472 return th;
463} 473}
@@ -545,7 +555,7 @@ elm_theme_overlay_add(Elm_Theme *th, const char *item)
545{ 555{
546 if (!item) return; 556 if (!item) return;
547 if (!th) th = &(theme_default); 557 if (!th) th = &(theme_default);
548 _elm_theme_file_item_add(&th->overlay, item); 558 _elm_theme_file_item_add(&th->overlay, item, EINA_TRUE);
549 elm_theme_flush(th); 559 elm_theme_flush(th);
550} 560}
551 561
@@ -564,7 +574,7 @@ elm_theme_overlay_mmap_add(Elm_Theme *th, const Eina_File *f)
564 Eina_File *file = eina_file_dup(f); 574 Eina_File *file = eina_file_dup(f);
565 575
566 if (!th) th = &(theme_default); 576 if (!th) th = &(theme_default);
567 _elm_theme_item_finalize(&th->overlay, eina_file_filename_get(file), file); 577 _elm_theme_item_finalize(&th->overlay, eina_file_filename_get(file), file, EINA_TRUE);
568 elm_theme_flush(th); 578 elm_theme_flush(th);
569} 579}
570 580
@@ -589,7 +599,7 @@ elm_theme_extension_add(Elm_Theme *th, const char *item)
589{ 599{
590 if (!item) return ; 600 if (!item) return ;
591 if (!th) th = &(theme_default); 601 if (!th) th = &(theme_default);
592 _elm_theme_file_item_add(&th->extension, item); 602 _elm_theme_file_item_add(&th->extension, item, EINA_FALSE);
593 elm_theme_flush(th); 603 elm_theme_flush(th);
594} 604}
595 605
@@ -609,7 +619,7 @@ elm_theme_extension_mmap_add(Elm_Theme *th, const Eina_File *f)
609 619
610 if (!f) return ; 620 if (!f) return ;
611 if (!th) th = &(theme_default); 621 if (!th) th = &(theme_default);
612 _elm_theme_item_finalize(&th->overlay, eina_file_filename_get(file), file); 622 _elm_theme_item_finalize(&th->overlay, eina_file_filename_get(file), file, EINA_FALSE);
613 elm_theme_flush(th); 623 elm_theme_flush(th);
614} 624}
615 625