summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2013-11-15 21:48:46 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2013-11-15 21:50:40 +0900
commitc727459c108c744571cb4ccf2efcf627784bbe14 (patch)
treea52bea5a856573358052265ead9ef0c71a0df564 /src
parent075048c2300b69e111dafa63cbbd6f40f114ad83 (diff)
elm_index.c: internal refactoring as a code cleanup.
- removed unnecessary duplicated parameter passing. - moved smart callback add to a proper place not to be confused with other object's smart callback addition. - removed unnecessary sub object add. it's done automatically in elm_layout_content_set.
Diffstat (limited to 'src')
-rw-r--r--src/lib/elm_index.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c
index 3a4a5c84d..7dd904106 100644
--- a/src/lib/elm_index.c
+++ b/src/lib/elm_index.c
@@ -871,19 +871,19 @@ _on_mouse_out_access(void *data,
871} 871}
872 872
873static void 873static void
874_index_resize_cb(void *data, 874_index_resize_cb(void *data __UNUSED__,
875 Evas *e __UNUSED__, 875 Evas *e __UNUSED__,
876 Evas_Object *obj __UNUSED__, 876 Evas_Object *obj,
877 void *event_info __UNUSED__) 877 void *event_info __UNUSED__)
878{ 878{
879 ELM_INDEX_DATA_GET_OR_RETURN(data, sd); 879 ELM_INDEX_DATA_GET_OR_RETURN(obj, sd);
880 880
881 if (!sd->omit_enabled) return; 881 if (!sd->omit_enabled) return;
882 882
883 Elm_Index_Item *it; 883 Elm_Index_Item *it;
884 884
885 _index_box_clear(data, 0); 885 _index_box_clear(obj, 0);
886 _index_box_auto_fill(data, 0); 886 _index_box_auto_fill(obj, 0);
887 887
888 it = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level); 888 it = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level);
889 if (it) 889 if (it)
@@ -899,7 +899,7 @@ static void
899_elm_index_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 899_elm_index_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
900{ 900{
901 Evas_Object *o; 901 Evas_Object *o;
902 Evas_Coord minw, minh; 902 Evas_Coord minw = 0, minh = 0;
903 903
904 Elm_Index_Smart_Data *priv = _pd; 904 Elm_Index_Smart_Data *priv = _pd;
905 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 905 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
@@ -911,18 +911,16 @@ _elm_index_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
911 (obj, "index", "base/vertical", elm_widget_style_get(obj))) 911 (obj, "index", "base/vertical", elm_widget_style_get(obj)))
912 CRITICAL("Failed to set layout!"); 912 CRITICAL("Failed to set layout!");
913 913
914 o = evas_object_rectangle_add(evas_object_evas_get(obj)); 914 evas_object_event_callback_add
915 priv->event[0] = o; 915 (obj, EVAS_CALLBACK_RESIZE, _index_resize_cb, NULL);
916
917 priv->event[0] = o = evas_object_rectangle_add(evas_object_evas_get(obj));
916 evas_object_color_set(o, 0, 0, 0, 0); 918 evas_object_color_set(o, 0, 0, 0, 0);
917 minw = minh = 0;
918 elm_coords_finger_size_adjust(1, &minw, 1, &minh); 919 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
919 evas_object_size_hint_min_set(o, minw, minh); 920 evas_object_size_hint_min_set(o, minw, minh);
920 elm_layout_content_set(obj, "elm.swallow.event.0", o); 921 elm_layout_content_set(obj, "elm.swallow.event.0", o);
921 elm_widget_sub_object_add(obj, o);
922 922
923 evas_object_event_callback_add 923 evas_object_event_callback_add
924 (obj, EVAS_CALLBACK_RESIZE, _index_resize_cb, obj);
925 evas_object_event_callback_add
926 (o, EVAS_CALLBACK_MOUSE_WHEEL, _on_mouse_wheel, obj); 924 (o, EVAS_CALLBACK_MOUSE_WHEEL, _on_mouse_wheel, obj);
927 evas_object_event_callback_add 925 evas_object_event_callback_add
928 (o, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, obj); 926 (o, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, obj);
@@ -950,12 +948,10 @@ _elm_index_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
950 evas_object_color_set(o, 0, 0, 0, 0); 948 evas_object_color_set(o, 0, 0, 0, 0);
951 evas_object_size_hint_min_set(o, minw, minh); 949 evas_object_size_hint_min_set(o, minw, minh);
952 elm_layout_content_set(obj, "elm.swallow.event.1", o); 950 elm_layout_content_set(obj, "elm.swallow.event.1", o);
953 elm_widget_sub_object_add(obj, o);
954 } 951 }
955 952
956 priv->bx[0] = evas_object_box_add(evas_object_evas_get(obj)); 953 priv->bx[0] = evas_object_box_add(evas_object_evas_get(obj));
957 evas_object_box_layout_set(priv->bx[0], _box_custom_layout, priv, NULL); 954 evas_object_box_layout_set(priv->bx[0], _box_custom_layout, priv, NULL);
958 elm_widget_sub_object_add(obj, priv->bx[0]);
959 elm_layout_content_set(obj, "elm.swallow.index.0", priv->bx[0]); 955 elm_layout_content_set(obj, "elm.swallow.index.0", priv->bx[0]);
960 evas_object_show(priv->bx[0]); 956 evas_object_show(priv->bx[0]);
961 957