From: Hyoyoung Chang Date: Thu, 8 Mar 2012 05:09:11 +0000 (+0900) Subject: [bubble, factory, store, pan] merge upstream X-Git-Tag: REL_F_I9500_20120317_1~18^2~41^2~13^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57fac155e3aade293193a7ef762724e699181345;p=framework%2Fuifw%2Felementary.git [bubble, factory, store, pan] merge upstream Change-Id: Ib9963cccbec0c5734512e59e2defb14a3afd8712 --- diff --git a/src/bin/test_bubble.c b/src/bin/test_bubble.c index 49fcbdf..57433dc 100644 --- a/src/bin/test_bubble.c +++ b/src/bin/test_bubble.c @@ -1,8 +1,5 @@ #include -<<<<<<< HEAD -======= #include "test.h" ->>>>>>> remotes/origin/upstream #ifdef HAVE_CONFIG_H # include "elementary_config.h" #endif @@ -14,17 +11,6 @@ _print_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i printf("bubble clicked\n"); } -<<<<<<< HEAD -void -test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Evas_Object *win, *bg, *bx, *ic, *bb, *ct; - char buf[PATH_MAX]; - - win = elm_win_add(NULL, "box-vert", ELM_WIN_BASIC); - elm_win_title_set(win, "Bubble"); - elm_win_autodel_set(win, EINA_TRUE); -======= struct _api_data { unsigned int state; /* What state we are testing */ @@ -128,24 +114,12 @@ test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info elm_win_title_set(win, "Bubble"); elm_win_autodel_set(win, EINA_TRUE); evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); ->>>>>>> remotes/origin/upstream bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); -<<<<<<< HEAD - bx = elm_box_add(win); - elm_win_resize_object_add(win, bx); - evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(bx); - - ic = elm_icon_add(win); - snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); - elm_icon_file_set(ic, buf, NULL); - elm_icon_scale_set(ic, 0, 0); -======= bxx = elm_box_add(win); elm_win_resize_object_add(win, bxx); evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -169,18 +143,13 @@ test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(ic, buf, NULL); elm_icon_resizable_set(ic, 0, 0); ->>>>>>> remotes/origin/upstream evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); bb = elm_bubble_add(win); elm_object_text_set(bb, "Message 1"); elm_object_part_text_set(bb, "info", "Corner: bottom_right"); elm_object_part_content_set(bb, "icon", ic); -<<<<<<< HEAD - elm_bubble_corner_set(bb, "bottom_right"); -======= elm_bubble_pos_set(bb, ELM_BUBBLE_POS_BOTTOM_RIGHT); ->>>>>>> remotes/origin/upstream evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); evas_object_show(ic); evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); diff --git a/src/examples/bubble_example_01.c b/src/examples/bubble_example_01.c index 1d0a59f..0f9cc0e 100644 --- a/src/examples/bubble_example_01.c +++ b/src/examples/bubble_example_01.c @@ -41,15 +41,9 @@ elm_main(int argc, char **argv) bubble = elm_bubble_add(win); elm_object_part_content_set(bubble, "icon", icon); -<<<<<<< HEAD - elm_bubble_info_set(bubble, "INFO"); - elm_object_text_set(bubble, "LABEL"); - elm_bubble_content_set(bubble, label); -======= elm_object_part_text_set(bubble, "info", "INFO"); elm_object_text_set(bubble, "LABEL"); elm_object_content_set(bubble, label); ->>>>>>> remotes/origin/upstream evas_object_resize(bubble, 300, 100); evas_object_show(bubble); @@ -60,11 +54,7 @@ elm_main(int argc, char **argv) evas_object_show(label); bubble = elm_bubble_add(win); -<<<<<<< HEAD - elm_bubble_content_set(bubble, label); -======= elm_object_content_set(bubble, label); ->>>>>>> remotes/origin/upstream evas_object_resize(bubble, 200, 50); evas_object_move(bubble, 0, 110); evas_object_show(bubble); diff --git a/src/lib/elm_bubble.c b/src/lib/elm_bubble.c index a0228b5..eef5c1e 100644 --- a/src/lib/elm_bubble.c +++ b/src/lib/elm_bubble.c @@ -8,10 +8,7 @@ struct _Widget_Data Evas_Object *bbl; Evas_Object *content, *icon; const char *label, *info, *corner; -<<<<<<< HEAD -======= Elm_Bubble_Pos pos; ->>>>>>> remotes/origin/upstream }; static const char *widtype = NULL; @@ -33,8 +30,6 @@ static const Evas_Smart_Cb_Description _signals[] = {NULL, NULL} }; -<<<<<<< HEAD -======= static const char *corner_string[] = { "top_left", @@ -43,7 +38,6 @@ static const char *corner_string[] = "bottom_right" }; ->>>>>>> remotes/origin/upstream static void _del_hook(Evas_Object *obj) { @@ -70,11 +64,7 @@ _theme_hook(Evas_Object *obj) if (!wd) return; _elm_widget_mirrored_reload(obj); _mirrored_set(obj, elm_widget_mirrored_get(obj)); -<<<<<<< HEAD - _elm_theme_object_set(obj, wd->bbl, "bubble", wd->corner, -======= _elm_theme_object_set(obj, wd->bbl, "bubble", corner_string[wd->pos], ->>>>>>> remotes/origin/upstream elm_widget_style_get(obj)); edje_object_part_text_set(wd->bbl, "elm.text", wd->label); if (wd->label) edje_object_signal_emit(wd->bbl, "elm,state,text,visible", "elm"); @@ -340,10 +330,7 @@ elm_bubble_add(Evas_Object *parent) elm_widget_content_unset_hook_set(obj, _content_unset_hook); wd->corner = eina_stringshare_add("base"); -<<<<<<< HEAD -======= wd->pos = ELM_BUBBLE_POS_TOP_LEFT; //default ->>>>>>> remotes/origin/upstream wd->bbl = edje_object_add(e); elm_widget_resize_object_set(obj, wd->bbl); @@ -360,70 +347,6 @@ elm_bubble_add(Evas_Object *parent) return obj; } -<<<<<<< HEAD -EAPI void -elm_bubble_label_set(Evas_Object *obj, const char *label) -{ - _elm_bubble_label_set(obj, NULL, label); -} - -EAPI const char* -elm_bubble_label_get(const Evas_Object *obj) -{ - return _elm_bubble_label_get(obj, NULL); -} - -EAPI void -elm_bubble_info_set(Evas_Object *obj, const char *info) -{ - _elm_bubble_label_set(obj, "info", info); -} - -EAPI const char * -elm_bubble_info_get(const Evas_Object *obj) -{ - return _elm_bubble_label_get(obj, "info"); -} - -EAPI void -elm_bubble_content_set(Evas_Object *obj, Evas_Object *content) -{ - _content_set_hook(obj, NULL, content); -} - -EAPI Evas_Object * -elm_bubble_content_get(const Evas_Object *obj) -{ - return _content_get_hook(obj, NULL); -} - -EAPI Evas_Object * -elm_bubble_content_unset(Evas_Object *obj) -{ - return _content_unset_hook(obj, NULL); -} - -EAPI void -elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon) -{ - _content_set_hook(obj, "icon", icon); -} - -EAPI Evas_Object * -elm_bubble_icon_get(const Evas_Object *obj) -{ - return _content_get_hook(obj, "icon"); -} - -EAPI Evas_Object * -elm_bubble_icon_unset(Evas_Object *obj) -{ - return _content_unset_hook(obj, "icon"); -} - -EAPI void -elm_bubble_corner_set(Evas_Object *obj, const char *corner) -======= EINA_DEPRECATED EAPI void elm_bubble_corner_set(Evas_Object *obj, const char *corner) { @@ -437,25 +360,10 @@ elm_bubble_corner_set(Evas_Object *obj, const char *corner) EAPI void elm_bubble_pos_set(Evas_Object *obj, Elm_Bubble_Pos pos) ->>>>>>> remotes/origin/upstream { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; -<<<<<<< HEAD - EINA_SAFETY_ON_NULL_RETURN(corner); - eina_stringshare_replace(&wd->corner, corner); - _theme_hook(obj); -} - -EAPI const char* -elm_bubble_corner_get(const Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return wd->corner; -======= if(posELM_BUBBLE_POS_BOTTOM_RIGHT) return; wd->pos = pos; _theme_hook(obj); @@ -474,5 +382,4 @@ elm_bubble_pos_get(const Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return ELM_BUBBLE_POS_INVALID; return wd->pos; ->>>>>>> remotes/origin/upstream } diff --git a/src/lib/elm_bubble.h b/src/lib/elm_bubble.h index 5c1bcb1..ac55e57 100644 --- a/src/lib/elm_bubble.h +++ b/src/lib/elm_bubble.h @@ -18,11 +18,7 @@ * corner is "top_left" or "bottom_left" and is right aligned to the frame * otherwise. * @li The @p info is a text which appears to the right of the label. Info's -<<<<<<< HEAD - * font is of a ligther color than label. -======= * font is of a lighter color than label. ->>>>>>> remotes/origin/upstream * @li The @p content is an evas object that is shown inside the frame. * * The position of the arrow, icon, label and info depends on which corner is @@ -35,11 +31,7 @@ * Signals that you can add callbacks for are: * @li "clicked" - This is called when a user has clicked the bubble. * -<<<<<<< HEAD - * Default contents parts of the bubble that you can use for are: -======= * Default content parts of the bubble that you can use for are: ->>>>>>> remotes/origin/upstream * @li "default" - A content of the bubble * @li "icon" - An icon of the bubble * @@ -54,18 +46,12 @@ * @li elm_object_part_content_get * @li elm_object_part_content_unset * -<<<<<<< HEAD - * For an example of using a buble see @ref bubble_01_example_page "this". -======= * For an example of using a bubble see @ref bubble_01_example_page "this". ->>>>>>> remotes/origin/upstream * * @{ */ /** -<<<<<<< HEAD -======= * Defines the corner values for a bubble. * * The corner will be used to determine where the arrow of the @@ -81,7 +67,6 @@ typedef enum } Elm_Bubble_Pos; /** ->>>>>>> remotes/origin/upstream * Add a new bubble to the parent * * @param parent The parent object @@ -101,18 +86,8 @@ EAPI Evas_Object *elm_bubble_add(Evas_Object *parent); * determine where the arrow in the frame points to and where label, icon and * info are shown. * -<<<<<<< HEAD - * Possible values for corner are: - * @li "top_left" - Default - * @li "top_right" - * @li "bottom_left" - * @li "bottom_right" - */ -EAPI void elm_bubble_corner_set(Evas_Object *obj, const char *corner); -======= */ EAPI void elm_bubble_pos_set(Evas_Object *obj, Elm_Bubble_Pos pos); ->>>>>>> remotes/origin/upstream /** * Get the corner of the bubble @@ -122,11 +97,7 @@ EAPI void elm_bubble_pos_set(Evas_Object *obj, Elm_Bubble_Pos pos); * * This function gets the selected corner of the bubble. */ -<<<<<<< HEAD -EAPI const char *elm_bubble_corner_get(const Evas_Object *obj); -======= EAPI Elm_Bubble_Pos elm_bubble_pos_get(const Evas_Object *obj); ->>>>>>> remotes/origin/upstream /** * @} diff --git a/src/lib/elm_factory.c b/src/lib/elm_factory.c index e3b31fb..123f67f 100644 --- a/src/lib/elm_factory.c +++ b/src/lib/elm_factory.c @@ -28,10 +28,7 @@ static void _child_change(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object static void _child_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content); static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); -<<<<<<< HEAD -======= static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); ->>>>>>> remotes/origin/upstream static const char SIG_REALIZE[] = "realize"; static const char SIG_UNREALIZE[] = "unrealize"; @@ -135,26 +132,16 @@ _eval(Evas_Object *obj) if (evas_object_smart_data_get(wd->content)) evas_object_smart_calculate(wd->content); } -<<<<<<< HEAD //wd->last_calc_count = //evas_smart_objects_calculate_count_get(evas_object_evas_get(obj)); -======= - wd->last_calc_count = - evas_smart_objects_calculate_count_get(evas_object_evas_get(obj)); ->>>>>>> remotes/origin/upstream } } else { if (wd->content) { -<<<<<<< HEAD //if (wd->last_calc_count != //evas_smart_objects_calculate_count_get(evas_object_evas_get(obj))) -======= - if (wd->last_calc_count != - evas_smart_objects_calculate_count_get(evas_object_evas_get(obj))) ->>>>>>> remotes/origin/upstream evas_object_smart_callback_call(obj, SIG_UNREALIZE, NULL); } } @@ -225,8 +212,6 @@ _child_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __ // printf("FAC-- = %i\n", fac); } -<<<<<<< HEAD -======= static Evas_Object * _content_unset_hook(Evas_Object *obj, const char *part) { @@ -251,52 +236,17 @@ _content_unset_hook(Evas_Object *obj, const char *part) return content; } ->>>>>>> remotes/origin/upstream static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd; -<<<<<<< HEAD -======= Evas_Object *prev_content; ->>>>>>> remotes/origin/upstream if (part && strcmp(part, "default")) return; wd = elm_widget_data_get(obj); if (!wd) return; if (wd->content == content) return; -<<<<<<< HEAD - if (wd->content) - { - Evas_Object *o = wd->content; - - evas_object_event_callback_del_full(wd->content, - EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _child_change, obj); - evas_object_event_callback_del_full(wd->content, - EVAS_CALLBACK_DEL, - _child_del, obj); - wd->content = NULL; - evas_object_del(o); - fac--; -// printf("FAC-- = %i\n", fac); - } - wd->content = content; - if (wd->content) - { - fac++; -// printf("FAC++ = %i\n", fac); - elm_widget_resize_object_set(obj, wd->content); - evas_object_event_callback_add(wd->content, EVAS_CALLBACK_DEL, - _child_del, obj); - evas_object_event_callback_add(wd->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _child_change, obj); - wd->eval = EINA_TRUE; - wd->szeval = EINA_TRUE; - evas_object_smart_changed(obj); - } -======= prev_content = _content_unset_hook(obj, part); if (prev_content) evas_object_del(prev_content); @@ -312,7 +262,6 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) wd->szeval = EINA_TRUE; evas_object_smart_changed(obj); fac++; ->>>>>>> remotes/origin/upstream } static Evas_Object * @@ -343,10 +292,7 @@ elm_factory_add(Evas_Object *parent) elm_widget_focus_next_hook_set(obj, _focus_next_hook); elm_widget_content_set_hook_set(obj, _content_set_hook); elm_widget_content_get_hook_set(obj, _content_get_hook); -<<<<<<< HEAD -======= elm_widget_content_unset_hook_set(obj, _content_unset_hook); ->>>>>>> remotes/origin/upstream elm_widget_can_focus_set(obj, EINA_FALSE); elm_widget_changed_hook_set(obj, _changed); @@ -361,21 +307,6 @@ elm_factory_add(Evas_Object *parent) } EAPI void -<<<<<<< HEAD -elm_factory_content_set(Evas_Object *obj, Evas_Object *content) -{ - _content_set_hook(obj, NULL, content); -} - -EAPI Evas_Object * -elm_factory_content_get(const Evas_Object *obj) -{ - return _content_get_hook(obj, NULL); -} - -EAPI void -======= ->>>>>>> remotes/origin/upstream elm_factory_maxmin_mode_set(Evas_Object *obj, Eina_Bool enabled) { ELM_CHECK_WIDTYPE(obj, widtype); diff --git a/src/lib/elm_factory.h b/src/lib/elm_factory.h index 9206800..a81ba5e 100644 --- a/src/lib/elm_factory.h +++ b/src/lib/elm_factory.h @@ -1,8 +1,5 @@ -<<<<<<< HEAD -======= /* this api is currently disabled due to being incomplete. you cannot * use it as it is not compiled in */ ->>>>>>> remotes/origin/upstream EAPI Evas_Object *elm_factory_add(Evas_Object *parent); EAPI void elm_factory_maxmin_mode_set(Evas_Object *obj, Eina_Bool enabled); EAPI Eina_Bool elm_factory_maxmin_mode_get(const Evas_Object *obj); diff --git a/src/lib/elm_store.c b/src/lib/elm_store.c index ca984e9..f88625f 100644 --- a/src/lib/elm_store.c +++ b/src/lib/elm_store.c @@ -2,20 +2,12 @@ #include #include "elm_priv.h" -<<<<<<< HEAD -#define ELM_STORE_MAGIC 0x3f89ea56 -#define ELM_STORE_FILESYSTEM_MAGIC 0x3f89ea57 -#define ELM_STORE_DBSYSTEM_MAGIC 0x3f89ea58 -#define ELM_STORE_ITEM_MAGIC 0x5afe8c1d -#define CACHE_COUNT 1024 -======= typedef struct _Elm_Store_Filesystem Elm_Store_Filesystem; typedef struct _Elm_Store_Item_Filesystem Elm_Store_Item_Filesystem; #define ELM_STORE_MAGIC 0x3f89ea56 #define ELM_STORE_FILESYSTEM_MAGIC 0x3f89ea57 #define ELM_STORE_ITEM_MAGIC 0x5afe8c1d ->>>>>>> remotes/origin/upstream struct _Elm_Store { @@ -30,12 +22,6 @@ struct _Elm_Store Eina_List *realized; int realized_count; int cache_max; -<<<<<<< HEAD - int item_count; - int type; - Eina_List *always_fetched; -======= ->>>>>>> remotes/origin/upstream struct { struct { Elm_Store_Item_List_Cb func; @@ -49,28 +35,9 @@ struct _Elm_Store Elm_Store_Item_Unfetch_Cb func; void *data; } unfetch; -<<<<<<< HEAD - struct { - Elm_Store_Item_Select_Cb func; - void *data; - } item_select; - struct { - Elm_Store_Item_Sort_Cb func; - void *data; - } item_sort; - struct { - Elm_Store_Item_Free_Cb func; - void *data; - } item_free; - } cb; - Eina_Bool sorted : 1; - Eina_Bool fetch_thread : 1; - Eina_Bool live : 1; -======= } cb; Eina_Bool sorted : 1; Eina_Bool fetch_thread : 1; ->>>>>>> remotes/origin/upstream }; struct _Elm_Store_Item @@ -78,21 +45,11 @@ struct _Elm_Store_Item EINA_INLIST; EINA_MAGIC; Elm_Store *store; -<<<<<<< HEAD - Elm_Object_Item *item; -======= Elm_Object_Item *item; ->>>>>>> remotes/origin/upstream Ecore_Thread *fetch_th; Ecore_Job *eval_job; const Elm_Store_Item_Mapping *mapping; void *data; -<<<<<<< HEAD - Elm_Store_Item_Info *item_info; - Elm_Object_Item *first_item; - Elm_Object_Item *last_item; -======= ->>>>>>> remotes/origin/upstream Eina_Lock lock; Eina_Bool live : 1; Eina_Bool was_live : 1; @@ -113,34 +70,8 @@ struct _Elm_Store_Item_Filesystem const char *path; }; -<<<<<<< HEAD -struct _Elm_Store_DBsystem -{ - Elm_Store base; - EINA_MAGIC; - void *p_db; -}; - -typedef enum -{ - ELM_STORE_ITEM_SORT_LOW = -1, - ELM_STORE_ITEM_SORT_SAME = 0, - ELM_STORE_ITEM_SORT_HIGH = 1, - ELM_STORE_ITEM_SORT_UNKNOWN = 2, - ELM_STORE_ITEM_SORT_LAST -} Elm_Store_Item_Sort_Type; - static Elm_Genlist_Item_Class _store_item_class; -static void _item_del(void *data, Evas_Object *obj __UNUSED__); -static void _item_realized(void *data, Evas_Object *obj __UNUSED__, void *event_info); -static void _item_unrealized(void *data, Evas_Object *obj __UNUSED__, void *event_info); -static void _genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__); - -======= -static Elm_Genlist_Item_Class _store_item_class; - ->>>>>>> remotes/origin/upstream static void _store_cache_trim(Elm_Store *st) { @@ -166,18 +97,11 @@ _store_cache_trim(Elm_Store *st) eina_lock_take(&sti->lock); } sti->fetched = EINA_FALSE; -<<<<<<< HEAD - eina_lock_release(&sti->lock); - if (st->cb.unfetch.func) - st->cb.unfetch.func(st->cb.unfetch.data, sti, NULL); - eina_lock_take(&sti->lock); -======= //// let fetch/unfetch do the locking // eina_lock_release(&sti->lock); if (st->cb.unfetch.func) st->cb.unfetch.func(st->cb.unfetch.data, sti); // eina_lock_take(&sti->lock); ->>>>>>> remotes/origin/upstream sti->data = NULL; eina_lock_release(&sti->lock); } @@ -204,14 +128,6 @@ _store_genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, sti->fetch_th = NULL; } if (sti->store->item.free) sti->store->item.free(sti); -<<<<<<< HEAD - if (sti->data) - { - if (st->cb.unfetch.func) - st->cb.unfetch.func(st->cb.unfetch.data, sti, NULL); - sti->data = NULL; - } -======= eina_lock_take(&sti->lock); if (sti->data) { @@ -220,7 +136,6 @@ _store_genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, sti->data = NULL; } eina_lock_release(&sti->lock); ->>>>>>> remotes/origin/upstream eina_lock_free(&sti->lock); st->items = NULL; free(sti); @@ -244,18 +159,11 @@ _store_filesystem_fetch_do(void *data, Ecore_Thread *th __UNUSED__) } if (!sti->fetched) { -<<<<<<< HEAD - eina_lock_release(&sti->lock); - if (sti->store->cb.fetch.func) - sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti, NULL); - eina_lock_take(&sti->lock); -======= //// let fetch/unfetch do the locking // eina_lock_release(&sti->lock); if (sti->store->cb.fetch.func) sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti); // eina_lock_take(&sti->lock); ->>>>>>> remotes/origin/upstream sti->fetched = EINA_TRUE; } eina_lock_release(&sti->lock); @@ -269,11 +177,7 @@ _store_filesystem_fetch_end(void *data, Ecore_Thread *th) { Elm_Store_Item *sti = data; eina_lock_take(&sti->lock); -<<<<<<< HEAD - if (sti->data) elm_genlist_item_update((Elm_Object_Item *) sti->item); -======= if (sti->data) elm_genlist_item_update(sti->item); ->>>>>>> remotes/origin/upstream eina_lock_release(&sti->lock); if (th == sti->fetch_th) sti->fetch_th = NULL; } @@ -285,11 +189,7 @@ _store_filesystem_fetch_cancel(void *data, Ecore_Thread *th) Elm_Store_Item *sti = data; eina_lock_take(&sti->lock); if (th == sti->fetch_th) sti->fetch_th = NULL; -<<<<<<< HEAD - if (sti->data) elm_genlist_item_update((Elm_Object_Item *) sti->item); -======= if (sti->data) elm_genlist_item_update(sti->item); ->>>>>>> remotes/origin/upstream eina_lock_release(&sti->lock); } @@ -334,11 +234,7 @@ _store_genlist_item_realized(void *data, Evas_Object *obj __UNUSED__, void *even { Elm_Store *st = data; Elm_Object_Item *gli = event_info; -<<<<<<< HEAD - Elm_Store_Item *sti = (Elm_Store_Item *) elm_genlist_item_data_get(gli); -======= Elm_Store_Item *sti = elm_object_item_data_get(gli); ->>>>>>> remotes/origin/upstream if (!sti) return; st->realized_count++; sti->live = EINA_TRUE; @@ -351,11 +247,7 @@ _store_genlist_item_unrealized(void *data, Evas_Object *obj __UNUSED__, void *ev { Elm_Store *st = data; Elm_Object_Item *gli = event_info; -<<<<<<< HEAD - Elm_Store_Item *sti = (Elm_Store_Item *) elm_genlist_item_data_get(gli); -======= Elm_Store_Item *sti = elm_object_item_data_get(gli); ->>>>>>> remotes/origin/upstream if (!sti) return; st->realized_count--; sti->live = EINA_FALSE; @@ -430,11 +322,7 @@ _store_item_content_get(void *data, Evas_Object *obj, const char *part) m->details.icon.h); elm_icon_smooth_set(ic, m->details.icon.smooth); elm_icon_no_scale_set(ic, m->details.icon.no_scale); -<<<<<<< HEAD - elm_icon_scale_set(ic, -======= elm_icon_resizable_set(ic, ->>>>>>> remotes/origin/upstream m->details.icon.scale_up, m->details.icon.scale_down); if (s) @@ -572,17 +460,10 @@ _store_filesystem_list_update(void *data, Ecore_Thread *th __UNUSED__, void *msg if (!itc) itc = &_store_item_class; else { -<<<<<<< HEAD - itc->func.text_get = (GenlistItemTextGetFunc)_store_item_text_get; - itc->func.content_get = (GenlistItemContentGetFunc)_store_item_content_get; - itc->func.state_get = NULL; // FIXME: support state gets later - itc->func.del = (GenlistItemDelFunc)_store_item_del; -======= itc->func.text_get = _store_item_text_get; itc->func.content_get = _store_item_content_get; itc->func.state_get = NULL; // FIXME: support state gets later itc->func.del = _store_item_del; ->>>>>>> remotes/origin/upstream } // FIXME: handle being a parent (tree) @@ -611,26 +492,15 @@ _elm_store_new(size_t size) eina_magic_string_set(ELM_STORE_ITEM_MAGIC, "Elm_Store_Item"); // setup default item class (always the same) if list cb doesnt provide one _store_item_class.item_style = "default"; -<<<<<<< HEAD - _store_item_class.func.text_get = (GenlistItemTextGetFunc)_store_item_text_get; - _store_item_class.func.content_get = (GenlistItemContentGetFunc)_store_item_content_get; - _store_item_class.func.state_get = NULL; // FIXME: support state gets later - _store_item_class.func.del = (GenlistItemDelFunc)_store_item_del; -======= _store_item_class.func.text_get = _store_item_text_get; _store_item_class.func.content_get = _store_item_content_get; _store_item_class.func.state_get = NULL; // FIXME: support state gets later _store_item_class.func.del = _store_item_del; ->>>>>>> remotes/origin/upstream // TODO: END - move to elm_store_init() EINA_MAGIC_SET(st, ELM_STORE_MAGIC); st->cache_max = 128; st->fetch_thread = EINA_TRUE; -<<<<<<< HEAD - st->type = 0; -======= ->>>>>>> remotes/origin/upstream return st; } #define elm_store_new(type) (type*)_elm_store_new(sizeof(type)) @@ -672,68 +542,6 @@ elm_store_free(Elm_Store *st) ecore_thread_cancel(st->list_th); st->list_th = NULL; } -<<<<<<< HEAD - - if (!st->type) - { - eina_list_free(st->realized); - item_free = st->item.free; - while (st->items) - { - Elm_Store_Item *sti = (Elm_Store_Item *)st->items; - if (sti->eval_job) ecore_job_del(sti->eval_job); - if (sti->fetch_th) - { - ecore_thread_cancel(sti->fetch_th); - sti->fetch_th = NULL; - } - if (item_free) item_free(sti); - if (sti->data) - { - if (st->cb.unfetch.func) - st->cb.unfetch.func(st->cb.unfetch.data, sti, NULL); - sti->data = NULL; - } - eina_lock_free(&sti->lock); - free(sti); - } - if (st->genlist) - { - evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); - evas_object_smart_callback_del(st->genlist, "realized", _store_genlist_item_realized); - evas_object_smart_callback_del(st->genlist, "unrealized", _store_genlist_item_unrealized); - elm_genlist_clear(st->genlist); - st->genlist = NULL; - } - if (st->free) st->free(st); - } - else - { - if (st->genlist) - { - evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _genlist_del, st); - evas_object_smart_callback_del(st->genlist, "realized", _item_realized); - evas_object_smart_callback_del(st->genlist, "unrealized", _item_unrealized); - elm_genlist_clear(st->genlist); - st->genlist = NULL; - } - while (st->always_fetched) - { - Elm_Store_Item *sti = eina_list_data_get(st->always_fetched); - Eina_List *find = NULL; - find = eina_list_data_find_list(st->always_fetched, sti); - if (find) - { - st->always_fetched = eina_list_remove_list(st->always_fetched, find); - _item_del(sti,NULL); - } - } - st->always_fetched = eina_list_free(st->always_fetched); - st->realized = eina_list_free(st->realized); - if (st->free) st->free(st); - st->live = EINA_FALSE; - } -======= eina_list_free(st->realized); item_free = st->item.free; while (st->items) @@ -766,7 +574,6 @@ elm_store_free(Elm_Store *st) st->genlist = NULL; } if (st->free) st->free(st); ->>>>>>> remotes/origin/upstream free(st); } @@ -777,46 +584,16 @@ elm_store_target_genlist_set(Elm_Store *st, Evas_Object *obj) if (st->genlist == obj) return; if (st->genlist) { -<<<<<<< HEAD - if (!st->type) - { - evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); - evas_object_smart_callback_del(st->genlist, "realized", _store_genlist_item_realized); - evas_object_smart_callback_del(st->genlist, "unrealized", _store_genlist_item_unrealized); - } - else - { - evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _genlist_del, st); - evas_object_smart_callback_del(st->genlist, "realized", _item_realized); - evas_object_smart_callback_del(st->genlist, "unrealized", _item_unrealized); - } -======= evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); evas_object_smart_callback_del(st->genlist, "realized", _store_genlist_item_realized); evas_object_smart_callback_del(st->genlist, "unrealized", _store_genlist_item_unrealized); ->>>>>>> remotes/origin/upstream elm_genlist_clear(st->genlist); } st->genlist = obj; if (!st->genlist) return; -<<<<<<< HEAD - if (!st->type) - { - evas_object_smart_callback_add(st->genlist, "realized", _store_genlist_item_realized, st); - evas_object_smart_callback_add(st->genlist, "unrealized", _store_genlist_item_unrealized, st); - evas_object_event_callback_add(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); - } - else - { - evas_object_smart_callback_add(st->genlist, "realized", _item_realized, st); - evas_object_smart_callback_add(st->genlist, "unrealized", _item_unrealized, st); - evas_object_event_callback_add(st->genlist, EVAS_CALLBACK_DEL, _genlist_del, st); - } -======= evas_object_smart_callback_add(st->genlist, "realized", _store_genlist_item_realized, st); evas_object_smart_callback_add(st->genlist, "unrealized", _store_genlist_item_unrealized, st); evas_object_event_callback_add(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); ->>>>>>> remotes/origin/upstream elm_genlist_clear(st->genlist); } @@ -854,11 +631,7 @@ elm_store_cache_set(Elm_Store *st, int max) if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; if (max < 0) max = 0; st->cache_max = max; -<<<<<<< HEAD - if(!st->type) _store_cache_trim(st); -======= _store_cache_trim(st); ->>>>>>> remotes/origin/upstream } EAPI int @@ -924,16 +697,10 @@ EAPI void elm_store_item_data_set(Elm_Store_Item *sti, void *data) { if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return; -<<<<<<< HEAD - eina_lock_take(&sti->lock); - sti->data = data; - eina_lock_release(&sti->lock); -======= //// let fetch/unfetch do the locking // eina_lock_take(&sti->lock); sti->data = data; // eina_lock_release(&sti->lock); ->>>>>>> remotes/origin/upstream } EAPI void * @@ -941,16 +708,10 @@ elm_store_item_data_get(Elm_Store_Item *sti) { if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL; void *d; -<<<<<<< HEAD - eina_lock_take(&sti->lock); - d = sti->data; - eina_lock_release(&sti->lock); -======= //// let fetch/unfetch do the locking // eina_lock_take(&sti->lock); d = sti->data; // eina_lock_release(&sti->lock); ->>>>>>> remotes/origin/upstream return d; } @@ -983,1229 +744,3 @@ elm_store_item_filesystem_path_get(const Elm_Store_Item *item) // dont need lock return sti->path; } -<<<<<<< HEAD - -// TODO: BEGIN -DBsystem store - -static const Elm_Store_Item_Mapping * -_item_mapping_find(Elm_Store_Item *sti, const char *part) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL; - const Elm_Store_Item_Mapping *m; - - if (!sti->item_info) return NULL; - - for (m = sti->item_info->mapping; m; m++) - { - if (m->type == ELM_STORE_ITEM_MAPPING_NONE) break; - if (!strcmp(part, m->part)) return m; - } - return NULL; -} - -static char * -_item_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part) -{ - Elm_Store_Item *sti = data; - Elm_Store *st = sti->store; - if (st->live) - { - eina_lock_take(&sti->lock); - if (sti->data) - { - const char *s = ""; - const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part); - if (m) - { - switch (m->type) - { - case ELM_STORE_ITEM_MAPPING_LABEL: - eina_lock_release(&sti->lock); - s = *(char **)(((unsigned char *)sti->data) + m->offset); - eina_lock_take(&sti->lock); - break; - - case ELM_STORE_ITEM_MAPPING_CUSTOM: - if (m->details.custom.func) - { - eina_lock_release(&sti->lock); - s = m->details.custom.func(sti->data, sti, part); - eina_lock_take(&sti->lock); - } - break; - - default: - break; - } - if (s) - { - eina_lock_release(&sti->lock); - return strdup(s); - } - else - { - eina_lock_release(&sti->lock); - return NULL; - } - } - } - else - { - const char *s = ""; - const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part); - if (m->type == ELM_STORE_ITEM_MAPPING_CUSTOM) - { - if (m->details.custom.func) - { - eina_lock_release(&sti->lock); - s = m->details.custom.func(sti->item_info, sti, part); - eina_lock_take(&sti->lock); - } - - if (s) - { - eina_lock_release(&sti->lock); - return strdup(s); - } - else - { - eina_lock_release(&sti->lock); - return NULL; - } - } - eina_lock_release(&sti->lock); - return NULL; - /* - if (!strcmp(part, "elm.text.1")) - { - eina_lock_release(&sti->lock); - // elm_genlist_item_display_only_set(sti->item, EINA_TRUE); - return strdup("Loading.."); - } - */ - } - eina_lock_release(&sti->lock); - } - return NULL; -} - -static Evas_Object * -_item_content_get(void *data, Evas_Object *obj, const char *part) -{ - Elm_Store_Item *sti = data; - Elm_Store *st = sti->store; - - if (st->live && sti->item) - { - eina_lock_take(&sti->lock); - if (sti->data) - { - const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part); - if (m) - { - Evas_Object *ic = NULL; - const char *s = NULL; - - switch (m->type) - { - case ELM_STORE_ITEM_MAPPING_ICON: - ic = elm_icon_add(obj); - s = *(char **)(((unsigned char *)sti->data) + m->offset); - elm_icon_order_lookup_set(ic, m->details.icon.lookup_order); - evas_object_size_hint_aspect_set(ic, - EVAS_ASPECT_CONTROL_VERTICAL, - m->details.icon.w, - m->details.icon.h); - elm_icon_smooth_set(ic, m->details.icon.smooth); - elm_icon_no_scale_set(ic, m->details.icon.no_scale); - elm_icon_scale_set(ic, - m->details.icon.scale_up, - m->details.icon.scale_down); - - if (s) - { - if (m->details.icon.standard_name) - elm_icon_standard_set(ic, s); - else - elm_icon_file_set(ic, s, NULL); - } - break; - - case ELM_STORE_ITEM_MAPPING_PHOTO: - ic = elm_icon_add(obj); - s = *(char **)(((unsigned char *)sti->data) + m->offset); - elm_photo_size_set(ic, m->details.photo.size); - if (s) - elm_photo_file_set(ic, s); - break; - - case ELM_STORE_ITEM_MAPPING_CUSTOM: - if (m->details.custom.func) - ic = m->details.custom.func(sti->data, sti, part); - break; - - default: - break; - } - eina_lock_release(&sti->lock); - return ic; - } - } - eina_lock_release(&sti->lock); - } - return NULL; -} - -static Elm_Store * -_store_init(size_t size) -{ - Elm_Store *st = calloc(1, size); - EINA_SAFETY_ON_NULL_RETURN_VAL(st, NULL); - - eina_magic_string_set(ELM_STORE_MAGIC, "Elm_Store"); - eina_magic_string_set(ELM_STORE_ITEM_MAGIC, "Elm_Store_Item"); - eina_magic_string_set(ELM_STORE_DBSYSTEM_MAGIC, "Elm_Store_DBsystem"); - - _store_item_class.item_style = "default"; - _store_item_class.func.text_get = (GenlistItemTextGetFunc)_item_text_get; - _store_item_class.func.content_get = (GenlistItemContentGetFunc)_item_content_get; - _store_item_class.func.state_get = NULL; - _store_item_class.func.del = NULL; - - EINA_MAGIC_SET(st, ELM_STORE_MAGIC); - st->cache_max = CACHE_COUNT; - st->live = EINA_TRUE; - st->fetch_thread = EINA_FALSE; - st->type = 1; - return st; -} - -#define _store_new(type) (type *)_store_init(sizeof(type)) - -static void -_genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Elm_Store *st = data; - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - - st->genlist = NULL; - if (st->list_th) - { - ecore_thread_cancel(st->list_th); - st->list_th = NULL; - } - st->realized = eina_list_free(st->realized); -} - -static void -_store_fetch_do(void *data, Ecore_Thread *th __UNUSED__) -{ - Elm_Store_Item *sti = data; - - eina_lock_take(&sti->lock); - if (sti->data) - { - eina_lock_release(&sti->lock); - return; - } - if (!sti->fetched) - { - if (sti->item_info != NULL) - { - eina_lock_release(&sti->lock); - if (sti->store->cb.fetch.func) - sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti, sti->item_info); - eina_lock_take(&sti->lock); - sti->fetched = EINA_TRUE; - } - } - eina_lock_release(&sti->lock); -} - -static void -_store_fetch_end(void *data, Ecore_Thread *th) -{ - Elm_Store_Item *sti = data; - eina_lock_take(&sti->lock); - if (sti->data) elm_genlist_item_update((Elm_Object_Item *) sti->item); - eina_lock_release(&sti->lock); - if (th == sti->fetch_th) sti->fetch_th = NULL; -} - -static void -_store_fetch_cancel(void *data, Ecore_Thread *th) -{ - Elm_Store_Item *sti = data; - eina_lock_take(&sti->lock); - if (th == sti->fetch_th) sti->fetch_th = NULL; - // if(sti->data) elm_genlist_item_update(sti->item); - eina_lock_release(&sti->lock); -} - -static void -_item_eval(void *data) -{ - Elm_Store_Item *sti = data; - if (!sti) return; - Elm_Store *st = sti->store; - - if (sti->fetched == EINA_FALSE) - { - if (st->fetch_thread && !sti->fetch_th) - { - sti->fetch_th = ecore_thread_run(_store_fetch_do, _store_fetch_end, _store_fetch_cancel, sti); - } - else if (!st->fetch_thread) - { - _store_fetch_do(sti,NULL); - _store_fetch_end(sti,NULL); - } - } - else - { - eina_lock_take(&sti->lock); - if (!sti->fetched) - { - eina_lock_release(&sti->lock); - if (sti->fetch_th) - { - ecore_thread_cancel(sti->fetch_th); - sti->fetch_th = NULL; - } - eina_lock_take(&sti->lock); - } - sti->fetched = EINA_FALSE; - eina_lock_release(&sti->lock); - if (st->cb.unfetch.func) - st->cb.unfetch.func(st->cb.unfetch.data, sti, sti->item_info); - eina_lock_take(&sti->lock); - sti->data = NULL; - eina_lock_release(&sti->lock); - } -} - -static void -_item_realize(void *data) -{ - Elm_Store_Item *sti = data; - Elm_Store *st = sti->store; - sti->eval_job = NULL; - if (st->live) - { - Eina_List *find = NULL; - find = eina_list_data_find_list(st->always_fetched, sti); - if (find) return; - - find = eina_list_data_find_list(st->realized,sti); - if (find) - { - Elm_Store_Item *realized_sti = NULL; - realized_sti = eina_list_data_get(find); - st->realized = eina_list_remove_list(st->realized, find); - _item_eval(realized_sti); - } - if (st->realized) - { - if ((int)eina_list_count(st->realized) == st->cache_max) - { - Elm_Store_Item *realized_sti = NULL; - Eina_List *last = eina_list_last(st->realized); - realized_sti = eina_list_data_get(last); - st->realized = eina_list_remove_list(st->realized, last); - _item_eval(realized_sti); - } - } - st->realized = eina_list_prepend(st->realized, sti); - _item_eval(sti); - } -} - -static void -_item_job_add(Elm_Store_Item *sti) -{ - if (sti->eval_job) ecore_job_del(sti->eval_job); - sti->eval_job = ecore_job_add(_item_realize, sti); -} - -static void -_item_fetch(Elm_Store_Item *sti) -{ - Elm_Store *st = sti->store; - - if (st->live) - { - eina_lock_take(&sti->lock); - if (!sti->fetched) - { - eina_lock_release(&sti->lock); - if (sti->fetch_th) - { - ecore_thread_cancel(sti->fetch_th); - sti->fetch_th = NULL; - } - eina_lock_take(&sti->lock); - } - if (sti->item_info != NULL) - { - eina_lock_release(&sti->lock); - if (sti->store->cb.fetch.func) - sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti, sti->item_info); - eina_lock_take(&sti->lock); - sti->fetched = EINA_TRUE; - } - eina_lock_release(&sti->lock); - } -} - -static void -_item_unfetch(Elm_Store_Item *sti) -{ - EINA_SAFETY_ON_NULL_RETURN(sti); - Elm_Store *st = sti->store; - - if (st->live) - { - eina_lock_take(&sti->lock); - if (!sti->fetched) - { - eina_lock_release(&sti->lock); - if (sti->fetch_th) - { - ecore_thread_cancel(sti->fetch_th); - sti->fetch_th = NULL; - } - eina_lock_take(&sti->lock); - } - sti->fetched = EINA_FALSE; - eina_lock_release(&sti->lock); - if (st->cb.unfetch.func) - st->cb.unfetch.func(st->cb.unfetch.data, sti, sti->item_info); - eina_lock_take(&sti->lock); - sti->data = NULL; - eina_lock_release(&sti->lock); - } -} - -static void -_item_realized(void *data , Evas_Object *obj __UNUSED__, void *event_info) -{ - Elm_Store *st = data; - if (!st) return; - Elm_Object_Item *gli = event_info; - Elm_Store_Item *sti = elm_genlist_item_data_get(gli); - if (!sti) return; - - if (st->live) - { - if (!sti->data) _item_job_add(sti); - } - // TODO: -} - -static void -_item_unrealized(void *data , Evas_Object *obj __UNUSED__, void *event_info) -{ - Elm_Store *st = data; - if (!st) return; - Elm_Object_Item *gli = event_info; - Elm_Store_Item *sti = elm_genlist_item_data_get(gli); - if (!sti) return; - - if (st->live) - { - if (sti->eval_job) - { - ecore_job_del(sti->eval_job); - sti->eval_job = NULL; - } - } -} - -static void -_item_free(Elm_Store_Item *sti) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return; - Elm_Store *st = sti->store; - eina_lock_take(&sti->lock); - if (st->live && st->cb.item_free.func && sti->item_info) - { - eina_lock_release(&sti->lock); - st->cb.item_free.func(st->cb.item_free.data, sti->item_info); - eina_lock_take(&sti->lock); - sti->item_info = NULL; - } - eina_lock_release(&sti->lock); - eina_lock_take(&sti->lock); - free(sti); -} - -static void -_item_del(void *data, Evas_Object *obj __UNUSED__) -{ - Elm_Store_Item *sti = data; - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return; - Elm_Store *st = sti->store; - - if (sti->eval_job) - { - ecore_job_del(sti->eval_job); - sti->eval_job = NULL; - } - - Eina_List *find = NULL; - find = eina_list_data_find_list(st->always_fetched, sti); - if (find) return; - - find = eina_list_data_find_list(st->realized,sti); - if (find) - { - Elm_Store_Item *realized_sti = NULL; - realized_sti = eina_list_data_get(find); - st->realized = eina_list_remove_list(st->realized, find); - } - if (sti->data) _item_unfetch(sti); - if (st->item.free) st->item.free(sti); -} - -static void -_list_do(void *data, Ecore_Thread *th) -{ - Elm_Store *st = data; - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - - Elm_Store_Item_Info *item_info; - Eina_Bool ok = EINA_FALSE; - int loop; - for (loop = 0; loop < st->item_count; loop++) - { - item_info = calloc(1, sizeof(Elm_Store_Item_Info)); - if (!item_info) return; - item_info->index = loop; - - if (st->cb.list.func) ok = st->cb.list.func(st->cb.list.data, item_info); - if (ok) ecore_thread_feedback(th, item_info); - else free(item_info); - if (ecore_thread_check(th)) break; - } -} - -static void -_list_update(void *data, Ecore_Thread *th __UNUSED__, void *msg) -{ - Elm_Store *st = data; - Elm_Store_Item_Info *info = msg; - elm_store_item_add(st, info); -} - -static void -_list_end(void *data, Ecore_Thread *th) -{ - Elm_Store *st = data; - if (th == st->list_th) st->list_th = NULL; -} - -static void -_list_cancel(void *data, Ecore_Thread *th) -{ - Elm_Store *st = data; - if (th == st->list_th) st->list_th = NULL; -} - -static void -_group_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return; - Elm_Store *st = sti->store; - if (st->live) - { - if (st->always_fetched) - { - Eina_Bool group_existed = EINA_FALSE; - const Eina_List *l = st->always_fetched; - Elm_Store_Item *group_sti = eina_list_data_get(l); - while (!group_existed && group_sti) - { - if (group_sti->item_info->group_index == sti->item_info->group_index) - { - group_existed = EINA_TRUE; - break; - } - else - { - l = eina_list_next(l); - group_sti = eina_list_data_get(l); - } - } - if (group_existed) return; //Already existed the group item - } - st->always_fetched = eina_list_append(st->always_fetched, sti); - sti->realized = EINA_FALSE; - if (sti->data) _item_unfetch(sti); - _item_fetch(sti); - - if (sti->item_info->group_index == -1) - { - sti->item = elm_genlist_item_append(st->genlist, - itc, - sti, - NULL, - ELM_GENLIST_ITEM_NONE, - (Evas_Smart_Cb)sti->store->cb.item_select.func, - (void *)sti->store->cb.item_select.data); - return; - } - } -} - -static void -_normal_item_append(Elm_Store_Item *sti, Elm_Genlist_Item_Class *itc) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return; - Elm_Store *st = sti->store; - if (st->live && sti->item_info) - { - Eina_Bool need_update = EINA_FALSE; - Eina_Bool group_existed = EINA_FALSE; - const Eina_List *l; - - if (st->always_fetched) - { - if (sti->item_info->rec_item == EINA_TRUE) - { - if (sti->item_info->group_index != sti->item_info->pre_group_index) - { - if (sti->item_info->group_index < sti->item_info->pre_group_index) - { - Eina_Bool pre_group_existed = EINA_FALSE; - l = st->always_fetched; - Elm_Store_Item *pre_group_sti = eina_list_data_get(l); - while (!pre_group_existed && pre_group_sti) - { - if (pre_group_sti->item_info->pre_group_index == sti->item_info->pre_group_index) - { - pre_group_existed = EINA_TRUE; - break; - } - else - { - l = eina_list_next(l); - pre_group_sti = eina_list_data_get(l); - } - } - if (pre_group_sti && pre_group_sti->realized) // already added the header item to the genlist - { - Eina_Bool deleted = EINA_FALSE; - Eina_Bool last_item = EINA_FALSE; - Elm_Object_Item *comp_item = pre_group_sti->first_item; - while (!deleted && comp_item) - { - Elm_Store_Item *comp_sti = elm_genlist_item_data_get(comp_item); - if (comp_sti) - { - int sort = st->cb.item_sort.func(st->cb.item_sort.data, sti->item_info, comp_sti->item_info); - if(sort == ELM_STORE_ITEM_SORT_SAME) - { - elm_store_item_del(comp_sti); - deleted = EINA_TRUE; - break; - } - } - if (last_item) break; - else comp_item = elm_genlist_item_next_get(comp_item); - - if (comp_item == pre_group_sti->last_item) last_item = EINA_TRUE; - } - if (!deleted) printf(" The item does not existed in the pre group of genlist \n"); - } - else //Pre group item does not existed in the always fetched list or the genlist - { - Eina_Bool deleted = EINA_FALSE; - Elm_Object_Item *comp_item = elm_genlist_first_item_get(st->genlist); - while (!deleted && comp_item) - { - Elm_Store_Item *comp_sti = elm_genlist_item_data_get(comp_item); - if (comp_sti && sti->item_info->item_type == comp_sti->item_info->item_type) - { - int sort = st->cb.item_sort.func(st->cb.item_sort.data, sti->item_info, comp_sti->item_info); - if (sort == ELM_STORE_ITEM_SORT_SAME) - { - elm_store_item_del(comp_sti); - deleted = EINA_TRUE; - break; - } - } - comp_item = elm_genlist_item_next_get(comp_item); - } - if (!deleted) printf(" The item does not existed in the genlist \n"); - } - } - else - { - sti->item_info->group_index = sti->item_info->pre_group_index; - need_update = EINA_TRUE; - } - } - else need_update = EINA_TRUE; - } - l = st->always_fetched; - Elm_Store_Item *group_sti = eina_list_data_get(l); - while (!group_existed && group_sti) // Search the group item of a normal item in the always_fetched list - { - if (group_sti->item_info->group_index == sti->item_info->group_index) - { - group_existed = EINA_TRUE; - break; - } - else - { - l = eina_list_next(l); - group_sti = eina_list_data_get(l); - } - } - if (group_sti) - { - if (group_sti->realized) // already added the header item to the genlist - { - Eina_Bool added = EINA_FALSE; - Elm_Object_Item *comp_item = group_sti->first_item; - while (!added && comp_item) - { - Elm_Store_Item *comp_sti = elm_genlist_item_data_get(comp_item); - if (comp_sti) - { - int sort = st->cb.item_sort.func(st->cb.item_sort.data, sti->item_info, comp_sti->item_info); - if (sort == ELM_STORE_ITEM_SORT_SAME) - { - if (need_update == EINA_TRUE) elm_store_item_update(comp_sti); - else added = EINA_TRUE; - break; - } - else if (sort == ELM_STORE_ITEM_SORT_LOW) - { - sti->item = elm_genlist_item_insert_before(st->genlist, - itc, - sti, - group_sti->item, - comp_item, - ELM_GENLIST_ITEM_NONE, - (Evas_Smart_Cb)sti->store->cb.item_select.func, - (void *)sti->store->cb.item_select.data); - - if (comp_item == group_sti->first_item) group_sti->first_item = sti->item; - added = EINA_TRUE; - break; - } - - if (comp_item == group_sti->last_item) //To add the item in to the last of its group - { - need_update = EINA_FALSE; - break; - } - } - comp_item = elm_genlist_item_next_get(comp_item); - } - if (!added && !need_update) - { - Elm_Object_Item *last_item = group_sti->last_item; - if (last_item) - { - sti->item = elm_genlist_item_insert_after(st->genlist, - itc, - sti, - group_sti->item, - last_item, - ELM_GENLIST_ITEM_NONE, - (Evas_Smart_Cb)sti->store->cb.item_select.func, - (void *)sti->store->cb.item_select.data); - group_sti->last_item = sti->item; - } - else printf(" Group item have no last item. so can not add a item to the genlist \n"); - } - } - else // To add the header item in genlist, and compare with other header items along with callback func - { - Eina_Bool added = EINA_FALSE; - l = st->always_fetched; - Elm_Store_Item *comp_group_sti = eina_list_data_get(l); - while (!added && comp_group_sti) - { - if (comp_group_sti != group_sti && comp_group_sti->realized) - { - // Compare with group items - int sort = st->cb.item_sort.func(st->cb.item_sort.data, group_sti->item_info, comp_group_sti->item_info); - if(sort == ELM_STORE_ITEM_SORT_LOW) - { - group_sti->item = elm_genlist_item_insert_before(st->genlist, - group_sti->item_info->item_class, - group_sti, - NULL, - comp_group_sti->item, - ELM_GENLIST_ITEM_GROUP, - NULL, NULL); - - group_sti->realized = EINA_TRUE; - sti->item = elm_genlist_item_insert_after(st->genlist, - itc, - sti, - group_sti->item, - group_sti->item, - ELM_GENLIST_ITEM_NONE, - (Evas_Smart_Cb)sti->store->cb.item_select.func, - (void *)sti->store->cb.item_select.data); - - group_sti->first_item = sti->item; - group_sti->last_item = sti->item; - added = EINA_TRUE; - break; - } - } - l = eina_list_next(l); - comp_group_sti = eina_list_data_get(l); - } - if (!comp_group_sti) // First item append in the genlist - { - group_sti->item = elm_genlist_item_append(st->genlist, - group_sti->item_info->item_class, - group_sti, - NULL, - ELM_GENLIST_ITEM_GROUP, - NULL, NULL); - - group_sti->realized = EINA_TRUE; - sti->item = elm_genlist_item_append(st->genlist, - itc, - sti, - group_sti->item, - ELM_GENLIST_ITEM_NONE, - (Evas_Smart_Cb)sti->store->cb.item_select.func, - (void *)sti->store->cb.item_select.data); - - group_sti->first_item = sti->item; - group_sti->last_item = sti->item; - } - } - } - } - if (!group_existed) // No exist the group item of normal item, so it added without group. - { - Eina_Bool added = EINA_FALSE; - Elm_Object_Item *comp_item = elm_genlist_first_item_get(st->genlist); - while (!added && comp_item) - { - Elm_Store_Item *comp_sti = elm_genlist_item_data_get(comp_item); - if (comp_sti) - { - if (sti->item_info->item_type == comp_sti->item_info->item_type) - { - int sort = st->cb.item_sort.func(st->cb.item_sort.data, sti->item_info, comp_sti->item_info); - if (sort == ELM_STORE_ITEM_SORT_SAME) - { - if (sti->item_info->rec_item == EINA_TRUE) - { - elm_store_item_update(comp_sti); - need_update = EINA_TRUE; - } - else added = EINA_TRUE; - break; - } - else if (sort == ELM_STORE_ITEM_SORT_LOW) - { - sti->item = elm_genlist_item_insert_before(st->genlist, - itc, - sti, - NULL, - comp_item, - ELM_GENLIST_ITEM_NONE, - (Evas_Smart_Cb)sti->store->cb.item_select.func, - (void *)sti->store->cb.item_select.data); - - added = EINA_TRUE; - break; - } - } - } - comp_item = elm_genlist_item_next_get(comp_item); - if (comp_item == NULL) need_update = EINA_FALSE; - } - if (!added && !need_update) - { - sti->item = elm_genlist_item_append(st->genlist, - itc, - sti, - NULL, - ELM_GENLIST_ITEM_NONE, - (Evas_Smart_Cb)sti->store->cb.item_select.func, - (void *)sti->store->cb.item_select.data); - } - } - } -} - -static void -_store_free(Elm_Store *st) -{ - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - Elm_Store_DBsystem *std = (Elm_Store_DBsystem *)st; - if(std->p_db) eina_stringshare_del(std->p_db); -} - -/** - * Add a new dbsystem Store object - * - * @return The new object or NULL if it cannot be created - * - * @ingroup Store - */ -EAPI Elm_Store * -elm_store_dbsystem_new(void) -{ - Elm_Store_DBsystem *std = _store_new(Elm_Store_DBsystem); - EINA_SAFETY_ON_NULL_RETURN_VAL(std, NULL); - - EINA_MAGIC_SET(std, ELM_STORE_DBSYSTEM_MAGIC); - std->base.free = _store_free; - std->base.item.free = _item_free; - return &std->base; -} - -/** - * Sets the item count of a store - * - * @param st The store object - * @param count The item count of an store - * - * @ingroup Store - */ -EAPI void -elm_store_item_count_set(Elm_Store *st, int count) -{ - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - st->item_count = count; -} - - -/** - * Set the select func that select the state of a list item whether true or false - * - * @param st The store object - * @param func The select cb function of an store - * @param data The new data pointer to set - * - * @ingroup Store - */ -EAPI void -elm_store_item_select_func_set(Elm_Store *st, Elm_Store_Item_Select_Cb func, const void *data) -{ - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - st->cb.item_select.func = func; - st->cb.item_select.data = (void *)data; -} - -/** - * Sets the sort func that sort the item with a next in the list - * - * @param st The store object - * @param func The sort cb function of an store - * @param data The new data pointer to set - * - * @ingroup Store - */ -EAPI void -elm_store_item_sort_func_set(Elm_Store *st, Elm_Store_Item_Sort_Cb func, const void *data) -{ - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - st->cb.item_sort.func = func; - st->cb.item_sort.data = (void *)data; -} - -/** - * Set the store item free func - * - * @param st The store object - * @param func The free cb function of an store - * @param data The new data pointer to set - * - * @ingroup Store - */ -EAPI void -elm_store_item_free_func_set(Elm_Store *st, Elm_Store_Item_Free_Cb func, const void *data) -{ - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - st->cb.item_free.func = func; - st->cb.item_free.data = (void *)data; -} - -/** - * Get the item index that included header items - * - * @param sti The store item object - * @return The item index in genlist - * - * @ingroup Store - */ -EAPI int -elm_store_item_index_get(const Elm_Store_Item *sti) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return -1; - Elm_Store *st = sti->store; - - if (st->live) - { - int index = 0; - if (st->genlist) - { - Elm_Object_Item *gen_item = elm_genlist_first_item_get(st->genlist); - while (gen_item) - { - Elm_Store_Item *item = elm_genlist_item_data_get(gen_item); - if (item == sti) return index; - gen_item = elm_genlist_item_next_get(gen_item); - index++; - } - } - } - return -1; -} - -/** - * Get the item index of real data that don't included header items - * - * @param sti The store item object - * @return The real item index - * - * @ingroup Store - */ -EAPI int -elm_store_item_data_index_get(const Elm_Store_Item *sti) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return -1; - Elm_Store *st = sti->store; - - if (st->live) - { - int index = 0; - Elm_Object_Item *gen_item = elm_genlist_first_item_get(st->genlist); - while (gen_item) - { - Elm_Store_Item *item = elm_genlist_item_data_get(gen_item); - if (item && item->item_info->item_type != ELM_GENLIST_ITEM_GROUP) - { - if(item == sti) return index; - index++; - } - gen_item = elm_genlist_item_next_get(gen_item); - } - } - return -1; -} - -/** - * Get the DB pointer of an item - * - * @param sti The store item object - * @return The DB pointer of item - * - * @ingroup Store - */ -EAPI void * -elm_store_dbsystem_db_get(const Elm_Store_Item *sti) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL; - - const Elm_Store_DBsystem *std = (const Elm_Store_DBsystem *)sti->store; - if (!EINA_MAGIC_CHECK(sti->store, ELM_STORE_MAGIC)) return NULL; - if (!EINA_MAGIC_CHECK(std, ELM_STORE_DBSYSTEM_MAGIC)) return NULL; - return std->p_db; -} - -/** - * Set the DB pointer of an item - * - * @param sti The store item object - * @parm p_db The DB pointer of item - * - * @ingroup Store - */ -EAPI void -elm_store_dbsystem_db_set(Elm_Store *store, void *p_db) -{ - Elm_Store_DBsystem *std = (Elm_Store_DBsystem *)store; - if (!EINA_MAGIC_CHECK(store, ELM_STORE_MAGIC)) return; - if (!EINA_MAGIC_CHECK(std, ELM_STORE_DBSYSTEM_MAGIC)) return; - if (store->list_th) - { - ecore_thread_cancel(store->list_th); - store->list_th = NULL; - } - std->p_db = p_db; - store->list_th = ecore_thread_feedback_run(_list_do, - _list_update, - _list_end, - _list_cancel, - store, EINA_TRUE); -} - -/** - * Append the item to the genlist - * - * @param st The store object - * @param info The store item info dbsystem object - * @return The item of store - * - * @ingroup Store - */ -EAPI Elm_Store_Item * -elm_store_item_add(Elm_Store *st, Elm_Store_Item_Info *info) -{ - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return NULL; - EINA_SAFETY_ON_NULL_RETURN_VAL(info, NULL); - Elm_Store_Item *sti; - Elm_Genlist_Item_Class *itc; - - sti = calloc(1, sizeof(Elm_Store_Item)); - if (!sti) return NULL; - eina_lock_new(&sti->lock); - EINA_MAGIC_SET(sti, ELM_STORE_ITEM_MAGIC); - sti->store = st; - sti->item_info = info; - sti->fetched = EINA_FALSE; - - itc = info->item_class; - if (!itc) itc = &_store_item_class; - else - { - itc->func.text_get = (GenlistItemTextGetFunc)_item_text_get; - itc->func.content_get = (GenlistItemContentGetFunc)_item_content_get; - itc->func.state_get = NULL; - itc->func.del = (GenlistItemDelFunc)_item_del; - } - - if (st->live) - { - if (sti->item_info->item_type == ELM_GENLIST_ITEM_GROUP) _group_item_append(sti, itc); - else _normal_item_append(sti, itc); - return sti; - } - else - { - free(sti); - return NULL; - } -} - -/** - * Realize the visible items to the screen - * - * @param st The store object - * - * @ingroup Store - */ -EAPI void -elm_store_visible_items_update(Elm_Store *st) -{ - if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; - - Eina_List *realized_list = elm_genlist_realized_items_get(st->genlist); - Elm_Object_Item *item = eina_list_data_get(realized_list); - while (item) - { - Elm_Store_Item *realized_sti = elm_genlist_item_data_get(item); - elm_store_item_update(realized_sti); - realized_list = eina_list_next(realized_list); - item = eina_list_data_get(realized_list); - } -} - -/** - * Realize the item to the screen - * - * @param sti The store item object - * - * @ingroup Store - */ -EAPI void -elm_store_item_update(Elm_Store_Item *sti) -{ - Elm_Store *st = sti->store; - - Eina_List *find = NULL; - find = eina_list_data_find_list(st->always_fetched, sti); - if (find) - { - if (sti->data) _item_unfetch(sti); - _item_fetch(sti); - if (sti->realized) elm_genlist_item_update(sti->item); - } - else - { - find = eina_list_data_find_list(st->realized,sti); - if (find) _item_realize(sti); - } -} - -/** - * Delete the item of genlist - * - * @param sti The store item object - * - * @ingroup Store - */ -EAPI void -elm_store_item_del(Elm_Store_Item *sti) -{ - if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return; - Elm_Store *st = sti->store; - - if (st->live) - { - Eina_List *find = NULL; - find = eina_list_data_find_list(st->always_fetched, sti); - if (find) st->always_fetched = eina_list_remove_list(st->always_fetched, find); - - Eina_Bool deleted = EINA_FALSE; - Elm_Object_Item *comp_item = elm_genlist_first_item_get(st->genlist); - while (!deleted && comp_item) - { - Elm_Store_Item *comp_sti = elm_genlist_item_data_get(comp_item); - if (comp_sti && (sti == comp_sti)) - { - Elm_Object_Item *group_item = elm_genlist_item_parent_get(comp_item); - if (group_item) - { - Elm_Store_Item *group_sti = elm_genlist_item_data_get(group_item); - if (group_sti) - { - if ((group_sti->first_item == comp_item) && (group_sti->last_item == comp_item)) - { - group_sti->realized = EINA_FALSE; - group_sti->first_item = NULL; - group_sti->last_item = NULL; - elm_genlist_item_del(group_item); - } - else if ((group_sti->first_item == comp_item) && (group_sti->last_item != comp_item)) - { - Elm_Object_Item *next_item = elm_genlist_item_next_get(comp_item); - group_sti->first_item = next_item; - } - else if ((group_sti->first_item != comp_item) && (group_sti->last_item == comp_item)) - { - Elm_Object_Item *prev_item = elm_genlist_item_prev_get(comp_item); - group_sti->last_item = prev_item; - } - } - } - elm_genlist_item_del(comp_sti->item); - deleted = EINA_TRUE; - break; - } - comp_item = elm_genlist_item_next_get(comp_item); - } - - if(!deleted) printf(" Not deleted because it does not existed in the genlist \n"); - } -} - -// TODO: END -DBsystem store - -======= ->>>>>>> remotes/origin/upstream diff --git a/src/lib/elm_store.h b/src/lib/elm_store.h index 7b85b55..e57b76b 100644 --- a/src/lib/elm_store.h +++ b/src/lib/elm_store.h @@ -1,26 +1,3 @@ -<<<<<<< HEAD -typedef struct _Elm_Store Elm_Store; -typedef struct _Elm_Store_DBsystem Elm_Store_DBsystem; -typedef struct _Elm_Store_Filesystem Elm_Store_Filesystem; -typedef struct _Elm_Store_Item Elm_Store_Item; -typedef struct _Elm_Store_Item_DBsystem Elm_Store_Item_DBsystem; -typedef struct _Elm_Store_Item_Filesystem Elm_Store_Item_Filesystem; -typedef struct _Elm_Store_Item_Info Elm_Store_Item_Info; -typedef struct _Elm_Store_Item_Info_Filesystem Elm_Store_Item_Info_Filesystem; -typedef struct _Elm_Store_Item_Mapping Elm_Store_Item_Mapping; -typedef struct _Elm_Store_Item_Mapping_Empty Elm_Store_Item_Mapping_Empty; -typedef struct _Elm_Store_Item_Mapping_Icon Elm_Store_Item_Mapping_Icon; -typedef struct _Elm_Store_Item_Mapping_Photo Elm_Store_Item_Mapping_Photo; -typedef struct _Elm_Store_Item_Mapping_Custom Elm_Store_Item_Mapping_Custom; - -typedef Eina_Bool (*Elm_Store_Item_List_Cb) (void *data, Elm_Store_Item_Info *info); -typedef void (*Elm_Store_Item_Fetch_Cb) (void *data, Elm_Store_Item *sti, Elm_Store_Item_Info *info); -typedef void (*Elm_Store_Item_Unfetch_Cb) (void *data, Elm_Store_Item *sti, Elm_Store_Item_Info *info); -typedef void (*Elm_Store_Item_Select_Cb) (void *data, Elm_Store_Item *sti); -typedef int (*Elm_Store_Item_Sort_Cb) (void *data, Elm_Store_Item_Info *info1, Elm_Store_Item_Info *info2); -typedef void (*Elm_Store_Item_Free_Cb) (void *data, Elm_Store_Item_Info *info); -typedef void *(*Elm_Store_Item_Mapping_Cb) (void *data, Elm_Store_Item *sti, const char *part); -======= /** * @defgroup Store Elementary Store * @@ -91,40 +68,20 @@ typedef Eina_Bool (*Elm_Store_Item_List_Cb)(void *dat typedef void (*Elm_Store_Item_Fetch_Cb)(void *data, Elm_Store_Item *sti); /**< Function to call to fetch item data */ typedef void (*Elm_Store_Item_Unfetch_Cb)(void *data, Elm_Store_Item *sti); /**< Function to cal lto un-fetch (free) an item */ typedef void *(*Elm_Store_Item_Mapping_Cb)(void *data, Elm_Store_Item *sti, const char *part); /**< Custom mapping function to call */ ->>>>>>> remotes/origin/upstream typedef enum { ELM_STORE_ITEM_MAPPING_NONE = 0, -<<<<<<< HEAD - ELM_STORE_ITEM_MAPPING_LABEL, // const char * -> label - ELM_STORE_ITEM_MAPPING_STATE, // Eina_Bool -> state - ELM_STORE_ITEM_MAPPING_ICON, // char * -> icon path - ELM_STORE_ITEM_MAPPING_PHOTO, // char * -> photo path - ELM_STORE_ITEM_MAPPING_CUSTOM, // item->custom(it->data, it, part) -> void * (-> any) - // can add more here as needed by common apps -======= ELM_STORE_ITEM_MAPPING_LABEL, /**< const char * -> label */ ELM_STORE_ITEM_MAPPING_STATE, /**< Eina_Bool -> state */ ELM_STORE_ITEM_MAPPING_ICON, /**< char * -> icon path */ ELM_STORE_ITEM_MAPPING_PHOTO, /**< char * -> photo path */ ELM_STORE_ITEM_MAPPING_CUSTOM, /**< item->custom(it->data, it, part) -> void * (-> any) */ ->>>>>>> remotes/origin/upstream ELM_STORE_ITEM_MAPPING_LAST } Elm_Store_Item_Mapping_Type; struct _Elm_Store_Item_Mapping_Icon { -<<<<<<< HEAD - // FIXME: allow edje file icons - int w, h; - Elm_Icon_Lookup_Order lookup_order; - Eina_Bool standard_name : 1; - Eina_Bool no_scale : 1; - Eina_Bool smooth : 1; - Eina_Bool scale_up : 1; - Eina_Bool scale_down : 1; -======= int w, h; /**< The desired icon size in addition to the file path returned from the mapping */ Elm_Icon_Lookup_Order lookup_order; /**< The order in which to find the icon */ Eina_Bool standard_name : 1; /**< Use a standard name to find it (EINA_TRUE) or not */ @@ -132,47 +89,28 @@ struct _Elm_Store_Item_Mapping_Icon Eina_Bool smooth : 1; /**< EINA_TRUE if icon is to be smooth scaled */ Eina_Bool scale_up : 1; /**< EINA_TRUE if scaling up is allowed */ Eina_Bool scale_down : 1; /**< EINA_TRUE if scaling down is allowed */ ->>>>>>> remotes/origin/upstream }; struct _Elm_Store_Item_Mapping_Empty { -<<<<<<< HEAD - Eina_Bool dummy; -======= Eina_Bool dummy; /**< dummy entry - set to anything you like */ ->>>>>>> remotes/origin/upstream }; struct _Elm_Store_Item_Mapping_Photo { -<<<<<<< HEAD - int size; -======= int size; /**< Photo size to use (see elm_photo_add()) with the given photo path */ ->>>>>>> remotes/origin/upstream }; struct _Elm_Store_Item_Mapping_Custom { -<<<<<<< HEAD - Elm_Store_Item_Mapping_Cb func; -======= Elm_Store_Item_Mapping_Cb func; /**< The function called to do the custom mapping and return it */ ->>>>>>> remotes/origin/upstream }; struct _Elm_Store_Item_Mapping { -<<<<<<< HEAD - Elm_Store_Item_Mapping_Type type; - const char *part; - int offset; -======= Elm_Store_Item_Mapping_Type type; /**< what kind of mapping is this */ const char *part; /**< what part name in the genlist item is this filling in */ int offset; /**< offset in memory (in bytes) relative to base of structure for item data where the data for the mapping lives */ ->>>>>>> remotes/origin/upstream union { Elm_Store_Item_Mapping_Empty empty; @@ -180,174 +118,11 @@ struct _Elm_Store_Item_Mapping Elm_Store_Item_Mapping_Photo photo; Elm_Store_Item_Mapping_Custom custom; // add more types here -<<<<<<< HEAD - } details; -======= } details; /**< Allowed to be one of these possible mapping types */ ->>>>>>> remotes/origin/upstream }; struct _Elm_Store_Item_Info { -<<<<<<< HEAD - int index; - int item_type; - int group_index; - Eina_Bool rec_item; - int pre_group_index; - - Elm_Genlist_Item_Class *item_class; - const Elm_Store_Item_Mapping *mapping; - void *data; - char *sort_id; -}; - - -struct _Elm_Store_Item_Info_Filesystem -{ - Elm_Store_Item_Info base; - char *path; -}; - -#define ELM_STORE_ITEM_MAPPING_END { ELM_STORE_ITEM_MAPPING_NONE, NULL, 0, { .empty = { EINA_TRUE } } } -#define ELM_STORE_ITEM_MAPPING_OFFSET(st, it) offsetof(st, it) - -EAPI void elm_store_free(Elm_Store *st); - -EAPI Elm_Store *elm_store_filesystem_new(void); -EAPI void elm_store_filesystem_directory_set(Elm_Store *st, const char *dir); -EAPI const char *elm_store_filesystem_directory_get(const Elm_Store *st); -EAPI const char *elm_store_item_filesystem_path_get(const Elm_Store_Item *sti); - -EAPI void elm_store_target_genlist_set(Elm_Store *st, Evas_Object *obj); - -EAPI void elm_store_cache_set(Elm_Store *st, int max); -EAPI int elm_store_cache_get(const Elm_Store *st); -EAPI void elm_store_list_func_set(Elm_Store *st, Elm_Store_Item_List_Cb func, const void *data); -EAPI void elm_store_fetch_func_set(Elm_Store *st, Elm_Store_Item_Fetch_Cb func, const void *data); -EAPI void elm_store_fetch_thread_set(Elm_Store *st, Eina_Bool use_thread); -EAPI Eina_Bool elm_store_fetch_thread_get(const Elm_Store *st); - -EAPI void elm_store_unfetch_func_set(Elm_Store *st, Elm_Store_Item_Unfetch_Cb func, const void *data); -EAPI void elm_store_sorted_set(Elm_Store *st, Eina_Bool sorted); -EAPI Eina_Bool elm_store_sorted_get(const Elm_Store *st); -EAPI void elm_store_item_data_set(Elm_Store_Item *sti, void *data); -EAPI void *elm_store_item_data_get(Elm_Store_Item *sti); -EAPI const Elm_Store *elm_store_item_store_get(const Elm_Store_Item *sti); -EAPI const Elm_Object_Item *elm_store_item_genlist_item_get(const Elm_Store_Item *sti); - -/** - * dbsystem Store object - * - * @addtogroup DBStore - * @{ - * - * @return The new object or NULL if it cannot be created - */ -EAPI Elm_Store *elm_store_dbsystem_new(void); -/** - * Sets the item count of a store - * - * @param st The store object - * @param count The item count of an store - */ -EAPI void elm_store_item_count_set(Elm_Store *st, int count) EINA_ARG_NONNULL(1); -/** - * Set the select func that select the state of a list item whether true or false - * - * @param st The store object - * @param func The select cb function of an store - * @param data The new data pointer to set - */ -EAPI void elm_store_item_select_func_set(Elm_Store *st, Elm_Store_Item_Select_Cb func, const void *data) EINA_ARG_NONNULL(1); -/** - * Sets the sort func that sort the item with a next in the list - * - * @param st The store object - * @param func The sort cb function of an store - * @param data The new data pointer to set - */ -EAPI void elm_store_item_sort_func_set(Elm_Store *st, Elm_Store_Item_Sort_Cb func, const void *data) EINA_ARG_NONNULL(1); -/** - * Set the store item free func - * - * @param st The store object - * @param func The free cb function of an store - * @param data The new data pointer to set - */ -EAPI void elm_store_item_free_func_set(Elm_Store *st, Elm_Store_Item_Free_Cb func, const void *data) EINA_ARG_NONNULL(1); -/** - * Get the item index that included header items - * - * @param sti The store item object - * @return The item index in genlist - */ -EAPI int elm_store_item_data_index_get(const Elm_Store_Item *sti) EINA_ARG_NONNULL(1); -/** - * Get the DB pointer of an item - * - * @param sti The store item object - * @return The DB pointer of item - */ -EAPI void *elm_store_dbsystem_db_get(const Elm_Store_Item *sti) EINA_ARG_NONNULL(1); -/** - * Set the DB pointer of an item - * - * @param sti The store item object - * @parm p_db The DB pointer of item - */ -EAPI void elm_store_dbsystem_db_set(Elm_Store *store, void *pDB) EINA_ARG_NONNULL(1); -/** - */ -EAPI int elm_store_item_index_get(const Elm_Store_Item *sti) EINA_ARG_NONNULL(1); -/** - * Append the item to the genlist - * - * @param st The store object - * @param info The store item info dbsystem object - * @return The item of store - */ -EAPI Elm_Store_Item *elm_store_item_add(Elm_Store *st, Elm_Store_Item_Info *info) EINA_ARG_NONNULL(1); -/** - * Realize the visible items to the screen - * - * @param st The store object - */ -EAPI void elm_store_item_update(Elm_Store_Item *sti) EINA_ARG_NONNULL(1); -/** - * Realize the item to the screen - * - * @param sti The store item object - */ -EAPI void elm_store_visible_items_update(Elm_Store *st) EINA_ARG_NONNULL(1); -/** - * Delete the item of genlist - * - * @param sti The store item object - */ -EAPI void elm_store_item_del(Elm_Store_Item *sti) EINA_ARG_NONNULL(1); -EAPI void elm_store_free(Elm_Store *st); -EAPI Elm_Store *elm_store_filesystem_new(void); -EAPI void elm_store_filesystem_directory_set(Elm_Store *st, const char *dir) EINA_ARG_NONNULL(1); -EAPI const char *elm_store_filesystem_directory_get(const Elm_Store *st) EINA_ARG_NONNULL(1); -EAPI const char *elm_store_item_filesystem_path_get(const Elm_Store_Item *sti) EINA_ARG_NONNULL(1); - -EAPI void elm_store_target_genlist_set(Elm_Store *st, Evas_Object *obj) EINA_ARG_NONNULL(1); - -EAPI void elm_store_cache_set(Elm_Store *st, int max) EINA_ARG_NONNULL(1); -EAPI int elm_store_cache_get(const Elm_Store *st) EINA_ARG_NONNULL(1); -EAPI void elm_store_list_func_set(Elm_Store *st, Elm_Store_Item_List_Cb func, const void *data) EINA_ARG_NONNULL(1, 2); -EAPI void elm_store_fetch_func_set(Elm_Store *st, Elm_Store_Item_Fetch_Cb func, const void *data) EINA_ARG_NONNULL(1, 2); -EAPI void elm_store_fetch_thread_set(Elm_Store *st, Eina_Bool use_thread) EINA_ARG_NONNULL(1); -EAPI Eina_Bool elm_store_fetch_thread_get(const Elm_Store *st) EINA_ARG_NONNULL(1); - -EAPI void elm_store_unfetch_func_set(Elm_Store *st, Elm_Store_Item_Unfetch_Cb func, const void *data) EINA_ARG_NONNULL(1, 2); -EAPI void elm_store_sorted_set(Elm_Store *st, Eina_Bool sorted) EINA_ARG_NONNULL(1); -EAPI Eina_Bool elm_store_sorted_get(const Elm_Store *st) EINA_ARG_NONNULL(1); -EAPI void elm_store_item_data_set(Elm_Store_Item *sti, void *data) EINA_ARG_NONNULL(1); -EAPI void *elm_store_item_data_get(Elm_Store_Item *sti) EINA_ARG_NONNULL(1); -EAPI const Elm_Store *elm_store_item_store_get(const Elm_Store_Item *sti) EINA_ARG_NONNULL(1); -======= Elm_Genlist_Item_Class *item_class; /**< The genlist item class that should be used for the item that has been listed */ const Elm_Store_Item_Mapping *mapping; /**< What kind of mappings do we use for the fields of this item to fill in the genlist item. Terminate array pointed to here with ELM_STORE_ITEM_MAPPING_END */ void *data; /**< Pointer to pass to struct data in memory if its already there, of not, NULL */ @@ -586,4 +361,3 @@ EAPI const Elm_Object_Item *elm_store_item_genlist_item_get(const Elm_Store_Item /** * @} */ ->>>>>>> remotes/origin/upstream diff --git a/src/lib/els_pan.c b/src/lib/els_pan.c index ee0c960..4e02b3d 100644 --- a/src/lib/els_pan.c +++ b/src/lib/els_pan.c @@ -208,10 +208,7 @@ _smart_reconfigure(Smart_Data *sd) evas_object_move(sd->child_obj, sd->x - sd->px, sd->y - sd->py); sd->px = sd->delta_posx*sd->gravity_x; sd->py = sd->delta_posy*sd->gravity_y; -<<<<<<< HEAD -======= ->>>>>>> remotes/origin/upstream } else evas_object_move(sd->child_obj, sd->x - sd->px, sd->y - sd->py);