summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-12 03:59:25 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-12 03:59:25 +0000
commit4f52ae0f1b8da82e54a42ef67f6639bd859d41a6 (patch)
treecfa8b46b2329d5bb613e5fe18bd0637a8b0e16a1
parent34f53151414bcdf44ec81e582b007f74da595694 (diff)
efl/ethumb: the test is actually an example.
SVN revision: 82676
-rw-r--r--configure.ac1
-rw-r--r--src/examples/Makefile.am2
-rw-r--r--src/examples/ethumb/ethumb_dbus.c (renamed from src/tests/ethumb/ethumb_dbus.c)26
3 files changed, 17 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 9035a2f5c7..a6299b5c93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3484,6 +3484,7 @@ src/examples/edbus/Makefile
3484src/examples/ephysics/Makefile 3484src/examples/ephysics/Makefile
3485src/examples/edje/Makefile 3485src/examples/edje/Makefile
3486src/examples/emotion/Makefile 3486src/examples/emotion/Makefile
3487src/examples/ethumb/Makefile
3487src/lib/eina/eina_config.h 3488src/lib/eina/eina_config.h
3488src/lib/ecore_x/ecore_x_version.h 3489src/lib/ecore_x/ecore_x_version.h
3489spec/efl.spec 3490spec/efl.spec
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 610627764d..dc4d9e6644 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -1,6 +1,6 @@
1MAINTAINERCLEANFILES = Makefile.in 1MAINTAINERCLEANFILES = Makefile.in
2 2
3SUBDIRS = eina eo eet evas ecore eio edbus ephysics edje emotion 3SUBDIRS = eina eo eet evas ecore eio edbus ephysics edje emotion ethumb
4 4
5.PHONY: examples install-examples 5.PHONY: examples install-examples
6 6
diff --git a/src/tests/ethumb/ethumb_dbus.c b/src/examples/ethumb/ethumb_dbus.c
index 946aa137ff..2f613e93ea 100644
--- a/src/tests/ethumb/ethumb_dbus.c
+++ b/src/examples/ethumb/ethumb_dbus.c
@@ -33,6 +33,8 @@
33#include <Ecore_Getopt.h> 33#include <Ecore_Getopt.h>
34#include <Ecore.h> 34#include <Ecore.h>
35 35
36static int _waiting_count = 0;
37
36static void 38static void
37_on_server_die_cb(void *data EINA_UNUSED, Ethumb_Client *client EINA_UNUSED) 39_on_server_die_cb(void *data EINA_UNUSED, Ethumb_Client *client EINA_UNUSED)
38{ 40{
@@ -43,18 +45,20 @@ static void
43_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) 45_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)
44{ 46{
45 fprintf(stderr, ">>> %hhu file ready: %s; thumb ready: %s; id = %d\n", success, file, thumb_path, id); 47 fprintf(stderr, ">>> %hhu file ready: %s; thumb ready: %s; id = %d\n", success, file, thumb_path, id);
48 _waiting_count--;
49 if (_waiting_count == 0)
50 ecore_main_loop_quit();
46} 51}
47 52
48static void 53static void
49_request_thumbnails(Ethumb_Client *client, void *data) 54_request_thumbnails(Ethumb_Client *client, void *data)
50{ 55{
51 const char *path = data; 56 const char *path = data;
52 DIR *dir; 57 Eina_File_Direct_Info *info;
53 struct dirent *de; 58 Eina_Iterator *itr;
54 char buf[PATH_MAX];
55 59
56 dir = opendir(path); 60 itr = eina_file_stat_ls(path);
57 if (!dir) 61 if (!itr)
58 { 62 {
59 fprintf(stderr, "ERROR: could not open directory: %s\n", path); 63 fprintf(stderr, "ERROR: could not open directory: %s\n", path);
60 return; 64 return;
@@ -66,16 +70,16 @@ _request_thumbnails(Ethumb_Client *client, void *data)
66 ethumb_client_size_set(client, 192, 192); 70 ethumb_client_size_set(client, 192, 192);
67 ethumb_client_category_set(client, "custom"); 71 ethumb_client_category_set(client, "custom");
68 72
69 while ((de = readdir(dir))) 73 EINA_ITERATOR_FOREACH(itr, info)
70 { 74 {
71 if (de->d_type != DT_REG) 75 if (info->type != EINA_FILE_REG)
72 continue; 76 continue;
73 snprintf(buf, sizeof(buf), "%s/%s", path, de->d_name); 77 ethumb_client_file_set(client, info->path, NULL);
74 ethumb_client_file_set(client, buf, NULL); 78 printf("request: %s\n", info->path);
75 ethumb_client_generate(client, _queue_add_cb, NULL, NULL); 79 ethumb_client_generate(client, _queue_add_cb, NULL, NULL);
80 _waiting_count++;
76 } 81 }
77 82 eina_iterator_free(itr);
78 closedir(dir);
79} 83}
80 84
81static void 85static void