From: Gustavo Sverzut Barbieri Date: Wed, 25 Feb 2009 15:54:26 +0000 (+0000) Subject: major warning + cast cleanup. X-Git-Tag: v1.0.0~5452 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49101306eabd5cd60dfdb1ca73bf1231b9599bbf;p=platform%2Fupstream%2Felementary.git major warning + cast cleanup. * casts: remove internal "Item" and use "Elm_XXXX_Item" for carousel, list, genlist and toolbar. * warning: fix const on lots of getter apis, the object should be const, and not the return! Of course lists that are returned and are not supposed to be modified are still returned as const, but maybe we should return iterators! * list/genlist: fix selected_set() to be a bit (marginally) faster. Do not operate if state has not changed and if it did changed we're sure we're not in the object->selected list. SVN revision: 39208 --- diff --git a/src/bin/run.c b/src/bin/run.c index d3aaf3b..2862447 100644 --- a/src/bin/run.c +++ b/src/bin/run.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index cc2cf81..03e19db 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -161,7 +161,7 @@ extern "C" { EAPI char *elm_quicklaunch_exe_path_get(const char *exe); EAPI void elm_object_scale_set(Evas_Object *obj, double scale); - EAPI double elm_object_scale_get(Evas_Object *obj); + EAPI double elm_object_scale_get(const Evas_Object *obj); EAPI void elm_object_focus(Evas_Object *obj); EAPI void elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h); @@ -194,7 +194,7 @@ extern "C" { */ /* X specific calls - won't work on non-x engines (return 0) */ - EAPI Ecore_X_Window elm_win_xwindow_get(Evas_Object *obj); + EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj); /* smart callbacks called: * "delete-request" - the user requested to delete the window */ @@ -255,7 +255,7 @@ extern "C" { EAPI void elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon); EAPI void elm_toggle_states_labels_set(Evas_Object *obj, const char *onlabel, const char *offlabel); EAPI void elm_toggle_state_set(Evas_Object *obj, Evas_Bool state); - EAPI Evas_Bool elm_toggle_state_get(Evas_Object *obj); + EAPI Evas_Bool elm_toggle_state_get(const Evas_Object *obj); EAPI void elm_toggle_state_pointer_set(Evas_Object *obj, Evas_Bool *statep); /* smart callbacks called: * "changed" - the user toggled the state @@ -285,7 +285,7 @@ extern "C" { EAPI Evas_Object *elm_clock_add(Evas_Object *parent); EAPI void elm_clock_time_set(Evas_Object *obj, int hrs, int min, int sec); - EAPI void elm_clock_time_get(Evas_Object *obj, int *hrs, int *min, int *sec); + EAPI void elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec); EAPI void elm_clock_edit_set(Evas_Object *obj, Evas_Bool edit); EAPI void elm_clock_show_am_pm_set(Evas_Object *obj, Evas_Bool am_pm); EAPI void elm_clock_show_seconds_set(Evas_Object *obj, Evas_Bool seconds); @@ -296,7 +296,7 @@ extern "C" { EAPI Evas_Object *elm_layout_add(Evas_Object *parent); EAPI void elm_layout_file_set(Evas_Object *obj, const char *file, const char *group); EAPI void elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content); - EAPI Evas_Object *elm_layout_edje_get(Evas_Object *obj); + EAPI Evas_Object *elm_layout_edje_get(const Evas_Object *obj); /* smart callbacks called: */ @@ -317,7 +317,7 @@ extern "C" { * popout * hoversel_vertical */ - EAPI const char *elm_hover_best_content_location_get(Evas_Object *obj, Elm_Hover_Axis pref_axis); + EAPI const char *elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis); /* smart callbacks called: * "clicked" - the user clicked the empty space in the hover to dismiss */ @@ -333,8 +333,8 @@ extern "C" { EAPI void elm_entry_single_line_set(Evas_Object *obj, Evas_Bool single_line); EAPI void elm_entry_password_set(Evas_Object *obj, Evas_Bool password); EAPI void elm_entry_entry_set(Evas_Object *obj, const char *entry); - EAPI const char *elm_entry_entry_get(Evas_Object *obj); - EAPI const char *elm_entry_selection_get(Evas_Object *obj); + EAPI const char *elm_entry_entry_get(const Evas_Object *obj); + EAPI const char *elm_entry_selection_get(const Evas_Object *obj); EAPI void elm_entry_entry_insert(Evas_Object *obj, const char *entry); EAPI void elm_entry_line_wrap_set(Evas_Object *obj, Evas_Bool wrap); EAPI void elm_entry_editable_set(Evas_Object *obj, Evas_Bool editable); @@ -476,15 +476,15 @@ extern "C" { EAPI void elm_list_go(Evas_Object *obj); EAPI void elm_list_multi_select_set(Evas_Object *obj, Evas_Bool multi); EAPI void elm_list_horizontal_mode_set(Evas_Object *obj, Elementary_List_Mode mode); - EAPI const Eina_List *elm_list_items_get(Evas_Object *obj); - EAPI const Elm_List_Item *elm_list_selected_item_get(Evas_Object *obj); - EAPI const Eina_List *elm_list_selected_items_get(Evas_Object *obj); + EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj); + EAPI Elm_List_Item *elm_list_selected_item_get(const Evas_Object *obj); + EAPI const Eina_List *elm_list_selected_items_get(const Evas_Object *obj); EAPI void elm_list_item_selected_set(Elm_List_Item *item, Evas_Bool selected); EAPI void elm_list_item_show(Elm_List_Item *item); EAPI void elm_list_item_del(Elm_List_Item *item); - EAPI const void *elm_list_item_data_get(Elm_List_Item *item); - EAPI Evas_Object *elm_list_item_icon_get(Elm_List_Item *item); - EAPI Evas_Object *elm_list_item_end_get(Elm_List_Item *item); + EAPI const void *elm_list_item_data_get(const Elm_List_Item *item); + EAPI Evas_Object *elm_list_item_icon_get(const Elm_List_Item *item); + EAPI Evas_Object *elm_list_item_end_get(const Elm_List_Item *item); /* smart callbacks called: * "clicked" - when the user double-clicked an item * "selected" - when the user selected an item @@ -510,7 +510,7 @@ extern "C" { EAPI void elm_slider_horizontal_set(Evas_Object *obj, Evas_Bool horizontal); EAPI void elm_slider_min_max_set(Evas_Object *obj, double min, double max); EAPI void elm_slider_value_set(Evas_Object *obj, double val); - EAPI double elm_slider_value_get(Evas_Object *obj); + EAPI double elm_slider_value_get(const Evas_Object *obj); EAPI void elm_slider_inverted_set(Evas_Object *obj, Evas_Bool inverted); /* smart callbacks called: * "changed" - when the slider value changes @@ -541,19 +541,19 @@ extern "C" { EAPI Elm_Genlist_Item *elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *before, Elm_Genlist_Item_Flags flags, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data); EAPI Elm_Genlist_Item *elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *after, Elm_Genlist_Item_Flags flags, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data); EAPI void elm_genlist_clear(Evas_Object *obj); - EAPI const Elm_Genlist_Item *elm_genlist_selected_item_get(Evas_Object *obj); - EAPI const Eina_List *elm_genlist_selected_items_get(Evas_Object *obj); - EAPI const Elm_Genlist_Item *elm_genlist_first_item_get(Evas_Object *obj); - EAPI const Elm_Genlist_Item *elm_genlist_last_item_get(Evas_Object *obj); - EAPI const Elm_Genlist_Item *elm_genlist_item_next_get(Elm_Genlist_Item *item); - EAPI const Elm_Genlist_Item *elm_genlist_item_prev_get(Elm_Genlist_Item *item); + EAPI Elm_Genlist_Item *elm_genlist_selected_item_get(const Evas_Object *obj); + EAPI const Eina_List *elm_genlist_selected_items_get(const Evas_Object *obj); + EAPI Elm_Genlist_Item *elm_genlist_first_item_get(const Evas_Object *obj); + EAPI Elm_Genlist_Item *elm_genlist_last_item_get(const Evas_Object *obj); + EAPI Elm_Genlist_Item *elm_genlist_item_next_get(const Elm_Genlist_Item *item); + EAPI Elm_Genlist_Item *elm_genlist_item_prev_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_selected_set(Elm_Genlist_Item *item, Evas_Bool selected); - EAPI Evas_Bool elm_genlist_item_selected_get(Elm_Genlist_Item *item); + EAPI Evas_Bool elm_genlist_item_selected_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_disabled_set(Elm_Genlist_Item *item, Evas_Bool disabled); - EAPI Evas_Bool elm_genlist_item_disabled_get(Elm_Genlist_Item *item); + EAPI Evas_Bool elm_genlist_item_disabled_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_show(Elm_Genlist_Item *item); EAPI void elm_genlist_item_del(Elm_Genlist_Item *item); - EAPI const void *elm_genlist_item_data_get(Elm_Genlist_Item *item); + EAPI const void *elm_genlist_item_data_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_update(Elm_Genlist_Item *item); /* smart callbacks called: * "clicked" - the user clicked the hoversel button and popped up the sel @@ -565,7 +565,7 @@ extern "C" { EAPI void elm_check_label_set(Evas_Object *obj, const char *label); EAPI void elm_check_icon_set(Evas_Object *obj, Evas_Object *icon); EAPI void elm_check_state_set(Evas_Object *obj, Evas_Bool state); - EAPI Evas_Bool elm_check_state_get(Evas_Object *obj); + EAPI Evas_Bool elm_check_state_get(const Evas_Object *obj); EAPI void elm_check_state_pointer_set(Evas_Object *obj, Evas_Bool *statep); /* smart callbacks called: * "changed" - the user toggled the state @@ -577,7 +577,7 @@ extern "C" { EAPI void elm_radio_group_add(Evas_Object *obj, Evas_Object *group); EAPI void elm_radio_state_value_set(Evas_Object *obj, int value); EAPI void elm_radio_value_set(Evas_Object *obj, int value); - EAPI int elm_radio_value_get(Evas_Object *obj); + EAPI int elm_radio_value_get(const Evas_Object *obj); EAPI void elm_radio_value_pointer_set(Evas_Object *obj, int *valuep); /* smart callbacks called: * "changed" - the user toggled the state diff --git a/src/lib/elm_carousel.c b/src/lib/elm_carousel.c index 039a841..cc41eb6 100644 --- a/src/lib/elm_carousel.c +++ b/src/lib/elm_carousel.c @@ -4,7 +4,6 @@ // FIXME: this is NOT the carousel - yet! typedef struct _Widget_Data Widget_Data; -typedef struct _Item Item; struct _Widget_Data { @@ -13,7 +12,7 @@ struct _Widget_Data int icon_size; }; -struct _Item +struct _Elm_Carousel_Item { Evas_Object *obj; Evas_Object *base; @@ -29,7 +28,7 @@ static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void -_item_show(Item *it) +_item_show(Elm_Carousel_Item *it) { Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Coord x, y, w, h, bx, by; @@ -40,9 +39,9 @@ _item_show(Item *it) } static void -_item_select(Item *it) +_item_select(Elm_Carousel_Item *it) { - Item *it2; + Elm_Carousel_Item *it2; Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Object *obj2; Eina_List *l; @@ -77,7 +76,7 @@ _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); Eina_List *l; - Item *it; + Elm_Carousel_Item *it; Evas_Coord mw, mh; for (l = wd->items; l; l = l->next) { @@ -125,7 +124,7 @@ _resize(void *data, Evas *e, Evas_Object *obj, void *event_info) Widget_Data *wd = elm_widget_data_get(data); Evas_Coord mw, mh, vw, vh, w, h; Eina_List *l; - Item *it; + Elm_Carousel_Item *it; elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); evas_object_size_hint_min_get(wd->bx, &mw, &mh); @@ -195,7 +194,7 @@ elm_carousel_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, vo { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord mw, mh; - Item *it = calloc(1, sizeof(Item)); + Elm_Carousel_Item *it = calloc(1, sizeof(Elm_Carousel_Item)); if (!it) return NULL; wd->items = eina_list_append(wd->items, it); it->obj = obj; @@ -226,13 +225,12 @@ elm_carousel_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, vo _els_smart_box_pack_end(wd->bx, it->base); evas_object_show(it->base); _sizing_eval(obj); - return (Elm_Carousel_Item *)it; + return it; } EAPI void -elm_carousel_item_del(Elm_Carousel_Item *item) +elm_carousel_item_del(Elm_Carousel_Item *it) { - Item *it = (Item *)item; Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Object *obj2 = it->obj; wd->items = eina_list_remove(wd->items, it); diff --git a/src/lib/elm_check.c b/src/lib/elm_check.c index b747c6e..c2421f5 100644 --- a/src/lib/elm_check.c +++ b/src/lib/elm_check.c @@ -208,7 +208,7 @@ elm_check_state_set(Evas_Object *obj, Evas_Bool state) } EAPI Evas_Bool -elm_check_state_get(Evas_Object *obj) +elm_check_state_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->state; diff --git a/src/lib/elm_clock.c b/src/lib/elm_clock.c index e8a1a51..4051829 100644 --- a/src/lib/elm_clock.c +++ b/src/lib/elm_clock.c @@ -396,7 +396,7 @@ elm_clock_time_set(Evas_Object *obj, int hrs, int min, int sec) } EAPI void -elm_clock_time_get(Evas_Object *obj, int *hrs, int *min, int *sec) +elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec) { Widget_Data *wd = elm_widget_data_get(obj); if (hrs) *hrs = wd->hrs; diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 2df8818..58801f5 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -55,12 +55,11 @@ static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - char *t; - t = (char *)elm_entry_entry_get(obj); - if (t) t = strdup(t); + const char *t; + t = eina_stringshare_ref(elm_entry_entry_get(obj)); _elm_theme_set(wd->ent, "entry", _getbase(obj), "default"); elm_entry_entry_set(obj, t); - if (t) free(t); + eina_stringshare_del(t); edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } @@ -503,7 +502,7 @@ _signal_anchor_up(void *data, Evas_Object *obj, const char *emission, const char p = strrchr(emission, ','); if (p) { - Eina_List *geoms; + const Eina_List *geoms; n = p + 1; p2 = p -1; @@ -523,7 +522,7 @@ _signal_anchor_up(void *data, Evas_Object *obj, const char *emission, const char if (geoms) { Evas_Textblock_Rectangle *r; - Eina_List *l; + const Eina_List *l; Evas_Coord px, py, x, y; evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL); @@ -676,15 +675,15 @@ EAPI void elm_entry_single_line_set(Evas_Object *obj, Evas_Bool single_line) { Widget_Data *wd = elm_widget_data_get(obj); - char *t; + const char *t; if (wd->single_line == single_line) return; wd->single_line = single_line; wd->linewrap = 0; - t = elm_entry_entry_get(obj); - if (t) t = strdup(t); + t = eina_stringshare_ref(elm_entry_entry_get(obj)); + eina_stringshare_del(t); _elm_theme_set(wd->ent, "entry", _getbase(obj), "default"); elm_entry_entry_set(obj, t); - if (t) free(t); + eina_stringshare_del(t); _sizing_eval(obj); } @@ -692,16 +691,15 @@ EAPI void elm_entry_password_set(Evas_Object *obj, Evas_Bool password) { Widget_Data *wd = elm_widget_data_get(obj); - char *t; + const char *t; if (wd->password == password) return; wd->password = password; wd->single_line = 1; wd->linewrap = 0; - t = elm_entry_entry_get(obj); - if (t) t = strdup(t); + t = eina_stringshare_ref(elm_entry_entry_get(obj)); _elm_theme_set(wd->ent, "entry", _getbase(obj), "default"); elm_entry_entry_set(obj, t); - if (t) free(t); + eina_stringshare_del(t); _sizing_eval(obj); } @@ -725,14 +723,14 @@ elm_entry_entry_set(Evas_Object *obj, const char *entry) } EAPI const char * -elm_entry_entry_get(Evas_Object *obj) +elm_entry_entry_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return edje_object_part_text_get(wd->ent, "elm.text"); } EAPI const char * -elm_entry_selection_get(Evas_Object *obj) +elm_entry_selection_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return edje_object_part_text_selection_get(wd->ent, "elm.text"); @@ -751,14 +749,13 @@ EAPI void elm_entry_line_wrap_set(Evas_Object *obj, Evas_Bool wrap) { Widget_Data *wd = elm_widget_data_get(obj); - char *t; + const char *t; if (wd->linewrap == wrap) return; wd->linewrap = wrap; - t = elm_entry_entry_get(obj); - if (t) t = strdup(t); + t = eina_stringshare_ref(elm_entry_entry_get(obj)); _elm_theme_set(wd->ent, "entry", _getbase(obj), "default"); elm_entry_entry_set(obj, t); - if (t) free(t); + eina_stringshare_del(t); _sizing_eval(obj); } @@ -766,14 +763,13 @@ EAPI void elm_entry_editable_set(Evas_Object *obj, Evas_Bool editable) { Widget_Data *wd = elm_widget_data_get(obj); - char *t; + const char *t; if (wd->editable == editable) return; wd->editable = editable; - t = elm_entry_entry_get(obj); - if (t) t = strdup(t); + t = eina_stringshare_ref(elm_entry_entry_get(obj)); _elm_theme_set(wd->ent, "entry", _getbase(obj), "default"); elm_entry_entry_set(obj, t); - if (t) free(t); + eina_stringshare_del(t); _sizing_eval(obj); } diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 436d9a1..d26c712 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -2,7 +2,6 @@ #include "elm_priv.h" typedef struct _Widget_Data Widget_Data; -typedef struct _Item Item; typedef struct _Item_Block Item_Block; typedef struct _Pan Pan; @@ -19,7 +18,7 @@ struct _Widget_Data Ecore_Idler *queue_idler; Eina_List *queue; Eina_List *selected; - Item *show_item; + Elm_Genlist_Item *show_item; Evas_Bool on_hold : 1; Evas_Bool multi : 1; Evas_Bool min_w : 1; @@ -37,7 +36,7 @@ struct _Item_Block Evas_Bool changed : 1; }; -struct _Item +struct _Elm_Genlist_Item { Eina_Inlist __header; Widget_Data *wd; @@ -58,7 +57,7 @@ struct _Item Eina_List *labels, *icons, *states; Eina_List *icon_objs; - Item *rel; + Elm_Genlist_Item *rel; int relcount; Evas_Bool before : 1; @@ -83,7 +82,7 @@ static void _show_region_hook(void *data, Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _sub_del(void *data, Evas_Object *obj, void *event_info); -static void _item_unrealize(Item *it); +static void _item_unrealize(Elm_Genlist_Item *it); static void _item_block_unrealize(Item_Block *itb); static void _calc_job(void *data); @@ -113,7 +112,7 @@ _theme_hook(Evas_Object *obj) if (itb->realized) _item_block_unrealize(itb); for (l = itb->items; l; l = l->next) { - Item *it = l->data; + Elm_Genlist_Item *it = l->data; it->mincalcd = 0; } itb->changed = 1; @@ -217,7 +216,7 @@ _stringlist_free(Eina_List *list) static void _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - Item *it = data; + Elm_Genlist_Item *it = data; Evas_Event_Mouse_Down *ev = event_info; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = 1; else it->wd->on_hold = 0; @@ -226,7 +225,7 @@ _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) } static void -_item_select(Item *it) +_item_select(Elm_Genlist_Item *it) { const char *selectraise; if (it->delete_me) return; @@ -242,7 +241,7 @@ _item_select(Item *it) } static void -_item_unselect(Item *it) +_item_unselect(Elm_Genlist_Item *it) { const char *stacking, *selectraise; if (it->delete_me) return; @@ -263,7 +262,7 @@ _item_unselect(Item *it) static void _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - Item *it = data; + Elm_Genlist_Item *it = data; Evas_Event_Mouse_Up *ev = event_info; Eina_List *l; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = 1; @@ -283,7 +282,7 @@ _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) { for (l = it->wd->selected; l;) { - Item *it2 = l->data; + Elm_Genlist_Item *it2 = l->data; l = l->next; if ((it2 != it) && (it2->selected)) _item_unselect(it2); } @@ -292,7 +291,7 @@ _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) } static void -_item_realize(Item *it, int in, int calc) +_item_realize(Elm_Genlist_Item *it, int in, int calc) { const char *stacking; char buf[1024]; @@ -391,7 +390,7 @@ _item_realize(Item *it, int in, int calc) } static void -_item_unrealize(Item *it) +_item_unrealize(Elm_Genlist_Item *it) { if (!it->realized) return; evas_object_del(it->base); @@ -420,7 +419,7 @@ _item_block_recalc(Item_Block *itb, int in) for (l = itb->items; l; l = l->next) { - Item *it = l->data; + Elm_Genlist_Item *it = l->data; if (it->delete_me) continue; showme |= it->showme; if (!itb->realized) @@ -452,7 +451,7 @@ _item_block_realize(Item_Block *itb, int in) if (itb->realized) return; for (l = itb->items; l; l = l->next) { - Item *it = l->data; + Elm_Genlist_Item *it = l->data; if (it->delete_me) continue; _item_realize(it, in, 0); in++; @@ -468,7 +467,7 @@ _item_block_unrealize(Item_Block *itb) if (!itb->realized) return; for (l = itb->items; l; l = l->next) { - Item *it = l->data; + Elm_Genlist_Item *it = l->data; _item_unrealize(it); } itb->realized = 0; @@ -483,7 +482,7 @@ _item_block_position(Item_Block *itb) evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, NULL, NULL); for (l = itb->items; l; l = l->next) { - Item *it = l->data; + Elm_Genlist_Item *it = l->data; if (it->delete_me) continue; it->x = 0; @@ -751,15 +750,15 @@ elm_genlist_add(Evas_Object *parent) return obj; } -static Item * +static Elm_Genlist_Item * _item_new(Widget_Data *wd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) { - Item *it; + Elm_Genlist_Item *it; - it = calloc(1, sizeof(Item)); + it = calloc(1, sizeof(Elm_Genlist_Item)); if (!it) return NULL; it->wd = wd; it->itc = itc; @@ -772,7 +771,7 @@ _item_new(Widget_Data *wd, const Elm_Genlist_Item_Class *itc, } static void -_item_block_del(Item *it) +_item_block_del(Elm_Genlist_Item *it) { Eina_Inlist *il; Item_Block *itb = it->block; @@ -799,7 +798,7 @@ _item_block_del(Item *it) { while (itb->items) { - Item *it2 = itb->items->data; + Elm_Genlist_Item *it2 = itb->items->data; it2->block = itbp; itbp->items = eina_list_append(itbp->items, it2); itb->items = eina_list_remove_list(itb->items, itb->items); @@ -814,7 +813,7 @@ _item_block_del(Item *it) while (itb->items) { Eina_List *last = eina_list_last(itb->items); - Item *it2 = last->data; + Elm_Genlist_Item *it2 = last->data; it2->block = itbn; itb->items = eina_list_remove_list(itb->items, last); itbn->items = eina_list_prepend(itbn->items, it2); @@ -829,7 +828,7 @@ _item_block_del(Item *it) } static void -_item_del(Item *it) +_item_del(Elm_Genlist_Item *it) { it->delete_me = 1; if (it->wd->show_item == it) it->wd->show_item = NULL; @@ -848,7 +847,7 @@ _item_del(Item *it) } static void -_item_block_add(Widget_Data *wd, Item *it, Item *itpar) +_item_block_add(Widget_Data *wd, Elm_Genlist_Item *it, Elm_Genlist_Item *itpar) { Item_Block *itb = NULL; @@ -968,7 +967,7 @@ _item_idler(void *data) for (n = 0; (wd->queue) && (n < 8); n++) { - Item *it; + Elm_Genlist_Item *it; it = wd->queue->data; wd->queue = eina_list_remove_list(wd->queue, wd->queue); @@ -996,7 +995,7 @@ _item_idler(void *data) } static void -_item_queue(Widget_Data *wd, Item *it) +_item_queue(Widget_Data *wd, Elm_Genlist_Item *it) { if (it->queued) return; if (!wd->queue_idler) wd->queue_idler = ecore_idler_add(_item_idler, wd); @@ -1011,7 +1010,7 @@ elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); if (!it) return NULL; if (!it->parent) wd->items = eina_inlist_append(wd->items, (Eina_Inlist *)it); @@ -1022,7 +1021,7 @@ elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, it->rel = NULL; it->before = 0; _item_queue(wd, it); - return (Elm_Genlist_Item *)it; + return it; } EAPI Elm_Genlist_Item * @@ -1032,7 +1031,7 @@ elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); if (!it) return NULL; if (!it->parent) wd->items = eina_inlist_prepend(wd->items, (Eina_Inlist *)it); @@ -1043,7 +1042,7 @@ elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, it->rel = NULL; it->before = 1; _item_queue(wd, it); - return (Elm_Genlist_Item *)it; + return it; } EAPI Elm_Genlist_Item * @@ -1053,7 +1052,7 @@ elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *i void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data); if (!it) return NULL; if (!it->parent) wd->items = eina_inlist_prepend_relative(wd->items, (Eina_Inlist *)it, (Eina_Inlist *)before); @@ -1061,11 +1060,11 @@ elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *i { // FIXME: tree. not done yet } - it->rel = (Item *)before; + it->rel = before; it->rel->relcount++; it->before = 1; _item_queue(wd, it); - return (Elm_Genlist_Item *)it; + return it; } EAPI Elm_Genlist_Item * @@ -1075,7 +1074,7 @@ elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *it void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data); + Elm_Genlist_Item *it = _item_new(wd, itc, data, NULL, flags, func, func_data); if (!it) return NULL; if (!it->parent) wd->items = eina_inlist_append_relative(wd->items, (Eina_Inlist *)it, (Eina_Inlist *)after); @@ -1083,11 +1082,11 @@ elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *it { // FIXME: tree. not done yet } - it->rel = (Item *)after; + it->rel = after; it->rel->relcount++; it->before = 0; _item_queue(wd, it); - return (Elm_Genlist_Item *)it; + return it; } EAPI void @@ -1096,7 +1095,7 @@ elm_genlist_clear(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); while (wd->items) { - Item *it = (Item *)(wd->items); + Elm_Genlist_Item *it = (Elm_Genlist_Item *)(wd->items); wd->items = eina_inlist_remove(wd->items, wd->items); if (it->realized) _item_unrealize(it); if (it->itc->func.del) it->itc->func.del(it->data, it->wd->obj); @@ -1144,8 +1143,8 @@ elm_genlist_multi_select_set(Evas_Object *obj, Evas_Bool multi) wd->multi = multi; } -EAPI const Elm_Genlist_Item * -elm_genlist_selected_item_get(Evas_Object *obj) +EAPI Elm_Genlist_Item * +elm_genlist_selected_item_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (wd->selected) return wd->selected->data; @@ -1153,83 +1152,80 @@ elm_genlist_selected_item_get(Evas_Object *obj) } EAPI const Eina_List * -elm_genlist_selected_items_get(Evas_Object *obj) +elm_genlist_selected_items_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->selected; } -EAPI const Elm_Genlist_Item * -elm_genlist_first_item_get(Evas_Object *obj) +EAPI Elm_Genlist_Item * +elm_genlist_first_item_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = (Item *)(wd->items); - while ((it) && (it->delete_me)) it = (Item *)(((Eina_Inlist *)it)->next); - return (Elm_Genlist_Item *)it; + Elm_Genlist_Item *it = (Elm_Genlist_Item *)(wd->items); + while ((it) && (it->delete_me)) + it = (Elm_Genlist_Item *)(((Eina_Inlist *)it)->next); + return it; } -EAPI const Elm_Genlist_Item * -elm_genlist_last_item_get(Evas_Object *obj) +EAPI Elm_Genlist_Item * +elm_genlist_last_item_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd->items) return NULL; - Item *it = (Item *)(wd->items->last); - while ((it) && (it->delete_me)) it = (Item *)(((Eina_Inlist *)it)->prev); - return (Elm_Genlist_Item *)it; + Elm_Genlist_Item *it = (Elm_Genlist_Item *)(wd->items->last); + while ((it) && (it->delete_me)) + it = (Elm_Genlist_Item *)(((Eina_Inlist *)it)->prev); + return it; } -EAPI const Elm_Genlist_Item * -elm_genlist_item_next_get(Elm_Genlist_Item *item) +EAPI Elm_Genlist_Item * +elm_genlist_item_next_get(const Elm_Genlist_Item *it) { - Item *it = (Item *)item; while (it) { - it = (Item *)(((Eina_Inlist *)it)->next); + it = (Elm_Genlist_Item *)(((Eina_Inlist *)it)->next); if ((it) && (!it->delete_me)) break; } return (Elm_Genlist_Item *)it; } -EAPI const Elm_Genlist_Item * -elm_genlist_item_prev_get(Elm_Genlist_Item *item) +EAPI Elm_Genlist_Item * +elm_genlist_item_prev_get(const Elm_Genlist_Item *it) { - Item *it = (Item *)item; while (it) { - it = (Item *)(((Eina_Inlist *)it)->prev); + it = (Elm_Genlist_Item *)(((Eina_Inlist *)it)->prev); if ((it) && (!it->delete_me)) break; } return (Elm_Genlist_Item *)it; } EAPI void -elm_genlist_item_selected_set(Elm_Genlist_Item *item, Evas_Bool selected) +elm_genlist_item_selected_set(Elm_Genlist_Item *it, Evas_Bool selected) { - Item *it = (Item *)item; Widget_Data *wd = elm_widget_data_get(it->wd->obj); - Eina_List *l; + if (it->delete_me) return; + selected = !!selected; + if (it->selected == selected) return; + if (selected) { if (!wd->multi) { - for (l = it->wd->selected; l;) - { - Item *it2 = l->data; - l = l->next; - if ((it2 != it) && (it2->selected)) _item_unselect(it2); - } + while (wd->selected) + _item_unselect(wd->selected->data); } - if (!it->selected) _item_select(it); + _item_select(it); } - else if (it->selected) + else _item_unselect(it); } EAPI Evas_Bool -elm_genlist_item_selected_get(Elm_Genlist_Item *item) +elm_genlist_item_selected_get(const Elm_Genlist_Item *it) { - Item *it = (Item *)item; return it->selected; } @@ -1240,15 +1236,14 @@ elm_genlist_item_expanded_set(Elm_Genlist_Item *item, Evas_Bool expanded) } EAPI Evas_Bool -elm_genlist_item_expanded_get(Elm_Genlist_Item *item) +elm_genlist_item_expanded_get(const Elm_Genlist_Item *item) { // FIXME: tree. not done yet } EAPI void -elm_genlist_item_disabled_set(Elm_Genlist_Item *item, Evas_Bool disabled) +elm_genlist_item_disabled_set(Elm_Genlist_Item *it, Evas_Bool disabled) { - Item *it = (Item *)item; if (it->disabled == disabled) return; if (it->delete_me) return; it->disabled = disabled; @@ -1262,17 +1257,15 @@ elm_genlist_item_disabled_set(Elm_Genlist_Item *item, Evas_Bool disabled) } EAPI Evas_Bool -elm_genlist_item_disabled_get(Elm_Genlist_Item *item) +elm_genlist_item_disabled_get(const Elm_Genlist_Item *it) { - Item *it = (Item *)item; if (it->delete_me) return 0; return it->disabled; } EAPI void -elm_genlist_item_show(Elm_Genlist_Item *item) +elm_genlist_item_show(Elm_Genlist_Item *it) { - Item *it = (Item *)item; if (it->delete_me) return; if ((it->queued) || (!it->mincalcd)) { @@ -1292,9 +1285,8 @@ elm_genlist_item_show(Elm_Genlist_Item *item) } EAPI void -elm_genlist_item_del(Elm_Genlist_Item *item) +elm_genlist_item_del(Elm_Genlist_Item *it) { - Item *it = (Item *)item; if (!it) return; if (it->relcount > 0) { @@ -1315,16 +1307,14 @@ elm_genlist_item_del(Elm_Genlist_Item *item) } EAPI const void * -elm_genlist_item_data_get(Elm_Genlist_Item *item) +elm_genlist_item_data_get(const Elm_Genlist_Item *it) { - Item *it = (Item *)item; return it->data; } EAPI void -elm_genlist_item_update(Elm_Genlist_Item *item) +elm_genlist_item_update(Elm_Genlist_Item *it) { - Item *it = (Item *)item; if (!it->block) return; if (it->delete_me) return; it->mincalcd = 0; diff --git a/src/lib/elm_hover.c b/src/lib/elm_hover.c index 313bcb4..7c1d24a 100644 --- a/src/lib/elm_hover.c +++ b/src/lib/elm_hover.c @@ -391,7 +391,7 @@ elm_hover_style_set(Evas_Object *obj, const char *style) } EAPI const char * -elm_hover_best_content_location_get(Evas_Object *obj, Elm_Hover_Axis pref_axis) +elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0; diff --git a/src/lib/elm_icon.c b/src/lib/elm_icon.c index 3937bf1..c0188a1 100644 --- a/src/lib/elm_icon.c +++ b/src/lib/elm_icon.c @@ -17,7 +17,7 @@ struct _Widget_Data static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); -static void _mouse_up(void *data, Evas_Object *obj, void *event_info); +static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _del_hook(Evas_Object *obj) @@ -72,7 +72,7 @@ _sizing_eval(Evas_Object *obj) } static void -_mouse_up(void *data, Evas_Object *obj, void *event_info) +_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) { evas_object_smart_callback_call(data, "clicked", NULL); } diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c index 5987e76..e514db0 100644 --- a/src/lib/elm_layout.c +++ b/src/lib/elm_layout.c @@ -157,7 +157,7 @@ elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conte } EAPI Evas_Object * -elm_layout_edje_get(Evas_Object *obj) +elm_layout_edje_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->lay; diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index 5cd7de2..dcdcf1b 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -2,7 +2,6 @@ #include "elm_priv.h" typedef struct _Widget_Data Widget_Data; -typedef struct _Item Item; struct _Widget_Data { @@ -15,7 +14,7 @@ struct _Widget_Data Evas_Bool multi : 1; }; -struct _Item +struct _Elm_List_Item { Evas_Object *obj; Evas_Object *base; @@ -45,7 +44,7 @@ _del_hook(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); while (wd->items) { - Item *it = wd->items->data; + Elm_List_Item *it = wd->items->data; wd->items = eina_list_remove_list(wd->items, wd->items); eina_stringshare_del(it->label); if (!it->fixed) @@ -97,7 +96,7 @@ _sub_del(void *data, Evas_Object *obj, void *event_info) for (l = wd->items; l; l = l->next) { - Item *it = l->data; + Elm_List_Item *it = l->data; if ((sub == it->icon) || (sub == it->end)) { @@ -115,7 +114,7 @@ _sub_del(void *data, Evas_Object *obj, void *event_info) static void _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - Item *it = data; + Elm_List_Item *it = data; Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Event_Mouse_Down *ev = event_info; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = 1; @@ -125,7 +124,7 @@ _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) } static void -_item_select(Item *it) +_item_select(Elm_List_Item *it) { Widget_Data *wd = elm_widget_data_get(it->obj); const char *selectraise; @@ -141,7 +140,7 @@ _item_select(Item *it) } static void -_item_unselect(Item *it) +_item_unselect(Elm_List_Item *it) { Widget_Data *wd = elm_widget_data_get(it->obj); const char *stacking, *selectraise; @@ -162,7 +161,7 @@ _item_unselect(Item *it) static void _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - Item *it = data; + Elm_List_Item *it = data; Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Event_Mouse_Up *ev = event_info; Eina_List *l; @@ -182,7 +181,7 @@ _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) { for (l = wd->selected; l;) { - Item *it2 = l->data; + Elm_List_Item *it2 = l->data; l = l->next; if ((it2 != it) && (it2->selected)) _item_unselect(it2); } @@ -190,13 +189,13 @@ _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) } } -static Item * +static Elm_List_Item * _item_new(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it; + Elm_List_Item *it; - it = calloc(1, sizeof(Item)); + it = calloc(1, sizeof(Elm_List_Item)); it->obj = obj; it->label = eina_stringshare_add(label); it->icon = icon; @@ -237,7 +236,7 @@ _fix_items(Evas_Object *obj) for (l = wd->items; l; l = l->next) { Evas_Coord mw, mh; - Item *it = l->data; + Elm_List_Item *it = l->data; if (it->icon) { evas_object_size_hint_min_get(it->icon, &mw, &mh); @@ -262,7 +261,7 @@ _fix_items(Evas_Object *obj) } for (i = 0, l = wd->items; l; l = l->next, i++) { - Item *it = l->data; + Elm_List_Item *it = l->data; it->even = i & 0x1; if ((it->even != it->is_even) || (!it->fixed) || (redo)) { @@ -375,40 +374,40 @@ EAPI Elm_List_Item * elm_list_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(obj, label, icon, end, func, data); + Elm_List_Item *it = _item_new(obj, label, icon, end, func, data); wd->items = eina_list_append(wd->items, it); elm_box_pack_end(wd->box, it->base); - return (Elm_List_Item *)it; + return it; } EAPI Elm_List_Item * elm_list_item_prepend(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(obj, label, icon, end, func, data); + Elm_List_Item *it = _item_new(obj, label, icon, end, func, data); wd->items = eina_list_prepend(wd->items, it); elm_box_pack_start(wd->box, it->base); - return (Elm_List_Item *)it; + return it; } EAPI Elm_List_Item * elm_list_item_insert_before(Evas_Object *obj, Elm_List_Item *before, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(obj, label, icon, end, func, data); + Elm_List_Item *it = _item_new(obj, label, icon, end, func, data); wd->items = eina_list_prepend_relative(wd->items, it, before); - elm_box_pack_before(wd->box, it->base, ((Item *)before)->base); - return (Elm_List_Item *)it; + elm_box_pack_before(wd->box, it->base, before->base); + return it; } EAPI Elm_List_Item * elm_list_item_insert_after(Evas_Object *obj, Elm_List_Item *after, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data) { Widget_Data *wd = elm_widget_data_get(obj); - Item *it = _item_new(obj, label, icon, end, func, data); + Elm_List_Item *it = _item_new(obj, label, icon, end, func, data); wd->items = eina_list_append_relative(wd->items, it, after); - elm_box_pack_after(wd->box, it->base, ((Item *)after)->base); - return (Elm_List_Item *)it; + elm_box_pack_after(wd->box, it->base, after->base); + return it; } EAPI void @@ -438,14 +437,14 @@ elm_list_horizontal_mode_set(Evas_Object *obj, Elementary_List_Mode mode) } EAPI const Eina_List * -elm_list_items_get(Evas_Object *obj) +elm_list_items_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->items; } -EAPI const Elm_List_Item * -elm_list_selected_item_get(Evas_Object *obj) +EAPI Elm_List_Item * +elm_list_selected_item_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (wd->selected) return wd->selected->data; @@ -453,39 +452,36 @@ elm_list_selected_item_get(Evas_Object *obj) } EAPI const Eina_List * -elm_list_selected_items_get(Evas_Object *obj) +elm_list_selected_items_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->selected; } EAPI void -elm_list_item_selected_set(Elm_List_Item *item, Evas_Bool selected) +elm_list_item_selected_set(Elm_List_Item *it, Evas_Bool selected) { - Item *it = (Item *)item; Widget_Data *wd = elm_widget_data_get(it->obj); - Eina_List *l; + + selected = !!selected; + if (it->selected == selected) return; + if (selected) { if (!wd->multi) { - for (l = it->selected; l;) - { - Item *it2 = l->data; - l = l->next; - if ((it2 != it) && (it2->selected)) _item_unselect(it2); - } + while (wd->selected) + _item_unselect(wd->selected->data); } - if (!it->selected) _item_select(it); + _item_select(it); } - else if (it->selected) + else _item_unselect(it); } EAPI void -elm_list_item_show(Elm_List_Item *item) +elm_list_item_show(Elm_List_Item *it) { - Item *it = (Item *)item; Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Coord bx, by, bw, bh; Evas_Coord x, y, w, h; @@ -497,9 +493,8 @@ elm_list_item_show(Elm_List_Item *item) } EAPI void -elm_list_item_del(Elm_List_Item *item) +elm_list_item_del(Elm_List_Item *it) { - Item *it = (Item *)item; Widget_Data *wd = elm_widget_data_get(it->obj); if (it->selected) _item_unselect(it); wd->items = eina_list_remove(wd->items, it); @@ -511,24 +506,21 @@ elm_list_item_del(Elm_List_Item *item) } EAPI const void * -elm_list_item_data_get(Elm_List_Item *item) +elm_list_item_data_get(const Elm_List_Item *it) { - Item *it = (Item *)item; return it->data; } EAPI Evas_Object * -elm_list_item_icon_get(Elm_List_Item *item) +elm_list_item_icon_get(const Elm_List_Item *it) { - Item *it = (Item *)item; if (it->dummy_icon) return NULL; return it->icon; } EAPI Evas_Object * -elm_list_item_end_get(Elm_List_Item *item) +elm_list_item_end_get(const Elm_List_Item *it) { - Item *it = (Item *)item; if (it->dummy_end) return NULL; return it->end; } diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index 4aa361c..d373538 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -480,8 +480,14 @@ elm_quicklaunch_fork(int argc, char **argv, char *cwd) char **args; child = fork(); - if (child) return 1; - chdir(cwd); + if (child > 0) return 1; + else if (child < 0) + { + perror("could not fork"); + return 0; + } + if (chdir(cwd) != 0) + perror("could not chdir"); args = alloca((argc + 1) * sizeof(char *)); for (i = 0; i < argc; i++) args[i] = argv[i]; args[argc] = NULL; @@ -489,8 +495,14 @@ elm_quicklaunch_fork(int argc, char **argv, char *cwd) exit(execvp(argv[0], args)); } child = fork(); - if (child) return 1; - chdir(cwd); + if (child > 0) return 1; + else if (child < 0) + { + perror("could not fork"); + return 0; + } + if (chdir(cwd) != 0) + perror("could not chdir"); ret = qr_main(argc, argv); exit(ret); } @@ -558,7 +570,7 @@ elm_quicklaunch_exe_path_get(const char *exe) } for (l = pathlist; l; l = l->next) { - snprintf(buf, sizeof(buf), "%s/%s", l->data, exe); + snprintf(buf, sizeof(buf), "%s/%s", (char *)l->data, exe); if (access(buf, R_OK | X_OK) == 0) return strdup(buf); } return NULL; @@ -583,7 +595,7 @@ elm_object_scale_set(Evas_Object *obj, double scale) } EAPI double -elm_object_scale_get(Evas_Object *obj) +elm_object_scale_get(const Evas_Object *obj) { return elm_widget_scale_get(obj); } diff --git a/src/lib/elm_photo.c b/src/lib/elm_photo.c index 55cf737..27989db 100644 --- a/src/lib/elm_photo.c +++ b/src/lib/elm_photo.c @@ -13,7 +13,7 @@ struct _Widget_Data static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); -static void _mouse_up(void *data, Evas_Object *obj, void *event_info); +static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _del_hook(Evas_Object *obj) @@ -50,7 +50,7 @@ _sizing_eval(Evas_Object *obj) } static void -_mouse_up(void *data, Evas_Object *obj, void *event_info) +_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) { evas_object_smart_callback_call(data, "clicked", NULL); } diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h index abf2f38..6ff4054 100644 --- a/src/lib/elm_priv.h +++ b/src/lib/elm_priv.h @@ -73,32 +73,32 @@ EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (v EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data); EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data); EAPI void elm_widget_data_set(Evas_Object *obj, void *data); -EAPI void *elm_widget_data_get(Evas_Object *obj); +EAPI void *elm_widget_data_get(const Evas_Object *obj); EAPI void elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj); EAPI void elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj); EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj); EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj); EAPI void elm_widget_can_focus_set(Evas_Object *obj, int can_focus); -EAPI int elm_widget_can_focus_get(Evas_Object *obj); -EAPI int elm_widget_focus_get(Evas_Object *obj); -EAPI Evas_Object *elm_widget_focused_object_get(Evas_Object *obj); -EAPI Evas_Object *elm_widget_top_get(Evas_Object *obj); +EAPI int elm_widget_can_focus_get(const Evas_Object *obj); +EAPI int elm_widget_focus_get(const Evas_Object *obj); +EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj); +EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj); EAPI int elm_widget_focus_jump(Evas_Object *obj, int forward); EAPI void elm_widget_focus_set(Evas_Object *obj, int first); EAPI void elm_widget_focused_object_clear(Evas_Object *obj); -EAPI Evas_Object *elm_widget_parent_get(Evas_Object *obj); +EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj); EAPI void elm_widget_focus_steal(Evas_Object *obj); EAPI void elm_widget_activate(Evas_Object *obj); EAPI void elm_widget_change(Evas_Object *obj); EAPI void elm_widget_disabled_set(Evas_Object *obj, int disabled); -EAPI int elm_widget_disabled_get(Evas_Object *obj); +EAPI int elm_widget_disabled_get(const Evas_Object *obj); EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); -EAPI void elm_widget_show_region_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); EAPI void elm_widget_scroll_hold_push(Evas_Object *obj); EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj); -EAPI int elm_widget_scroll_hold_get(Evas_Object *obj); +EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj); EAPI void elm_widget_scale_set(Evas_Object *obj, double scale); -EAPI double elm_widget_scale_get(Evas_Object *obj); +EAPI double elm_widget_scale_get(const Evas_Object *obj); extern char *_elm_appname; extern Elm_Config *_elm_config; diff --git a/src/lib/elm_radio.c b/src/lib/elm_radio.c index 3cdc51f..da188a1 100644 --- a/src/lib/elm_radio.c +++ b/src/lib/elm_radio.c @@ -246,7 +246,7 @@ elm_radio_value_set(Evas_Object *obj, int value) } EAPI int -elm_radio_value_get(Evas_Object *obj) +elm_radio_value_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->group->value; diff --git a/src/lib/elm_slider.c b/src/lib/elm_slider.c index f248b9e..f4fd490 100644 --- a/src/lib/elm_slider.c +++ b/src/lib/elm_slider.c @@ -372,7 +372,7 @@ elm_slider_value_set(Evas_Object *obj, double val) } EAPI double -elm_slider_value_get(Evas_Object *obj) +elm_slider_value_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->val; diff --git a/src/lib/elm_toggle.c b/src/lib/elm_toggle.c index 7e3a1fb..1f8ecb3 100644 --- a/src/lib/elm_toggle.c +++ b/src/lib/elm_toggle.c @@ -215,7 +215,7 @@ elm_toggle_state_set(Evas_Object *obj, Evas_Bool state) } EAPI Evas_Bool -elm_toggle_state_get(Evas_Object *obj) +elm_toggle_state_get(const Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); return wd->state; diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 3357b02..bbdc360 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -2,7 +2,6 @@ #include "elm_priv.h" typedef struct _Widget_Data Widget_Data; -typedef struct _Item Item; struct _Widget_Data { @@ -12,7 +11,7 @@ struct _Widget_Data Evas_Bool scrollable : 1; }; -struct _Item +struct _Elm_Toolbar_Item { Evas_Object *obj; Evas_Object *base; @@ -28,7 +27,7 @@ static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void -_item_show(Item *it) +_item_show(Elm_Toolbar_Item *it) { Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Coord x, y, w, h, bx, by; @@ -39,9 +38,9 @@ _item_show(Item *it) } static void -_item_select(Item *it) +_item_select(Elm_Toolbar_Item *it) { - Item *it2; + Elm_Toolbar_Item *it2; Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Object *obj2; Eina_List *l; @@ -70,7 +69,7 @@ _del_hook(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); while (wd->items) { - Item *it = wd->items->data; + Elm_Toolbar_Item *it = wd->items->data; wd->items = eina_list_remove_list(wd->items, wd->items); eina_stringshare_del(it->label); if (it->icon) evas_object_del(it->icon); @@ -85,7 +84,7 @@ _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); Eina_List *l; - Item *it; + Elm_Toolbar_Item *it; Evas_Coord mw, mh; for (l = wd->items; l; l = l->next) { @@ -143,7 +142,7 @@ _resize(void *data, Evas *e, Evas_Object *obj, void *event_info) Widget_Data *wd = elm_widget_data_get(data); Evas_Coord mw, mh, vw, vh, w, h; Eina_List *l; - Item *it; + Elm_Toolbar_Item *it; elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); evas_object_size_hint_min_get(wd->bx, &mw, &mh); @@ -214,7 +213,7 @@ elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, voi { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord mw, mh; - Item *it = calloc(1, sizeof(Item)); + Elm_Toolbar_Item *it = calloc(1, sizeof(Elm_Toolbar_Item)); if (!it) return NULL; wd->items = eina_list_append(wd->items, it); it->obj = obj; @@ -248,13 +247,12 @@ elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, voi _els_smart_box_pack_end(wd->bx, it->base); evas_object_show(it->base); _sizing_eval(obj); - return (Elm_Toolbar_Item *)it; + return it; } EAPI void -elm_toolbar_item_del(Elm_Toolbar_Item *item) +elm_toolbar_item_del(Elm_Toolbar_Item *it) { - Item *it = (Item *)item; Widget_Data *wd = elm_widget_data_get(it->obj); Evas_Object *obj2 = it->obj; wd->items = eina_list_remove(wd->items, it); diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 5edb3c7..6cbbaae 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -178,7 +178,7 @@ elm_widget_data_set(Evas_Object *obj, void *data) } EAPI void * -elm_widget_data_get(Evas_Object *obj) +elm_widget_data_get(const Evas_Object *obj) { API_ENTRY return NULL; return sd->data; @@ -283,7 +283,7 @@ elm_widget_can_focus_set(Evas_Object *obj, int can_focus) } EAPI int -elm_widget_can_focus_get(Evas_Object *obj) +elm_widget_can_focus_get(const Evas_Object *obj) { API_ENTRY return 0; if (sd->can_focus) return 1; @@ -292,35 +292,33 @@ elm_widget_can_focus_get(Evas_Object *obj) } EAPI int -elm_widget_focus_get(Evas_Object *obj) +elm_widget_focus_get(const Evas_Object *obj) { API_ENTRY return 0; return sd->focused; } EAPI Evas_Object * -elm_widget_focused_object_get(Evas_Object *obj) +elm_widget_focused_object_get(const Evas_Object *obj) { - Eina_List *l; + const Evas_Object *subobj; + const Eina_List *l; API_ENTRY return NULL; if (!sd->focused) return NULL; - for (l = sd->subobjs; l; l = l->next) - { - Evas_Object *fobj; - - fobj = elm_widget_focused_object_get(l->data); + EINA_LIST_FOREACH(sd->subobjs, l, subobj) + { + Evas_Object *fobj = elm_widget_focused_object_get(subobj); if (fobj) return fobj; } - return obj; + return (Evas_Object *)obj; } EAPI Evas_Object * -elm_widget_top_get(Evas_Object *obj) +elm_widget_top_get(const Evas_Object *obj) { - Eina_List *l; API_ENTRY return NULL; if (sd->parent_obj) return elm_widget_top_get(sd->parent_obj); - return obj; + return (Evas_Object *)obj; } EAPI int @@ -529,7 +527,7 @@ elm_widget_focus_set(Evas_Object *obj, int first) } EAPI Evas_Object * -elm_widget_parent_get(Evas_Object *obj) +elm_widget_parent_get(const Evas_Object *obj) { API_ENTRY return NULL; return sd->parent_obj; @@ -654,7 +652,7 @@ elm_widget_disabled_set(Evas_Object *obj, int disabled) } EAPI int -elm_widget_disabled_get(Evas_Object *obj) +elm_widget_disabled_get(const Evas_Object *obj) { API_ENTRY return 0; return sd->disabled; @@ -673,7 +671,7 @@ elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Co } EAPI void -elm_widget_show_region_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) { API_ENTRY return; if (x) *x = sd->rx; @@ -699,7 +697,7 @@ elm_widget_scroll_hold_pop(Evas_Object *obj) } EAPI int -elm_widget_scroll_hold_get(Evas_Object *obj) +elm_widget_scroll_hold_get(const Evas_Object *obj) { API_ENTRY return 0; return sd->scroll_hold; @@ -718,7 +716,7 @@ elm_widget_scale_set(Evas_Object *obj, double scale) } EAPI double -elm_widget_scale_get(Evas_Object *obj) +elm_widget_scale_get(const Evas_Object *obj) { API_ENTRY return 1.0; if (sd->scale == 0.0) return elm_widget_scale_get(sd->parent_obj); diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 76c124b..f3447a5 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -611,9 +611,9 @@ elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content) /* windowing spcific calls - shall we do this differently? */ EAPI Ecore_X_Window -elm_win_xwindow_get(Evas_Object *obj) +elm_win_xwindow_get(const Evas_Object *obj) { - Elm_Win *win = elm_widget_data_get(obj); + Elm_Win *win = (Elm_Win *)elm_widget_data_get(obj); if (!win) return 0; _elm_win_xwindow_get(win); return win->xwin;