diff --git a/legacy/ethumb/src/bin/ethumb.c b/legacy/ethumb/src/bin/ethumb.c index e23c82967b..784068e61d 100644 --- a/legacy/ethumb/src/bin/ethumb.c +++ b/legacy/ethumb/src/bin/ethumb.c @@ -129,7 +129,7 @@ const Ecore_Getopt optdesc = { }; static void -_finished_thumb(Ethumb *e, void *data) +_finished_thumb(Ethumb *e, int result, void *data) { ecore_main_loop_quit(); } diff --git a/legacy/ethumb/src/lib/Ethumb.c b/legacy/ethumb/src/lib/Ethumb.c index 2e01d2cdaf..f06c623e46 100644 --- a/legacy/ethumb/src/lib/Ethumb.c +++ b/legacy/ethumb/src/lib/Ethumb.c @@ -794,7 +794,6 @@ _ethumb_plugin_generate(Ethumb *e) { const char *ext; Ethumb_Plugin *plugin; - int r; ext = strrchr(e->src_path, '.'); if (!ext) @@ -815,9 +814,9 @@ _ethumb_plugin_generate(Ethumb *e) else evas_object_hide(e->img); - r = plugin->generate_thumb(e); + plugin->generate_thumb(e); - return r; + return 1; } int @@ -955,7 +954,7 @@ _ethumb_finished_idler_cb(void *data) { Ethumb *e = data; - e->finished_cb(e, e->cb_data); + e->finished_cb(e, e->cb_result, e->cb_data); e->finished_idler = NULL; e->finished_cb = NULL; e->cb_data = NULL; @@ -964,10 +963,11 @@ _ethumb_finished_idler_cb(void *data) } void -ethumb_finished_callback_call(Ethumb *e) +ethumb_finished_callback_call(Ethumb *e, int result) { EINA_SAFETY_ON_NULL_RETURN(e); + e->cb_result = result; if (e->finished_idler) ecore_idler_del(e->finished_idler); e->finished_idler = ecore_idler_add(_ethumb_finished_idler_cb, e); @@ -992,19 +992,20 @@ ethumb_generate(Ethumb *e, ethumb_generate_callback_t finished_cb, void *data) r = _ethumb_plugin_generate(e); if (r) - return r; + return 1; if (!_ethumb_image_load(e)) { ERR("could not load input image.\n"); - return 0; + ethumb_finished_callback_call(e, 0); + return 1; } r = ethumb_image_save(e); - if (r && finished_cb) - ethumb_finished_callback_call(e); - return r; + ethumb_finished_callback_call(e, r); + + return 1; } EAPI int diff --git a/legacy/ethumb/src/lib/Ethumb.h b/legacy/ethumb/src/lib/Ethumb.h index 50da7aab2b..adb79e3d9b 100644 --- a/legacy/ethumb/src/lib/Ethumb.h +++ b/legacy/ethumb/src/lib/Ethumb.h @@ -66,7 +66,7 @@ typedef enum _Ethumb_Thumb_Aspect Ethumb_Thumb_Aspect; typedef struct _Ethumb_Frame Ethumb_Frame; typedef struct _Ethumb Ethumb; -typedef void (*ethumb_generate_callback_t)(Ethumb *e, void *data); +typedef void (*ethumb_generate_callback_t)(Ethumb *e, int result, void *data); EAPI int ethumb_init(void); EAPI int ethumb_shutdown(void); diff --git a/legacy/ethumb/src/lib/Ethumb_Plugin.h b/legacy/ethumb/src/lib/Ethumb_Plugin.h index dff8d3a93a..e6db2f028c 100644 --- a/legacy/ethumb/src/lib/Ethumb_Plugin.h +++ b/legacy/ethumb/src/lib/Ethumb_Plugin.h @@ -10,14 +10,14 @@ typedef struct _Ethumb_Plugin Ethumb_Plugin; struct _Ethumb_Plugin { const char **extensions; - int (*generate_thumb)(Ethumb *); + void (*generate_thumb)(Ethumb *); }; void ethumb_calculate_aspect(Ethumb *e, int iw, int ih, int *w, int *h); void ethumb_calculate_fill(Ethumb *e, int iw, int ih, int *fx, int *fy, int *fw, int *fh); int ethumb_plugin_image_resize(Ethumb *e, int w, int h); int ethumb_image_save(Ethumb *e); -void ethumb_finished_callback_call(Ethumb *e); +void ethumb_finished_callback_call(Ethumb *e, int result); Evas * ethumb_evas_get(const Ethumb *e); #endif /* _ETHUMB_PLUGIN_H_ */ diff --git a/legacy/ethumb/src/lib/ethumb_private.h b/legacy/ethumb/src/lib/ethumb_private.h index 1da7f0d4f3..b43131f2bf 100644 --- a/legacy/ethumb/src/lib/ethumb_private.h +++ b/legacy/ethumb/src/lib/ethumb_private.h @@ -39,6 +39,7 @@ struct _Ethumb Ecore_Idler *finished_idler; ethumb_generate_callback_t finished_cb; void *cb_data; + int cb_result; }; #endif /* __ETHUMB_PRIVATE_H__ */ diff --git a/legacy/ethumb/src/plugins/emotion/emotion.c b/legacy/ethumb/src/plugins/emotion/emotion.c index 2ca1066da1..b82db3319d 100644 --- a/legacy/ethumb/src/plugins/emotion/emotion.c +++ b/legacy/ethumb/src/plugins/emotion/emotion.c @@ -29,10 +29,10 @@ _frame_resized_cb(void *data, Evas_Object *o, void *event_info) evas_object_smart_callback_del(o, "frame_resize", _frame_resized_cb); emotion_object_play_set(o, 0); evas_object_del(o); - ethumb_finished_callback_call(e); + ethumb_finished_callback_call(e, 1); } -static int +static void _generate_thumb(Ethumb *e) { Evas_Object *o; @@ -47,7 +47,8 @@ _generate_thumb(Ethumb *e) fprintf(stderr, "ERROR: could not start emotion using gstreamer" " plugin.\n"); evas_object_del(o); - return r; + ethumb_finished_callback_call(e, 0); + return; } ethumb_file_get(e, &file, NULL); @@ -63,7 +64,6 @@ _generate_thumb(Ethumb *e) _emotion = o; - return 1; } EAPI Ethumb_Plugin * diff --git a/legacy/ethumb/src/plugins/epdf/epdf.c b/legacy/ethumb/src/plugins/epdf/epdf.c index 43111ebbf2..9cc47a1fab 100644 --- a/legacy/ethumb/src/plugins/epdf/epdf.c +++ b/legacy/ethumb/src/plugins/epdf/epdf.c @@ -8,7 +8,7 @@ #include #include -static int +static void _generate_thumb(Ethumb *e) { Epdf_Document *document; @@ -23,7 +23,8 @@ _generate_thumb(Ethumb *e) if (!document) { fprintf(stderr, "ERROR: could not read document: %s\n", e->src_path); - return 0; + ethumb_finished_callback_call(e, 0); + return; } page = epdf_page_new(document); @@ -31,7 +32,8 @@ _generate_thumb(Ethumb *e) { fprintf(stderr, "ERROR: could not read document: %s\n", e->src_path); epdf_document_delete(document); - return 0; + ethumb_finished_callback_call(e, 0); + return; } npages = epdf_document_page_count_get(document); @@ -57,9 +59,7 @@ _generate_thumb(Ethumb *e) epdf_page_delete(page); epdf_document_delete(document); - ethumb_finished_callback_call(e); - - return 1; + ethumb_finished_callback_call(e, 1); } Ethumb_Plugin *