summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2009-09-12 18:23:05 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2009-09-12 18:23:05 +0000
commit97645fe7bc69994a5430a9fbf1b521af75cb11a6 (patch)
treef5279769191bd394b27748e223d3715045e7aa44 /legacy
parent52de9e33cdf7bd4f8b769388faf54651d42e5844 (diff)
API BREAK: Fix Ethumb API to be more EFL-like
* Callbacks were named to help Vala bindings. * All callbacks get 'void *data' as first argument, always. * All async methods get free_data parameters and call them also on disconnect() * queue_remove() renamed to generate_cancel() to be more clear. * queue_clear() renamed tp generate_cancel_call() to be more clear. SVN revision: 42445
Diffstat (limited to '')
-rw-r--r--legacy/ethumb/src/bin/ethumb.c2
-rw-r--r--legacy/ethumb/src/bin/ethumbd.c8
-rw-r--r--legacy/ethumb/src/bin/ethumbd_child.c13
-rw-r--r--legacy/ethumb/src/bin/ethumbd_client.c4
-rw-r--r--legacy/ethumb/src/lib/Ethumb.c6
-rw-r--r--legacy/ethumb/src/lib/Ethumb.h4
-rw-r--r--legacy/ethumb/src/lib/client/Ethumb_Client.c348
-rw-r--r--legacy/ethumb/src/lib/client/Ethumb_Client.h19
-rw-r--r--legacy/ethumb/src/lib/ethumb_private.h4
-rw-r--r--legacy/ethumb/src/tests/ethumb_dbus.c18
10 files changed, 333 insertions, 93 deletions
diff --git a/legacy/ethumb/src/bin/ethumb.c b/legacy/ethumb/src/bin/ethumb.c
index 5fb285e335..0e31942ae0 100644
--- a/legacy/ethumb/src/bin/ethumb.c
+++ b/legacy/ethumb/src/bin/ethumb.c
@@ -133,7 +133,7 @@ _thumb_report(const char *mode, Ethumb *e)
133} 133}
134 134
135static void 135static void
136_finished_thumb(Ethumb *e, Eina_Bool success, void *data __UNUSED__) 136_finished_thumb( void *data __UNUSED__, Ethumb *e, Eina_Bool success)
137{ 137{
138 const char *mode = success ? "GENERATED" : "FAILED"; 138 const char *mode = success ? "GENERATED" : "FAILED";
139 _thumb_report(mode, e); 139 _thumb_report(mode, e);
diff --git a/legacy/ethumb/src/bin/ethumbd.c b/legacy/ethumb/src/bin/ethumbd.c
index 731337a068..0cce3ece73 100644
--- a/legacy/ethumb/src/bin/ethumbd.c
+++ b/legacy/ethumb/src/bin/ethumbd.c
@@ -42,10 +42,10 @@
42 42
43#define MAX_ID 2000000 43#define MAX_ID 2000000
44 44
45#define DBG(...) EINA_ERROR_PDBG(__VA_ARGS__) 45#define DBG(...) EINA_LOG_DBG(__VA_ARGS__)
46#define INF(...) EINA_ERROR_PINFO(__VA_ARGS__) 46#define INF(...) EINA_LOG_INFO(__VA_ARGS__)
47#define WRN(...) EINA_ERROR_PWARN(__VA_ARGS__) 47#define WRN(...) EINA_LOG_WARN(__VA_ARGS__)
48#define ERR(...) EINA_ERROR_PERR(__VA_ARGS__) 48#define ERR(...) EINA_LOG_ERR(__VA_ARGS__)
49 49
50static const char _ethumb_dbus_bus_name[] = "org.enlightenment.Ethumb"; 50static const char _ethumb_dbus_bus_name[] = "org.enlightenment.Ethumb";
51static const char _ethumb_dbus_interface[] = "org.enlightenment.Ethumb"; 51static const char _ethumb_dbus_interface[] = "org.enlightenment.Ethumb";
diff --git a/legacy/ethumb/src/bin/ethumbd_child.c b/legacy/ethumb/src/bin/ethumbd_child.c
index 5a6ac805a0..48516056b5 100644
--- a/legacy/ethumb/src/bin/ethumbd_child.c
+++ b/legacy/ethumb/src/bin/ethumbd_child.c
@@ -33,10 +33,10 @@
33 33
34#include "ethumbd_private.h" 34#include "ethumbd_private.h"
35 35
36#define DBG(...) EINA_ERROR_PDBG(__VA_ARGS__) 36#define DBG(...) EINA_LOG_DBG(__VA_ARGS__)
37#define INF(...) EINA_ERROR_PINFO(__VA_ARGS__) 37#define INF(...) EINA_LOG_INFO(__VA_ARGS__)
38#define WRN(...) EINA_ERROR_PWARN(__VA_ARGS__) 38#define WRN(...) EINA_LOG_WARN(__VA_ARGS__)
39#define ERR(...) EINA_ERROR_PERR(__VA_ARGS__) 39#define ERR(...) EINA_LOG_ERR(__VA_ARGS__)
40 40
41#define NETHUMBS 100 41#define NETHUMBS 100
42 42
@@ -228,7 +228,7 @@ _ec_op_del(struct _Ethumbd_Child *ec)
228} 228}
229 229
230static void 230static void
231_ec_op_generated_cb(Ethumb *e, Eina_Bool success, void *data) 231_ec_op_generated_cb(void *data, Ethumb *e, Eina_Bool success)
232{ 232{
233 struct _Ethumbd_Child *ec = data; 233 struct _Ethumbd_Child *ec = data;
234 const char *thumb_path, *thumb_key; 234 const char *thumb_path, *thumb_key;
@@ -267,8 +267,7 @@ _ec_op_generate(struct _Ethumbd_Child *ec)
267 267
268 ethumb_file_set(ec->ethumbt[index], path, key); 268 ethumb_file_set(ec->ethumbt[index], path, key);
269 ethumb_thumb_path_set(ec->ethumbt[index], thumb_path, thumb_key); 269 ethumb_thumb_path_set(ec->ethumbt[index], thumb_path, thumb_key);
270 ethumb_generate(ec->ethumbt[index], _ec_op_generated_cb, 270 ethumb_generate(ec->ethumbt[index], _ec_op_generated_cb, ec, NULL);
271 ec, NULL);
272 271
273 free(path); 272 free(path);
274 free(key); 273 free(key);
diff --git a/legacy/ethumb/src/bin/ethumbd_client.c b/legacy/ethumb/src/bin/ethumbd_client.c
index 69dac049b9..685cb9b0ac 100644
--- a/legacy/ethumb/src/bin/ethumbd_client.c
+++ b/legacy/ethumb/src/bin/ethumbd_client.c
@@ -149,7 +149,7 @@ _thumb_report(const char *mode, const char *src_path, const char *src_key, const
149} 149}
150 150
151static void 151static void
152_finished_thumb(long id __UNUSED__, const char *src_path, const char *src_key, const char *thumb_path, const char *thumb_key, Eina_Bool success, void *data __UNUSED__) 152_finished_thumb(void *data __UNUSED__, Ethumb_Client *client __UNUSED__, int id __UNUSED__, const char *src_path, const char *src_key, const char *thumb_path, const char *thumb_key, Eina_Bool success)
153{ 153{
154 const char *mode = success ? "GENERATED" : "FAILED"; 154 const char *mode = success ? "GENERATED" : "FAILED";
155 _thumb_report(mode, src_path, src_key, thumb_path, thumb_key); 155 _thumb_report(mode, src_path, src_key, thumb_path, thumb_key);
@@ -157,7 +157,7 @@ _finished_thumb(long id __UNUSED__, const char *src_path, const char *src_key, c
157} 157}
158 158
159static void 159static void
160_connected(Ethumb_Client *c, Eina_Bool success, void *data) 160_connected(void *data, Ethumb_Client *c, Eina_Bool success)
161{ 161{
162 struct options *opts = data; 162 struct options *opts = data;
163 const char *thumb_path, *thumb_key; 163 const char *thumb_path, *thumb_key;
diff --git a/legacy/ethumb/src/lib/Ethumb.c b/legacy/ethumb/src/lib/Ethumb.c
index 582511b5eb..00326b396a 100644
--- a/legacy/ethumb/src/lib/Ethumb.c
+++ b/legacy/ethumb/src/lib/Ethumb.c
@@ -1195,7 +1195,7 @@ _ethumb_finished_idler_cb(void *data)
1195{ 1195{
1196 Ethumb *e = data; 1196 Ethumb *e = data;
1197 1197
1198 e->finished_cb(e, e->cb_result, e->cb_data); 1198 e->finished_cb(e->cb_data, e, e->cb_result);
1199 if (e->cb_data_free) 1199 if (e->cb_data_free)
1200 e->cb_data_free(e->cb_data); 1200 e->cb_data_free(e->cb_data);
1201 e->finished_idler = NULL; 1201 e->finished_idler = NULL;
@@ -1218,7 +1218,7 @@ ethumb_finished_callback_call(Ethumb *e, int result)
1218} 1218}
1219 1219
1220EAPI Eina_Bool 1220EAPI Eina_Bool
1221ethumb_generate(Ethumb *e, ethumb_generate_callback_t finished_cb, void *data, void (*free_data)(void *)) 1221ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, const void *data, Eina_Free_Cb free_data)
1222{ 1222{
1223 int r; 1223 int r;
1224 1224
@@ -1234,7 +1234,7 @@ ethumb_generate(Ethumb *e, ethumb_generate_callback_t finished_cb, void *data, v
1234 return EINA_FALSE; 1234 return EINA_FALSE;
1235 } 1235 }
1236 e->finished_cb = finished_cb; 1236 e->finished_cb = finished_cb;
1237 e->cb_data = data; 1237 e->cb_data = (void *)data;
1238 e->cb_data_free = free_data; 1238 e->cb_data_free = free_data;
1239 1239
1240 if (!e->src_path) 1240 if (!e->src_path)
diff --git a/legacy/ethumb/src/lib/Ethumb.h b/legacy/ethumb/src/lib/Ethumb.h
index 107128c5ff..8d9530440d 100644
--- a/legacy/ethumb/src/lib/Ethumb.h
+++ b/legacy/ethumb/src/lib/Ethumb.h
@@ -68,7 +68,7 @@ typedef enum _Ethumb_Thumb_Aspect Ethumb_Thumb_Aspect;
68 68
69typedef struct _Ethumb_Frame Ethumb_Frame; 69typedef struct _Ethumb_Frame Ethumb_Frame;
70typedef struct _Ethumb Ethumb; 70typedef struct _Ethumb Ethumb;
71typedef void (*ethumb_generate_callback_t)(Ethumb *e, Eina_Bool success, void *data); 71typedef void (*Ethumb_Generate_Cb)(void *data, Ethumb *e, Eina_Bool success);
72 72
73EAPI int ethumb_init(void); 73EAPI int ethumb_init(void);
74EAPI int ethumb_shutdown(void); 74EAPI int ethumb_shutdown(void);
@@ -126,7 +126,7 @@ EAPI void ethumb_file_get(const Ethumb *e, const char **path, const char **key)
126EAPI void ethumb_file_free(Ethumb *e) EINA_ARG_NONNULL(1); 126EAPI void ethumb_file_free(Ethumb *e) EINA_ARG_NONNULL(1);
127EAPI void ethumb_thumb_path_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1); 127EAPI void ethumb_thumb_path_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1);
128EAPI void ethumb_thumb_path_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1); 128EAPI void ethumb_thumb_path_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1);
129EAPI Eina_Bool ethumb_generate(Ethumb *e, ethumb_generate_callback_t finished_cb, void *data, void (*free_data)(void *)) EINA_ARG_NONNULL(1, 2); 129EAPI Eina_Bool ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, const void *data, Eina_Free_Cb free_data) EINA_ARG_NONNULL(1, 2);
130EAPI Eina_Bool ethumb_exists(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 130EAPI Eina_Bool ethumb_exists(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
131 131
132#ifdef __cplusplus 132#ifdef __cplusplus
diff --git a/legacy/ethumb/src/lib/client/Ethumb_Client.c b/legacy/ethumb/src/lib/client/Ethumb_Client.c
index 93fa8e77aa..6c83c17d80 100644
--- a/legacy/ethumb/src/lib/client/Ethumb_Client.c
+++ b/legacy/ethumb/src/lib/client/Ethumb_Client.c
@@ -62,16 +62,21 @@ struct _Ethumb_Client
62 DBusPendingCall *pending_start_service_by_name; 62 DBusPendingCall *pending_start_service_by_name;
63 const char *unique_name; 63 const char *unique_name;
64 DBusPendingCall *pending_new; 64 DBusPendingCall *pending_new;
65 ec_connect_callback_t connect_cb; 65 struct {
66 void *connect_cb_data; 66 Ethumb_Client_Connect_Cb cb;
67 void (*connect_cb_free_data)(void *); 67 void *data;
68 Eina_Free_Cb free_data;
69 } connect;
68 Eina_List *pending_add; 70 Eina_List *pending_add;
69 Eina_List *pending_remove; 71 Eina_List *pending_remove;
70 Eina_List *pending_gen; 72 Eina_List *pending_gen;
71 DBusPendingCall *pending_clear; 73 DBusPendingCall *pending_clear;
72 DBusPendingCall *pending_setup; 74 DBusPendingCall *pending_setup;
73 void (*on_server_die_cb)(Ethumb_Client *client, void *data); 75 struct {
74 void *on_server_die_cb_data; 76 Ethumb_Client_Die_Cb cb;
77 void *data;
78 Eina_Free_Cb free_data;
79 } die;
75 const char *object_path; 80 const char *object_path;
76 81
77 Eina_Bool ethumb_dirty : 1; 82 Eina_Bool ethumb_dirty : 1;
@@ -86,9 +91,9 @@ struct _ethumb_pending_add
86 const char *key; 91 const char *key;
87 const char *thumb; 92 const char *thumb;
88 const char *thumb_key; 93 const char *thumb_key;
89 generated_callback_t generated_cb; 94 Ethumb_Client_Generate_Cb generated_cb;
90 void *data; 95 void *data;
91 void (*free_data)(void *); 96 Eina_Free_Cb free_data;
92 DBusPendingCall *pending_call; 97 DBusPendingCall *pending_call;
93 Ethumb_Client *client; 98 Ethumb_Client *client;
94}; 99};
@@ -96,8 +101,9 @@ struct _ethumb_pending_add
96struct _ethumb_pending_remove 101struct _ethumb_pending_remove
97{ 102{
98 dbus_int32_t id; 103 dbus_int32_t id;
99 void (*remove_cb)(Eina_Bool result, void *data); 104 Ethumb_Client_Generate_Cancel_Cb cancel_cb;
100 void *data; 105 void *data;
106 Eina_Free_Cb free_data;
101 DBusPendingCall *pending_call; 107 DBusPendingCall *pending_call;
102 Ethumb_Client *client; 108 Ethumb_Client *client;
103}; 109};
@@ -109,9 +115,9 @@ struct _ethumb_pending_gen
109 const char *key; 115 const char *key;
110 const char *thumb; 116 const char *thumb;
111 const char *thumb_key; 117 const char *thumb_key;
112 generated_callback_t generated_cb; 118 Ethumb_Client_Generate_Cb generated_cb;
113 void *data; 119 void *data;
114 void (*free_data)(void *); 120 Eina_Free_Cb free_data;
115}; 121};
116 122
117static const char _ethumb_dbus_bus_name[] = "org.enlightenment.Ethumb"; 123static const char _ethumb_dbus_bus_name[] = "org.enlightenment.Ethumb";
@@ -215,9 +221,17 @@ _ethumb_client_name_owner_changed(void *data, DBusMessage *msg)
215 else 221 else
216 { 222 {
217 ERR("server exit!!!\n"); 223 ERR("server exit!!!\n");
218 if (client->on_server_die_cb) 224 if (client->die.cb)
219 client->on_server_die_cb(client, 225 {
220 client->on_server_die_cb_data); 226 client->die.cb(client->die.data, client);
227 client->die.cb = NULL;
228 }
229 if (client->die.free_data)
230 {
231 client->die.free_data(client->die.data);
232 client->die.free_data = NULL;
233 client->die.data = NULL;
234 }
221 } 235 }
222 } 236 }
223 else 237 else
@@ -225,6 +239,25 @@ _ethumb_client_name_owner_changed(void *data, DBusMessage *msg)
225} 239}
226 240
227static void 241static void
242_ethumb_client_report_connect(Ethumb_Client *client, Eina_Bool success)
243{
244 if (!client->connect.cb)
245 {
246 ERR("already called?!");
247 return;
248 }
249
250 client->connect.cb(client->connect.data, client, success);
251 if (client->connect.free_data)
252 {
253 client->connect.free_data(client->connect.data);
254 client->connect.free_data = NULL;
255 }
256 client->connect.cb = NULL;
257 client->connect.data = NULL;
258}
259
260static void
228_ethumb_client_new_cb(void *data, DBusMessage *msg, DBusError *error) 261_ethumb_client_new_cb(void *data, DBusMessage *msg, DBusError *error)
229{ 262{
230 DBusMessageIter iter; 263 DBusMessageIter iter;
@@ -251,15 +284,11 @@ _ethumb_client_new_cb(void *data, DBusMessage *msg, DBusError *error)
251 _ethumb_dbus_objects_interface, "generated", 284 _ethumb_dbus_objects_interface, "generated",
252 _ethumb_client_generated_cb, client); 285 _ethumb_client_generated_cb, client);
253 286
254 client->connect_cb(client, 1, client->connect_cb_data); 287 _ethumb_client_report_connect(client, 1);
255 if (client->connect_cb_free_data)
256 client->connect_cb_free_data(client->connect_cb_data);
257 return; 288 return;
258 289
259end_error: 290end_error:
260 client->connect_cb(client, 0, client->connect_cb_data); 291 _ethumb_client_report_connect(client, 0);
261 if (client->connect_cb_free_data)
262 client->connect_cb_free_data(client->connect_cb_data);
263} 292}
264 293
265static void 294static void
@@ -323,9 +352,7 @@ _ethumb_client_start_server_cb(void *data, DBusMessage *msg, DBusError *err)
323 352
324 error: 353 error:
325 ERR("failed to start Ethumbd DBus service by its name.\n"); 354 ERR("failed to start Ethumbd DBus service by its name.\n");
326 client->connect_cb(client, 0, client->connect_cb_data); 355 _ethumb_client_report_connect(client, 0);
327 if (client->connect_cb_free_data)
328 client->connect_cb_free_data(client->connect_cb_data);
329} 356}
330 357
331static void 358static void
@@ -344,9 +371,7 @@ _ethumb_client_start_server(Ethumb_Client *client)
344 if (!client->pending_start_service_by_name) 371 if (!client->pending_start_service_by_name)
345 { 372 {
346 ERR("could not start service by name!\n"); 373 ERR("could not start service by name!\n");
347 client->connect_cb(client, 0, client->connect_cb_data); 374 _ethumb_client_report_connect(client, 0);
348 if (client->connect_cb_free_data)
349 client->connect_cb_free_data(client->connect_cb_data);
350 } 375 }
351} 376}
352 377
@@ -389,9 +414,7 @@ _ethumb_client_get_name_owner(void *data, DBusMessage *msg, DBusError *err)
389 return; 414 return;
390 415
391error: 416error:
392 client->connect_cb(client, 0, client->connect_cb_data); 417 _ethumb_client_report_connect(client, 0);
393 if (client->connect_cb_free_data)
394 client->connect_cb_free_data(client->connect_cb_data);
395} 418}
396 419
397EAPI int 420EAPI int
@@ -434,8 +457,46 @@ ethumb_client_shutdown(void)
434 return _initcount; 457 return _initcount;
435} 458}
436 459
460/**
461 * Connects to Ethumb server and return the client instance.
462 *
463 * This is the "constructor" of Ethumb_Client, where everything
464 * starts.
465 *
466 * If server was down, it is tried to start it using DBus activation,
467 * then the connection is retried.
468 *
469 * This call is asynchronous and will not block, instead it will be in
470 * "not connected" state until @a connect_cb is called with either
471 * success or failure. On failure, then no methods should be
472 * called. On success you're now able to setup and then ask generation
473 * of thumbnails.
474 *
475 * Usually you should listen for server death/disconenction with
476 * ethumb_client_on_server_die_callback_set().
477 *
478 * @param connect_cb function to call to report connection success or
479 * failure. Do not call any other ethumb_client method until
480 * this function returns. The first received parameter is the
481 * given argument @a data. Must @b not be @c NULL. This
482 * function will not be called if user explicitly calls
483 * ethumb_client_disconnect().
484 * @param data context to give back to @a connect_cb. May be @c NULL.
485 * @param free_data function used to release @a data resources, if
486 * any. May be @c NULL. If this function exists, it will be
487 * called immediately after @a connect_cb is called or if user
488 * explicitly calls ethumb_client_disconnect() before such
489 * (that is, don't rely on @a data after @a connect_cb was
490 * called!)
491 *
492 * @return client instance or NULL if failed. If @a connect_cb is
493 * missing it returns @c NULL. If it fail for other
494 * conditions, @c NULL is also returned and @a connect_cb is
495 * called with @c success=EINA_FALSE. The client instance is
496 * not ready to be used until @a connect_cb is called.
497 */
437EAPI Ethumb_Client * 498EAPI Ethumb_Client *
438ethumb_client_connect(ec_connect_callback_t connect_cb, void *data, void (*free_data)(void *)) 499ethumb_client_connect(Ethumb_Client_Connect_Cb connect_cb, const void *data, Eina_Free_Cb free_data)
439{ 500{
440 Ethumb_Client *eclient; 501 Ethumb_Client *eclient;
441 502
@@ -448,9 +509,9 @@ ethumb_client_connect(ec_connect_callback_t connect_cb, void *data, void (*free_
448 goto err; 509 goto err;
449 } 510 }
450 511
451 eclient->connect_cb = connect_cb; 512 eclient->connect.cb = connect_cb;
452 eclient->connect_cb_data = data; 513 eclient->connect.data = (void *)data;
453 eclient->connect_cb_free_data = free_data; 514 eclient->connect.free_data = free_data;
454 515
455 eclient->ethumb = ethumb_new(); 516 eclient->ethumb = ethumb_new();
456 if (!eclient->ethumb) 517 if (!eclient->ethumb)
@@ -486,10 +547,18 @@ connection_err:
486ethumb_new_err: 547ethumb_new_err:
487 free(eclient); 548 free(eclient);
488err: 549err:
489 connect_cb(NULL, EINA_FALSE, data); 550 connect_cb((void *)data, NULL, EINA_FALSE);
551 if (free_data)
552 free_data((void *)data);
490 return NULL; 553 return NULL;
491} 554}
492 555
556/**
557 * Disconnect the client, releasing all client resources.
558 *
559 * This is the destructor of Ethumb_Client, after it's disconnected
560 * the client handle is now gone and should not be used.
561 */
493EAPI void 562EAPI void
494ethumb_client_disconnect(Ethumb_Client *client) 563ethumb_client_disconnect(Ethumb_Client *client)
495{ 564{
@@ -531,6 +600,8 @@ ethumb_client_disconnect(Ethumb_Client *client)
531 struct _ethumb_pending_remove *pending = data; 600 struct _ethumb_pending_remove *pending = data;
532 dbus_pending_call_cancel(pending->pending_call); 601 dbus_pending_call_cancel(pending->pending_call);
533 dbus_pending_call_unref(pending->pending_call); 602 dbus_pending_call_unref(pending->pending_call);
603 if (pending->free_data)
604 pending->free_data(pending->data);
534 free(pending); 605 free(pending);
535 } 606 }
536 607
@@ -563,14 +634,46 @@ end_connection:
563 e_dbus_signal_handler_del(client->conn, client->generated_signal); 634 e_dbus_signal_handler_del(client->conn, client->generated_signal);
564 e_dbus_connection_close(client->conn); 635 e_dbus_connection_close(client->conn);
565 636
637 if (client->connect.free_data)
638 client->connect.free_data(client->connect.data);
639 if (client->die.free_data)
640 client->die.free_data(client->die.data);
641
566 free(client); 642 free(client);
567} 643}
568 644
645/**
646 * Sets the callback to report server died.
647 *
648 * When server dies there is nothing you can do, just release
649 * resources with ethumb_client_disconnect() and probably try to
650 * connect again.
651 *
652 * Usually you should set this callback and handle this case, it does
653 * happen!
654 *
655 * @param client the client instance to monitor. Must @b not be @c
656 * NULL.
657 * @param server_die_cb function to call back when server dies. The
658 * first parameter will be the argument @a data. May be @c
659 * NULL.
660 * @param data context to give back to @a server_die_cb. May be @c
661 * NULL.
662 * @param free_data used to release @a data resources after @a
663 * server_die_cb is called or user calls
664 * ethumb_client_disconnect().
665 */
569EAPI void 666EAPI void
570ethumb_client_on_server_die_callback_set(Ethumb_Client *client, void (*on_server_die_cb)(Ethumb_Client *client, void *data), void *data) 667ethumb_client_on_server_die_callback_set(Ethumb_Client *client, Ethumb_Client_Die_Cb server_die_cb, const void *data, Eina_Free_Cb free_data)
571{ 668{
572 client->on_server_die_cb = on_server_die_cb; 669 EINA_SAFETY_ON_NULL_RETURN(client);
573 client->on_server_die_cb_data = data; 670
671 if (client->die.free_data)
672 client->die.free_data(client->die.data);
673
674 client->die.cb = server_die_cb;
675 client->die.data = (void *)data;
676 client->die.free_data = free_data;
574} 677}
575 678
576static void 679static void
@@ -631,6 +734,15 @@ _ethumb_client_dbus_append_bytearray(DBusMessageIter *iter, const char *string)
631 dbus_message_iter_close_container(iter, &viter); 734 dbus_message_iter_close_container(iter, &viter);
632} 735}
633 736
737/**
738 * Send setup to server.
739 *
740 * This method is called automatically by ethumb_client_generate() if
741 * any property was changed. No need to call it manually.
742 *
743 * @param client client instance. Must @b not be @c NULL and client
744 * must be connected (after connected_cb is called).
745 */
634EAPI void 746EAPI void
635ethumb_client_ethumb_setup(Ethumb_Client *client) 747ethumb_client_ethumb_setup(Ethumb_Client *client)
636{ 748{
@@ -647,6 +759,7 @@ ethumb_client_ethumb_setup(Ethumb_Client *client)
647 dbus_int32_t video_ntimes, video_fps, document_page; 759 dbus_int32_t video_ntimes, video_fps, document_page;
648 760
649 EINA_SAFETY_ON_NULL_RETURN(client); 761 EINA_SAFETY_ON_NULL_RETURN(client);
762 EINA_SAFETY_ON_FALSE_RETURN(client->connected);
650 client->ethumb_dirty = 0; 763 client->ethumb_dirty = 0;
651 764
652 msg = dbus_message_new_method_call(_ethumb_dbus_bus_name, 765 msg = dbus_message_new_method_call(_ethumb_dbus_bus_name,
@@ -822,9 +935,10 @@ _ethumb_client_generated_cb(void *data, DBusMessage *msg)
822 if (found) 935 if (found)
823 { 936 {
824 client->pending_gen = eina_list_remove_list(client->pending_gen, l); 937 client->pending_gen = eina_list_remove_list(client->pending_gen, l);
825 pending->generated_cb(id, pending->file, pending->key, 938 pending->generated_cb(pending->data, client, id,
939 pending->file, pending->key,
826 pending->thumb, pending->thumb_key, 940 pending->thumb, pending->thumb_key,
827 success, pending->data); 941 success);
828 if (pending->free_data) 942 if (pending->free_data)
829 pending->free_data(pending->data); 943 pending->free_data(pending->data);
830 eina_stringshare_del(pending->file); 944 eina_stringshare_del(pending->file);
@@ -875,8 +989,8 @@ end:
875 free(pending); 989 free(pending);
876} 990}
877 991
878static long 992static int
879_ethumb_client_queue_add(Ethumb_Client *client, const char *file, const char *key, const char *thumb, const char *thumb_key, generated_callback_t generated_cb, void *data, void (*free_data)(void *)) 993_ethumb_client_queue_add(Ethumb_Client *client, const char *file, const char *key, const char *thumb, const char *thumb_key, Ethumb_Client_Generate_Cb generated_cb, const void *data, Eina_Free_Cb free_data)
880{ 994{
881 DBusMessage *msg; 995 DBusMessage *msg;
882 DBusMessageIter iter; 996 DBusMessageIter iter;
@@ -889,7 +1003,7 @@ _ethumb_client_queue_add(Ethumb_Client *client, const char *file, const char *ke
889 pending->thumb = eina_stringshare_add(thumb); 1003 pending->thumb = eina_stringshare_add(thumb);
890 pending->thumb_key = eina_stringshare_add(thumb_key); 1004 pending->thumb_key = eina_stringshare_add(thumb_key);
891 pending->generated_cb = generated_cb; 1005 pending->generated_cb = generated_cb;
892 pending->data = data; 1006 pending->data = (void *)data;
893 pending->free_data = free_data; 1007 pending->free_data = free_data;
894 pending->client = client; 1008 pending->client = client;
895 1009
@@ -937,13 +1051,30 @@ _ethumb_client_queue_remove_cb(void *data, DBusMessage *msg, DBusError *error)
937 dbus_message_iter_get_basic(&iter, &success); 1051 dbus_message_iter_get_basic(&iter, &success);
938 1052
939end: 1053end:
940 if (pending->remove_cb) 1054 if (pending->cancel_cb)
941 pending->remove_cb(success, pending->data); 1055 pending->cancel_cb(pending->data, success);
1056 if (pending->free_data)
1057 pending->free_data(pending->data);
942 free(pending); 1058 free(pending);
943} 1059}
944 1060
1061/**
1062 * Ask server to cancel generation of thumbnail.
1063 *
1064 * @param client client instance. Must @b not be @c NULL and client
1065 * must be connected (after connected_cb is called).
1066 * @param id valid id returned by ethumb_client_generate()
1067 * @param cancel_cb function to report cancellation results.
1068 * @param data context argument to give back to @a cancel_cb. May be
1069 * @c NULL.
1070 * @param data context to give back to @a cancel_cb. May be @c
1071 * NULL.
1072 * @param free_data used to release @a data resources after @a
1073 * cancel_cb is called or user calls
1074 * ethumb_client_disconnect().
1075 */
945EAPI void 1076EAPI void
946ethumb_client_queue_remove(Ethumb_Client *client, int id, void (*queue_remove_cb)(Eina_Bool success, void *data), void *data) 1077ethumb_client_generate_cancel(Ethumb_Client *client, int id, Ethumb_Client_Generate_Cancel_Cb cancel_cb, const void *data, Eina_Free_Cb free_data)
947{ 1078{
948 DBusMessage *msg; 1079 DBusMessage *msg;
949 struct _ethumb_pending_remove *pending; 1080 struct _ethumb_pending_remove *pending;
@@ -951,11 +1082,13 @@ ethumb_client_queue_remove(Ethumb_Client *client, int id, void (*queue_remove_cb
951 int found; 1082 int found;
952 dbus_int32_t id32 = id; 1083 dbus_int32_t id32 = id;
953 EINA_SAFETY_ON_NULL_RETURN(client); 1084 EINA_SAFETY_ON_NULL_RETURN(client);
1085 EINA_SAFETY_ON_FALSE_RETURN(id >= 0);
954 1086
955 pending = calloc(1, sizeof(*pending)); 1087 pending = calloc(1, sizeof(*pending));
956 pending->id = id; 1088 pending->id = id;
957 pending->remove_cb = queue_remove_cb; 1089 pending->cancel_cb = cancel_cb;
958 pending->data = data; 1090 pending->data = (void *)data;
1091 pending->free_data = free_data;
959 pending->client = client; 1092 pending->client = client;
960 1093
961 msg = dbus_message_new_method_call(_ethumb_dbus_bus_name, 1094 msg = dbus_message_new_method_call(_ethumb_dbus_bus_name,
@@ -1029,8 +1162,16 @@ _ethumb_client_queue_clear_cb(void *data, DBusMessage *msg __UNUSED__, DBusError
1029 client->pending_clear = NULL; 1162 client->pending_clear = NULL;
1030} 1163}
1031 1164
1165/**
1166 * Ask server to cancel generation of all thumbnails.
1167 *
1168 * @param client client instance. Must @b not be @c NULL and client
1169 * must be connected (after connected_cb is called).
1170 *
1171 * @see ethumb_client_generate_cancel()
1172 */
1032EAPI void 1173EAPI void
1033ethumb_client_queue_clear(Ethumb_Client *client) 1174ethumb_client_generate_cancel_all(Ethumb_Client *client)
1034{ 1175{
1035 DBusMessage *msg; 1176 DBusMessage *msg;
1036 void *data; 1177 void *data;
@@ -1287,6 +1428,23 @@ ethumb_client_document_page_set(Ethumb_Client *client, int page)
1287 ethumb_document_page_set(client->ethumb, page); 1428 ethumb_document_page_set(client->ethumb, page);
1288} 1429}
1289 1430
1431/**
1432 * Set source file to be thumbnailed.
1433 *
1434 * Calling this function has the side effect of resetting values set
1435 * with ethumb_client_thumb_path_set() or auto-generated with
1436 * ethumb_client_thumb_exists().
1437 *
1438 * @param client the client instance to use. Must @b not be @c
1439 * NULL. May be pending connected (can be called before @c
1440 * connected_cb)
1441 * @param path the filesystem path to use. May be @c NULL.
1442 * @param key the extra argument/key inside @a path to read image
1443 * from. This is only used for formats that allow multiple
1444 * resources in one file, like EET or Edje (group name).
1445 *
1446 * @return #EINA_TRUE on success, #EINA_FALSE on failure.
1447 */
1290EAPI Eina_Bool 1448EAPI Eina_Bool
1291ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key) 1449ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key)
1292{ 1450{
@@ -1295,6 +1453,9 @@ ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key)
1295 return ethumb_file_set(client->ethumb, path, key); 1453 return ethumb_file_set(client->ethumb, path, key);
1296} 1454}
1297 1455
1456/**
1457 * Get values set with ethumb_client_file_get()
1458 */
1298EAPI void 1459EAPI void
1299ethumb_client_file_get(Ethumb_Client *client, const char **path, const char **key) 1460ethumb_client_file_get(Ethumb_Client *client, const char **path, const char **key)
1300{ 1461{
@@ -1305,6 +1466,13 @@ ethumb_client_file_get(Ethumb_Client *client, const char **path, const char **ke
1305 ethumb_file_get(client->ethumb, path, key); 1466 ethumb_file_get(client->ethumb, path, key);
1306} 1467}
1307 1468
1469/**
1470 * Reset previously set file to @c NULL.
1471 *
1472 * @param client the client instance to use. Must @b not be @c
1473 * NULL. May be pending connected (can be called before @c
1474 * connected_cb)
1475 */
1308EAPI void 1476EAPI void
1309ethumb_client_file_free(Ethumb_Client *client) 1477ethumb_client_file_free(Ethumb_Client *client)
1310{ 1478{
@@ -1313,6 +1481,16 @@ ethumb_client_file_free(Ethumb_Client *client)
1313 ethumb_file_free(client->ethumb); 1481 ethumb_file_free(client->ethumb);
1314} 1482}
1315 1483
1484/**
1485 * Set a defined path and key to store the thumbnail.
1486 *
1487 * If not explicitly given, the thumbnail path will be auto-generated
1488 * by ethumb_client_thumb_exists() or server using configured
1489 * parameters like size, aspect and category.
1490 *
1491 * Set these to @c NULL to forget previously given values. After
1492 * ethumb_client_file_set() these values will be reset to @c NULL.
1493 */
1316EAPI void 1494EAPI void
1317ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key) 1495ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key)
1318{ 1496{
@@ -1321,6 +1499,27 @@ ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char
1321 ethumb_thumb_path_set(client->ethumb, path, key); 1499 ethumb_thumb_path_set(client->ethumb, path, key);
1322} 1500}
1323 1501
1502/**
1503 * Get the configured thumbnail path.
1504 *
1505 * This returns the value set with ethumb_client_thumb_path_set() or
1506 * auto-generated by ethumb_client_thumb_exists() if it was not set.
1507 *
1508 * @param path where to return configured path. May be @c NULL. If
1509 * there was no path configured with
1510 * ethumb_client_thumb_path_set() and
1511 * ethumb_client_thumb_exists() was not called, then it will
1512 * probably return @c NULL. If not @c NULL, then it will be a
1513 * pointer to a stringshared instance, but @b no references are
1514 * added (do it with eina_stringshare_ref())!
1515 * @param key where to return configured key. May be @c NULL. If
1516 * there was no key configured with
1517 * ethumb_client_thumb_key_set() and
1518 * ethumb_client_thumb_exists() was not called, then it will
1519 * probably return @c NULL. If not @c NULL, then it will be a
1520 * pointer to a stringshared instance, but @b no references are
1521 * added (do it with eina_stringshare_ref())!
1522 */
1324EAPI void 1523EAPI void
1325ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const char **key) 1524ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const char **key)
1326{ 1525{
@@ -1331,6 +1530,20 @@ ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const cha
1331 ethumb_thumb_path_get(client->ethumb, path, key); 1530 ethumb_thumb_path_get(client->ethumb, path, key);
1332} 1531}
1333 1532
1533/**
1534 * Checks whenever file already exists (locally!)
1535 *
1536 * This will check locally (not calling server) if thumbnail already
1537 * exists or not, also calculating the thumbnail path. See
1538 * ethumb_client_thumb_path_get(). Path must be configured with
1539 * ethumb_client_file_set() before using it and the last set file will
1540 * be used!
1541 *
1542 * @param client client instance. Must @b not be @c NULL and client
1543 * must be configured with ethumb_client_file_set().
1544 *
1545 * @return #EINA_TRUE if it exists, #EINA_FALSE otherwise.
1546 */
1334EAPI Eina_Bool 1547EAPI Eina_Bool
1335ethumb_client_thumb_exists(Ethumb_Client *client) 1548ethumb_client_thumb_exists(Ethumb_Client *client)
1336{ 1549{
@@ -1339,12 +1552,47 @@ ethumb_client_thumb_exists(Ethumb_Client *client)
1339 return ethumb_exists(client->ethumb); 1552 return ethumb_exists(client->ethumb);
1340} 1553}
1341 1554
1342EAPI long 1555/**
1343ethumb_client_generate(Ethumb_Client *client, generated_callback_t generated_cb, void *data, void (*free_data)(void *)) 1556 * Ask server to generate thumbnail.
1557 *
1558 * This process is asynchronous and will report back from main loop
1559 * using @a generated_cb. One can cancel this request by calling
1560 * ethumb_client_generate_cancel() or
1561 * ethumb_client_generate_cancel_all(), but not that request might be
1562 * processed by server already and no generated files will be removed
1563 * if that is the case.
1564 *
1565 * This will not check if file already exists, this should be done by
1566 * explicitly calling ethumb_client_thumb_exists(). That is, this
1567 * function will override any existing thumbnail.
1568 *
1569 * @param client client instance. Must @b not be @c NULL and client
1570 * must be connected (after connected_cb is called).
1571 * @param generated_cb function to report generation results.
1572 * @param data context argument to give back to @a generated_cb. May
1573 * be @c NULL.
1574 * @param data context to give back to @a generate_cb. May be @c
1575 * NULL.
1576 * @param free_data used to release @a data resources after @a
1577 * generated_cb is called or user calls
1578 * ethumb_client_disconnect().
1579 *
1580 * @return identifier or -1 on error. If -1 is returned (error) then
1581 * @a free_data is @b not called!
1582 *
1583 * @see ethumb_client_connect()
1584 * @see ethumb_client_file_set()
1585 * @see ethumb_client_thumb_exists()
1586 * @see ethumb_client_generate_cancel()
1587 * @see ethumb_client_generate_cancel_all()
1588 */
1589EAPI int
1590ethumb_client_generate(Ethumb_Client *client, Ethumb_Client_Generate_Cb generated_cb, const void *data, Eina_Free_Cb free_data)
1344{ 1591{
1345 const char *file, *key, *thumb, *thumb_key; 1592 const char *file, *key, *thumb, *thumb_key;
1346 long id; 1593 int id;
1347 EINA_SAFETY_ON_NULL_RETURN_VAL(client, -1); 1594 EINA_SAFETY_ON_NULL_RETURN_VAL(client, -1);
1595 EINA_SAFETY_ON_FALSE_RETURN_VAL(client->connected, -1);
1348 1596
1349 ethumb_file_get(client->ethumb, &file, &key); 1597 ethumb_file_get(client->ethumb, &file, &key);
1350 if (!file) 1598 if (!file)
diff --git a/legacy/ethumb/src/lib/client/Ethumb_Client.h b/legacy/ethumb/src/lib/client/Ethumb_Client.h
index c90f6cc786..2035f6bea6 100644
--- a/legacy/ethumb/src/lib/client/Ethumb_Client.h
+++ b/legacy/ethumb/src/lib/client/Ethumb_Client.h
@@ -38,20 +38,17 @@ extern "C" {
38#endif 38#endif
39 39
40typedef struct _Ethumb_Client Ethumb_Client; 40typedef struct _Ethumb_Client Ethumb_Client;
41typedef void (*ec_connect_callback_t)(Ethumb_Client *client, Eina_Bool success, void *data); 41typedef void (*Ethumb_Client_Connect_Cb)(void *data, Ethumb_Client *client, Eina_Bool success);
42typedef void (*generated_callback_t)(long id, const char *file, const char *key, 42typedef void (*Ethumb_Client_Die_Cb)(void *data, Ethumb_Client *client);
43 const char *thumb_path, const char *thumb_key, 43typedef void (*Ethumb_Client_Generate_Cb)(void *data, Ethumb_Client *client, int id, const char *file, const char *key, const char *thumb_path, const char *thumb_key, Eina_Bool success);
44 Eina_Bool success, void *data); 44typedef void (*Ethumb_Client_Generate_Cancel_Cb)(void *data, Eina_Bool success);
45 45
46EAPI int ethumb_client_init(void); 46EAPI int ethumb_client_init(void);
47EAPI int ethumb_client_shutdown(void); 47EAPI int ethumb_client_shutdown(void);
48 48
49EAPI Ethumb_Client * ethumb_client_connect(ec_connect_callback_t connect_cb, void *data, void (*free_data)(void *)); 49EAPI Ethumb_Client * ethumb_client_connect(Ethumb_Client_Connect_Cb connect_cb, const void *data, Eina_Free_Cb free_data);
50EAPI void ethumb_client_disconnect(Ethumb_Client *client); 50EAPI void ethumb_client_disconnect(Ethumb_Client *client);
51EAPI void ethumb_client_on_server_die_callback_set(Ethumb_Client *client, void (*on_server_die_cb)(Ethumb_Client *client, void *data), void *data); 51EAPI void ethumb_client_on_server_die_callback_set(Ethumb_Client *client, Ethumb_Client_Die_Cb server_die_cb, const void *data, Eina_Free_Cb free_data);
52
53EAPI void ethumb_client_queue_remove(Ethumb_Client *client, int id, void (*queue_remove_cb)(Eina_Bool success, void *data), void *data);
54EAPI void ethumb_client_queue_clear(Ethumb_Client *client);
55 52
56EAPI void ethumb_client_fdo_set(Ethumb_Client *client, Ethumb_Thumb_FDO_Size s); 53EAPI void ethumb_client_fdo_set(Ethumb_Client *client, Ethumb_Thumb_FDO_Size s);
57EAPI void ethumb_client_size_set(Ethumb_Client *client, int tw, int th); 54EAPI void ethumb_client_size_set(Ethumb_Client *client, int tw, int th);
@@ -87,7 +84,9 @@ EAPI void ethumb_client_file_free(Ethumb_Client *client);
87EAPI void ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key); 84EAPI void ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key);
88EAPI void ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const char **key); 85EAPI void ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const char **key);
89EAPI Eina_Bool ethumb_client_thumb_exists(Ethumb_Client *client); 86EAPI Eina_Bool ethumb_client_thumb_exists(Ethumb_Client *client);
90EAPI long ethumb_client_generate(Ethumb_Client *client, generated_callback_t generated_cb, void *data, void (*free_data)(void *)); 87EAPI int ethumb_client_generate(Ethumb_Client *client, Ethumb_Client_Generate_Cb generated_cb, const void *data, Eina_Free_Cb free_data);
88EAPI void ethumb_client_generate_cancel(Ethumb_Client *client, int id, Ethumb_Client_Generate_Cancel_Cb cancel_cb, const void *data, Eina_Free_Cb free_data);
89EAPI void ethumb_client_generate_cancel_all(Ethumb_Client *client);
91 90
92#ifdef __cplusplus 91#ifdef __cplusplus
93} 92}
diff --git a/legacy/ethumb/src/lib/ethumb_private.h b/legacy/ethumb/src/lib/ethumb_private.h
index cce6f0c1c1..ed7937bc3d 100644
--- a/legacy/ethumb/src/lib/ethumb_private.h
+++ b/legacy/ethumb/src/lib/ethumb_private.h
@@ -40,9 +40,9 @@ struct _Ethumb
40 Evas *e, *sub_e; 40 Evas *e, *sub_e;
41 Evas_Object *o, *img; 41 Evas_Object *o, *img;
42 Ecore_Idler *finished_idler; 42 Ecore_Idler *finished_idler;
43 ethumb_generate_callback_t finished_cb; 43 Ethumb_Generate_Cb finished_cb;
44 void *cb_data; 44 void *cb_data;
45 void (*cb_data_free)(void *); 45 Eina_Free_Cb cb_data_free;
46 int cb_result; 46 int cb_result;
47}; 47};
48 48
diff --git a/legacy/ethumb/src/tests/ethumb_dbus.c b/legacy/ethumb/src/tests/ethumb_dbus.c
index 59a95bfdc9..3357c6f92f 100644
--- a/legacy/ethumb/src/tests/ethumb_dbus.c
+++ b/legacy/ethumb/src/tests/ethumb_dbus.c
@@ -33,21 +33,15 @@
33#include <Ecore.h> 33#include <Ecore.h>
34 34
35static void 35static void
36_on_server_die_cb(Ethumb_Client *client, void *data) 36_on_server_die_cb(void *data __UNUSED__, Ethumb_Client *client __UNUSED__)
37{ 37{
38 ecore_main_loop_quit(); 38 ecore_main_loop_quit();
39} 39}
40 40
41static void 41static void
42_queue_add_cb(long id, const char *file, const char *key, const char *thumb_path, const char *thumb_key, Eina_Bool success, void *data) 42_queue_add_cb(void *data __UNUSED__, Ethumb_Client *client __UNUSED__, int id, const char *file, const char *key __UNUSED__, const char *thumb_path, const char *thumb_key __UNUSED__, Eina_Bool success)
43{ 43{
44 fprintf(stderr, ">>> file ready: %s; thumb ready: %s; id = %ld\n", file, thumb_path, id); 44 fprintf(stderr, ">>> %hhu file ready: %s; thumb ready: %s; id = %d\n", success, file, thumb_path, id);
45}
46
47static void
48_disconnect(Ethumb_Client *client)
49{
50 ethumb_client_disconnect(client);
51} 45}
52 46
53static void 47static void
@@ -84,7 +78,7 @@ _request_thumbnails(Ethumb_Client *client, void *data)
84} 78}
85 79
86static void 80static void
87_connect_cb(Ethumb_Client *client, Eina_Bool success, void *data) 81_connect_cb(void *data, Ethumb_Client *client, Eina_Bool success)
88{ 82{
89 fprintf(stderr, "connected: %d\n", success); 83 fprintf(stderr, "connected: %d\n", success);
90 if (!success) 84 if (!success)
@@ -116,12 +110,12 @@ main(int argc, char *argv[])
116 ethumb_client_shutdown(); 110 ethumb_client_shutdown();
117 return -1; 111 return -1;
118 } 112 }
119 ethumb_client_on_server_die_callback_set(client, _on_server_die_cb, NULL); 113 ethumb_client_on_server_die_callback_set(client, _on_server_die_cb, NULL, NULL);
120 114
121 fprintf(stderr, "*** debug\n"); 115 fprintf(stderr, "*** debug\n");
122 ecore_main_loop_begin(); 116 ecore_main_loop_begin();
123 117
124 _disconnect(client); 118 ethumb_client_disconnect(client);
125 119
126 ethumb_client_shutdown(); 120 ethumb_client_shutdown();
127 121