summaryrefslogtreecommitdiff
path: root/src/bin/e_bg.c
diff options
context:
space:
mode:
authorrephorm <rephorm>2006-10-16 23:45:16 +0000
committerrephorm <rephorm@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2006-10-16 23:45:16 +0000
commit1532587bcbcc6c42525ab9e7b1315e74212c6c01 (patch)
tree627a2b632d11ea50341d011dbce8e96b9351f3c1 /src/bin/e_bg.c
parent9c2590121eea4726fbe9f5cda9cc203e1cfea1d6 (diff)
Dynamically add and remove desks in the preview when you change the # of virtual desks.
A few small fixmes still to go SVN revision: 26662
Diffstat (limited to 'src/bin/e_bg.c')
-rw-r--r--src/bin/e_bg.c67
1 files changed, 36 insertions, 31 deletions
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index 7e06e34..7696810 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -10,55 +10,55 @@ static void _e_bg_signal(void *data, Evas_Object *obj, const char *emission, con
10 10
11/* externally accessible functions */ 11/* externally accessible functions */
12EAPI const char * 12EAPI const char *
13e_bg_file_get(E_Zone *zone, E_Desk *desk) 13e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
14{ 14{
15 Evas_List *l, *ll, *entries; 15 Evas_List *l, *ll, *entries;
16 int ok; 16 int ok;
17 int current_spec; 17 int current_spec;
18 const char *bgfile = ""; 18 const char *bgfile = "";
19 19
20
21 if (!zone) zone = e_zone_current_get(e_container_current_get(e_manager_current_get()));
22
23 ok = 0; 20 ok = 0;
24 current_spec = 0; /* how specific the setting is - we want the least general one that applies */ 21 current_spec = 0; /* how specific the setting is - we want the least general one that applies */
25 22
26 /* look for desk specific background. if desk is NULL this is skipped */ 23 /* look for desk specific background. */
27 for (l = e_config->desktop_backgrounds; desk && l; l = l->next) 24 if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
28 { 25 {
29 E_Config_Desktop_Background *cfbg; 26 for (l = e_config->desktop_backgrounds; l; l = l->next)
30 int spec; 27 {
31 28 E_Config_Desktop_Background *cfbg;
32 cfbg = l->data; 29 int spec;
33 if ((cfbg->container >= 0) && (zone->container->num != cfbg->container)) continue;
34 if ((cfbg->zone >= 0) && (zone->num != cfbg->zone)) continue;
35 if ((cfbg->desk_x >= 0) && (cfbg->desk_x != desk->x)) continue;
36 if ((cfbg->desk_y >= 0) && (cfbg->desk_y != desk->y)) continue;
37 30
38 spec = 0; 31 cfbg = l->data;
39 if (cfbg->container >= 0) spec++;
40 if (cfbg->zone >= 0) spec++;
41 if (cfbg->desk_x >= 0) spec++;
42 if (cfbg->desk_y >= 0) spec++;
43 32
44 if (spec <= current_spec) continue; 33 spec = 0;
34 if (cfbg->container == container_num) spec++;
35 else if (cfbg->container >= 0) continue;
36 if (cfbg->zone == zone_num) spec++;
37 else if (cfbg->zone >= 0) continue;
38 if (cfbg->desk_x == desk_x) spec++;
39 else if (cfbg->desk_x >= 0) continue;
40 if (cfbg->desk_y == desk_y) spec++;
41 else if (cfbg->desk_y >= 0) continue;
45 42
46 entries = edje_file_collection_list(cfbg->file); 43 if (spec <= current_spec) continue;
47 if (entries) 44
48 { 45 entries = edje_file_collection_list(cfbg->file);
49 for (ll = entries; ll; ll = ll->next) 46 if (entries)
50 { 47 {
51 if (!strcmp(ll->data, "e/desktop/background")) 48 for (ll = entries; ll; ll = ll->next)
52 { 49 {
53 bgfile = cfbg->file; 50 if (!strcmp(ll->data, "e/desktop/background"))
54 current_spec = spec; 51 {
55 ok = 1; 52 bgfile = cfbg->file;
53 current_spec = spec;
54 ok = 1;
55 }
56 } 56 }
57 edje_file_collection_list_free(entries);
57 } 58 }
58 edje_file_collection_list_free(entries);
59 } 59 }
60 } 60 }
61 /* fall back to default bg for zone */ 61 /* fall back to default */
62 if (!ok) 62 if (!ok)
63 { 63 {
64 entries = edje_file_collection_list(e_config->desktop_default_background); 64 entries = edje_file_collection_list(e_config->desktop_default_background);
@@ -89,13 +89,18 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
89 Evas_Object *o; 89 Evas_Object *o;
90 const char *bgfile = ""; 90 const char *bgfile = "";
91 const char *trans = ""; 91 const char *trans = "";
92 E_Desk *desk;
92 93
93 if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start; 94 if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start;
94 else if (transition == E_BG_TRANSITION_DESK) trans = e_config->transition_desk; 95 else if (transition == E_BG_TRANSITION_DESK) trans = e_config->transition_desk;
95 else if (transition == E_BG_TRANSITION_CHANGE) trans = e_config->transition_change; 96 else if (transition == E_BG_TRANSITION_CHANGE) trans = e_config->transition_change;
96 if ((!trans) || (strlen(trans) < 1)) transition = E_BG_TRANSITION_NONE; 97 if ((!trans) || (strlen(trans) < 1)) transition = E_BG_TRANSITION_NONE;
97 98
98 bgfile = e_bg_file_get(zone, e_desk_current_get(zone)); 99 desk = e_desk_current_get(zone);
100 if (desk)
101 bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y);
102 else
103 bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1);
99 104
100 if (zone->bg_object) 105 if (zone->bg_object)
101 { 106 {