summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/themes/default.edc127
-rw-r--r--data/themes/images/Makefile.am3
-rw-r--r--data/themes/images/media_busy_knob.pngbin0 -> 2183 bytes
-rw-r--r--data/themes/images/media_busy_progress.pngbin0 -> 721 bytes
-rw-r--r--data/themes/images/media_busy_spinner.pngbin0 -> 946 bytes
-rw-r--r--src/bin/media.c219
-rw-r--r--src/bin/termio.c14
-rw-r--r--src/bin/utils.c12
-rw-r--r--src/bin/utils.h3
9 files changed, 346 insertions, 32 deletions
diff --git a/data/themes/default.edc b/data/themes/default.edc
index eb47ebe..54a6e53 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -2205,6 +2205,133 @@ target: "4.bottom"
2205 2205
2206////////////////////////////////////////////////////////////////////////////// 2206//////////////////////////////////////////////////////////////////////////////
2207 //// the multimedia controls 2207 //// the multimedia controls
2208 group { name: "terminology/mediabusy";
2209 images {
2210 image: "media_busy_knob.png" COMP;
2211 image: "media_busy_spinner.png" COMP;
2212 image: "media_busy_progress.png" COMP;
2213 }
2214 script {
2215 public message(Msg_Type:type, id, ...) {
2216 if ((type == MSG_FLOAT) && (id == 1)) {
2217 new Float:val;
2218 val = getfarg(2);
2219 // val 0.0 -. 1.0 percentage
2220 custom_state(PART:"progress", "default", 0.0);
2221 set_state_val(PART:"progress", STATE_REL2, val, 1.0);
2222 set_state(PART:"progress", "custom", 0.0);
2223 }
2224 }
2225 }
2226 parts {
2227 part { name: "progress_area"; type: SPACER;
2228 mouse_events: 0;
2229 description { state: "default" 0.0;
2230 fixed: 1 1;
2231 rel2.to_x: "knob";
2232 rel2.relative: 0.0 1.0;
2233 min: 10 40;
2234 max: 99999 40;
2235 align: 0.0 1.0;
2236 }
2237 }
2238 part { name: "progress";
2239 mouse_events: 0;
2240 clip_to: "fade";
2241 description { state: "default" 0.0;
2242 fixed: 1 1;
2243 rel1.to: "progress_area";
2244 rel2.to: "progress_area";
2245 rel2.relative: 0.0 1.0;
2246 color: 100 160 255 255;
2247 image.normal: "media_busy_progress.png";
2248 image.border: 5 5 0 0;
2249 min: 10 40;
2250 align: 0.0 1.0;
2251 }
2252 }
2253 part { name: "fade"; type: RECT;
2254 mouse_events: 0;
2255 description { state: "default" 0.0;
2256 color: 255 255 255 0;
2257 visible: 0;
2258 }
2259 description { state: "visible" 0.0;
2260 inherit: "default" 0.0;
2261 visible: 1;
2262 color: 255 255 255 255;
2263 }
2264 }
2265 part { name: "knob";
2266 clip_to: "fade";
2267 mouse_events: 0;
2268 description { state: "default" 0.0;
2269 fixed: 1 1;
2270 image.normal: "media_busy_knob.png";
2271 min: 40 40;
2272 max: 40 40;
2273 align: 1.0 1.0;
2274 }
2275 }
2276 part { name: "knob_spinner";
2277 clip_to: "fade";
2278 mouse_events: 0;
2279 description { state: "default" 0.0;
2280 fixed: 1 1;
2281 color: 100 160 255 255;
2282 rel1.to: "knob";
2283 rel2.to: "knob";
2284 image.normal: "media_busy_spinner.png";
2285 map {
2286 on: 1;
2287 smooth: 1;
2288 rotation.center: "knob";
2289 }
2290 }
2291 description { state: "spin" 0.0;
2292 inherit: "default" 0.0;
2293 visible: 1;
2294 map.rotation.z: 360;
2295 }
2296 }
2297 }
2298 programs {
2299 program { name: "busy";
2300 signal: "busy";
2301 source: "terminology";
2302 action: STATE_SET "visible" 0.0;
2303 transition: DECELERATE 0.5;
2304 target: "fade";
2305 }
2306 program { name: "spin1";
2307 signal: "busy";
2308 source: "terminology";
2309 action: STATE_SET "spin" 0.0;
2310 transition: LINEAR 0.5;
2311 target: "knob_spinner";
2312 after: "spin2";
2313 }
2314 program { name: "spin2";
2315 action: STATE_SET "default" 0.0;
2316 target: "knob_spinner";
2317 after: "spin1";
2318 }
2319// program { name: "downloading";
2320// signal: "busy";
2321// source: "terminology";
2322// action: STATE_SET "default" 0.0;
2323// }
2324 program { name: "done";
2325 signal: "done";
2326 source: "terminology";
2327 action: STATE_SET "default" 0.0;
2328 transition: DECELERATE 1.5;
2329 target: "fade";
2330 }
2331 }
2332 }
2333//////////////////////////////////////////////////////////////////////////////
2334 //// the multimedia controls
2208 group { name: "terminology/mediactrl"; 2335 group { name: "terminology/mediactrl";
2209 images { 2336 images {
2210 image: "media_bg.png" COMP; 2337 image: "media_bg.png" COMP;
diff --git a/data/themes/images/Makefile.am b/data/themes/images/Makefile.am
index fc44b4f..bf41bf1 100644
--- a/data/themes/images/Makefile.am
+++ b/data/themes/images/Makefile.am
@@ -22,6 +22,9 @@ media_play.png \
22media_stop.png \ 22media_stop.png \
23media_knob_pos.png \ 23media_knob_pos.png \
24media_knob_vol.png \ 24media_knob_vol.png \
25media_busy_knob.png \
26media_busy_progress.png \
27media_busy_spinner.png \
25pm_fill.png \ 28pm_fill.png \
26pm_overlay.png \ 29pm_overlay.png \
27pm_shadow.png \ 30pm_shadow.png \
diff --git a/data/themes/images/media_busy_knob.png b/data/themes/images/media_busy_knob.png
new file mode 100644
index 0000000..93780ef
--- /dev/null
+++ b/data/themes/images/media_busy_knob.png
Binary files differ
diff --git a/data/themes/images/media_busy_progress.png b/data/themes/images/media_busy_progress.png
new file mode 100644
index 0000000..0f5f23e
--- /dev/null
+++ b/data/themes/images/media_busy_progress.png
Binary files differ
diff --git a/data/themes/images/media_busy_spinner.png b/data/themes/images/media_busy_spinner.png
new file mode 100644
index 0000000..1091bb0
--- /dev/null
+++ b/data/themes/images/media_busy_spinner.png
Binary files differ
diff --git a/src/bin/media.c b/src/bin/media.c
index f307901..60b7bf6 100644
--- a/src/bin/media.c
+++ b/src/bin/media.c
@@ -2,6 +2,8 @@
2 2
3#include <Elementary.h> 3#include <Elementary.h>
4#include <Emotion.h> 4#include <Emotion.h>
5#include <stdlib.h>
6#include <unistd.h>
5#include "media.h" 7#include "media.h"
6#include "config.h" 8#include "config.h"
7#include "utils.h" 9#include "utils.h"
@@ -11,12 +13,18 @@ typedef struct _Media Media;
11struct _Media 13struct _Media
12{ 14{
13 Evas_Object_Smart_Clipped_Data __clipped_data; 15 Evas_Object_Smart_Clipped_Data __clipped_data;
14 Evas_Object *clip, *o_img, *o_tmp, *o_ctrl; 16 Evas_Object *clip, *o_img, *o_tmp, *o_ctrl, *o_busy;
15 Ecore_Timer *anim; 17 Ecore_Timer *anim;
16 Ecore_Timer *smooth_timer; 18 Ecore_Timer *smooth_timer;
17 Ecore_Job *restart_job; 19 Ecore_Job *restart_job;
20 Ecore_Con_Url *url;
21 Ecore_Event_Handler *url_prog_hand, *url_compl_hand;
18 const char *src; 22 const char *src;
23 const char *ext;
24 const char *realf;
19 const Config *config; 25 const Config *config;
26 double download_perc;
27 int tmpfd;
20 int w, h; 28 int w, h;
21 int iw, ih; 29 int iw, ih;
22 int sw, sh; 30 int sw, sh;
@@ -24,6 +32,7 @@ struct _Media
24 int mode, type; 32 int mode, type;
25 int resizes; 33 int resizes;
26 Eina_Bool nosmooth : 1; 34 Eina_Bool nosmooth : 1;
35 Eina_Bool downloading : 1;
27}; 36};
28 37
29static Evas_Smart *_smart = NULL; 38static Evas_Smart *_smart = NULL;
@@ -62,7 +71,7 @@ static const char *extn_mov[] =
62 NULL 71 NULL
63}; 72};
64 73
65static Eina_Bool 74static const char *
66_is_fmt(const char *f, const char **extn) 75_is_fmt(const char *f, const char **extn)
67{ 76{
68 int i, len, l; 77 int i, len, l;
@@ -72,9 +81,9 @@ _is_fmt(const char *f, const char **extn)
72 { 81 {
73 l = strlen(extn[i]); 82 l = strlen(extn[i]);
74 if (len < l) continue; 83 if (len < l) continue;
75 if (!strcasecmp(extn[i], f + len - l)) return EINA_TRUE; 84 if (!strcasecmp(extn[i], f + len - l)) return extn[i];
76 } 85 }
77 return EINA_FALSE; 86 return NULL;
78} 87}
79 88
80//////////////////////// img 89//////////////////////// img
@@ -84,6 +93,7 @@ _cb_img_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
84 Media *sd = evas_object_smart_data_get(data); 93 Media *sd = evas_object_smart_data_get(data);
85 if (!sd) return; 94 if (!sd) return;
86 evas_object_show(sd->o_img); 95 evas_object_show(sd->o_img);
96 evas_object_show(sd->clip);
87} 97}
88 98
89static Eina_Bool 99static Eina_Bool
@@ -127,7 +137,7 @@ _type_img_init(Evas_Object *obj)
127 evas_object_clip_set(o, sd->clip); 137 evas_object_clip_set(o, sd->clip);
128 evas_object_event_callback_add(o, EVAS_CALLBACK_IMAGE_PRELOADED, 138 evas_object_event_callback_add(o, EVAS_CALLBACK_IMAGE_PRELOADED,
129 _cb_img_preloaded, obj); 139 _cb_img_preloaded, obj);
130 evas_object_image_file_set(o, sd->src, NULL); 140 evas_object_image_file_set(o, sd->realf, NULL);
131 evas_object_image_size_get(o, &(sd->iw), &(sd->ih)); 141 evas_object_image_size_get(o, &(sd->iw), &(sd->ih));
132 evas_object_image_preload(o, EINA_FALSE); 142 evas_object_image_preload(o, EINA_FALSE);
133 _type_img_anim_handle(obj); 143 _type_img_anim_handle(obj);
@@ -189,13 +199,18 @@ _cb_scale_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
189{ 199{
190 Media *sd = evas_object_smart_data_get(data); 200 Media *sd = evas_object_smart_data_get(data);
191 if (!sd) return; 201 if (!sd) return;
192 if (!sd->o_tmp) evas_object_show(sd->o_img); 202 if (!sd->o_tmp)
203 {
204 evas_object_show(sd->o_img);
205 evas_object_show(sd->clip);
206 }
193 else 207 else
194 { 208 {
195 evas_object_del(sd->o_img); 209 evas_object_del(sd->o_img);
196 sd->o_img = sd->o_tmp; 210 sd->o_img = sd->o_tmp;
197 sd->o_tmp = NULL; 211 sd->o_tmp = NULL;
198 evas_object_show(sd->o_img); 212 evas_object_show(sd->o_img);
213 evas_object_show(sd->clip);
199 } 214 }
200} 215}
201 216
@@ -211,7 +226,7 @@ _type_scale_init(Evas_Object *obj)
211 evas_object_clip_set(o, sd->clip); 226 evas_object_clip_set(o, sd->clip);
212 evas_object_event_callback_add(o, EVAS_CALLBACK_IMAGE_PRELOADED, 227 evas_object_event_callback_add(o, EVAS_CALLBACK_IMAGE_PRELOADED,
213 _cb_scale_preloaded, obj); 228 _cb_scale_preloaded, obj);
214 evas_object_image_file_set(o, sd->src, NULL); 229 evas_object_image_file_set(o, sd->realf, NULL);
215 evas_object_image_size_get(o, &(sd->iw), &(sd->ih)); 230 evas_object_image_size_get(o, &(sd->iw), &(sd->ih));
216 evas_object_image_preload(o, EINA_FALSE); 231 evas_object_image_preload(o, EINA_FALSE);
217} 232}
@@ -273,7 +288,7 @@ _type_scale_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Eva
273 evas_object_clip_set(o, sd->clip); 288 evas_object_clip_set(o, sd->clip);
274 evas_object_event_callback_add(o, EVAS_CALLBACK_IMAGE_PRELOADED, 289 evas_object_event_callback_add(o, EVAS_CALLBACK_IMAGE_PRELOADED,
275 _cb_scale_preloaded, obj); 290 _cb_scale_preloaded, obj);
276 evas_object_image_file_set(o, sd->src, NULL); 291 evas_object_image_file_set(o, sd->realf, NULL);
277 evas_object_image_load_size_set(sd->o_tmp, lw, lh); 292 evas_object_image_load_size_set(sd->o_tmp, lw, lh);
278 evas_object_image_preload(o, EINA_FALSE); 293 evas_object_image_preload(o, EINA_FALSE);
279 } 294 }
@@ -296,6 +311,7 @@ _cb_edje_preloaded(void *data, Evas_Object *obj __UNUSED__, const char *sig __UN
296 Media *sd = evas_object_smart_data_get(data); 311 Media *sd = evas_object_smart_data_get(data);
297 if (!sd) return; 312 if (!sd) return;
298 evas_object_show(sd->o_img); 313 evas_object_show(sd->o_img);
314 evas_object_show(sd->clip);
299} 315}
300 316
301static void 317static void
@@ -317,7 +333,7 @@ _type_edje_init(Evas_Object *obj)
317 evas_object_clip_set(o, sd->clip); 333 evas_object_clip_set(o, sd->clip);
318 for (i = 0; groups[i]; i++) 334 for (i = 0; groups[i]; i++)
319 { 335 {
320 if (edje_object_file_set(o, sd->src, groups[i])) 336 if (edje_object_file_set(o, sd->realf, groups[i]))
321 { 337 {
322 edje_object_signal_callback_add(o, "preload,done", "", 338 edje_object_signal_callback_add(o, "preload,done", "",
323 _cb_edje_preloaded, obj); 339 _cb_edje_preloaded, obj);
@@ -350,6 +366,7 @@ _cb_mov_frame_decode(void *data, Evas_Object *obj __UNUSED__, void *event __UNUS
350 if (!sd) return; 366 if (!sd) return;
351 evas_object_geometry_get(data, &ox, &oy, &ow, &oh); 367 evas_object_geometry_get(data, &ox, &oy, &ow, &oh);
352 evas_object_show(sd->o_img); 368 evas_object_show(sd->o_img);
369 evas_object_show(sd->clip);
353 _type_mov_calc(data, ox, oy, ow, oh); 370 _type_mov_calc(data, ox, oy, ow, oh);
354 371
355 len = emotion_object_play_length_get(sd->o_img); 372 len = emotion_object_play_length_get(sd->o_img);
@@ -494,7 +511,7 @@ _type_mov_init(Evas_Object *obj)
494 _cb_mov_progress, obj); 511 _cb_mov_progress, obj);
495 evas_object_smart_callback_add(o, "ref_change", 512 evas_object_smart_callback_add(o, "ref_change",
496 _cb_mov_ref, obj); 513 _cb_mov_ref, obj);
497 emotion_object_file_set(o, sd->src); 514 emotion_object_file_set(o, sd->realf);
498 evas_object_smart_member_add(o, obj); 515 evas_object_smart_member_add(o, obj);
499 evas_object_clip_set(o, sd->clip); 516 evas_object_clip_set(o, sd->clip);
500 517
@@ -602,7 +619,6 @@ _smart_add(Evas_Object *obj)
602 evas_object_smart_member_add(o, obj); 619 evas_object_smart_member_add(o, obj);
603 sd->clip = o; 620 sd->clip = o;
604 evas_object_color_set(o, 255, 255, 255, 255); 621 evas_object_color_set(o, 255, 255, 255, 255);
605 evas_object_show(o);
606} 622}
607 623
608static void 624static void
@@ -610,10 +626,29 @@ _smart_del(Evas_Object *obj)
610{ 626{
611 Media *sd = evas_object_smart_data_get(obj); 627 Media *sd = evas_object_smart_data_get(obj);
612 if (!sd) return; 628 if (!sd) return;
629 if (sd->url)
630 {
631 ecore_event_handler_del(sd->url_prog_hand);
632 ecore_event_handler_del(sd->url_compl_hand);
633 ecore_con_url_free(sd->url);
634 ecore_con_url_shutdown();
635 ecore_con_shutdown();
636 }
637 sd->url = NULL;
638 sd->url_prog_hand = NULL;
639 sd->url_compl_hand = NULL;
640 if (sd->tmpfd >= 0)
641 {
642 unlink(sd->realf);
643 close(sd->tmpfd);
644 }
645 if (sd->src) eina_stringshare_del(sd->src);
646 if (sd->realf) eina_stringshare_del(sd->realf);
613 if (sd->clip) evas_object_del(sd->clip); 647 if (sd->clip) evas_object_del(sd->clip);
614 if (sd->o_img) evas_object_del(sd->o_img); 648 if (sd->o_img) evas_object_del(sd->o_img);
615 if (sd->o_tmp) evas_object_del(sd->o_tmp); 649 if (sd->o_tmp) evas_object_del(sd->o_tmp);
616 if (sd->o_ctrl) evas_object_del(sd->o_ctrl); 650 if (sd->o_ctrl) evas_object_del(sd->o_ctrl);
651 if (sd->o_busy) evas_object_del(sd->o_busy);
617 if (sd->anim) ecore_timer_del(sd->anim); 652 if (sd->anim) ecore_timer_del(sd->anim);
618 if (sd->smooth_timer) sd->smooth_timer = ecore_timer_del(sd->smooth_timer); 653 if (sd->smooth_timer) sd->smooth_timer = ecore_timer_del(sd->smooth_timer);
619 if (sd->restart_job) ecore_job_del(sd->restart_job); 654 if (sd->restart_job) ecore_job_del(sd->restart_job);
@@ -712,6 +747,11 @@ _smart_calculate(Evas_Object *obj)
712 else if (sd->type == TYPE_MOV) _type_mov_calc(obj, ox, oy, ow, oh); 747 else if (sd->type == TYPE_MOV) _type_mov_calc(obj, ox, oy, ow, oh);
713 evas_object_move(sd->clip, ox, oy); 748 evas_object_move(sd->clip, ox, oy);
714 evas_object_resize(sd->clip, ow, oh); 749 evas_object_resize(sd->clip, ow, oh);
750 if (sd->o_busy)
751 {
752 evas_object_move(sd->o_busy, ox, oy);
753 evas_object_resize(sd->o_busy, ow, oh);
754 }
715} 755}
716 756
717static void 757static void
@@ -722,6 +762,66 @@ _smart_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
722 evas_object_smart_changed(obj); 762 evas_object_smart_changed(obj);
723} 763}
724 764
765static Eina_Bool
766_url_prog_cb(void *data, int type __UNUSED__, void *event_info)
767{
768 Ecore_Con_Event_Url_Progress *ev = event_info;
769 Evas_Object *obj = data;
770 Media *sd = evas_object_smart_data_get(obj);
771 if (!sd) return EINA_TRUE;
772 if (ev->url_con != sd->url) return EINA_TRUE;
773 if (ev->down.total > 0.0)
774 {
775 double perc;
776
777 if (!sd->downloading)
778 edje_object_signal_emit(sd->o_busy, "downloading", "terminology");
779 sd->downloading = EINA_TRUE;
780 perc = ev->down.now / ev->down.total;
781 if (perc != sd->download_perc)
782 {
783 Edje_Message_Float msg;
784
785 sd->download_perc = perc;
786 msg.val = perc;
787 edje_object_message_send(sd->o_busy, EDJE_MESSAGE_FLOAT, 1, &msg);
788 }
789 }
790 return EINA_FALSE;
791}
792
793static Eina_Bool
794_url_compl_cb(void *data, int type __UNUSED__, void *event_info)
795{
796 Ecore_Con_Event_Url_Complete *ev = event_info;
797 Evas_Object *obj = data;
798 Media *sd = evas_object_smart_data_get(obj);
799 if (!sd) return EINA_TRUE;
800 if (ev->url_con != sd->url) return EINA_TRUE;
801
802 edje_object_signal_emit(sd->o_busy, "done", "terminology");
803 ecore_event_handler_del(sd->url_prog_hand);
804 ecore_event_handler_del(sd->url_compl_hand);
805 ecore_con_url_free(sd->url);
806 ecore_con_url_shutdown();
807 ecore_con_shutdown();
808 sd->url = NULL;
809 sd->url_prog_hand = NULL;
810 sd->url_compl_hand = NULL;
811
812 if (_is_fmt(sd->src, extn_img))
813 _type_img_init(obj);
814 else if (_is_fmt(sd->src, extn_scale))
815 _type_scale_init(obj);
816 else if (_is_fmt(sd->src, extn_edj))
817 _type_edje_init(obj);
818 else if (_is_fmt(sd->src, extn_mov))
819 _type_mov_init(obj);
820 evas_object_raise(sd->o_busy);
821 _smart_calculate(obj);
822 return EINA_FALSE;
823}
824
725static void 825static void
726_smart_init(void) 826_smart_init(void)
727{ 827{
@@ -758,24 +858,105 @@ media_add(Evas_Object *parent, const char *src, const Config *config, int mode,
758 sd->src = eina_stringshare_add(src); 858 sd->src = eina_stringshare_add(src);
759 sd->config = config; 859 sd->config = config;
760 sd->mode = mode; 860 sd->mode = mode;
761 if (_is_fmt(src, extn_img)) 861 sd->tmpfd = -1;
862
863 if (link_is_url(sd->src))
864 {
865 const char *ext = NULL;
866 char *tbuf;
867
868 if (!strncasecmp(sd->src, "www.", 4))
869 {
870 tbuf = alloca(strlen(sd->src) + 10);
871 strcpy(tbuf, "http://");
872 strcat(tbuf, sd->src);
873 }
874 else if (!strncasecmp(sd->src, "ftp.", 4))
875 {
876 tbuf = alloca(strlen(sd->src) + 10);
877 strcpy(tbuf, "ftp://");
878 strcat(tbuf, sd->src);
879 }
880 else
881 tbuf = (char *)sd->src;
882 if ((ext = _is_fmt(src, extn_img)))
883 sd->ext = ext;
884 else if ((ext = _is_fmt(src, extn_scale)))
885 sd->ext = ext;
886 else if ((ext = _is_fmt(src, extn_edj)))
887 sd->ext = ext;
888 else if ((ext = _is_fmt(src, extn_mov)))
889 sd->ext = ext;
890 if (sd->ext)
891 {
892 char buf[4096];
893
894 snprintf(buf, sizeof(buf), "/tmp/tmngyXXXXXX%s", sd->ext);
895 sd->tmpfd = mkstemps(buf, strlen(sd->ext));
896 if (sd->tmpfd >= 0)
897 {
898 ecore_con_init();
899 ecore_con_url_init();
900 sd->url = ecore_con_url_new(tbuf);
901 if (!sd->url)
902 {
903 unlink(buf);
904 close(sd->tmpfd);
905 ecore_con_url_shutdown();
906 ecore_con_shutdown();
907 }
908 else
909 {
910 ecore_con_url_fd_set(sd->url, sd->tmpfd);
911 if (!ecore_con_url_get(sd->url))
912 {
913 unlink(buf);
914 close(sd->tmpfd);
915 ecore_con_url_shutdown();
916 ecore_con_shutdown();
917 sd->url = NULL;
918 }
919 else
920 {
921 Evas_Object *o;
922
923 o = sd->o_busy = edje_object_add(evas_object_evas_get(obj));
924 evas_object_smart_member_add(o, obj);
925 theme_apply(o, sd->config, "terminology/mediabusy");
926 evas_object_show(o);
927 edje_object_signal_emit(o, "busy", "terminology");
928
929 sd->realf = eina_stringshare_add(buf);
930 sd->url_prog_hand = ecore_event_handler_add
931 (ECORE_CON_EVENT_URL_PROGRESS, _url_prog_cb, obj);
932 sd->url_compl_hand = ecore_event_handler_add
933 (ECORE_CON_EVENT_URL_COMPLETE, _url_compl_cb, obj);
934 }
935 }
936 }
937 }
938 }
939
940 if (!sd->url) sd->realf = eina_stringshare_add(sd->src);
941
942 if (_is_fmt(sd->src, extn_img))
762 { 943 {
763 _type_img_init(obj); 944 if (!sd->url) _type_img_init(obj);
764 if (type) *type = TYPE_IMG; 945 if (type) *type = TYPE_IMG;
765 } 946 }
766 else if (_is_fmt(src, extn_scale)) 947 else if (_is_fmt(sd->src, extn_scale))
767 { 948 {
768 _type_scale_init(obj); 949 if (!sd->url) _type_scale_init(obj);
769 if (type) *type = TYPE_SCALE; 950 if (type) *type = TYPE_SCALE;
770 } 951 }
771 else if (_is_fmt(src, extn_edj)) 952 else if (_is_fmt(sd->src, extn_edj))
772 { 953 {
773 _type_edje_init(obj); 954 if (!sd->url) _type_edje_init(obj);
774 if (type) *type = TYPE_EDJE; 955 if (type) *type = TYPE_EDJE;
775 } 956 }
776 else if (_is_fmt(src, extn_mov)) 957 else if (_is_fmt(sd->src, extn_mov))
777 { 958 {
778 _type_mov_init(obj); 959 if (!sd->url) _type_mov_init(obj);
779 if (type) *type = TYPE_MOV; 960 if (type) *type = TYPE_MOV;
780 } 961 }
781 return obj; 962 return obj;
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 3cd4e72..b26735a 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -92,14 +92,8 @@ _activate_link(Evas_Object *obj)
92 if (!sd) return; 92 if (!sd) return;
93 if (!config) return; 93 if (!config) return;
94 if (!sd->link.string) return; 94 if (!sd->link.string) return;
95 if ((!strncasecmp(sd->link.string, "http://", 7))|| 95 if (link_is_url(sd->link.string))
96 (!strncasecmp(sd->link.string, "https://", 8)) || 96 url = EINA_TRUE;
97 (!strncasecmp(sd->link.string, "ftp://", 6)) ||
98 (!strncasecmp(sd->link.string, "www.", 4)) ||
99 (!strncasecmp(sd->link.string, "ftp.", 4)))
100 {
101 url = EINA_TRUE;
102 }
103 else if ((!strncasecmp(sd->link.string, "file://", 7)) || 97 else if ((!strncasecmp(sd->link.string, "file://", 7)) ||
104 (!strncasecmp(sd->link.string, "/", 1))) 98 (!strncasecmp(sd->link.string, "/", 1)))
105 { 99 {
@@ -107,9 +101,7 @@ _activate_link(Evas_Object *obj)
107 if (!strncasecmp(sd->link.string, "file://", 7)) path = path + 7; 101 if (!strncasecmp(sd->link.string, "file://", 7)) path = path + 7;
108 } 102 }
109 else if (strchr(sd->link.string, '@')) 103 else if (strchr(sd->link.string, '@'))
110 { 104 email = EINA_TRUE;
111 email = EINA_TRUE;
112 }
113 105
114 s = eina_str_escape(sd->link.string); 106 s = eina_str_escape(sd->link.string);
115 if (!s) return; 107 if (!s) return;
diff --git a/src/bin/utils.c b/src/bin/utils.c
index 136a664..601931a 100644
--- a/src/bin/utils.c
+++ b/src/bin/utils.c
@@ -50,3 +50,15 @@ theme_auto_reload_enable(Evas_Object *edje)
50 edje_object_signal_callback_add 50 edje_object_signal_callback_add
51 (edje, "edje,change,file", "edje", theme_reload_cb, NULL); 51 (edje, "edje,change,file", "edje", theme_reload_cb, NULL);
52} 52}
53
54Eina_Bool
55link_is_url(const char *str)
56{
57 if ((!strncasecmp(str, "http://", 7))||
58 (!strncasecmp(str, "https://", 8)) ||
59 (!strncasecmp(str, "ftp://", 6)) ||
60 (!strncasecmp(str, "www.", 4)) ||
61 (!strncasecmp(str, "ftp.", 4)))
62 return EINA_TRUE;
63 return EINA_FALSE;
64}
diff --git a/src/bin/utils.h b/src/bin/utils.h
index 139eca4..7ad93c1 100644
--- a/src/bin/utils.h
+++ b/src/bin/utils.h
@@ -5,9 +5,8 @@
5#include "config.h" 5#include "config.h"
6 6
7Eina_Bool theme_apply(Evas_Object *edje, const Config *config, const char *group); 7Eina_Bool theme_apply(Evas_Object *edje, const Config *config, const char *group);
8
9void theme_reload(Evas_Object *edje); 8void theme_reload(Evas_Object *edje);
10
11void theme_auto_reload_enable(Evas_Object *edje); 9void theme_auto_reload_enable(Evas_Object *edje);
10Eina_Bool link_is_url(const char *str);
12 11
13#endif 12#endif