entrance: factorizing

This commit is contained in:
Michael Bouchaud 2014-05-05 22:48:54 +00:00
parent 0458a9a0b6
commit dade6965dc
3 changed files with 21 additions and 51 deletions

View File

@ -12,7 +12,8 @@ typedef struct Entrance_Conf_Background_
do { \
Entrance_Image *ptr; \
Entrance_Conf_Background *tmp_ptr; \
EINA_LIST_FOREACH(l_src, node, ptr) \
Eina_List *img_list; \
EINA_LIST_FOREACH(l_src, img_list, ptr) \
{ \
tmp_ptr = malloc(sizeof(Entrance_Conf_Background)); \
tmp_ptr->path = eina_stringshare_add(ptr->path); \

View File

@ -163,7 +163,7 @@ static Evas_Object *
_entrance_conf_main_build(Evas_Object *obj)
{
Evas_Object *bx_over, *o, *bx, *t;
Eina_List *s_bg, *t_bg, *tmp = NULL, *node = NULL, *profiles, *tmp_profiles = NULL;
Eina_List *s_bg, *t_bg, *l = NULL, *profiles, *tmp_profiles = NULL;
char *ctmp;
@ -203,17 +203,12 @@ _entrance_conf_main_build(Evas_Object *obj)
s_bg = entrance_gui_background_pool_get();
t_bg = entrance_gui_theme_backgrounds();
#define LIST_FILL(list) \
tmp = NULL; \
IMG_LIST_FORK(list, tmp); \
entrance_fill(o, entrance_conf_background_fill_get(),\
tmp, _entrance_conf_bg_fill_cb,\
IMG_LIST_FORK(s_bg, l);
IMG_LIST_FORK(t_bg, l);
entrance_fill(o, entrance_conf_background_fill_get(),
l, _entrance_conf_bg_fill_cb,
_entrance_conf_bg_sel, o);
LIST_FILL(s_bg);
LIST_FILL(t_bg);
#undef LIST_FILL
eina_list_free(l);
/* General */
t = elm_table_add(obj);
@ -264,7 +259,7 @@ _entrance_conf_main_build(Evas_Object *obj)
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 1, 1, 1, 1);
profiles = elm_config_profile_list_get();
EINA_LIST_FOREACH(profiles, node, ctmp)
EINA_LIST_FOREACH(profiles, l, ctmp)
{
tmp_profiles = eina_list_append(tmp_profiles, eina_stringshare_add(ctmp));
}

View File

@ -300,7 +300,7 @@ static void
_entrance_conf_user_build_cb(Evas_Object *t, Entrance_Login *eu)
{
Evas_Object *o, *gl, *bx, *hbx;
Eina_List *l = NULL, *tmp = NULL, *node = NULL;
Eina_List *l = NULL;
Entrance_Conf_Background *img;
int j = 0;
@ -338,30 +338,18 @@ _entrance_conf_user_build_cb(Evas_Object *t, Entrance_Login *eu)
elm_gengrid_group_item_size_set(gl,
elm_config_scale_get() * 31,
elm_config_scale_get() * 31);
img = calloc(1, sizeof(Entrance_Conf_Background));
img->group = NULL;
img->path = NULL;
img->name = eina_stringshare_add("None");
l = eina_list_append(l, img);
#define LIST_FILL(list) \
tmp = NULL; \
IMG_LIST_FORK(list, tmp); \
entrance_fill(gl, entrance_conf_background_fill_get(),\
tmp, _entrance_conf_user_bg_fill_cb,\
_entrance_conf_user_bg_sel, o);
IMG_LIST_FORK(entrance_gui_background_pool_get(), l);
IMG_LIST_FORK(entrance_gui_background_pool_get(), l);
IMG_LIST_FORK(entrance_gui_theme_backgrounds(), l);
IMG_LIST_FORK(eu->background_pool, l);
entrance_fill(gl, entrance_conf_background_fill_get(),
l, _entrance_conf_user_bg_fill_cb,
_entrance_conf_user_bg_sel, o);
LIST_FILL(entrance_gui_background_pool_get());
LIST_FILL(entrance_gui_theme_backgrounds());
LIST_FILL(eu->background_pool);
#undef LIST_FILL
eina_list_free(l);
/* Icon */
bx = elm_box_add(t);
@ -391,29 +379,15 @@ _entrance_conf_user_build_cb(Evas_Object *t, Entrance_Login *eu)
elm_config_scale_get() * 31);
img = calloc(1, sizeof(Entrance_Conf_Background));
img->group = NULL;
img->path = NULL;
img->name = eina_stringshare_add("Random");
l = NULL;
l = eina_list_append(l, img);
#define LIST_FILL(list) \
tmp = NULL; \
IMG_LIST_FORK(list, tmp); \
entrance_fill(gl, entrance_conf_background_fill_get(),\
tmp, _entrance_conf_user_icon_fill_cb,\
_entrance_conf_user_icon_sel, o);
l = eina_list_append(NULL, img);
IMG_LIST_FORK(entrance_gui_icon_pool_get(), l);
IMG_LIST_FORK(entrance_gui_theme_icons(), l);
IMG_LIST_FORK(eu->icon_pool, l);
entrance_fill(gl, entrance_conf_background_fill_get(),
l, _entrance_conf_user_icon_fill_cb,
_entrance_conf_user_icon_sel, o);
LIST_FILL(entrance_gui_icon_pool_get());
LIST_FILL(entrance_gui_theme_icons());
LIST_FILL(eu->icon_pool);
#undef LIST_FILL
eina_list_free(l);
/* Session to autoselect */
o = elm_label_add(t);