forked from enlightenment/efl
Add image deleted signal into plug. it help user notice socket service
ail and they can retry service connection. and add test code deal with this signal. SVN revision: 76539
This commit is contained in:
parent
d8b60a8746
commit
b508fa5e21
|
@ -472,3 +472,8 @@
|
|||
|
||||
* Fix ctxpopup direction if -1 is uses as priority.
|
||||
|
||||
2012-09-15 Jiyoun Park (jypark)
|
||||
|
||||
* Add image deleted signal into plug. it help user notice socket service
|
||||
fail and they can retry service connection.
|
||||
* Add test code deal with this signal.
|
||||
|
|
|
@ -16,6 +16,7 @@ Improvements:
|
|||
* Panel widget is now an elm layout.
|
||||
* Improve elm map module loading/searching efficiency.
|
||||
* Diskselector handles dyanmic show/hide of icons now like buttons.
|
||||
* Plug widget handles image object deletion
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
@ -4,6 +4,61 @@
|
|||
#include <Elementary.h>
|
||||
#ifndef ELM_LIB_QUICKLAUNCH
|
||||
|
||||
#define MAX_TRY 40
|
||||
|
||||
static int try_num = 0;
|
||||
|
||||
static void
|
||||
_timer_del(void *data __UNUSED__,
|
||||
Evas *e __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Ecore_Timer *timer = evas_object_data_del(obj, "test-timer");
|
||||
if (!timer) return;
|
||||
ecore_timer_del(timer);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
cb_plug_connect(void *data)
|
||||
{
|
||||
Evas_Object *obj = data;
|
||||
Ecore_Timer *timer;
|
||||
|
||||
if (!obj) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
try_num++;
|
||||
if (try_num > MAX_TRY) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
timer= evas_object_data_get(obj, "test-timer");
|
||||
if (!timer) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
if (elm_plug_connect(obj, "ello", 0, EINA_FALSE))
|
||||
{
|
||||
printf("plug connect to server[ello]\n");
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
ecore_timer_interval_set(timer, 1);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_plug_disconnected(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Ecore_Timer *timer = evas_object_data_get(obj, "test-timer");
|
||||
if (timer)
|
||||
{
|
||||
ecore_timer_del(timer);
|
||||
evas_object_data_del(obj, "test-timer");
|
||||
return;
|
||||
}
|
||||
|
||||
timer = ecore_timer_add(1, cb_plug_connect, obj);
|
||||
evas_object_data_set(obj, "test-timer", timer);
|
||||
}
|
||||
|
||||
static void
|
||||
cb_mouse_down(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
|
||||
|
@ -99,12 +154,15 @@ test_win_plug(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
|
|||
|
||||
plug = elm_plug_add(win);
|
||||
evas_object_event_callback_add(elm_plug_image_object_get(plug), EVAS_CALLBACK_MOUSE_DOWN, cb_mouse_down, NULL);
|
||||
evas_object_event_callback_add(plug, EVAS_CALLBACK_DEL, _timer_del, NULL);
|
||||
if (!elm_plug_connect(plug, "ello", 0, EINA_FALSE))
|
||||
{
|
||||
printf("Cannot connect plug\n");
|
||||
return;
|
||||
}
|
||||
|
||||
evas_object_smart_callback_add(plug, "image.deleted", cb_plug_disconnected, NULL);
|
||||
|
||||
evas_object_resize(plug, 380, 500);
|
||||
evas_object_move(plug, 10, 10);
|
||||
evas_object_show(plug);
|
||||
|
|
|
@ -4,9 +4,13 @@
|
|||
|
||||
EAPI const char ELM_PLUG_SMART_NAME[] = "elm_plug";
|
||||
|
||||
static const char PLUG_KEY[] = "__Plug_Ecore_Evas";
|
||||
|
||||
static const char SIG_CLICKED[] = "clicked";
|
||||
static const char SIG_IMAGE_DELETED[] = "image.deleted";
|
||||
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||
{SIG_CLICKED, ""},
|
||||
{SIG_IMAGE_DELETED, ""},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -24,6 +28,17 @@ _sizing_eval(Evas_Object *obj)
|
|||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_plug_disconnected(Ecore_Evas *ee)
|
||||
{
|
||||
Evas_Object *plug = NULL;
|
||||
|
||||
if (!ee) return;
|
||||
plug = ecore_evas_data_get(ee, PLUG_KEY);
|
||||
if (!plug) return;
|
||||
evas_object_smart_callback_call(plug, SIG_IMAGE_DELETED, NULL);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_plug_smart_theme(Evas_Object *obj)
|
||||
{
|
||||
|
@ -129,8 +144,21 @@ elm_plug_connect(Evas_Object *obj,
|
|||
{
|
||||
Evas_Object *plug_img = NULL;
|
||||
|
||||
ELM_PLUG_CHECK(obj) EINA_FALSE;
|
||||
|
||||
plug_img = elm_plug_image_object_get(obj);
|
||||
if (!plug_img) return EINA_FALSE;
|
||||
|
||||
return ecore_evas_extn_plug_connect(plug_img, svcname, svcnum, svcsys);
|
||||
if (ecore_evas_extn_plug_connect(plug_img, svcname, svcnum, svcsys))
|
||||
{
|
||||
Ecore_Evas *ee = NULL;
|
||||
ee = ecore_evas_object_ecore_evas_get(plug_img);
|
||||
if (!ee) return EINA_FALSE;
|
||||
|
||||
ecore_evas_data_set(ee, PLUG_KEY, obj);
|
||||
ecore_evas_callback_delete_request_set(ee, _elm_plug_disconnected);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
else
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue