billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=981f76c6e3b11c260bd637b4e111ae6ece0d59fb

commit 981f76c6e3b11c260bd637b4e111ae6ece0d59fb
Author: Boris Faure <bill...@gmail.com>
Date:   Wed Apr 8 23:38:57 2015 +0200

    add ugly timeout to http head when trying to preview links
---
 src/bin/win.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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 {
      const char *src;
      Ecore_Con_Url *url;
      Ecore_Event_Handler *url_complete;
+     Ecore_Timer *timeout;
      Term *term;
 } Ty_Http_Head;
 
@@ -1624,10 +1625,22 @@ _ty_http_head_delete(Ty_Http_Head *ty_head)
    ecore_event_handler_del(ty_head->url_complete);
    edje_object_signal_emit(ty_head->term->bg, "done", "terminology");
    term_unref(ty_head->term);
+   ecore_timer_del(ty_head->timeout);
 
    free(ty_head);
 }
 
+
+static Eina_Bool
+_media_http_head_timeout(void *data)
+{
+   Ty_Http_Head *ty_head = data;
+   media_unknown_handle(ty_head->handler, ty_head->src);
+   ty_head->timeout = NULL;
+   _ty_http_head_delete(ty_head);
+   return ECORE_CALLBACK_CANCEL;
+}
+
 static Eina_Bool
 _media_http_head_complete(void *data, int kind EINA_UNUSED, void *event_info)
 {
@@ -1717,6 +1730,7 @@ _popmedia(Term *term, const char *src)
         if (!ecore_con_url_head(ty_head->url)) goto error;
         ty_head->url_complete = ecore_event_handler_add
           (ECORE_CON_EVENT_URL_COMPLETE, _media_http_head_complete, ty_head);
+        ty_head->timeout = ecore_timer_add(2.5, _media_http_head_timeout, 
ty_head);
         if (!ty_head->url_complete) goto error;
         ty_head->term = term;
         edje_object_signal_emit(term->bg, "busy", "terminology");

-- 


Reply via email to