forked from enlightenment/efl
finished callback is always called now.
The ethumb_generate() function now just returns 0 if there is already a generation in progress (and in that case, the callback isn't called). SVN revision: 40738
This commit is contained in:
parent
bfabdd2404
commit
16c574df94
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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_ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <Evas.h>
|
||||
#include <Epdf.h>
|
||||
|
||||
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 *
|
||||
|
|
Loading…
Reference in New Issue