[Genlist] Open source merge. r69518.
authorseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Mar 2012 05:44:18 +0000 (05:44 +0000)
committerDaniel Juyung Seo <juyung.seo@samsung.com>
Tue, 27 Mar 2012 02:49:27 +0000 (11:49 +0900)
elm genlist: Refactoring. Create spacer object only when it is needed.

Change-Id: I15d1a5d6df4193f7d936458d6a5011ed35508b4e
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69518 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_genlist.c

index 39b23f3..316842a 100644 (file)
@@ -1727,8 +1727,11 @@ _item_cache_add(Elm_Gen_Item *it)
      {
         evas_object_del(VIEW(it));
         VIEW(it) = NULL;
-        evas_object_del(it->spacer);
-        it->spacer = NULL;
+        if (it->spacer)
+          {
+             evas_object_del(it->spacer);
+             it->spacer = NULL;
+          }
         evas_event_thaw(evas_object_evas_get(it->wd->obj));
         evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
         return;
@@ -2298,19 +2301,25 @@ _item_realize(Elm_Gen_Item *it,
 
         edje_object_mirrored_set(VIEW(it),
                                  elm_widget_mirrored_get(WIDGET(it)));
-        it->spacer =
-          evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
-        evas_object_color_set(it->spacer, 0, 0, 0, 0);
-        elm_widget_sub_object_add(WIDGET(it), it->spacer);
      }
 
    _elm_genlist_item_odd_even_update(it);
 
    treesize = edje_object_data_get(VIEW(it), "treesize");
    if (treesize) tsize = atoi(treesize);
-   evas_object_size_hint_min_set(it->spacer,
-                                 (it->item->expanded_depth * tsize) * _elm_config->scale, 1);
-   edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
+   if (!it->spacer && treesize)
+     {
+        it->spacer =
+          evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
+        evas_object_color_set(it->spacer, 0, 0, 0, 0);
+        elm_widget_sub_object_add(WIDGET(it), it->spacer);
+     }
+   if (it->spacer)
+     {
+        evas_object_size_hint_min_set(it->spacer,
+                                      (it->item->expanded_depth * tsize) * _elm_config->scale, 1);
+        edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
+     }
    if (!calc)
      {
         edje_object_signal_callback_add(VIEW(it),
@@ -2441,8 +2450,11 @@ _item_unrealize_cb(Elm_Gen_Item *it)
      {
         evas_object_del(VIEW(it));
         VIEW(it) = NULL;
-        evas_object_del(it->spacer);
-        it->spacer = NULL;
+        if (it->spacer)
+          {
+             evas_object_del(it->spacer);
+             it->spacer = NULL;
+          }
      }
    else
      {