wallpaper2 - select wallpaper that is used on start

version config - literally keep the last 9 config revisions (10 including the
current) and if config gets corrupted...it auto-falls back to the last good
one.



SVN revision: 41252
This commit is contained in:
Carsten Haitzler 2009-07-06 09:43:58 +00:00
parent 584a95b6ad
commit 00819897b6
5 changed files with 262 additions and 13 deletions

View File

@ -25709,6 +25709,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
group { name: "e/conf/wallpaper/main/mini"; group { name: "e/conf/wallpaper/main/mini";
images { images {
image: "e17_mini_button_shadow2.png" COMP; image: "e17_mini_button_shadow2.png" COMP;
image: "glow.png" COMP;
} }
parts { parts {
part { name: "icon_box_shadow"; part { name: "icon_box_shadow";
@ -25738,6 +25739,31 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
visible: 1; visible: 1;
} }
} }
part { name: "glow";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
rel1 {
to: "base";
offset: -10 -10;
}
rel2 {
to: "base";
offset: 9 9;
}
fill.smooth: 0;
image {
normal: "glow.png";
border: 10 10 10 10;
}
color: 255 255 255 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "icon_box"; part { name: "icon_box";
type: RECT; type: RECT;
mouse_events: 0; mouse_events: 0;
@ -25835,6 +25861,20 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
} }
} }
programs { programs {
program { name: "sel";
signal: "e,state,selected";
source: "e";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 0.2;
target: "glow";
}
program { name: "unsel";
signal: "e,state,unselected";
source: "e";
action: STATE_SET "default" 0.0;
transition: DECELERATE 1.0;
target: "glow";
}
program { name: "thumb_gen"; program { name: "thumb_gen";
signal: "e,action,thumb,gen"; signal: "e,action,thumb,gen";
source: "e"; source: "e";
@ -25885,6 +25925,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
target: "icon_zoom"; target: "icon_zoom";
target: "e.swallow.content"; target: "e.swallow.content";
target: "events"; target: "events";
target: "glow";
after: "thumb_gen2"; after: "thumb_gen2";
} }
} }
@ -25893,6 +25934,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
images { images {
image: "e17_mini_button_shadow2.png" COMP; image: "e17_mini_button_shadow2.png" COMP;
image: "theme-label.png" COMP; image: "theme-label.png" COMP;
image: "glow.png" COMP;
} }
parts { parts {
part { name: "icon_box_shadow"; part { name: "icon_box_shadow";
@ -25922,6 +25964,31 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
visible: 1; visible: 1;
} }
} }
part { name: "glow";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
rel1 {
to: "base";
offset: -10 -10;
}
rel2 {
to: "base";
offset: 9 9;
}
fill.smooth: 0;
image {
normal: "glow.png";
border: 10 10 10 10;
}
color: 255 255 255 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "icon_box"; part { name: "icon_box";
type: RECT; type: RECT;
mouse_events: 0; mouse_events: 0;
@ -26008,6 +26075,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
part { name: "theme"; part { name: "theme";
mouse_events: 0; mouse_events: 0;
description { state: "default" 0.0; description { state: "default" 0.0;
visible: 0;
aspect: 1.709677419 1.709677419; aspect: 1.709677419 1.709677419;
rel1 { rel1 {
to: "e.swallow.content"; to: "e.swallow.content";
@ -26021,6 +26089,10 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
} }
image.normal: "theme-label.png"; image.normal: "theme-label.png";
} }
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
} }
part { name: "events"; part { name: "events";
type: RECT; type: RECT;
@ -26035,6 +26107,20 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
} }
} }
programs { programs {
program { name: "sel";
signal: "e,state,selected";
source: "e";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 0.2;
target: "glow";
}
program { name: "unsel";
signal: "e,state,unselected";
source: "e";
action: STATE_SET "default" 0.0;
transition: DECELERATE 1.0;
target: "glow";
}
program { name: "thumb_gen"; program { name: "thumb_gen";
signal: "e,action,thumb,gen"; signal: "e,action,thumb,gen";
source: "e"; source: "e";
@ -26045,6 +26131,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
target: "icon_zoom"; target: "icon_zoom";
target: "e.swallow.content"; target: "e.swallow.content";
target: "events"; target: "events";
target: "theme";
after: "thumb_gen2"; after: "thumb_gen2";
} }
program { name: "thumb_gen2"; program { name: "thumb_gen2";
@ -26085,6 +26172,8 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
target: "icon_zoom"; target: "icon_zoom";
target: "e.swallow.content"; target: "e.swallow.content";
target: "events"; target: "events";
target: "theme";
target: "glow";
after: "thumb_gen2"; after: "thumb_gen2";
} }
} }

View File

@ -559,5 +559,6 @@ wp-bot2.png \
wp-tb3.png \ wp-tb3.png \
wp-tbs.png \ wp-tbs.png \
systray_rounded_corners.png \ systray_rounded_corners.png \
theme-label.png theme-label.png \
glow.png

BIN
data/themes/images/glow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

View File

@ -11,6 +11,8 @@
EAPI E_Config *e_config = NULL; EAPI E_Config *e_config = NULL;
static int _e_config_revisions = 9;
/* local subsystem functions */ /* local subsystem functions */
static void _e_config_save_cb(void *data); static void _e_config_save_cb(void *data);
static void _e_config_free(E_Config *cfg); static void _e_config_free(E_Config *cfg);
@ -68,9 +70,20 @@ e_config_init(void)
ef = eet_open(buf, EET_FILE_MODE_READ); ef = eet_open(buf, EET_FILE_MODE_READ);
if (!ef) if (!ef)
{ {
/* use system if no user profile config */ int i;
e_prefix_data_concat_static(buf, "data/config/profile.cfg");
ef = eet_open(buf, EET_FILE_MODE_READ); for (i =1; i <= _e_config_revisions; i++)
{
e_user_dir_snprintf(buf, sizeof(buf), "config/profile.%i.cfg", i);
ef = eet_open(buf, EET_FILE_MODE_READ);
if (ef) break;
}
if (!ef)
{
/* use system if no user profile config */
e_prefix_data_concat_static(buf, "data/config/profile.cfg");
ef = eet_open(buf, EET_FILE_MODE_READ);
}
} }
if (ef) if (ef)
{ {
@ -1274,6 +1287,7 @@ e_config_domain_load(const char *domain, E_Config_DD *edd)
Eet_File *ef; Eet_File *ef;
char buf[4096]; char buf[4096];
void *data = NULL; void *data = NULL;
int i;
e_user_dir_snprintf(buf, sizeof(buf), "config/%s/%s.cfg", e_user_dir_snprintf(buf, sizeof(buf), "config/%s/%s.cfg",
_e_config_profile, domain); _e_config_profile, domain);
@ -1282,7 +1296,22 @@ e_config_domain_load(const char *domain, E_Config_DD *edd)
{ {
data = eet_data_read(ef, edd, "config"); data = eet_data_read(ef, edd, "config");
eet_close(ef); eet_close(ef);
return data; if (data) return data;
}
for (i =1; i <= _e_config_revisions; i++)
{
char buf2[4096];
e_user_dir_snprintf(buf, sizeof(buf), "config/%s/%s.%i.cfg",
_e_config_profile, domain, i);
ef = eet_open(buf, EET_FILE_MODE_READ);
if (ef)
{
data = eet_data_read(ef, edd, "config");
eet_close(ef);
if (data) return data;
}
} }
return e_config_domain_system_load(domain, edd); return e_config_domain_system_load(domain, edd);
} }
@ -1326,8 +1355,23 @@ e_config_profile_save(void)
if (_e_config_eet_close_handle(ef, buf2)) if (_e_config_eet_close_handle(ef, buf2))
{ {
int ret; int ret;
ret = ecore_file_mv(buf2, buf); if (_e_config_revisions > 0)
{
int i;
char bsrc[4096], bdst[4096];
for (i = _e_config_revisions; i > 1; i--)
{
e_user_dir_snprintf(bsrc, sizeof(bsrc), "config/profile.%i.cfg", i - 1);
e_user_dir_snprintf(bdst, sizeof(bdst), "config/profile.%i.cfg", i);
ecore_file_mv(bsrc, bdst);
}
e_user_dir_snprintf(bsrc, sizeof(bsrc), "config/profile.cfg");
e_user_dir_snprintf(bdst, sizeof(bdst), "config/profile.1.cfg");
ecore_file_mv(bsrc, bdst);
}
ret = ecore_file_mv(buf2, buf);
if (!ret) if (!ret)
{ {
printf("*** Error saving profile. ***"); printf("*** Error saving profile. ***");
@ -1374,6 +1418,21 @@ e_config_domain_save(const char *domain, E_Config_DD *edd, const void *data)
ok = eet_data_write(ef, edd, "config", data, 1); ok = eet_data_write(ef, edd, "config", data, 1);
if (_e_config_eet_close_handle(ef, buf2)) if (_e_config_eet_close_handle(ef, buf2))
{ {
if (_e_config_revisions > 0)
{
int i;
char bsrc[4096], bdst[4096];
for (i = _e_config_revisions; i > 1; i--)
{
e_user_dir_snprintf(bsrc, sizeof(bsrc), "config/%s/%s.%i.cfg", _e_config_profile, domain, i - 1);
e_user_dir_snprintf(bdst, sizeof(bdst), "config/%s/%s.%i.cfg", _e_config_profile, domain, i);
ecore_file_mv(bsrc, bdst);
}
e_user_dir_snprintf(bsrc, sizeof(bsrc), "config/%s/%s.cfg", _e_config_profile, domain);
e_user_dir_snprintf(bdst, sizeof(bdst), "config/%s/%s.1.cfg", _e_config_profile, domain);
ecore_file_mv(bsrc, bdst);
}
ret = ecore_file_mv(buf2, buf); ret = ecore_file_mv(buf2, buf);
if (!ret) if (!ret)
{ {

View File

@ -8,8 +8,6 @@
// need choice after add (file, gradient, online source) // need choice after add (file, gradient, online source)
// need delete select mode // need delete select mode
// need after select on delete an ok/cancel if file or "ok to remove whole online source" if online // need after select on delete an ok/cancel if file or "ok to remove whole online source" if online
// need to go to the current selected wallpaper (if it exists) or theme if theme selected (and set filename)
// need to make thumb white rect better (shaded etc.)
// need to make "exchange" wallpapers have a different look // need to make "exchange" wallpapers have a different look
// need signal to emit for popping down slide-up panel // need signal to emit for popping down slide-up panel
// bug: animated wp doesnt workon first show // bug: animated wp doesnt workon first show
@ -50,10 +48,12 @@ struct _Smart_Data
Evas_Coord cx, cy, cw, ch; Evas_Coord cx, cy, cw, ch;
Evas_Coord sx, sy; Evas_Coord sx, sy;
int id_num; int id_num;
int sort_num;
double seltime; double seltime;
double selmove; double selmove;
Eina_Bool selin : 1; Eina_Bool selin : 1;
Eina_Bool selout : 1; Eina_Bool selout : 1;
Eina_Bool jump2hi : 1;
}; };
struct _Item struct _Item
@ -69,6 +69,7 @@ struct _Item
Eina_Bool remote : 1; Eina_Bool remote : 1;
Eina_Bool theme : 1; Eina_Bool theme : 1;
Eina_Bool visible : 1; Eina_Bool visible : 1;
Eina_Bool hilighted : 1;
}; };
static Info *global_info = NULL; static Info *global_info = NULL;
@ -322,6 +323,8 @@ _e_smart_reconfigure_do(void *data)
else else
e_theme_edje_object_set(it->frame, "base/theme/widgets", e_theme_edje_object_set(it->frame, "base/theme/widgets",
"e/conf/wallpaper/main/mini"); "e/conf/wallpaper/main/mini");
if (it->hilighted)
edje_object_signal_emit(it->frame, "e,state,selected", "e");
evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN,
_item_down, it); _item_down, it);
evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP, evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP,
@ -624,6 +627,37 @@ _sel_timer(void *data)
return 0; return 0;
} }
static void
_pan_unhilight(Evas_Object *obj, Item *it)
{
Smart_Data *sd = evas_object_smart_data_get(obj);
if (!it->hilighted) return;
it->hilighted = 0;
if (it->frame)
edje_object_signal_emit(it->frame, "e,state,unselected", "e");
}
static void
_pan_hilight(Evas_Object *obj, Item *it)
{
Eina_List *l;
Item *it2;
Smart_Data *sd = evas_object_smart_data_get(obj);
if (it->hilighted) return;
EINA_LIST_FOREACH(sd->items, l, it2)
{
if (it2->hilighted)
{
_pan_unhilight(obj, it2);
break;
}
}
it->hilighted = 1;
if (it->frame)
edje_object_signal_emit(it->frame, "e,state,selected", "e");
}
static void static void
_pan_sel(Evas_Object *obj, Item *it) _pan_sel(Evas_Object *obj, Item *it)
{ {
@ -698,6 +732,7 @@ static int
_sort_cb(const void *d1, const void *d2) _sort_cb(const void *d1, const void *d2)
{ {
Item *it1 = d1, *it2 = d2; Item *it1 = d1, *it2 = d2;
if ((!it1->sort_id) || (!it2->sort_id)) return 0;
return strcmp(it1->sort_id, it2->sort_id); return strcmp(it1->sort_id, it2->sort_id);
} }
@ -706,20 +741,40 @@ _item_sort(Item *it)
{ {
Evas_Object *obj = it->obj; Evas_Object *obj = it->obj;
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
int num; int num, dosort = 0;
Eina_List *l; Eina_List *l;
sd->id_num++; sd->id_num++;
sd->info->scans--; sd->info->scans--;
num = eina_list_count(sd->items); num = eina_list_count(sd->items);
if (sd->id_num == num) // if (sd->sort_num < sd->id_num)
// {
// sd->sort_num = sd->id_num + 10;
// dosort = 1;
// }
if ((sd->id_num == num) || (dosort))
{ {
sd->items = eina_list_sort(sd->items, num, _sort_cb); sd->items = eina_list_sort(sd->items, num, _sort_cb);
_e_smart_reconfigure(obj); _e_smart_reconfigure_do(obj);
if (sd->jump2hi)
{
Eina_List *l;
Item *it2 = NULL;
EINA_LIST_FOREACH(sd->items, l, it2)
{
if (it2->hilighted) break;
it2 = NULL;
}
if (it2)
_pan_set(obj,
it2->x + (it2->w / 2) - (sd->w / 2),
it2->y + (it2->h / 2) - (sd->h / 2));
sd->jump2hi = 1;
}
} }
if (sd->info->scans == 0) if (sd->info->scans == 0)
{ {
printf("END3!\n");
edje_object_signal_emit(sd->info->bg, "e,state,busy,off", "e"); edje_object_signal_emit(sd->info->bg, "e,state,busy,off", "e");
} }
} }
@ -770,6 +825,7 @@ _item_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{ {
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
{ {
_pan_hilight(it->obj, it);
_pan_sel(it->obj, it); _pan_sel(it->obj, it);
// FIXME: select image!!! // FIXME: select image!!!
} }
@ -797,6 +853,8 @@ _pan_file_add(Evas_Object *obj, const char *file, Eina_Bool remote, Eina_Bool th
else else
e_theme_edje_object_set(it->frame, "base/theme/widgets", e_theme_edje_object_set(it->frame, "base/theme/widgets",
"e/conf/wallpaper/main/mini"); "e/conf/wallpaper/main/mini");
if (it->hilighted)
edje_object_signal_emit(it->frame, "e,state,selected", "e");
evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN,
_item_down, it); _item_down, it);
evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP, evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP,
@ -823,6 +881,48 @@ _pan_file_add(Evas_Object *obj, const char *file, Eina_Bool remote, Eina_Bool th
it->do_thumb = 1; it->do_thumb = 1;
// e_thumb_icon_begin(it->image); // e_thumb_icon_begin(it->image);
if (it->theme)
{
if (sd->info->use_theme_bg)
{
_pan_hilight(it->obj, it);
edje_object_part_text_set(sd->info->bg, "e.text.filename", _("Theme Wallpaper"));
}
}
else
{
if (sd->info->bg_file)
{
int match = 0;
if (!strcmp(sd->info->bg_file, it->file)) match = 1;
if (!match)
{
const char *p1, *p2;
p1 = ecore_file_file_get(sd->info->bg_file);
p2 = ecore_file_file_get(it->file);
if (!strcmp(p1, p2)) match = 1;
}
if (match)
{
char *name = NULL, *p;
sd->jump2hi = 1;
_pan_hilight(it->obj, it);
p = strrchr(sd->info->bg_file, '/');
if (p)
{
p++;
name = strdup(p);
p = strrchr(name, '.');
if (p) *p = 0;
}
edje_object_part_text_set(sd->info->bg, "e.text.filename", name);
if (name) free(name);
}
}
}
_e_smart_reconfigure(obj); _e_smart_reconfigure(obj);
} }