summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-04-08 23:38:57 +0200
committerBoris Faure <billiob@gmail.com>2015-04-08 23:40:11 +0200
commit981f76c6e3b11c260bd637b4e111ae6ece0d59fb (patch)
treec23e6fded16e0313b3c4376a22dbd023d9cdecf0 /src
parent674c68005271e678ae47fb873ee5ac60f3603156 (diff)
add ugly timeout to http head when trying to preview links
Diffstat (limited to 'src')
-rw-r--r--src/bin/win.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bin/win.c b/src/bin/win.c
index 9dfe5ba..0f1840b 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -1612,6 +1612,7 @@ typedef struct _Ty_Http_Head {
1612 const char *src; 1612 const char *src;
1613 Ecore_Con_Url *url; 1613 Ecore_Con_Url *url;
1614 Ecore_Event_Handler *url_complete; 1614 Ecore_Event_Handler *url_complete;
1615 Ecore_Timer *timeout;
1615 Term *term; 1616 Term *term;
1616} Ty_Http_Head; 1617} Ty_Http_Head;
1617 1618
@@ -1624,10 +1625,22 @@ _ty_http_head_delete(Ty_Http_Head *ty_head)
1624 ecore_event_handler_del(ty_head->url_complete); 1625 ecore_event_handler_del(ty_head->url_complete);
1625 edje_object_signal_emit(ty_head->term->bg, "done", "terminology"); 1626 edje_object_signal_emit(ty_head->term->bg, "done", "terminology");
1626 term_unref(ty_head->term); 1627 term_unref(ty_head->term);
1628 ecore_timer_del(ty_head->timeout);
1627 1629
1628 free(ty_head); 1630 free(ty_head);
1629} 1631}
1630 1632
1633
1634static Eina_Bool
1635_media_http_head_timeout(void *data)
1636{
1637 Ty_Http_Head *ty_head = data;
1638 media_unknown_handle(ty_head->handler, ty_head->src);
1639 ty_head->timeout = NULL;
1640 _ty_http_head_delete(ty_head);
1641 return ECORE_CALLBACK_CANCEL;
1642}
1643
1631static Eina_Bool 1644static Eina_Bool
1632_media_http_head_complete(void *data, int kind EINA_UNUSED, void *event_info) 1645_media_http_head_complete(void *data, int kind EINA_UNUSED, void *event_info)
1633{ 1646{
@@ -1717,6 +1730,7 @@ _popmedia(Term *term, const char *src)
1717 if (!ecore_con_url_head(ty_head->url)) goto error; 1730 if (!ecore_con_url_head(ty_head->url)) goto error;
1718 ty_head->url_complete = ecore_event_handler_add 1731 ty_head->url_complete = ecore_event_handler_add
1719 (ECORE_CON_EVENT_URL_COMPLETE, _media_http_head_complete, ty_head); 1732 (ECORE_CON_EVENT_URL_COMPLETE, _media_http_head_complete, ty_head);
1733 ty_head->timeout = ecore_timer_add(2.5, _media_http_head_timeout, ty_head);
1720 if (!ty_head->url_complete) goto error; 1734 if (!ty_head->url_complete) goto error;
1721 ty_head->term = term; 1735 ty_head->term = term;
1722 edje_object_signal_emit(term->bg, "busy", "terminology"); 1736 edje_object_signal_emit(term->bg, "busy", "terminology");