forked from enlightenment/enlightenment
... allow non edj files as wallpapers... if u try. :)
SVN revision: 62340
This commit is contained in:
parent
aea6b1e70b
commit
28d6049319
|
@ -118,7 +118,8 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
|
|||
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
||||
{
|
||||
int spec;
|
||||
|
||||
const char *ext;
|
||||
|
||||
if (!cfbg) continue;
|
||||
spec = 0;
|
||||
if (cfbg->container == container_num) spec++;
|
||||
|
@ -142,19 +143,28 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
|
|||
if (bf) bgfile = bf;
|
||||
}
|
||||
}
|
||||
entries = edje_file_collection_list(bgfile);
|
||||
if (entries)
|
||||
{
|
||||
EINA_LIST_FOREACH(entries, ll, entry)
|
||||
{
|
||||
if (!strcmp(entry, "e/desktop/background"))
|
||||
{
|
||||
bg = cfbg;
|
||||
current_spec = spec;
|
||||
}
|
||||
}
|
||||
edje_file_collection_list_free(entries);
|
||||
}
|
||||
ext = strrchr(bgfile, '.');
|
||||
if ((ext) && (!strcasecmp(ext, ".edj")))
|
||||
{
|
||||
entries = edje_file_collection_list(bgfile);
|
||||
if (entries)
|
||||
{
|
||||
EINA_LIST_FOREACH(entries, ll, entry)
|
||||
{
|
||||
if (!strcmp(entry, "e/desktop/background"))
|
||||
{
|
||||
bg = cfbg;
|
||||
current_spec = spec;
|
||||
}
|
||||
}
|
||||
edje_file_collection_list_free(entries);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bg = cfbg;
|
||||
current_spec = spec;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bg;
|
||||
|
@ -188,6 +198,8 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
|
|||
}
|
||||
else
|
||||
{
|
||||
const char *ext;
|
||||
|
||||
bgfile = e_config->desktop_default_background;
|
||||
if (bgfile)
|
||||
{
|
||||
|
@ -199,19 +211,24 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
|
|||
if (bf) bgfile = bf;
|
||||
}
|
||||
}
|
||||
entries = edje_file_collection_list(bgfile);
|
||||
if (entries)
|
||||
{
|
||||
EINA_LIST_FOREACH(entries, l, entry)
|
||||
{
|
||||
if (!strcmp(entry, "e/desktop/background"))
|
||||
{
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
edje_file_collection_list_free(entries);
|
||||
}
|
||||
ext = strrchr(bgfile, '.');
|
||||
if ((ext) && (!strcasecmp(ext, ".edj")))
|
||||
{
|
||||
entries = edje_file_collection_list(bgfile);
|
||||
if (entries)
|
||||
{
|
||||
EINA_LIST_FOREACH(entries, l, entry)
|
||||
{
|
||||
if (!strcmp(entry, "e/desktop/background"))
|
||||
{
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
edje_file_collection_list_free(entries);
|
||||
}
|
||||
}
|
||||
else ok = 1;
|
||||
if (!ok)
|
||||
bgfile = e_theme_edje_file_get("base/theme/background",
|
||||
"e/desktop/background");
|
||||
|
@ -226,6 +243,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
|||
Evas_Object *o;
|
||||
const char *bgfile = "";
|
||||
const char *trans = "";
|
||||
const char *ext;
|
||||
E_Desk *desk;
|
||||
|
||||
if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start;
|
||||
|
@ -283,10 +301,21 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
|||
evas_object_clip_set(o, zone->bg_clip_object);
|
||||
evas_object_show(o);
|
||||
}
|
||||
o = edje_object_add(zone->container->bg_evas);
|
||||
ext = strrchr(bgfile, '.');
|
||||
if ((ext) && (!strcasecmp(ext, ".edj")))
|
||||
{
|
||||
o = edje_object_add(zone->container->bg_evas);
|
||||
evas_object_data_set(o, "e_zone", zone);
|
||||
edje_object_file_set(o, bgfile, "e/desktop/background");
|
||||
}
|
||||
else
|
||||
{
|
||||
o = e_icon_add(zone->container->bg_evas);
|
||||
evas_object_data_set(o, "e_zone", zone);
|
||||
e_icon_file_key_set(o, bgfile, NULL);
|
||||
e_icon_fill_inside_set(o, 0);
|
||||
}
|
||||
zone->bg_object = o;
|
||||
evas_object_data_set(o, "e_zone", zone);
|
||||
edje_object_file_set(o, bgfile, "e/desktop/background");
|
||||
if (transition == E_BG_TRANSITION_NONE)
|
||||
{
|
||||
evas_object_move(o, zone->x, zone->y);
|
||||
|
|
|
@ -7,7 +7,9 @@ struct _E_Smart_Data
|
|||
Evas_Coord x, y, w, h;
|
||||
Evas_Object *obj;
|
||||
Evas_Object *eventarea;
|
||||
Ecore_Timer *timer;
|
||||
int size;
|
||||
int frame, frame_count;
|
||||
const char *fdo;
|
||||
unsigned char fill_inside : 1;
|
||||
unsigned char scale_up : 1;
|
||||
|
@ -61,6 +63,47 @@ _e_icon_obj_prepare(Evas_Object *obj, E_Smart_Data *sd)
|
|||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_frame_anim(void *data)
|
||||
{
|
||||
E_Smart_Data *sd = data;
|
||||
double t;
|
||||
int fr;
|
||||
|
||||
sd->frame++;
|
||||
fr = (sd->frame % (sd->frame_count)) + 1;
|
||||
evas_object_image_animated_frame_set(sd->obj, fr);
|
||||
t = evas_object_image_animated_frame_duration_get(sd->obj, fr, 0);
|
||||
sd->timer = ecore_timer_add(t, _frame_anim, sd);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
_handle_anim(E_Smart_Data *sd)
|
||||
{
|
||||
double t;
|
||||
|
||||
if (sd->timer) ecore_timer_del(sd->timer);
|
||||
sd->timer = NULL;
|
||||
sd->frame = 0;
|
||||
sd->frame_count = 0;
|
||||
if (!evas_object_image_animated_get(sd->obj)) return 0;
|
||||
// FIXME: hack around jiyouns BUG!!!!!!!!
|
||||
{
|
||||
const char *file;
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "%ld", (long)sd);
|
||||
evas_object_image_file_get(sd->obj, &file, NULL);
|
||||
evas_object_image_file_set(sd->obj, file, buf);
|
||||
}
|
||||
sd->frame_count = evas_object_image_animated_frame_count_get(sd->obj);
|
||||
if (sd->frame_count < 2) return 0;
|
||||
evas_object_show(sd->obj);
|
||||
t = evas_object_image_animated_frame_duration_get(sd->obj, sd->frame, 0);
|
||||
sd->timer = ecore_timer_add(t, _frame_anim, sd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
e_icon_file_set(Evas_Object *obj, const char *file)
|
||||
{
|
||||
|
@ -85,19 +128,27 @@ e_icon_file_set(Evas_Object *obj, const char *file)
|
|||
sd->fdo = NULL;
|
||||
}
|
||||
|
||||
if (sd->timer) ecore_timer_del(sd->timer);
|
||||
sd->timer = NULL;
|
||||
sd->frame = 0;
|
||||
sd->frame_count = 0;
|
||||
|
||||
if (sd->size != 0)
|
||||
evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
|
||||
if (sd->preload) evas_object_hide(sd->obj);
|
||||
evas_object_image_file_set(sd->obj, file, NULL);
|
||||
if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
|
||||
return EINA_FALSE;
|
||||
if (sd->preload)
|
||||
if (!_handle_anim(sd))
|
||||
{
|
||||
sd->loading = 1;
|
||||
evas_object_image_preload(sd->obj, EINA_FALSE);
|
||||
if (sd->preload)
|
||||
{
|
||||
sd->loading = 1;
|
||||
evas_object_image_preload(sd->obj, EINA_FALSE);
|
||||
}
|
||||
else if (evas_object_visible_get(obj))
|
||||
evas_object_show(sd->obj);
|
||||
}
|
||||
else if (evas_object_visible_get(obj))
|
||||
evas_object_show(sd->obj);
|
||||
|
||||
_e_icon_smart_reconfigure(sd);
|
||||
return EINA_TRUE;
|
||||
|
@ -118,6 +169,12 @@ e_icon_file_key_set(Evas_Object *obj, const char *file, const char *key)
|
|||
eina_stringshare_del(sd->fdo);
|
||||
sd->fdo = NULL;
|
||||
}
|
||||
|
||||
if (sd->timer) ecore_timer_del(sd->timer);
|
||||
sd->timer = NULL;
|
||||
sd->frame = 0;
|
||||
sd->frame_count = 0;
|
||||
|
||||
_e_icon_obj_prepare(obj, sd);
|
||||
if (sd->size != 0)
|
||||
evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
|
||||
|
@ -125,13 +182,16 @@ e_icon_file_key_set(Evas_Object *obj, const char *file, const char *key)
|
|||
evas_object_image_file_set(sd->obj, file, key);
|
||||
if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
|
||||
return EINA_FALSE;
|
||||
if (sd->preload)
|
||||
if (!_handle_anim(sd))
|
||||
{
|
||||
sd->loading = 1;
|
||||
evas_object_image_preload(sd->obj, 0);
|
||||
if (sd->preload)
|
||||
{
|
||||
sd->loading = 1;
|
||||
evas_object_image_preload(sd->obj, 0);
|
||||
}
|
||||
else if (evas_object_visible_get(obj))
|
||||
evas_object_show(sd->obj);
|
||||
}
|
||||
else if (evas_object_visible_get(obj))
|
||||
evas_object_show(sd->obj);
|
||||
_e_icon_smart_reconfigure(sd);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -152,6 +212,12 @@ e_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
|
|||
eina_stringshare_del(sd->fdo);
|
||||
sd->fdo = NULL;
|
||||
}
|
||||
|
||||
if (sd->timer) ecore_timer_del(sd->timer);
|
||||
sd->timer = NULL;
|
||||
sd->frame = 0;
|
||||
sd->frame_count = 0;
|
||||
|
||||
sd->obj = edje_object_add(evas_object_evas_get(obj));
|
||||
edje_object_file_set(sd->obj, file, part);
|
||||
if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
|
||||
|
@ -175,6 +241,11 @@ e_icon_fdo_icon_set(Evas_Object *obj, const char *icon)
|
|||
if (!(sd = evas_object_smart_data_get(obj)))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (sd->timer) ecore_timer_del(sd->timer);
|
||||
sd->timer = NULL;
|
||||
sd->frame = 0;
|
||||
sd->frame_count = 0;
|
||||
|
||||
eina_stringshare_replace(&sd->fdo, icon);
|
||||
if (!sd->fdo) return EINA_FALSE;
|
||||
|
||||
|
@ -212,6 +283,11 @@ e_icon_object_set(Evas_Object *obj, Evas_Object *o)
|
|||
|
||||
if (!(sd = evas_object_smart_data_get(obj))) return;
|
||||
|
||||
if (sd->timer) ecore_timer_del(sd->timer);
|
||||
sd->timer = NULL;
|
||||
sd->frame = 0;
|
||||
sd->frame_count = 0;
|
||||
|
||||
/* smart code here */
|
||||
if (sd->obj) evas_object_del(sd->obj);
|
||||
sd->loading = 0;
|
||||
|
@ -539,6 +615,7 @@ _e_icon_smart_del(Evas_Object *obj)
|
|||
evas_object_del(sd->obj);
|
||||
evas_object_del(sd->eventarea);
|
||||
if (sd->fdo) eina_stringshare_del(sd->fdo);
|
||||
if (sd->timer) ecore_timer_del(sd->timer);
|
||||
free(sd);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ e_widget_preview_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
if (wd->o_thumb) evas_object_del(wd->o_thumb);
|
||||
|
||||
wd->o_thumb = e_icon_add(e_livethumb_evas_get(wd->img));
|
||||
e_icon_fill_inside_set(wd->o_thumb, 0);
|
||||
e_icon_file_key_set(wd->o_thumb, file, key);
|
||||
evas_object_show(wd->o_thumb);
|
||||
e_livethumb_thumb_set(wd->img, wd->o_thumb);
|
||||
|
|
|
@ -108,6 +108,32 @@ _e_int_config_wallpaper_desk(E_Container *con, int con_num, int zone_num, int de
|
|||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_bg_set(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (!cfdata->o_preview) return;
|
||||
if (cfdata->bg)
|
||||
{
|
||||
const char *ext = strrchr(cfdata->bg, '.');
|
||||
|
||||
if ((ext) && (!strcasecmp(ext, ".edj")))
|
||||
e_widget_preview_edje_set(cfdata->o_preview, cfdata->bg,
|
||||
"e/desktop/background");
|
||||
else
|
||||
e_widget_preview_file_set(cfdata->o_preview, cfdata->bg,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *f;
|
||||
|
||||
f = e_theme_edje_file_get("base/theme/backgrounds",
|
||||
"e/desktop/background");
|
||||
e_widget_preview_edje_set(cfdata->o_preview, f,
|
||||
"e/desktop/background");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_int_config_wallpaper_update(E_Config_Dialog *dia, char *file)
|
||||
{
|
||||
|
@ -124,9 +150,7 @@ e_int_config_wallpaper_update(E_Config_Dialog *dia, char *file)
|
|||
if (cfdata->o_theme_bg)
|
||||
e_widget_check_checked_set(cfdata->o_theme_bg, cfdata->use_theme_bg);
|
||||
if (cfdata->o_fm) e_widget_flist_path_set(cfdata->o_fm, path, "/");
|
||||
if (cfdata->o_preview)
|
||||
e_widget_preview_edje_set(cfdata->o_preview, cfdata->bg,
|
||||
"e/desktop/background");
|
||||
_bg_set(cfdata);
|
||||
if (cfdata->o_fm) e_widget_change(cfdata->o_fm);
|
||||
}
|
||||
|
||||
|
@ -195,8 +219,7 @@ _cb_files_selection_change(void *data, Evas_Object *obj __UNUSED__, void *event_
|
|||
E_FREE(cfdata->bg);
|
||||
|
||||
cfdata->bg = strdup(buf);
|
||||
if (cfdata->o_preview)
|
||||
e_widget_preview_edje_set(cfdata->o_preview, buf, "e/desktop/background");
|
||||
_bg_set(cfdata);
|
||||
if (cfdata->o_theme_bg)
|
||||
e_widget_check_checked_set(cfdata->o_theme_bg, 0);
|
||||
cfdata->use_theme_bg = 0;
|
||||
|
@ -281,20 +304,13 @@ _cb_theme_wallpaper(void *data, Evas_Object *obj __UNUSED__, void *event_info __
|
|||
"e/desktop/background");
|
||||
E_FREE(cfdata->bg);
|
||||
cfdata->bg = strdup(f);
|
||||
if (cfdata->o_preview)
|
||||
e_widget_preview_edje_set(cfdata->o_preview, f,
|
||||
"e/desktop/background");
|
||||
_bg_set(cfdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_smart_callback_call(cfdata->o_fm, "selection_change",
|
||||
cfdata);
|
||||
if (cfdata->bg)
|
||||
{
|
||||
if (cfdata->o_preview)
|
||||
e_widget_preview_edje_set(cfdata->o_preview, cfdata->bg,
|
||||
"e/desktop/background");
|
||||
}
|
||||
_bg_set(cfdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +450,6 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
E_Radio_Group *rg;
|
||||
char path[PATH_MAX];
|
||||
int mw, mh, online;
|
||||
const char *f;
|
||||
|
||||
online = ecore_file_download_protocol_available("http://");
|
||||
|
||||
|
@ -506,11 +521,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
oa = e_widget_aspect_add(evas, mw, mh);
|
||||
ow = e_widget_preview_add(evas, mw, mh);
|
||||
cfdata->o_preview = ow;
|
||||
if (cfdata->bg)
|
||||
f = cfdata->bg;
|
||||
else
|
||||
f = e_theme_edje_file_get("base/theme/backgrounds", "e/desktop/background");
|
||||
e_widget_preview_edje_set(ow, f, "e/desktop/background");
|
||||
_bg_set(cfdata);
|
||||
e_widget_aspect_child_set(oa, ow);
|
||||
evas_object_show(ow);
|
||||
evas_object_show(oa);
|
||||
|
@ -564,7 +575,6 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
E_Radio_Group *rg;
|
||||
char path[PATH_MAX];
|
||||
int mw, mh, online;
|
||||
const char *f;
|
||||
|
||||
online = ecore_file_download_protocol_available("http://");
|
||||
|
||||
|
@ -634,11 +644,7 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
oa = e_widget_aspect_add(evas, mw, mh);
|
||||
ow = e_widget_preview_add(evas, mw, mh);
|
||||
cfdata->o_preview = ow;
|
||||
if (cfdata->bg)
|
||||
f = cfdata->bg;
|
||||
else
|
||||
f = e_theme_edje_file_get("base/theme/backgrounds", "e/desktop/background");
|
||||
e_widget_preview_edje_set(ow, f, "e/desktop/background");
|
||||
_bg_set(cfdata);
|
||||
e_widget_aspect_child_set(oa, ow);
|
||||
e_widget_table_object_append(ot, oa, 0, 2, 2 + online, 1, 1, 1, 1, 1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue