[genlist, gen, gen_common] merge upstream except for elm_genlist.c
[framework/uifw/elementary.git] / src / examples / genlist_example_01.c
index f60ef41..da5d9ad 100644 (file)
@@ -10,7 +10,7 @@
 
 #define N_ITEMS 30
 
-static Elm_Genlist_Item_Class _itc;
+static Elm_Genlist_Item_Class *_itc = NULL;
 
 static char *
 _item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
@@ -57,17 +57,21 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
    elm_win_resize_object_add(win, bg);
    evas_object_show(bg);
 
-   _itc.item_style = "default";
-   _itc.func.label_get = _item_label_get;
-   _itc.func.content_get = _item_content_get;
-   _itc.func.state_get = NULL;
-   _itc.func.del = NULL;
+   if (!_itc)
+     {
+        _itc = elm_genlist_item_class_new();
+        _itc->item_style = "default";
+        _itc->func.text_get = _item_label_get;
+        _itc->func.content_get = _item_content_get;
+        _itc->func.state_get = NULL;
+        _itc->func.del = NULL;
+     }
 
    list = elm_genlist_add(win);
 
    for (i = 0; i < N_ITEMS; i++)
      {
-       elm_genlist_item_append(list, &_itc,
+       elm_genlist_item_append(list, _itc,
                                (void *)(long)i, NULL,
                                ELM_GENLIST_ITEM_NONE,
                                _item_sel_cb, NULL);