summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-11-22 09:09:11 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-11-22 09:40:37 +0200
commitdb5dd5f7d3fa532c68eb57090eebd6e4f0c339cb (patch)
tree17eb250f011b466b37e5b57f0a361324f2757d3b
parent079391717d4de6a4c6e3af34a9043ff1d07bd8a0 (diff)
Genlist: Fix API return value.
elm_genlist_item_subitems_get has to return a list of Elm_Object_Item. Because of the porting of the genlist item to Eo, this function returns a list of Elm_Gen_Item. Thanks to zmike and seoz for catching this. Fixes T1859
-rw-r--r--src/lib/elm_genlist.c95
1 files changed, 57 insertions, 38 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index f1a1fdf1c..4cd9c224c 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -818,28 +818,30 @@ _elm_genlist_elm_layout_sizing_eval(Eo *obj, Elm_Genlist_Data *sd)
818} 818}
819 819
820static void 820static void
821_item_contract_emit(Elm_Gen_Item *it) 821_item_contract_emit(Elm_Object_Item *eo_it)
822{ 822{
823 Elm_Gen_Item *it2; 823 ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
824 Elm_Object_Item *eo_it2;
824 Eina_List *l; 825 Eina_List *l;
825 826
826 edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", ""); // XXX: for compat 827 edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", ""); // XXX: for compat
827 edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", "elm"); 828 edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", "elm");
828 it->item->tree_effect_finished = EINA_FALSE; 829 it->item->tree_effect_finished = EINA_FALSE;
829 830
830 EINA_LIST_FOREACH(it->item->items, l, it2) 831 EINA_LIST_FOREACH(it->item->items, l, eo_it2)
831 if (it2) _item_contract_emit(it2); 832 if (eo_it2) _item_contract_emit(eo_it2);
832} 833}
833 834
834static int 835static int
835_item_tree_effect_before(Elm_Gen_Item *it) 836_item_tree_effect_before(Elm_Gen_Item *it)
836{ 837{
837 Elm_Gen_Item *it2; 838 Elm_Object_Item *eo_it2;
838 Eina_List *l; 839 Eina_List *l;
839 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); 840 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
840 841
841 EINA_LIST_FOREACH(it->item->items, l, it2) 842 EINA_LIST_FOREACH(it->item->items, l, eo_it2)
842 { 843 {
844 ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
843 if (it2->parent && (it == it2->parent)) 845 if (it2->parent && (it == it2->parent))
844 { 846 {
845 if (!it2->realized) 847 if (!it2->realized)
@@ -852,7 +854,7 @@ _item_tree_effect_before(Elm_Gen_Item *it)
852 } 854 }
853 else if (sd->move_effect_mode == 855 else if (sd->move_effect_mode ==
854 ELM_GENLIST_TREE_EFFECT_CONTRACT) 856 ELM_GENLIST_TREE_EFFECT_CONTRACT)
855 _item_contract_emit(it2); 857 _item_contract_emit(eo_it2);
856 } 858 }
857 } 859 }
858 return ECORE_CALLBACK_CANCEL; 860 return ECORE_CALLBACK_CANCEL;
@@ -940,26 +942,27 @@ static void
940_item_sub_items_clear(Elm_Gen_Item *it) 942_item_sub_items_clear(Elm_Gen_Item *it)
941{ 943{
942 Eina_List *tl = NULL, *l; 944 Eina_List *tl = NULL, *l;
943 Elm_Gen_Item *it2; 945 Elm_Object_Item *eo_it2;
944 946
945 ELM_GENLIST_ITEM_CHECK_OR_RETURN(it); 947 ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
946 948
947 EINA_LIST_FOREACH(it->item->items, l, it2) 949 EINA_LIST_FOREACH(it->item->items, l, eo_it2)
948 tl = eina_list_append(tl, it2); 950 tl = eina_list_append(tl, eo_it2);
949 EINA_LIST_FREE(tl, it2) 951 EINA_LIST_FREE(tl, eo_it2)
950 eo_do(EO_OBJ(it2), elm_wdg_item_del()); 952 eo_do(eo_it2, elm_wdg_item_del());
951} 953}
952 954
953static void 955static void
954_item_auto_scroll(Elm_Genlist_Data *sd) 956_item_auto_scroll(Elm_Genlist_Data *sd)
955{ 957{
956 Elm_Gen_Item *tmp_item = NULL; 958 Elm_Object_Item *eo_tmp_item = NULL;
957 959
958 if ((sd->expanded_item) && (sd->auto_scroll_enabled)) 960 if ((sd->expanded_item) && (sd->auto_scroll_enabled))
959 { 961 {
960 tmp_item = eina_list_data_get 962 eo_tmp_item = eina_list_data_get
961 (eina_list_last(sd->expanded_item->item->items)); 963 (eina_list_last(sd->expanded_item->item->items));
962 if (!tmp_item) return; 964 if (!eo_tmp_item) return;
965 ELM_GENLIST_ITEM_DATA_GET(eo_tmp_item, tmp_item);
963 sd->show_item = tmp_item; 966 sd->show_item = tmp_item;
964 sd->bring_in = EINA_TRUE; 967 sd->bring_in = EINA_TRUE;
965 sd->scroll_to_type = ELM_GENLIST_ITEM_SCROLLTO_IN; 968 sd->scroll_to_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
@@ -976,7 +979,7 @@ _item_auto_scroll(Elm_Genlist_Data *sd)
976static void 979static void
977_item_tree_effect_finish(Elm_Genlist_Data *sd) 980_item_tree_effect_finish(Elm_Genlist_Data *sd)
978{ 981{
979 Elm_Gen_Item *it = NULL; 982 Elm_Object_Item *eo_it = NULL;
980 const Eina_List *l; 983 const Eina_List *l;
981 984
982 if (sd->tree_effect_animator) 985 if (sd->tree_effect_animator)
@@ -984,8 +987,9 @@ _item_tree_effect_finish(Elm_Genlist_Data *sd)
984 if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) 987 if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT)
985 _item_sub_items_clear(sd->expanded_item); 988 _item_sub_items_clear(sd->expanded_item);
986 989
987 EINA_LIST_FOREACH(sd->expanded_item->item->items, l, it) 990 EINA_LIST_FOREACH(sd->expanded_item->item->items, l, eo_it)
988 { 991 {
992 ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
989 it->item->tree_effect_finished = EINA_TRUE; 993 it->item->tree_effect_finished = EINA_TRUE;
990 it->item->old_scrl_y = it->item->scrl_y; 994 it->item->old_scrl_y = it->item->scrl_y;
991 if (GL_IT(it)->wsd->move_effect_mode == 995 if (GL_IT(it)->wsd->move_effect_mode ==
@@ -1087,7 +1091,7 @@ _elm_genlist_item_position_state_update(Elm_Gen_Item *it)
1087 if (it->deco_all_view) 1091 if (it->deco_all_view)
1088 edje_object_signal_emit(it->deco_all_view, "elm,state,group,first", "elm"); 1092 edje_object_signal_emit(it->deco_all_view, "elm,state,group,first", "elm");
1089 } 1093 }
1090 else if (it == eina_list_data_get(eina_list_last(it->parent->item->items))) 1094 else if (EO_OBJ(it) == eina_list_data_get(eina_list_last(it->parent->item->items)))
1091 { 1095 {
1092 edje_object_signal_emit(VIEW(it), "elm,state,group,last", "elm"); 1096 edje_object_signal_emit(VIEW(it), "elm,state,group,last", "elm");
1093 if (it->deco_all_view) 1097 if (it->deco_all_view)
@@ -3267,7 +3271,7 @@ _item_block_del(Elm_Gen_Item *it)
3267 itbn = (Item_Block *)(il->next); 3271 itbn = (Item_Block *)(il->next);
3268 if (it->parent) 3272 if (it->parent)
3269 it->parent->item->items = 3273 it->parent->item->items =
3270 eina_list_remove(it->parent->item->items, it); 3274 eina_list_remove(it->parent->item->items, EO_OBJ(it));
3271 else 3275 else
3272 { 3276 {
3273 _item_block_position_update(il->next, itb->position); 3277 _item_block_position_update(il->next, itb->position);
@@ -3457,7 +3461,7 @@ _item_del(Elm_Gen_Item *it)
3457 if (sd->expanded_next_item == it) sd->expanded_next_item = NULL; 3461 if (sd->expanded_next_item == it) sd->expanded_next_item = NULL;
3458 if (sd->move_items) sd->move_items = eina_list_remove(sd->move_items, it); 3462 if (sd->move_items) sd->move_items = eina_list_remove(sd->move_items, it);
3459 if (it->parent) 3463 if (it->parent)
3460 it->parent->item->items = eina_list_remove(it->parent->item->items, it); 3464 it->parent->item->items = eina_list_remove(it->parent->item->items, EO_OBJ(it));
3461 ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del); 3465 ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del);
3462 _elm_genlist_item_del_serious(it); 3466 _elm_genlist_item_del_serious(it);
3463 elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc); 3467 elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc);
@@ -5720,7 +5724,7 @@ _elm_genlist_item_elm_widget_item_del_pre(Eo *eo_it, Elm_Gen_Item *it)
5720 if (it->parent) 5724 if (it->parent)
5721 { 5725 {
5722 it->parent->item->items = 5726 it->parent->item->items =
5723 eina_list_remove(it->parent->item->items, it); 5727 eina_list_remove(it->parent->item->items, eo_it);
5724 it->parent = NULL; 5728 it->parent = NULL;
5725 } 5729 }
5726 return EINA_FALSE; 5730 return EINA_FALSE;
@@ -5860,6 +5864,17 @@ _elm_genlist_item_list_compare(const void *data,
5860 return GL_IT(it)->wsd->item_compare_cb(EO_OBJ(it), EO_OBJ(item1)); 5864 return GL_IT(it)->wsd->item_compare_cb(EO_OBJ(it), EO_OBJ(item1));
5861} 5865}
5862 5866
5867static int
5868_elm_genlist_eo_item_list_compare(const void *data,
5869 const void *data1)
5870{
5871 const Elm_Object_Item *eo_it = data;
5872 const Elm_Object_Item *eo_item1 = data1;
5873 ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
5874
5875 return GL_IT(it)->wsd->item_compare_cb(eo_it, eo_item1);
5876}
5877
5863EOLIAN static unsigned int 5878EOLIAN static unsigned int
5864_elm_genlist_items_count(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd) 5879_elm_genlist_items_count(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
5865{ 5880{
@@ -5870,12 +5885,13 @@ static Eina_List *
5870_list_last_recursive(Eina_List *list) 5885_list_last_recursive(Eina_List *list)
5871{ 5886{
5872 Eina_List *ll, *ll2; 5887 Eina_List *ll, *ll2;
5873 Elm_Gen_Item *it2; 5888 Elm_Object_Item *eo_it2;
5874 5889
5875 ll = eina_list_last(list); 5890 ll = eina_list_last(list);
5876 if (!ll) return NULL; 5891 if (!ll) return NULL;
5877 5892
5878 it2 = ll->data; 5893 eo_it2 = ll->data;
5894 ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
5879 5895
5880 if (it2->item->items) 5896 if (it2->item->items)
5881 { 5897 {
@@ -5907,13 +5923,14 @@ _elm_genlist_item_append(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_Ge
5907 } 5923 }
5908 else 5924 else
5909 { 5925 {
5910 Elm_Gen_Item *it2 = NULL; 5926 Elm_Object_Item *eo_it2 = NULL;
5911 Eina_List *ll = _list_last_recursive(it->parent->item->items); 5927 Eina_List *ll = _list_last_recursive(it->parent->item->items);
5912 5928
5913 if (ll) it2 = ll->data; 5929 if (ll) eo_it2 = ll->data;
5914 it->parent->item->items = 5930 it->parent->item->items =
5915 eina_list_append(it->parent->item->items, it); 5931 eina_list_append(it->parent->item->items, EO_OBJ(it));
5916 if (!it2) it2 = it->parent; 5932 if (!eo_it2) eo_it2 = EO_OBJ(it->parent);
5933 ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
5917 sd->items = eina_inlist_append_relative 5934 sd->items = eina_inlist_append_relative
5918 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(it2)); 5935 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(it2));
5919 it->item->rel = it2; 5936 it->item->rel = it2;
@@ -5943,13 +5960,14 @@ _elm_genlist_item_prepend(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_G
5943 } 5960 }
5944 else 5961 else
5945 { 5962 {
5946 Elm_Gen_Item *it2 = NULL; 5963 Elm_Object_Item *eo_it2 = NULL;
5947 Eina_List *ll = it->parent->item->items; 5964 Eina_List *ll = it->parent->item->items;
5948 5965
5949 if (ll) it2 = ll->data; 5966 if (ll) eo_it2 = ll->data;
5950 it->parent->item->items = 5967 it->parent->item->items =
5951 eina_list_prepend(it->parent->item->items, it); 5968 eina_list_prepend(it->parent->item->items, EO_OBJ(it));
5952 if (!it2) it2 = it->parent; 5969 if (!eo_it2) eo_it2 = EO_OBJ(it->parent);
5970 ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
5953 sd->items = eina_inlist_prepend_relative 5971 sd->items = eina_inlist_prepend_relative
5954 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(it2)); 5972 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(it2));
5955 it->item->rel = it2; 5973 it->item->rel = it2;
@@ -5986,7 +6004,7 @@ _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
5986 else 6004 else
5987 { 6005 {
5988 it->parent->item->items = 6006 it->parent->item->items =
5989 eina_list_append_relative(it->parent->item->items, it, after); 6007 eina_list_append_relative(it->parent->item->items, EO_OBJ(it), eo_after);
5990 } 6008 }
5991 sd->items = eina_inlist_append_relative 6009 sd->items = eina_inlist_append_relative
5992 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after)); 6010 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
@@ -6024,7 +6042,7 @@ _elm_genlist_item_insert_before(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6024 else 6042 else
6025 { 6043 {
6026 it->parent->item->items = 6044 it->parent->item->items =
6027 eina_list_prepend_relative(it->parent->item->items, it, before); 6045 eina_list_prepend_relative(it->parent->item->items, EO_OBJ(it), eo_before);
6028 } 6046 }
6029 sd->items = eina_inlist_prepend_relative 6047 sd->items = eina_inlist_prepend_relative
6030 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before)); 6048 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
@@ -6045,6 +6063,7 @@ _elm_genlist_item_sorted_insert(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6045 it = _elm_genlist_item_new 6063 it = _elm_genlist_item_new
6046 (sd, itc, data, parent, type, func, func_data); 6064 (sd, itc, data, parent, type, func, func_data);
6047 if (!it) return NULL; 6065 if (!it) return NULL;
6066 Elm_Object_Item *eo_it = EO_OBJ(it);
6048 6067
6049 sd->item_compare_cb = comp; 6068 sd->item_compare_cb = comp;
6050 6069
@@ -6054,7 +6073,7 @@ _elm_genlist_item_sorted_insert(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6054 int cmp_result; 6073 int cmp_result;
6055 6074
6056 l = eina_list_search_sorted_near_list 6075 l = eina_list_search_sorted_near_list
6057 (it->parent->item->items, _elm_genlist_item_list_compare, it, 6076 (it->parent->item->items, _elm_genlist_eo_item_list_compare, eo_it,
6058 &cmp_result); 6077 &cmp_result);
6059 6078
6060 if (l) 6079 if (l)
@@ -6064,7 +6083,7 @@ _elm_genlist_item_sorted_insert(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6064 if (cmp_result >= 0) 6083 if (cmp_result >= 0)
6065 { 6084 {
6066 it->parent->item->items = eina_list_prepend_relative_list 6085 it->parent->item->items = eina_list_prepend_relative_list
6067 (it->parent->item->items, it, l); 6086 (it->parent->item->items, eo_it, l);
6068 sd->items = eina_inlist_prepend_relative 6087 sd->items = eina_inlist_prepend_relative
6069 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel)); 6088 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
6070 it->item->before = EINA_TRUE; 6089 it->item->before = EINA_TRUE;
@@ -6072,7 +6091,7 @@ _elm_genlist_item_sorted_insert(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6072 else if (cmp_result < 0) 6091 else if (cmp_result < 0)
6073 { 6092 {
6074 it->parent->item->items = eina_list_append_relative_list 6093 it->parent->item->items = eina_list_append_relative_list
6075 (it->parent->item->items, it, l); 6094 (it->parent->item->items, eo_it, l);
6076 sd->items = eina_inlist_append_relative 6095 sd->items = eina_inlist_append_relative
6077 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel)); 6096 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
6078 it->item->before = EINA_FALSE; 6097 it->item->before = EINA_FALSE;
@@ -6084,7 +6103,7 @@ _elm_genlist_item_sorted_insert(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6084 6103
6085 // ignoring the comparison 6104 // ignoring the comparison
6086 it->parent->item->items = eina_list_prepend_relative_list 6105 it->parent->item->items = eina_list_prepend_relative_list
6087 (it->parent->item->items, it, l); 6106 (it->parent->item->items, eo_it, l);
6088 sd->items = eina_inlist_prepend_relative 6107 sd->items = eina_inlist_prepend_relative
6089 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel)); 6108 (sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
6090 it->item->before = EINA_FALSE; 6109 it->item->before = EINA_FALSE;
@@ -6126,7 +6145,7 @@ _elm_genlist_item_sorted_insert(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6126 6145
6127 _item_queue(sd, it, _elm_genlist_item_list_compare); 6146 _item_queue(sd, it, _elm_genlist_item_list_compare);
6128 6147
6129 return EO_OBJ(it); 6148 return eo_it;
6130} 6149}
6131 6150
6132EOLIAN static void 6151EOLIAN static void