Replace repetetive if(type== with switch/case
authorleif <leif@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Mar 2012 03:19:13 +0000 (03:19 +0000)
committerleif <leif@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Mar 2012 03:19:13 +0000 (03:19 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69512 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_genlist.c

index 040183b..288625a 100644 (file)
@@ -4845,26 +4845,26 @@ _elm_genlist_item_compute_coordinates(Elm_Object_Item *it,
      }
 
    evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, w, h);
-   if (type==ELM_GENLIST_ITEM_SCROLLTO_IN)
+   switch(type)
      {
-        if ((_it->item->group_item) &&
-           (_it->wd->pan_y > (_it->y + _it->item->block->y)))
-            gith = _it->item->group_item->item->h;
+      case ELM_GENLIST_ITEM_SCROLLTO_IN:
+         if ((_it->item->group_item) &&
+            (_it->wd->pan_y > (_it->y + _it->item->block->y)))
+             gith = _it->item->group_item->item->h;
 
-        *h = _it->item->h;
-        *y = _it->y + _it->item->block->y - gith;
-     }
-   else if (type==ELM_GENLIST_ITEM_SCROLLTO_TOP)
-     {
-        if (_it->item->group_item) gith = _it->item->group_item->item->h;
-        *y = _it->y + _it->item->block->y - gith;
-     }
-   else if (type==ELM_GENLIST_ITEM_SCROLLTO_MIDDLE)
-     {
-        *y = _it->y + _it->item->block->y - *h / 2 + _it->item->h / 2;
+         *h = _it->item->h;
+         *y = _it->y + _it->item->block->y - gith;
+         break;
+      case ELM_GENLIST_ITEM_SCROLLTO_TOP:
+         if (_it->item->group_item) gith = _it->item->group_item->item->h;
+         *y = _it->y + _it->item->block->y - gith;
+         break;
+      case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE:
+         *y = _it->y + _it->item->block->y - *h / 2 + _it->item->h / 2;
+         break;
+      default:
+         return EINA_FALSE;
      }
-   else
-     return EINA_FALSE;
 
    *x = _it->x + _it->item->block->x;
    *w = _it->item->block->w;