forked from enlightenment/efl
efl/ethumb: the test is actually an example.
SVN revision: 82676
This commit is contained in:
parent
34f5315141
commit
4f52ae0f1b
|
@ -3484,6 +3484,7 @@ src/examples/edbus/Makefile
|
||||||
src/examples/ephysics/Makefile
|
src/examples/ephysics/Makefile
|
||||||
src/examples/edje/Makefile
|
src/examples/edje/Makefile
|
||||||
src/examples/emotion/Makefile
|
src/examples/emotion/Makefile
|
||||||
|
src/examples/ethumb/Makefile
|
||||||
src/lib/eina/eina_config.h
|
src/lib/eina/eina_config.h
|
||||||
src/lib/ecore_x/ecore_x_version.h
|
src/lib/ecore_x/ecore_x_version.h
|
||||||
spec/efl.spec
|
spec/efl.spec
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
SUBDIRS = eina eo eet evas ecore eio edbus ephysics edje emotion
|
SUBDIRS = eina eo eet evas ecore eio edbus ephysics edje emotion ethumb
|
||||||
|
|
||||||
.PHONY: examples install-examples
|
.PHONY: examples install-examples
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include <Ecore_Getopt.h>
|
#include <Ecore_Getopt.h>
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
|
|
||||||
|
static int _waiting_count = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_on_server_die_cb(void *data EINA_UNUSED, Ethumb_Client *client EINA_UNUSED)
|
_on_server_die_cb(void *data EINA_UNUSED, Ethumb_Client *client EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -43,18 +45,20 @@ static void
|
||||||
_queue_add_cb(void *data EINA_UNUSED, Ethumb_Client *client EINA_UNUSED, int id, const char *file, const char *key EINA_UNUSED, const char *thumb_path, const char *thumb_key EINA_UNUSED, Eina_Bool success)
|
_queue_add_cb(void *data EINA_UNUSED, Ethumb_Client *client EINA_UNUSED, int id, const char *file, const char *key EINA_UNUSED, const char *thumb_path, const char *thumb_key EINA_UNUSED, Eina_Bool success)
|
||||||
{
|
{
|
||||||
fprintf(stderr, ">>> %hhu file ready: %s; thumb ready: %s; id = %d\n", success, file, thumb_path, id);
|
fprintf(stderr, ">>> %hhu file ready: %s; thumb ready: %s; id = %d\n", success, file, thumb_path, id);
|
||||||
|
_waiting_count--;
|
||||||
|
if (_waiting_count == 0)
|
||||||
|
ecore_main_loop_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_request_thumbnails(Ethumb_Client *client, void *data)
|
_request_thumbnails(Ethumb_Client *client, void *data)
|
||||||
{
|
{
|
||||||
const char *path = data;
|
const char *path = data;
|
||||||
DIR *dir;
|
Eina_File_Direct_Info *info;
|
||||||
struct dirent *de;
|
Eina_Iterator *itr;
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
dir = opendir(path);
|
itr = eina_file_stat_ls(path);
|
||||||
if (!dir)
|
if (!itr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: could not open directory: %s\n", path);
|
fprintf(stderr, "ERROR: could not open directory: %s\n", path);
|
||||||
return;
|
return;
|
||||||
|
@ -66,16 +70,16 @@ _request_thumbnails(Ethumb_Client *client, void *data)
|
||||||
ethumb_client_size_set(client, 192, 192);
|
ethumb_client_size_set(client, 192, 192);
|
||||||
ethumb_client_category_set(client, "custom");
|
ethumb_client_category_set(client, "custom");
|
||||||
|
|
||||||
while ((de = readdir(dir)))
|
EINA_ITERATOR_FOREACH(itr, info)
|
||||||
{
|
{
|
||||||
if (de->d_type != DT_REG)
|
if (info->type != EINA_FILE_REG)
|
||||||
continue;
|
continue;
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", path, de->d_name);
|
ethumb_client_file_set(client, info->path, NULL);
|
||||||
ethumb_client_file_set(client, buf, NULL);
|
printf("request: %s\n", info->path);
|
||||||
ethumb_client_generate(client, _queue_add_cb, NULL, NULL);
|
ethumb_client_generate(client, _queue_add_cb, NULL, NULL);
|
||||||
|
_waiting_count++;
|
||||||
}
|
}
|
||||||
|
eina_iterator_free(itr);
|
||||||
closedir(dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
Loading…
Reference in New Issue