forked from enlightenment/efl
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Add New "loaded" signal I want to add new "loaded" signal to elementary map. This signal notify users when all map tiles are loaded. Timer is used for this signal. Currently "tile,loaded" can be used for each separated tile. So the users are hard to know whether all tiles are loaded or not. Please review this patch. SVN revision: 71406
This commit is contained in:
parent
725f0c62dd
commit
bfff7d7836
|
@ -97,3 +97,7 @@
|
||||||
* Add ability to use cnp helper code on non-elm widget objects by
|
* Add ability to use cnp helper code on non-elm widget objects by
|
||||||
falling back to ecore-evas to get the window id.
|
falling back to ecore-evas to get the window id.
|
||||||
|
|
||||||
|
2012-05-24 Tae-Hwan Kim (Bluezery)
|
||||||
|
|
||||||
|
* Add "loaded" signal for elm_map.
|
||||||
|
|
||||||
|
|
|
@ -364,6 +364,12 @@ _map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
|
||||||
_bubble_parking_follow(obj);
|
_bubble_parking_follow(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_map_loaded(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
printf("loaded\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_map_tile_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
_map_tile_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
|
@ -1058,6 +1064,7 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
|
||||||
evas_object_smart_callback_add(map, "zoom,start", _map_zoom_start, map);
|
evas_object_smart_callback_add(map, "zoom,start", _map_zoom_start, map);
|
||||||
evas_object_smart_callback_add(map, "zoom,stop", _map_zoom_stop, map);
|
evas_object_smart_callback_add(map, "zoom,stop", _map_zoom_stop, map);
|
||||||
evas_object_smart_callback_add(map, "zoom,change", _map_zoom_change, map);
|
evas_object_smart_callback_add(map, "zoom,change", _map_zoom_change, map);
|
||||||
|
evas_object_smart_callback_add(map, "loaded", _map_loaded, map);
|
||||||
evas_object_smart_callback_add(map, "tile,load", _map_tile_load, map);
|
evas_object_smart_callback_add(map, "tile,load", _map_tile_load, map);
|
||||||
evas_object_smart_callback_add(map, "tile,loaded", _map_tile_loaded, map);
|
evas_object_smart_callback_add(map, "tile,loaded", _map_tile_loaded, map);
|
||||||
evas_object_smart_callback_add(map, "tile,loaded,fail", _map_tile_loaded_fail, map);
|
evas_object_smart_callback_add(map, "tile,loaded,fail", _map_tile_loaded_fail, map);
|
||||||
|
|
|
@ -410,6 +410,8 @@ struct _Widget_Data
|
||||||
Ecore_Timer *zoom_timer;
|
Ecore_Timer *zoom_timer;
|
||||||
Ecore_Animator *zoom_animator;
|
Ecore_Animator *zoom_animator;
|
||||||
|
|
||||||
|
Ecore_Timer *loaded_timer;
|
||||||
|
|
||||||
int try_num;
|
int try_num;
|
||||||
int finish_num;
|
int finish_num;
|
||||||
int download_num;
|
int download_num;
|
||||||
|
@ -513,6 +515,7 @@ static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
|
||||||
static const char SIG_ZOOM_START[] = "zoom,start";
|
static const char SIG_ZOOM_START[] = "zoom,start";
|
||||||
static const char SIG_ZOOM_STOP[] = "zoom,stop";
|
static const char SIG_ZOOM_STOP[] = "zoom,stop";
|
||||||
static const char SIG_ZOOM_CHANGE[] = "zoom,change";
|
static const char SIG_ZOOM_CHANGE[] = "zoom,change";
|
||||||
|
static const char SIG_LOADED[] = "loaded";
|
||||||
static const char SIG_TILE_LOAD[] = "tile,load";
|
static const char SIG_TILE_LOAD[] = "tile,load";
|
||||||
static const char SIG_TILE_LOADED[] = "tile,loaded";
|
static const char SIG_TILE_LOADED[] = "tile,loaded";
|
||||||
static const char SIG_TILE_LOADED_FAIL[] = "tile,loaded,fail";
|
static const char SIG_TILE_LOADED_FAIL[] = "tile,loaded,fail";
|
||||||
|
@ -536,6 +539,7 @@ static const Evas_Smart_Cb_Description _signals[] = {
|
||||||
{SIG_ZOOM_START, ""},
|
{SIG_ZOOM_START, ""},
|
||||||
{SIG_ZOOM_STOP, ""},
|
{SIG_ZOOM_STOP, ""},
|
||||||
{SIG_ZOOM_CHANGE, ""},
|
{SIG_ZOOM_CHANGE, ""},
|
||||||
|
{SIG_LOADED, ""},
|
||||||
{SIG_TILE_LOAD, ""},
|
{SIG_TILE_LOAD, ""},
|
||||||
{SIG_TILE_LOADED, ""},
|
{SIG_TILE_LOADED, ""},
|
||||||
{SIG_TILE_LOADED_FAIL, ""},
|
{SIG_TILE_LOADED_FAIL, ""},
|
||||||
|
@ -735,6 +739,18 @@ _grid_item_in_viewport(Grid_Item *gi)
|
||||||
return ELM_RECTS_INTERSECT(x, y, w, h, vx, vy, vw, vh);
|
return ELM_RECTS_INTERSECT(x, y, w, h, vx, vy, vw, vh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_loaded_timeout(void *data)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE);
|
||||||
|
Widget_Data *wd = data;
|
||||||
|
|
||||||
|
wd->loaded_timer = NULL;
|
||||||
|
if (!(wd->download_num) && !(wd->download_idler))
|
||||||
|
evas_object_smart_callback_call(wd->obj, SIG_LOADED, NULL);
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_grid_item_update(Grid_Item *gi)
|
_grid_item_update(Grid_Item *gi)
|
||||||
{
|
{
|
||||||
|
@ -761,6 +777,9 @@ _grid_item_update(Grid_Item *gi)
|
||||||
_obj_rotate(gi->wd, gi->img);
|
_obj_rotate(gi->wd, gi->img);
|
||||||
gi->file_have = EINA_TRUE;
|
gi->file_have = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gi->wd->loaded_timer) ecore_timer_del(gi->wd->loaded_timer);
|
||||||
|
gi->wd->loaded_timer = ecore_timer_add(0.25, _loaded_timeout, gi->wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3692,6 +3711,11 @@ _del_hook(Evas_Object *obj)
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(wd);
|
EINA_SAFETY_ON_NULL_RETURN(wd);
|
||||||
|
|
||||||
|
if (wd->loaded_timer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(wd->loaded_timer);
|
||||||
|
wd->loaded_timer = NULL;
|
||||||
|
}
|
||||||
if (wd->map) evas_map_free(wd->map);
|
if (wd->map) evas_map_free(wd->map);
|
||||||
free(wd);
|
free(wd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
* - "name,loaded" - Name request ends.
|
* - "name,loaded" - Name request ends.
|
||||||
* - "name,loaded,fail" - Name request fails.
|
* - "name,loaded,fail" - Name request fails.
|
||||||
* - "overlay,clicked" - A overlay is clicked.
|
* - "overlay,clicked" - A overlay is clicked.
|
||||||
|
* - "loaded" - when a map is finally loaded.
|
||||||
*
|
*
|
||||||
* Available style for map widget:
|
* Available style for map widget:
|
||||||
* - @c "default"
|
* - @c "default"
|
||||||
|
|
Loading…
Reference in New Issue