Hi, Elementary devs.
I think some of you know this odd genlist bug where, for genlists with
>= 34 items, elm_genlist_item_show() will misbehave. Here is a simple testing
program for that. Any of you genlist developers have any ideas?
Best regards,
--
Gustavo Lima Chaves
Senior Developer @ ProFUSION Embedded Systems
#include <Elementary.h>
#include <stdio.h>
#include <string.h>
static char *_txt_get(void *data, Evas_Object *o, const char *part)
{
char buf[10];
int i = (int)(long)data;
snprintf(buf, sizeof(buf), "%d", i);
return strdup(buf);
}
int elm_main(int argc, char **argv)
{
Evas_Object *win, *list, *bg;
Elm_Genlist_Item_Class *itc, *itc_group;
int i;
Elm_Object_Item *it;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Genlist test", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
elm_win_title_set(win, "Genlist test");
evas_object_resize(win, 800, 100);
evas_object_move(win, 0, 0);
evas_object_show(win);
bg = elm_bg_add(win);
elm_bg_color_set(bg, 255, 255, 255);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
list = elm_genlist_add(win);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, list);
evas_object_show(list);
itc = elm_genlist_item_class_new();
itc->item_style = "default";
itc->func.text_get = _txt_get;
itc_group = elm_genlist_item_class_new();
itc_group->item_style = "default";
itc_group->func.text_get = _txt_get;
// for list sizes <= 33, OK. for bigger that that -> BUG
for (i = 0; i < 33; i++)
{
elm_genlist_item_append(list, itc, (void *)(long)i, NULL,
ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
elm_genlist_item_prepend(list, itc_group, (void *)(long)-1, NULL,
ELM_GENLIST_ITEM_GROUP, NULL, NULL);
it = elm_genlist_item_next_get(elm_genlist_first_item_get(list));
elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_TOP);
elm_run();
elm_genlist_item_class_free(itc);
elm_genlist_item_class_free(itc_group);
elm_shutdown();
return 0;
}
ELM_MAIN()
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel