Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        etk_combobox.c 


Log Message:
* [Combobox] Make etk_combobox_active_item_nth_get() a bit cleaner


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_combobox.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- etk_combobox.c      11 Sep 2006 13:45:08 -0000      1.29
+++ etk_combobox.c      11 Sep 2006 15:17:58 -0000      1.30
@@ -324,24 +324,22 @@
 /**
  * @brief Gets the index of the current active item of the combobox
  * @param combobox a combobox
- * @return Returns the index of the current active item
+ * @return Returns the index of the current active item, or -1 on failure
  */
 int etk_combobox_active_item_nth_get(Etk_Combobox *combobox)
 {
-   Evas_List *list;
-   int i = 0;
+   Evas_List *l;
+   int i;
 
-   if (!combobox)
+   if (!combobox || !combobox->active_item)
       return -1;
 
-   list = evas_list_find_list(combobox->items, combobox->active_item);
-   while (list)
-     {
-       list = evas_list_next(list);
-       i++;
-     }
-
-   return evas_list_count(combobox->items) - i;
+   for (i = 0, l = combobox->items; l; i++, l = l->next)
+   {
+      if (l->data == combobox->active_item)
+         return i;
+   }
+   return -1;
 }
 
 /**



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to