summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-01-22 17:13:35 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-25 16:24:16 +0900
commit2ea0df8aa9177c9d8974288fe718f85f41748c59 (patch)
treecaa5d142756244c4993cf7d75722b25ece55d75a
parentd92869633ffeca83acd3f3389368bd60d1e43854 (diff)
elm_test: Show popup error when Plug can't connect
-rw-r--r--src/bin/test_win_plug.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/bin/test_win_plug.c b/src/bin/test_win_plug.c
index 3557dc9b3..dd5d5d3f1 100644
--- a/src/bin/test_win_plug.c
+++ b/src/bin/test_win_plug.c
@@ -143,8 +143,36 @@ create_handles(Evas_Object *obj)
143 } 143 }
144} 144}
145 145
146static Eina_Bool
147_notify_end(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
148{
149 eo_del(obj);
150 return EINA_FALSE;
151}
152
153static inline void
154_notify_error(Evas_Object *parent, const char *msg)
155{
156 Evas_Object *notif, *txt;
157
158 printf("%s\n", msg);
159
160 notif = elm_notify_add(parent);
161 evas_object_size_hint_weight_set(notif, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
162 elm_notify_align_set(notif, 0.5, 1.0);
163 elm_notify_timeout_set(notif, 3.0);
164 eo_do(notif, eo_event_callback_add(ELM_NOTIFY_EVENT_DISMISSED, _notify_end, NULL));
165
166 txt = elm_label_add(notif);
167 elm_object_text_set(txt, msg);
168 elm_object_content_set(notif, txt);
169
170 evas_object_show(txt);
171 evas_object_show(notif);
172}
173
146void 174void
147test_win_plug(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 175test_win_plug(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
148{ 176{
149 Evas_Object *win, *bg, *plug; 177 Evas_Object *win, *bg, *plug;
150 char buf[PATH_MAX]; 178 char buf[PATH_MAX];
@@ -165,7 +193,7 @@ test_win_plug(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
165 evas_object_event_callback_add(plug, EVAS_CALLBACK_DEL, _timer_del, NULL); 193 evas_object_event_callback_add(plug, EVAS_CALLBACK_DEL, _timer_del, NULL);
166 if (!elm_plug_connect(plug, "ello", 0, EINA_FALSE)) 194 if (!elm_plug_connect(plug, "ello", 0, EINA_FALSE))
167 { 195 {
168 printf("Cannot connect plug\n"); 196 _notify_error(data, "Unable to connect to the Window Socket!");
169 return; 197 return;
170 } 198 }
171 199