forked from enlightenment/enlightenment
Reduce variable usage.
Use E_NEW & E_FREE. SVN revision: 49762
This commit is contained in:
parent
d4c70a863c
commit
d0868ecd95
|
@ -17,38 +17,38 @@ static void _e_wid_preview_thumb_gen(void *data, Evas_Object *obj, void *event_i
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
e_widget_preview_add(Evas *evas, int minw, int minh)
|
e_widget_preview_add(Evas *evas, int minw, int minh)
|
||||||
{
|
{
|
||||||
Evas_Object *obj, *o;
|
Evas_Object *obj;
|
||||||
E_Widget_Data *wd;
|
E_Widget_Data *wd;
|
||||||
Evas_Coord mw, mh;
|
Evas_Coord mw, mh;
|
||||||
|
|
||||||
obj = e_widget_add(evas);
|
obj = e_widget_add(evas);
|
||||||
e_widget_del_hook_set(obj, _e_wid_del_hook);
|
e_widget_del_hook_set(obj, _e_wid_del_hook);
|
||||||
wd = calloc(1, sizeof(E_Widget_Data));
|
|
||||||
|
wd = E_NEW(E_Widget_Data, 1);
|
||||||
if (!wd) return NULL;
|
if (!wd) return NULL;
|
||||||
|
|
||||||
wd->obj = obj;
|
wd->obj = obj;
|
||||||
|
|
||||||
o = edje_object_add(evas);
|
wd->o_frame = edje_object_add(evas);
|
||||||
wd->o_frame = o;
|
e_theme_edje_object_set(wd->o_frame, "base/theme/widgets",
|
||||||
e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/preview");
|
"e/widgets/preview");
|
||||||
evas_object_show(o);
|
evas_object_show(wd->o_frame);
|
||||||
e_widget_sub_object_add(obj, o);
|
e_widget_sub_object_add(obj, wd->o_frame);
|
||||||
e_widget_resize_object_set(obj, o);
|
e_widget_resize_object_set(obj, wd->o_frame);
|
||||||
|
|
||||||
o = e_livethumb_add(evas);
|
wd->img = e_livethumb_add(evas);
|
||||||
wd->img = o;
|
e_livethumb_vsize_set(wd->img, minw * 2, minh * 2);
|
||||||
e_livethumb_vsize_set(o, minw * 2, minh * 2);
|
edje_extern_object_min_size_set(wd->img, minw, minh);
|
||||||
edje_extern_object_min_size_set(o, minw, minh);
|
|
||||||
/* Why do we set max size? This prevents from being nicely resized. */
|
/* Why do we set max size? This prevents from being nicely resized. */
|
||||||
/* edje_extern_object_max_size_set(o, minw, minh); */
|
/* edje_extern_object_max_size_set(o, minw, minh); */
|
||||||
evas_object_show(o);
|
// evas_object_show(wd->img);
|
||||||
edje_object_part_swallow(wd->o_frame, "e.swallow.content", o);
|
edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->img);
|
||||||
|
e_widget_sub_object_add(obj, wd->img);
|
||||||
|
|
||||||
e_widget_data_set(obj, wd);
|
e_widget_data_set(obj, wd);
|
||||||
e_widget_can_focus_set(obj, 0);
|
e_widget_can_focus_set(obj, 0);
|
||||||
edje_object_size_min_calc(wd->o_frame, &mw, &mh);
|
edje_object_size_min_calc(wd->o_frame, &mw, &mh);
|
||||||
e_widget_size_min_set(obj, mw, mh);
|
e_widget_size_min_set(obj, mw, mh);
|
||||||
e_widget_sub_object_add(obj, o);
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,6 @@ e_widget_preview_edje_set(Evas_Object *obj, const char *file, const char *group)
|
||||||
ret = edje_object_file_set(wd->o_thumb, file, group);
|
ret = edje_object_file_set(wd->o_thumb, file, group);
|
||||||
evas_object_show(wd->o_thumb);
|
evas_object_show(wd->o_thumb);
|
||||||
e_livethumb_thumb_set(wd->img, wd->o_thumb);
|
e_livethumb_thumb_set(wd->img, wd->o_thumb);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,5 +163,5 @@ _e_wid_del_hook(Evas_Object *obj)
|
||||||
E_Widget_Data *wd;
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
wd = e_widget_data_get(obj);
|
wd = e_widget_data_get(obj);
|
||||||
free(wd);
|
E_FREE(wd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue