summaryrefslogtreecommitdiff
path: root/src/bin/e_bg.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2009-08-21 15:08:49 +0000
committerCedric BAIL <cedric.bail@free.fr>2009-08-21 15:08:49 +0000
commitf8c05999e4b6df682bfb2bf4568fe0350d272cf3 (patch)
treea42f8a5d2868027223020c3d4a0c069d99d1f823 /src/bin/e_bg.c
parentb1225d525148a873794842807953ac18e8832a48 (diff)
* e: Cleanup use of Eina data structure.
Patch from Peter van de Werken <pwerken-e@a-eskwadraat.nl>. SVN revision: 41916
Diffstat (limited to 'src/bin/e_bg.c')
-rw-r--r--src/bin/e_bg.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index ab05368..092874b 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -32,6 +32,7 @@ EAPI int
32e_bg_init(void) 32e_bg_init(void)
33{ 33{
34 Eina_List *l = NULL; 34 Eina_List *l = NULL;
35 E_Config_Desktop_Background *cfbg = NULL;
35 36
36 /* Register mime handler */ 37 /* Register mime handler */
37 bg_hdl = e_fm2_mime_handler_new(_("Set As Background"), 38 bg_hdl = e_fm2_mime_handler_new(_("Set As Background"),
@@ -44,11 +45,8 @@ e_bg_init(void)
44 if (e_config->desktop_default_background) 45 if (e_config->desktop_default_background)
45 e_filereg_register(e_config->desktop_default_background); 46 e_filereg_register(e_config->desktop_default_background);
46 47
47 for (l = e_config->desktop_backgrounds; l; l = l->next) 48 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
48 { 49 {
49 E_Config_Desktop_Background *cfbg;
50
51 cfbg = l->data;
52 if (!cfbg) continue; 50 if (!cfbg) continue;
53 e_filereg_register(cfbg->file); 51 e_filereg_register(cfbg->file);
54 } 52 }
@@ -61,6 +59,7 @@ EAPI int
61e_bg_shutdown(void) 59e_bg_shutdown(void)
62{ 60{
63 Eina_List *l = NULL; 61 Eina_List *l = NULL;
62 E_Config_Desktop_Background *cfbg = NULL;
64 63
65 /* Deregister mime handler */ 64 /* Deregister mime handler */
66 if (bg_hdl) 65 if (bg_hdl)
@@ -73,11 +72,8 @@ e_bg_shutdown(void)
73 if (e_config->desktop_default_background) 72 if (e_config->desktop_default_background)
74 e_filereg_deregister(e_config->desktop_default_background); 73 e_filereg_deregister(e_config->desktop_default_background);
75 74
76 for (l = e_config->desktop_backgrounds; l; l = l->next) 75 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
77 { 76 {
78 E_Config_Desktop_Background *cfbg;
79
80 cfbg = l->data;
81 if (!cfbg) continue; 77 if (!cfbg) continue;
82 e_filereg_deregister(cfbg->file); 78 e_filereg_deregister(cfbg->file);
83 } 79 }
@@ -94,19 +90,18 @@ EAPI const E_Config_Desktop_Background *
94e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y) 90e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
95{ 91{
96 Eina_List *l, *ll, *entries; 92 Eina_List *l, *ll, *entries;
97 E_Config_Desktop_Background *bg = NULL; 93 E_Config_Desktop_Background *bg = NULL, *cfbg = NULL;
98 const char *bgfile = ""; 94 const char *bgfile = "";
95 char *entry;
99 int current_spec = 0; /* how specific the setting is - we want the least general one that applies */ 96 int current_spec = 0; /* how specific the setting is - we want the least general one that applies */
100 97
101 /* look for desk specific background. */ 98 /* look for desk specific background. */
102 if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0) 99 if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
103 { 100 {
104 for (l = e_config->desktop_backgrounds; l; l = l->next) 101 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
105 { 102 {
106 E_Config_Desktop_Background *cfbg;
107 int spec; 103 int spec;
108 104
109 cfbg = l->data;
110 if (!cfbg) continue; 105 if (!cfbg) continue;
111 spec = 0; 106 spec = 0;
112 if (cfbg->container == container_num) spec++; 107 if (cfbg->container == container_num) spec++;
@@ -133,9 +128,9 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
133 entries = edje_file_collection_list(bgfile); 128 entries = edje_file_collection_list(bgfile);
134 if (entries) 129 if (entries)
135 { 130 {
136 for (ll = entries; ll; ll = ll->next) 131 EINA_LIST_FOREACH(entries, ll, entry)
137 { 132 {
138 if (!strcmp(ll->data, "e/desktop/background")) 133 if (!strcmp(entry, "e/desktop/background"))
139 { 134 {
140 bg = cfbg; 135 bg = cfbg;
141 current_spec = spec; 136 current_spec = spec;
@@ -154,6 +149,7 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
154 const E_Config_Desktop_Background *cfbg; 149 const E_Config_Desktop_Background *cfbg;
155 Eina_List *l, *entries; 150 Eina_List *l, *entries;
156 const char *bgfile = ""; 151 const char *bgfile = "";
152 char *entry;
157 int ok = 0; 153 int ok = 0;
158 154
159 cfbg = e_bg_config_get(container_num, zone_num, desk_x, desk_y); 155 cfbg = e_bg_config_get(container_num, zone_num, desk_x, desk_y);
@@ -189,9 +185,9 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
189 entries = edje_file_collection_list(bgfile); 185 entries = edje_file_collection_list(bgfile);
190 if (entries) 186 if (entries)
191 { 187 {
192 for (l = entries; l; l = l->next) 188 EINA_LIST_FOREACH(entries, l, entry)
193 { 189 {
194 if (!strcmp(l->data, "e/desktop/background")) 190 if (!strcmp(entry, "e/desktop/background"))
195 { 191 {
196 ok = 1; 192 ok = 1;
197 break; 193 break;
@@ -442,13 +438,11 @@ EAPI void
442e_bg_del(int container, int zone, int desk_x, int desk_y) 438e_bg_del(int container, int zone, int desk_x, int desk_y)
443{ 439{
444 Eina_List *l = NULL; 440 Eina_List *l = NULL;
441 E_Config_Desktop_Background *cfbg = NULL;
445 E_Event_Bg_Update *ev; 442 E_Event_Bg_Update *ev;
446 443
447 for (l = e_config->desktop_backgrounds; l; l = l->next) 444 EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
448 { 445 {
449 E_Config_Desktop_Background *cfbg;
450
451 cfbg = l->data;
452 if (!cfbg) continue; 446 if (!cfbg) continue;
453 if ((cfbg->container == container) && (cfbg->zone == zone) && 447 if ((cfbg->container == container) && (cfbg->zone == zone) &&
454 (cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y)) 448 (cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y))
@@ -477,15 +471,12 @@ e_bg_update(void)
477 E_Container *con; 471 E_Container *con;
478 E_Zone *zone; 472 E_Zone *zone;
479 473
480 for (l = e_manager_list(); l; l = l->next) 474 EINA_LIST_FOREACH(e_manager_list(), l, man)
481 { 475 {
482 man = l->data; 476 EINA_LIST_FOREACH(man->containers, ll, con)
483 for (ll = man->containers; ll; ll = ll->next)
484 { 477 {
485 con = ll->data; 478 EINA_LIST_FOREACH(con->zones, lll, zone)
486 for (lll = con->zones; lll; lll = lll->next)
487 { 479 {
488 zone = lll->data;
489 e_zone_bg_reconfigure(zone); 480 e_zone_bg_reconfigure(zone);
490 } 481 }
491 } 482 }