seoz pushed a commit to branch master. http://git.enlightenment.org/tools/elm-theme-viewer.git/commit/?id=1ab464812f2703cdefd6d3b441e99accfe4dd8ca
commit 1ab464812f2703cdefd6d3b441e99accfe4dd8ca Author: Daniel Juyung Seo <seojuyu...@gmail.com> Date: Thu Mar 20 04:19:49 2014 +0900 gui: Use genlist instead of list for the widget styles list. Now I can show the full group name of a style as well as a simple style name. --- src/bin/gui.c | 40 +++++++++++++++++++++++++++++++++++----- src/bin/gui.h | 1 + 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/bin/gui.c b/src/bin/gui.c index 01a19c8..d93fe0a 100644 --- a/src/bin/gui.c +++ b/src/bin/gui.c @@ -596,6 +596,27 @@ _gui_widget_style_exclude_check(Widget_Type type, const char *style) } } +static char * +_gl_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *part) +{ + Style_Data *sd = data; + Widget_Data_Style *wds = sd->wds; + + if (!strcmp(part, "elm.text")) + return strdup(wds->simple); + else + return strdup(wds->group); +} + +static void +_gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED) +{ + Style_Data *sd = data; + + // do not need to free the internals of Style_Data + free(sd); +} + static Evas_Object * _gui_widget_style_load(Evas_Object *parent, Widget_Type type) { @@ -603,10 +624,18 @@ _gui_widget_style_load(Evas_Object *parent, Widget_Type type) Eina_List *styles = NULL, *l = NULL; Widget_Data_Style *wds = NULL; Style_Data *sd = NULL; + Elm_Genlist_Item_Class *itc = NULL; + + itc = elm_genlist_item_class_new(); + itc->item_style = "double_label"; + itc->func.text_get = _gl_text_get_cb; + itc->func.content_get = NULL; + itc->func.state_get = NULL; + itc->func.del = _gl_del_cb; // widget styles list - o = elm_list_add(parent); - elm_list_select_mode_set(o, ELM_OBJECT_SELECT_MODE_ALWAYS); + gd->left_menu_style_genlist = o = elm_genlist_add(parent); + elm_genlist_select_mode_set(o, ELM_OBJECT_SELECT_MODE_ALWAYS); styles = theme_widget_styles_get(type); EINA_LIST_FOREACH(styles, l, wds) { @@ -617,14 +646,15 @@ _gui_widget_style_load(Evas_Object *parent, Widget_Type type) sd = (Style_Data *)calloc(1, sizeof(Style_Data)); sd->widget_type = type; sd->wds = wds; - elm_list_item_append(o, wds->style, NULL, NULL, _style_list_sel_cb, sd); + elm_genlist_item_append(o, itc, sd, NULL, ELM_GENLIST_ITEM_NONE, + _style_list_sel_cb, sd); } // add additional hacky custom styles for special reasons //_custom_styles_add(o, type); - elm_list_item_selected_set(elm_list_first_item_get(o), EINA_TRUE); - elm_list_go(o); + elm_genlist_item_selected_set(elm_genlist_first_item_get(o), EINA_TRUE); + elm_genlist_item_class_free(itc); return o; } diff --git a/src/bin/gui.h b/src/bin/gui.h index 6a8841f..2316263 100644 --- a/src/bin/gui.h +++ b/src/bin/gui.h @@ -12,6 +12,7 @@ struct _Gui_Data Evas_Object *left_menu_box; Eina_Bool left_menu_widget_desc; // true if widget desc is created + Evas_Object *left_menu_style_genlist; // genlist for the widget styles on the left menu Evas_Object *preview_bg; Evas_Object *preview_box; --