summaryrefslogtreecommitdiff
path: root/src/examples/gengrid_example.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-03-06 06:30:43 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-03-06 06:30:43 +0000
commit1cb3372426f72f1ac11d4d2c0a66470cf0c0020a (patch)
treeb16d0482e471f03e15061c6fc217a1d805088b7a /src/examples/gengrid_example.c
parentb4c9199056acf00924c4b3b37812b4e959080317 (diff)
lets update genlist/grid examples to use the new class thing.
SVN revision: 68774
Diffstat (limited to 'src/examples/gengrid_example.c')
-rw-r--r--src/examples/gengrid_example.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/examples/gengrid_example.c b/src/examples/gengrid_example.c
index 37ee2323d..b75734c2d 100644
--- a/src/examples/gengrid_example.c
+++ b/src/examples/gengrid_example.c
@@ -35,8 +35,8 @@ static const char *imgs[9] =
35 "wood_01.jpg", 35 "wood_01.jpg",
36}; 36};
37 37
38static Elm_Gengrid_Item_Class gic; 38static Elm_Gengrid_Item_Class *gic = NULL;
39Evas_Object *before_bt, *after_bt; 39static Evas_Object *before_bt, *after_bt;
40 40
41static void 41static void
42_on_done(void *data __UNUSED__, 42_on_done(void *data __UNUSED__,
@@ -170,7 +170,7 @@ _before_bt_clicked(void *data,
170 return; 170 return;
171 171
172 it = _item_new(); 172 it = _item_new();
173 elm_gengrid_item_insert_before(grid, &gic, it, sel, _grid_sel, NULL); 173 elm_gengrid_item_insert_before(grid, gic, it, sel, _grid_sel, NULL);
174} 174}
175 175
176/* "insert after" callback */ 176/* "insert after" callback */
@@ -188,7 +188,7 @@ _after_bt_clicked(void *data,
188 return; 188 return;
189 189
190 it = _item_new(); 190 it = _item_new();
191 elm_gengrid_item_insert_after(grid, &gic, it, sel, _grid_sel, NULL); 191 elm_gengrid_item_insert_after(grid, gic, it, sel, _grid_sel, NULL);
192} 192}
193 193
194/* prepend an item */ 194/* prepend an item */
@@ -201,7 +201,7 @@ _prepend_bt_clicked(void *data,
201 Evas_Object *grid = data; 201 Evas_Object *grid = data;
202 202
203 it = _item_new(); 203 it = _item_new();
204 elm_gengrid_item_prepend(grid, &gic, it, _grid_sel, NULL); 204 elm_gengrid_item_prepend(grid, gic, it, _grid_sel, NULL);
205} 205}
206 206
207/* append an item */ 207/* append an item */
@@ -213,7 +213,7 @@ _append_bt_clicked(void *data,
213 Evas_Object *grid = data; 213 Evas_Object *grid = data;
214 Example_Item *it = _item_new(); 214 Example_Item *it = _item_new();
215 215
216 elm_gengrid_item_append(grid, &gic, it, _grid_sel, NULL); 216 elm_gengrid_item_append(grid, gic, it, _grid_sel, NULL);
217} 217}
218 218
219/* delete items */ 219/* delete items */
@@ -604,11 +604,15 @@ elm_main(int argc __UNUSED__,
604 _page_change_cb(grid, sl, NULL); 604 _page_change_cb(grid, sl, NULL);
605 evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid); 605 evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid);
606 606
607 gic.item_style = "default"; 607 if (!gic)
608 gic.func.text_get = _grid_label_get; 608 {
609 gic.func.content_get = _grid_content_get; 609 gic = elm_gengrid_item_class_new();
610 gic.func.state_get = _grid_state_get; 610 gic->item_style = "default";
611 gic.func.del = _grid_del; 611 gic->func.text_get = _grid_label_get;
612 gic->func.content_get = _grid_content_get;
613 gic->func.state_get = _grid_state_get;
614 gic->func.del = _grid_del;
615 } // we only create the first time its needed. we dont unref/free
612 616
613 _append_bt_clicked(grid, NULL, NULL); 617 _append_bt_clicked(grid, NULL, NULL);
614 _append_bt_clicked(grid, NULL, NULL); 618 _append_bt_clicked(grid, NULL, NULL);