summaryrefslogtreecommitdiff
path: root/legacy/ethumb/src/bin/ethumbd.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2011-04-21 10:13:18 +0000
committerCedric BAIL <cedric.bail@free.fr>2011-04-21 10:13:18 +0000
commit6110f6e6f452452f9efff45edbeb70cde3426cb4 (patch)
tree1c8b5ff2809096c1d97b82ec697ec4ac4b9f8bca /legacy/ethumb/src/bin/ethumbd.c
parentdb20d2aeabc927d4bc1a53c2d697e450dd1f3a85 (diff)
ethumb: cleanup ethumbd to prepare multi slave support.
SVN revision: 58787
Diffstat (limited to '')
-rw-r--r--legacy/ethumb/src/bin/ethumbd.c351
1 files changed, 181 insertions, 170 deletions
diff --git a/legacy/ethumb/src/bin/ethumbd.c b/legacy/ethumb/src/bin/ethumbd.c
index 026f5724b1..dacbf42114 100644
--- a/legacy/ethumb/src/bin/ethumbd.c
+++ b/legacy/ethumb/src/bin/ethumbd.c
@@ -60,7 +60,15 @@ static const char fdo_path[] = "/org/freedesktop/DBus";
60 60
61static int _log_domain = -1; 61static int _log_domain = -1;
62 62
63struct _Ethumb_Setup 63typedef struct _Ethumbd_Setup Ethumbd_Setup;
64typedef struct _Ethumbd_Slave Ethumbd_Slave;
65typedef struct _Ethumbd_Request Ethumbd_Request;
66typedef struct _Ethumbd_Queue Ethumbd_Queue;
67typedef struct _Ethumbd_Object Ethumbd_Object;
68typedef struct _Ethumbd_Object_Data Ethumbd_Object_Data;
69typedef struct _Ethumbd Ethumbd;
70
71struct _Ethumbd_Setup
64{ 72{
65 struct 73 struct
66 { 74 {
@@ -103,15 +111,15 @@ struct _Ethumb_Setup
103 unsigned int document_page; 111 unsigned int document_page;
104}; 112};
105 113
106struct _Ethumb_Request 114struct _Ethumbd_Request
107{ 115{
108 int id; 116 int id;
109 const char *file, *key; 117 const char *file, *key;
110 const char *thumb, *thumb_key; 118 const char *thumb, *thumb_key;
111 struct _Ethumb_Setup setup; 119 Ethumbd_Setup setup;
112}; 120};
113 121
114struct _Ethumb_Object 122struct _Ethumbd_Object
115{ 123{
116 int used; 124 int used;
117 const char *path; 125 const char *path;
@@ -124,18 +132,18 @@ struct _Ethumb_Object
124 E_DBus_Object *dbus_obj; 132 E_DBus_Object *dbus_obj;
125}; 133};
126 134
127struct _Ethumb_Queue 135struct _Ethumbd_Queue
128{ 136{
129 int count; 137 int count;
130 int max_count; 138 int max_count;
131 int nqueue; 139 int nqueue;
132 int last; 140 int last;
133 int current; 141 int current;
134 struct _Ethumb_Object *table; 142 Ethumbd_Object *table;
135 int *list; 143 int *list;
136}; 144};
137 145
138struct _Ethumb_Slave 146struct _Ethumbd_Slave
139{ 147{
140 Ecore_Exe *exe; 148 Ecore_Exe *exe;
141 Ecore_Event_Handler *data_cb; 149 Ecore_Event_Handler *data_cb;
@@ -152,17 +160,17 @@ struct _Ethumbd
152 E_DBus_Interface *eiface, *objects_iface; 160 E_DBus_Interface *eiface, *objects_iface;
153 E_DBus_Object *dbus_obj; 161 E_DBus_Object *dbus_obj;
154 Ecore_Idler *idler; 162 Ecore_Idler *idler;
155 struct _Ethumb_Request *processing; 163 Ethumbd_Request *processing;
156 struct _Ethumb_Queue queue; 164 Ethumbd_Queue queue;
157 double timeout; 165 double timeout;
158 Ecore_Timer *timeout_timer; 166 Ecore_Timer *timeout_timer;
159 struct _Ethumb_Slave slave; 167 Ethumbd_Slave slave;
160}; 168};
161 169
162struct _Ethumb_Object_Data 170struct _Ethumbd_Object_Data
163{ 171{
164 int index; 172 int idx;
165 struct _Ethumbd *ed; 173 Ethumbd *ed;
166}; 174};
167 175
168struct _Ethumb_DBus_Method_Table 176struct _Ethumb_DBus_Method_Table
@@ -201,13 +209,13 @@ const Ecore_Getopt optdesc = {
201 } 209 }
202}; 210};
203 211
204static void _ethumb_dbus_generated_signal(struct _Ethumbd *ed, int *id, const char *thumb_path, const char *thumb_key, Eina_Bool success); 212static void _ethumb_dbus_generated_signal(Ethumbd *ed, int *id, const char *thumb_path, const char *thumb_key, Eina_Bool success);
205static int _ethumbd_slave_spawn(struct _Ethumbd *ed); 213static int _ethumbd_slave_spawn(Ethumbd *ed);
206 214
207static Eina_Bool 215static Eina_Bool
208_ethumbd_timeout_cb(void *data) 216_ethumbd_timeout_cb(void *data)
209{ 217{
210 struct _Ethumbd *ed = data; 218 Ethumbd *ed = data;
211 219
212 ecore_main_loop_quit(); 220 ecore_main_loop_quit();
213 ed->timeout_timer = NULL; 221 ed->timeout_timer = NULL;
@@ -216,7 +224,7 @@ _ethumbd_timeout_cb(void *data)
216} 224}
217 225
218static void 226static void
219_ethumbd_timeout_start(struct _Ethumbd *ed) 227_ethumbd_timeout_start(Ethumbd *ed)
220{ 228{
221 if (ed->timeout < 0) 229 if (ed->timeout < 0)
222 return; 230 return;
@@ -226,7 +234,7 @@ _ethumbd_timeout_start(struct _Ethumbd *ed)
226} 234}
227 235
228static void 236static void
229_ethumbd_timeout_stop(struct _Ethumbd *ed) 237_ethumbd_timeout_stop(Ethumbd *ed)
230{ 238{
231 if (!ed->timeout_timer) 239 if (!ed->timeout_timer)
232 return; 240 return;
@@ -236,7 +244,7 @@ _ethumbd_timeout_stop(struct _Ethumbd *ed)
236} 244}
237 245
238static int 246static int
239_ethumb_dbus_check_id(struct _Ethumb_Object *eobject, int id) 247_ethumb_dbus_check_id(Ethumbd_Object *eobject, int id)
240{ 248{
241 if (id < 0 || id > MAX_ID) 249 if (id < 0 || id > MAX_ID)
242 return 0; 250 return 0;
@@ -250,7 +258,7 @@ _ethumb_dbus_check_id(struct _Ethumb_Object *eobject, int id)
250} 258}
251 259
252static void 260static void
253_ethumb_dbus_inc_max_id(struct _Ethumb_Object *eobject, int id) 261_ethumb_dbus_inc_max_id(Ethumbd_Object *eobject, int id)
254{ 262{
255 if (eobject->min_id < 0 && eobject->max_id < 0) 263 if (eobject->min_id < 0 && eobject->max_id < 0)
256 eobject->min_id = id; 264 eobject->min_id = id;
@@ -259,14 +267,14 @@ _ethumb_dbus_inc_max_id(struct _Ethumb_Object *eobject, int id)
259} 267}
260 268
261static void 269static void
262_ethumb_dbus_inc_min_id(struct _Ethumb_Object *eobject) 270_ethumb_dbus_inc_min_id(Ethumbd_Object *eobject)
263{ 271{
264 Eina_List *l; 272 Eina_List *l;
265 273
266 l = eobject->queue; 274 l = eobject->queue;
267 while (l) 275 while (l)
268 { 276 {
269 struct _Ethumb_Request *request = l->data; 277 Ethumbd_Request *request = l->data;
270 if (request->id >= 0) 278 if (request->id >= 0)
271 { 279 {
272 eobject->min_id = request->id; 280 eobject->min_id = request->id;
@@ -284,37 +292,37 @@ _ethumb_dbus_inc_min_id(struct _Ethumb_Object *eobject)
284} 292}
285 293
286int 294int
287_ethumbd_write_safe(struct _Ethumbd *ed, const void *buf, ssize_t size) 295_ethumbd_write_safe(Ethumbd_Slave *slave, const void *buf, ssize_t size)
288{ 296{
289 297
290 if (!ed->slave.exe) 298 if (!slave->exe)
291 { 299 {
292 ERR("slave process isn't running."); 300 ERR("slave process isn't running.");
293 return 0; 301 return 0;
294 } 302 }
295 303
296 ecore_exe_send(ed->slave.exe, buf, size); 304 ecore_exe_send(slave->exe, buf, size);
297 return 1; 305 return 1;
298} 306}
299 307
300static void 308static void
301_ethumbd_child_write_op_new(struct _Ethumbd *ed, int index) 309_ethumbd_child_write_op_new(Ethumbd_Slave *slave, int idx)
302{ 310{
303 int id = ETHUMBD_OP_NEW; 311 int id = ETHUMBD_OP_NEW;
304 _ethumbd_write_safe(ed, &id, sizeof(id)); 312 _ethumbd_write_safe(slave, &id, sizeof(id));
305 _ethumbd_write_safe(ed, &index, sizeof(index)); 313 _ethumbd_write_safe(slave, &idx, sizeof(idx));
306} 314}
307 315
308static void 316static void
309_ethumbd_child_write_op_del(struct _Ethumbd *ed, int index) 317_ethumbd_child_write_op_del(Ethumbd_Slave *slave, int idx)
310{ 318{
311 int id = ETHUMBD_OP_DEL; 319 int id = ETHUMBD_OP_DEL;
312 _ethumbd_write_safe(ed, &id, sizeof(id)); 320 _ethumbd_write_safe(slave, &id, sizeof(id));
313 _ethumbd_write_safe(ed, &index, sizeof(index)); 321 _ethumbd_write_safe(slave, &idx, sizeof(idx));
314} 322}
315 323
316static void 324static void
317_ethumbd_pipe_str_write(struct _Ethumbd *ed, const char *str) 325_ethumbd_pipe_str_write(Ethumbd_Slave *slave, const char *str)
318{ 326{
319 int len; 327 int len;
320 328
@@ -323,26 +331,28 @@ _ethumbd_pipe_str_write(struct _Ethumbd *ed, const char *str)
323 else 331 else
324 len = 0; 332 len = 0;
325 333
326 _ethumbd_write_safe(ed, &len, sizeof(len)); 334 _ethumbd_write_safe(slave, &len, sizeof(len));
327 _ethumbd_write_safe(ed, str, len); 335 _ethumbd_write_safe(slave, str, len);
328} 336}
329 337
330static void 338static void
331_ethumbd_child_write_op_generate(struct _Ethumbd *ed, int index, const char *path, const char *key, const char *thumb_path, const char *thumb_key) 339_ethumbd_child_write_op_generate(Ethumbd_Slave *slave,
340 int idx, const char *path, const char *key,
341 const char *thumb_path, const char *thumb_key)
332{ 342{
333 int id = ETHUMBD_OP_GENERATE; 343 int id = ETHUMBD_OP_GENERATE;
334 344
335 _ethumbd_write_safe(ed, &id, sizeof(id)); 345 _ethumbd_write_safe(slave, &id, sizeof(id));
336 _ethumbd_write_safe(ed, &index, sizeof(index)); 346 _ethumbd_write_safe(slave, &idx, sizeof(idx));
337 347
338 _ethumbd_pipe_str_write(ed, path); 348 _ethumbd_pipe_str_write(slave, path);
339 _ethumbd_pipe_str_write(ed, key); 349 _ethumbd_pipe_str_write(slave, key);
340 _ethumbd_pipe_str_write(ed, thumb_path); 350 _ethumbd_pipe_str_write(slave, thumb_path);
341 _ethumbd_pipe_str_write(ed, thumb_key); 351 _ethumbd_pipe_str_write(slave, thumb_key);
342} 352}
343 353
344static void 354static void
345_generated_cb(struct _Ethumbd *ed, Eina_Bool success, const char *thumb_path, const char *thumb_key) 355_generated_cb(Ethumbd *ed, Eina_Bool success, const char *thumb_path, const char *thumb_key)
346{ 356{
347 int i = ed->queue.current; 357 int i = ed->queue.current;
348 358
@@ -360,7 +370,7 @@ _generated_cb(struct _Ethumbd *ed, Eina_Bool success, const char *thumb_path, co
360} 370}
361 371
362static void 372static void
363_ethumbd_slave_cmd_ready(struct _Ethumbd *ed) 373_ethumbd_slave_cmd_ready(Ethumbd *ed)
364{ 374{
365 const char *bufcmd = ed->slave.bufcmd; 375 const char *bufcmd = ed->slave.bufcmd;
366 Eina_Bool success; 376 Eina_Bool success;
@@ -399,7 +409,7 @@ _ethumbd_slave_cmd_ready(struct _Ethumbd *ed)
399} 409}
400 410
401static int 411static int
402_ethumbd_slave_alloc_cmd(struct _Ethumbd *ed, int ssize, char *sdata) 412_ethumbd_slave_alloc_cmd(Ethumbd *ed, int ssize, char *sdata)
403{ 413{
404 int *scmd; 414 int *scmd;
405 415
@@ -421,7 +431,7 @@ _ethumbd_slave_alloc_cmd(struct _Ethumbd *ed, int ssize, char *sdata)
421static Eina_Bool 431static Eina_Bool
422_ethumbd_slave_data_read_cb(void *data, int type __UNUSED__, void *event) 432_ethumbd_slave_data_read_cb(void *data, int type __UNUSED__, void *event)
423{ 433{
424 struct _Ethumbd *ed = data; 434 Ethumbd *ed = data;
425 Ecore_Exe_Event_Data *ev = event; 435 Ecore_Exe_Event_Data *ev = event;
426 int ssize; 436 int ssize;
427 char *sdata; 437 char *sdata;
@@ -467,7 +477,7 @@ _ethumbd_slave_data_read_cb(void *data, int type __UNUSED__, void *event)
467static Eina_Bool 477static Eina_Bool
468_ethumbd_slave_del_cb(void *data, int type __UNUSED__, void *event) 478_ethumbd_slave_del_cb(void *data, int type __UNUSED__, void *event)
469{ 479{
470 struct _Ethumbd *ed = data; 480 Ethumbd *ed = data;
471 Ecore_Exe_Event_Del *ev = event; 481 Ecore_Exe_Event_Del *ev = event;
472 int i; 482 int i;
473 483
@@ -505,12 +515,12 @@ end:
505} 515}
506 516
507static void 517static void
508_ethumbd_pipe_write_setup(struct _Ethumbd *ed, int type, const void *data) 518_ethumbd_pipe_write_setup(Ethumbd_Slave *slave, int type, const void *data)
509{ 519{
510 const int *i_value; 520 const int *i_value;
511 const float *f_value; 521 const float *f_value;
512 522
513 _ethumbd_write_safe(ed, &type, sizeof(type)); 523 _ethumbd_write_safe(slave, &type, sizeof(type));
514 524
515 switch (type) 525 switch (type)
516 { 526 {
@@ -526,7 +536,7 @@ _ethumbd_pipe_write_setup(struct _Ethumbd *ed, int type, const void *data)
526 case ETHUMBD_VIDEO_NTIMES: 536 case ETHUMBD_VIDEO_NTIMES:
527 case ETHUMBD_VIDEO_FPS: 537 case ETHUMBD_VIDEO_FPS:
528 i_value = data; 538 i_value = data;
529 _ethumbd_write_safe(ed, i_value, sizeof(*i_value)); 539 _ethumbd_write_safe(slave, i_value, sizeof(*i_value));
530 break; 540 break;
531 case ETHUMBD_CROP_X: 541 case ETHUMBD_CROP_X:
532 case ETHUMBD_CROP_Y: 542 case ETHUMBD_CROP_Y:
@@ -534,14 +544,14 @@ _ethumbd_pipe_write_setup(struct _Ethumbd *ed, int type, const void *data)
534 case ETHUMBD_VIDEO_START: 544 case ETHUMBD_VIDEO_START:
535 case ETHUMBD_VIDEO_INTERVAL: 545 case ETHUMBD_VIDEO_INTERVAL:
536 f_value = data; 546 f_value = data;
537 _ethumbd_write_safe(ed, f_value, sizeof(*f_value)); 547 _ethumbd_write_safe(slave, f_value, sizeof(*f_value));
538 break; 548 break;
539 case ETHUMBD_DIRECTORY: 549 case ETHUMBD_DIRECTORY:
540 case ETHUMBD_CATEGORY: 550 case ETHUMBD_CATEGORY:
541 case ETHUMBD_FRAME_FILE: 551 case ETHUMBD_FRAME_FILE:
542 case ETHUMBD_FRAME_GROUP: 552 case ETHUMBD_FRAME_GROUP:
543 case ETHUMBD_FRAME_SWALLOW: 553 case ETHUMBD_FRAME_SWALLOW:
544 _ethumbd_pipe_str_write(ed, data); 554 _ethumbd_pipe_str_write(slave, data);
545 break; 555 break;
546 case ETHUMBD_SETUP_FINISHED: 556 case ETHUMBD_SETUP_FINISHED:
547 break; 557 break;
@@ -551,63 +561,64 @@ _ethumbd_pipe_write_setup(struct _Ethumbd *ed, int type, const void *data)
551} 561}
552 562
553static void 563static void
554_process_setup(struct _Ethumbd *ed) 564_process_setup(Ethumbd *ed)
555{ 565{
556 int op_id = ETHUMBD_OP_SETUP; 566 int op_id = ETHUMBD_OP_SETUP;
557 int index = ed->queue.current; 567 int idx = ed->queue.current;
558 568
559 struct _Ethumb_Setup *setup = &ed->processing->setup; 569 Ethumbd_Setup *setup = &ed->processing->setup;
570 Ethumbd_Slave *slave = &ed->slave;
560 571
561 _ethumbd_write_safe(ed, &op_id, sizeof(op_id)); 572 _ethumbd_write_safe(slave, &op_id, sizeof(op_id));
562 _ethumbd_write_safe(ed, &index, sizeof(index)); 573 _ethumbd_write_safe(slave, &idx, sizeof(idx));
563 574
564 if (setup->flags.fdo) 575 if (setup->flags.fdo)
565 _ethumbd_pipe_write_setup(ed, ETHUMBD_FDO, &setup->fdo); 576 _ethumbd_pipe_write_setup(slave, ETHUMBD_FDO, &setup->fdo);
566 if (setup->flags.size) 577 if (setup->flags.size)
567 { 578 {
568 _ethumbd_pipe_write_setup(ed, ETHUMBD_SIZE_W, &setup->tw); 579 _ethumbd_pipe_write_setup(slave, ETHUMBD_SIZE_W, &setup->tw);
569 _ethumbd_pipe_write_setup(ed, ETHUMBD_SIZE_H, &setup->th); 580 _ethumbd_pipe_write_setup(slave, ETHUMBD_SIZE_H, &setup->th);
570 } 581 }
571 if (setup->flags.format) 582 if (setup->flags.format)
572 _ethumbd_pipe_write_setup(ed, ETHUMBD_FORMAT, &setup->format); 583 _ethumbd_pipe_write_setup(slave, ETHUMBD_FORMAT, &setup->format);
573 if (setup->flags.aspect) 584 if (setup->flags.aspect)
574 _ethumbd_pipe_write_setup(ed, ETHUMBD_ASPECT, &setup->aspect); 585 _ethumbd_pipe_write_setup(slave, ETHUMBD_ASPECT, &setup->aspect);
575 if (setup->flags.orientation) 586 if (setup->flags.orientation)
576 _ethumbd_pipe_write_setup(ed, ETHUMBD_ORIENTATION, &setup->orientation); 587 _ethumbd_pipe_write_setup(slave, ETHUMBD_ORIENTATION, &setup->orientation);
577 if (setup->flags.crop) 588 if (setup->flags.crop)
578 { 589 {
579 _ethumbd_pipe_write_setup(ed, ETHUMBD_CROP_X, &setup->cx); 590 _ethumbd_pipe_write_setup(slave, ETHUMBD_CROP_X, &setup->cx);
580 _ethumbd_pipe_write_setup(ed, ETHUMBD_CROP_Y, &setup->cy); 591 _ethumbd_pipe_write_setup(slave, ETHUMBD_CROP_Y, &setup->cy);
581 } 592 }
582 if (setup->flags.quality) 593 if (setup->flags.quality)
583 _ethumbd_pipe_write_setup(ed, ETHUMBD_QUALITY, &setup->quality); 594 _ethumbd_pipe_write_setup(slave, ETHUMBD_QUALITY, &setup->quality);
584 if (setup->flags.compress) 595 if (setup->flags.compress)
585 _ethumbd_pipe_write_setup(ed, ETHUMBD_COMPRESS, &setup->compress); 596 _ethumbd_pipe_write_setup(slave, ETHUMBD_COMPRESS, &setup->compress);
586 if (setup->flags.directory) 597 if (setup->flags.directory)
587 _ethumbd_pipe_write_setup(ed, ETHUMBD_DIRECTORY, setup->directory); 598 _ethumbd_pipe_write_setup(slave, ETHUMBD_DIRECTORY, setup->directory);
588 if (setup->flags.category) 599 if (setup->flags.category)
589 _ethumbd_pipe_write_setup(ed, ETHUMBD_CATEGORY, setup->category); 600 _ethumbd_pipe_write_setup(slave, ETHUMBD_CATEGORY, setup->category);
590 if (setup->flags.frame) 601 if (setup->flags.frame)
591 { 602 {
592 _ethumbd_pipe_write_setup(ed, ETHUMBD_FRAME_FILE, setup->theme_file); 603 _ethumbd_pipe_write_setup(slave, ETHUMBD_FRAME_FILE, setup->theme_file);
593 _ethumbd_pipe_write_setup(ed, ETHUMBD_FRAME_GROUP, setup->group); 604 _ethumbd_pipe_write_setup(slave, ETHUMBD_FRAME_GROUP, setup->group);
594 _ethumbd_pipe_write_setup(ed, ETHUMBD_FRAME_SWALLOW, setup->swallow); 605 _ethumbd_pipe_write_setup(slave, ETHUMBD_FRAME_SWALLOW, setup->swallow);
595 } 606 }
596 if (setup->flags.video_time) 607 if (setup->flags.video_time)
597 _ethumbd_pipe_write_setup(ed, ETHUMBD_VIDEO_TIME, &setup->video_time); 608 _ethumbd_pipe_write_setup(slave, ETHUMBD_VIDEO_TIME, &setup->video_time);
598 if (setup->flags.video_start) 609 if (setup->flags.video_start)
599 _ethumbd_pipe_write_setup(ed, ETHUMBD_VIDEO_START, &setup->video_start); 610 _ethumbd_pipe_write_setup(slave, ETHUMBD_VIDEO_START, &setup->video_start);
600 if (setup->flags.video_interval) 611 if (setup->flags.video_interval)
601 _ethumbd_pipe_write_setup(ed, ETHUMBD_VIDEO_INTERVAL, 612 _ethumbd_pipe_write_setup(slave, ETHUMBD_VIDEO_INTERVAL,
602 &setup->video_interval); 613 &setup->video_interval);
603 if (setup->flags.video_ntimes) 614 if (setup->flags.video_ntimes)
604 _ethumbd_pipe_write_setup(ed, ETHUMBD_VIDEO_NTIMES, &setup->video_ntimes); 615 _ethumbd_pipe_write_setup(slave, ETHUMBD_VIDEO_NTIMES, &setup->video_ntimes);
605 if (setup->flags.video_fps) 616 if (setup->flags.video_fps)
606 _ethumbd_pipe_write_setup(ed, ETHUMBD_VIDEO_FPS, &setup->video_fps); 617 _ethumbd_pipe_write_setup(slave, ETHUMBD_VIDEO_FPS, &setup->video_fps);
607 if (setup->flags.document_page) 618 if (setup->flags.document_page)
608 _ethumbd_pipe_write_setup(ed, ETHUMBD_DOCUMENT_PAGE, 619 _ethumbd_pipe_write_setup(slave, ETHUMBD_DOCUMENT_PAGE,
609 &setup->document_page); 620 &setup->document_page);
610 _ethumbd_pipe_write_setup(ed, ETHUMBD_SETUP_FINISHED, NULL); 621 _ethumbd_pipe_write_setup(slave, ETHUMBD_SETUP_FINISHED, NULL);
611 622
612 623
613 if (setup->directory) eina_stringshare_del(setup->directory); 624 if (setup->directory) eina_stringshare_del(setup->directory);
@@ -621,32 +632,32 @@ _process_setup(struct _Ethumbd *ed)
621} 632}
622 633
623static void 634static void
624_process_file(struct _Ethumbd *ed) 635_process_file(Ethumbd *ed)
625{ 636{
626 _ethumbd_child_write_op_generate 637 _ethumbd_child_write_op_generate
627 (ed, ed->queue.current, ed->processing->file, 638 (&ed->slave, ed->queue.current, ed->processing->file,
628 ed->processing->key, ed->processing->thumb, ed->processing->thumb_key); 639 ed->processing->key, ed->processing->thumb, ed->processing->thumb_key);
629} 640}
630 641
631static int 642static int
632_get_next_on_queue(struct _Ethumb_Queue *queue) 643_get_next_on_queue(Ethumbd_Queue *queue)
633{ 644{
634 int i, index; 645 int i, idx;
635 struct _Ethumb_Object *eobject; 646 Ethumbd_Object *eobject;
636 647
637 i = queue->last; 648 i = queue->last;
638 i++; 649 i++;
639 if (i >= queue->count) 650 if (i >= queue->count)
640 i = 0; 651 i = 0;
641 652
642 index = queue->list[i]; 653 idx = queue->list[i];
643 eobject = &(queue->table[index]); 654 eobject = &(queue->table[idx]);
644 while (!eobject->nqueue) 655 while (!eobject->nqueue)
645 { 656 {
646 i = (i + 1) % queue->count; 657 i = (i + 1) % queue->count;
647 658
648 index = queue->list[i]; 659 idx = queue->list[i];
649 eobject = &(queue->table[index]); 660 eobject = &(queue->table[idx]);
650 } 661 }
651 662
652 return queue->list[i]; 663 return queue->list[i];
@@ -655,11 +666,11 @@ _get_next_on_queue(struct _Ethumb_Queue *queue)
655static Eina_Bool 666static Eina_Bool
656_process_queue_cb(void *data) 667_process_queue_cb(void *data)
657{ 668{
658 struct _Ethumb_Object *eobject; 669 Ethumbd_Object *eobject;
659 int i; 670 int i;
660 struct _Ethumbd *ed = data; 671 Ethumbd *ed = data;
661 struct _Ethumb_Queue *queue = &ed->queue; 672 Ethumbd_Queue *queue = &ed->queue;
662 struct _Ethumb_Request *request; 673 Ethumbd_Request *request;
663 674
664 if (ed->processing) 675 if (ed->processing)
665 return 1; 676 return 1;
@@ -699,14 +710,14 @@ _process_queue_cb(void *data)
699} 710}
700 711
701static void 712static void
702_process_queue_start(struct _Ethumbd *ed) 713_process_queue_start(Ethumbd *ed)
703{ 714{
704 if (!ed->idler) 715 if (!ed->idler)
705 ed->idler = ecore_idler_add(_process_queue_cb, ed); 716 ed->idler = ecore_idler_add(_process_queue_cb, ed);
706} 717}
707 718
708static void 719static void
709_process_queue_stop(struct _Ethumbd *ed) 720_process_queue_stop(Ethumbd *ed)
710{ 721{
711 if (ed->idler) 722 if (ed->idler)
712 { 723 {
@@ -716,11 +727,11 @@ _process_queue_stop(struct _Ethumbd *ed)
716} 727}
717 728
718static int 729static int
719_ethumb_table_append(struct _Ethumbd *ed) 730_ethumb_table_append(Ethumbd *ed)
720{ 731{
721 int i; 732 int i;
722 char buf[1024]; 733 char buf[1024];
723 struct _Ethumb_Queue *q = &ed->queue; 734 Ethumbd_Queue *q = &ed->queue;
724 735
725 if (q->count == q->max_count) 736 if (q->count == q->max_count)
726 { 737 {
@@ -731,15 +742,15 @@ _ethumb_table_append(struct _Ethumbd *ed)
731 start = q->max_count; 742 start = q->max_count;
732 size = new_max - q->max_count; 743 size = new_max - q->max_count;
733 744
734 tmp = realloc(q->table, new_max * sizeof(struct _Ethumb_Object)); 745 tmp = realloc(q->table, new_max * sizeof(Ethumbd_Object));
735 if (!tmp) 746 if (!tmp)
736 { 747 {
737 CRIT("could not realloc q->table to %zd bytes: %s", 748 CRIT("could not realloc q->table to %zd bytes: %s",
738 new_max * sizeof(struct _Ethumb_Object), strerror(errno)); 749 new_max * sizeof(Ethumbd_Object), strerror(errno));
739 return -1; 750 return -1;
740 } 751 }
741 q->table = tmp; 752 q->table = tmp;
742 memset(&q->table[start], 0, size * sizeof(struct _Ethumb_Object)); 753 memset(&q->table[start], 0, size * sizeof(Ethumbd_Object));
743 754
744 tmp = realloc(q->list, new_max * sizeof(int)); 755 tmp = realloc(q->list, new_max * sizeof(int));
745 if (!tmp) 756 if (!tmp)
@@ -766,13 +777,13 @@ _ethumb_table_append(struct _Ethumbd *ed)
766 q->table[i].min_id = -1; 777 q->table[i].min_id = -1;
767 q->list[q->count] = i; 778 q->list[q->count] = i;
768 q->count++; 779 q->count++;
769 DBG("new object: %s, index = %d, count = %d", buf, i, q->count); 780 DBG("new object: %s, idx = %d, count = %d", buf, i, q->count);
770 781
771 return i; 782 return i;
772} 783}
773 784
774static inline int 785static inline int
775_get_index_for_path(const char *path) 786_get_idx_for_path(const char *path)
776{ 787{
777 int i; 788 int i;
778 int n; 789 int n;
@@ -783,20 +794,20 @@ _get_index_for_path(const char *path)
783} 794}
784 795
785static void 796static void
786_ethumb_table_del(struct _Ethumbd *ed, int i) 797_ethumb_table_del(Ethumbd *ed, int i)
787{ 798{
788 int j; 799 int j;
789 Eina_List *l; 800 Eina_List *l;
790 const Eina_List *il; 801 const Eina_List *il;
791 struct _Ethumb_Queue *q = &ed->queue; 802 Ethumbd_Queue *q = &ed->queue;
792 struct _Ethumb_Object_Data *odata; 803 Ethumbd_Object_Data *odata;
793 804
794 eina_stringshare_del(q->table[i].path); 805 eina_stringshare_del(q->table[i].path);
795 806
796 l = q->table[i].queue; 807 l = q->table[i].queue;
797 while (l) 808 while (l)
798 { 809 {
799 struct _Ethumb_Request *request = l->data; 810 Ethumbd_Request *request = l->data;
800 eina_stringshare_del(request->file); 811 eina_stringshare_del(request->file);
801 eina_stringshare_del(request->key); 812 eina_stringshare_del(request->key);
802 eina_stringshare_del(request->thumb); 813 eina_stringshare_del(request->thumb);
@@ -816,7 +827,7 @@ _ethumb_table_del(struct _Ethumbd *ed, int i)
816 free(odata); 827 free(odata);
817 e_dbus_object_free(q->table[i].dbus_obj); 828 e_dbus_object_free(q->table[i].dbus_obj);
818 829
819 memset(&(q->table[i]), 0, sizeof(struct _Ethumb_Object)); 830 memset(&(q->table[i]), 0, sizeof(Ethumbd_Object));
820 for (j = 0; j < q->count; j++) 831 for (j = 0; j < q->count; j++)
821 { 832 {
822 if (q->list[j] == i) 833 if (q->list[j] == i)
@@ -824,13 +835,13 @@ _ethumb_table_del(struct _Ethumbd *ed, int i)
824 } 835 }
825 836
826 q->count--; 837 q->count--;
827 _ethumbd_child_write_op_del(ed, i); 838 _ethumbd_child_write_op_del(&ed->slave, i);
828 if (!q->count && !ed->processing) 839 if (!q->count && !ed->processing)
829 _ethumbd_timeout_start(ed); 840 _ethumbd_timeout_start(ed);
830} 841}
831 842
832static void 843static void
833_ethumb_table_clear(struct _Ethumbd *ed) 844_ethumb_table_clear(Ethumbd *ed)
834{ 845{
835 int i; 846 int i;
836 847
@@ -843,8 +854,8 @@ static void
843_name_owner_changed_cb(void *data, DBusMessage *msg) 854_name_owner_changed_cb(void *data, DBusMessage *msg)
844{ 855{
845 DBusError err; 856 DBusError err;
846 struct _Ethumbd *ed = data; 857 Ethumbd *ed = data;
847 struct _Ethumb_Queue *q = &ed->queue; 858 Ethumbd_Queue *q = &ed->queue;
848 const char *name, *from, *to; 859 const char *name, *from, *to;
849 int i; 860 int i;
850 861
@@ -878,7 +889,7 @@ _name_owner_changed_cb(void *data, DBusMessage *msg)
878} 889}
879 890
880static void 891static void
881_ethumb_dbus_add_name_owner_changed_cb(struct _Ethumbd *ed) 892_ethumb_dbus_add_name_owner_changed_cb(Ethumbd *ed)
882{ 893{
883 ed->name_owner_changed_handler = e_dbus_signal_handler_add 894 ed->name_owner_changed_handler = e_dbus_signal_handler_add
884 (ed->conn, fdo_bus_name, fdo_path, fdo_interface, "NameOwnerChanged", 895 (ed->conn, fdo_bus_name, fdo_path, fdo_interface, "NameOwnerChanged",
@@ -891,11 +902,11 @@ _ethumb_dbus_ethumb_new_cb(E_DBus_Object *object, DBusMessage *msg)
891 DBusMessage *reply; 902 DBusMessage *reply;
892 DBusMessageIter iter; 903 DBusMessageIter iter;
893 E_DBus_Object *dbus_object; 904 E_DBus_Object *dbus_object;
894 struct _Ethumb_Object_Data *odata; 905 Ethumbd_Object_Data *odata;
895 int i; 906 int i;
896 const char *return_path = ""; 907 const char *return_path = "";
897 const char *client; 908 const char *client;
898 struct _Ethumbd *ed; 909 Ethumbd *ed;
899 910
900 ed = e_dbus_object_data_get(object); 911 ed = e_dbus_object_data_get(object);
901 client = dbus_message_get_sender(msg); 912 client = dbus_message_get_sender(msg);
@@ -907,7 +918,7 @@ _ethumb_dbus_ethumb_new_cb(E_DBus_Object *object, DBusMessage *msg)
907 goto end_new; 918 goto end_new;
908 919
909 odata = calloc(1, sizeof(*odata)); 920 odata = calloc(1, sizeof(*odata));
910 odata->index = i; 921 odata->idx = i;
911 odata->ed = ed; 922 odata->ed = ed;
912 923
913 ed->queue.table[i].client = eina_stringshare_add(client); 924 ed->queue.table[i].client = eina_stringshare_add(client);
@@ -925,7 +936,7 @@ _ethumb_dbus_ethumb_new_cb(E_DBus_Object *object, DBusMessage *msg)
925 e_dbus_object_interface_attach(dbus_object, ed->objects_iface); 936 e_dbus_object_interface_attach(dbus_object, ed->objects_iface);
926 ed->queue.table[i].dbus_obj = dbus_object; 937 ed->queue.table[i].dbus_obj = dbus_object;
927 938
928 _ethumbd_child_write_op_new(ed, i); 939 _ethumbd_child_write_op_new(&ed->slave, i);
929 _ethumbd_timeout_stop(ed); 940 _ethumbd_timeout_stop(ed);
930 941
931 end_new: 942 end_new:
@@ -987,10 +998,10 @@ _ethumb_dbus_queue_add_cb(E_DBus_Object *object, DBusMessage *msg)
987 DBusMessageIter iter; 998 DBusMessageIter iter;
988 const char *file, *key; 999 const char *file, *key;
989 const char *thumb, *thumb_key; 1000 const char *thumb, *thumb_key;
990 struct _Ethumb_Object_Data *odata; 1001 Ethumbd_Object_Data *odata;
991 struct _Ethumb_Object *eobject; 1002 Ethumbd_Object *eobject;
992 struct _Ethumbd *ed; 1003 Ethumbd *ed;
993 struct _Ethumb_Request *request; 1004 Ethumbd_Request *request;
994 dbus_int32_t id = -1; 1005 dbus_int32_t id = -1;
995 1006
996 dbus_message_iter_init(msg, &iter); 1007 dbus_message_iter_init(msg, &iter);
@@ -1018,7 +1029,7 @@ _ethumb_dbus_queue_add_cb(E_DBus_Object *object, DBusMessage *msg)
1018 } 1029 }
1019 1030
1020 ed = odata->ed; 1031 ed = odata->ed;
1021 eobject = &(ed->queue.table[odata->index]); 1032 eobject = &(ed->queue.table[odata->idx]);
1022 if (!_ethumb_dbus_check_id(eobject, id)) 1033 if (!_ethumb_dbus_check_id(eobject, id))
1023 goto end; 1034 goto end;
1024 request = calloc(1, sizeof(*request)); 1035 request = calloc(1, sizeof(*request));
@@ -1047,10 +1058,10 @@ _ethumb_dbus_queue_remove_cb(E_DBus_Object *object, DBusMessage *msg)
1047 DBusMessage *reply; 1058 DBusMessage *reply;
1048 DBusMessageIter iter; 1059 DBusMessageIter iter;
1049 dbus_int32_t id; 1060 dbus_int32_t id;
1050 struct _Ethumb_Object_Data *odata; 1061 Ethumbd_Object_Data *odata;
1051 struct _Ethumb_Object *eobject; 1062 Ethumbd_Object *eobject;
1052 struct _Ethumb_Request *request; 1063 Ethumbd_Request *request;
1053 struct _Ethumbd *ed; 1064 Ethumbd *ed;
1054 dbus_bool_t r = 0; 1065 dbus_bool_t r = 0;
1055 Eina_List *l; 1066 Eina_List *l;
1056 1067
@@ -1065,7 +1076,7 @@ _ethumb_dbus_queue_remove_cb(E_DBus_Object *object, DBusMessage *msg)
1065 } 1076 }
1066 1077
1067 ed = odata->ed; 1078 ed = odata->ed;
1068 eobject = &ed->queue.table[odata->index]; 1079 eobject = &ed->queue.table[odata->idx];
1069 l = eobject->queue; 1080 l = eobject->queue;
1070 while (l) 1081 while (l)
1071 { 1082 {
@@ -1100,9 +1111,9 @@ DBusMessage *
1100_ethumb_dbus_queue_clear_cb(E_DBus_Object *object, DBusMessage *msg) 1111_ethumb_dbus_queue_clear_cb(E_DBus_Object *object, DBusMessage *msg)
1101{ 1112{
1102 DBusMessage *reply; 1113 DBusMessage *reply;
1103 struct _Ethumb_Object_Data *odata; 1114 Ethumbd_Object_Data *odata;
1104 struct _Ethumb_Object *eobject; 1115 Ethumbd_Object *eobject;
1105 struct _Ethumbd *ed; 1116 Ethumbd *ed;
1106 Eina_List *l; 1117 Eina_List *l;
1107 1118
1108 odata = e_dbus_object_data_get(object); 1119 odata = e_dbus_object_data_get(object);
@@ -1113,11 +1124,11 @@ _ethumb_dbus_queue_clear_cb(E_DBus_Object *object, DBusMessage *msg)
1113 } 1124 }
1114 1125
1115 ed = odata->ed; 1126 ed = odata->ed;
1116 eobject = &ed->queue.table[odata->index]; 1127 eobject = &ed->queue.table[odata->idx];
1117 l = eobject->queue; 1128 l = eobject->queue;
1118 while (l) 1129 while (l)
1119 { 1130 {
1120 struct _Ethumb_Request *request = l->data; 1131 Ethumbd_Request *request = l->data;
1121 eina_stringshare_del(request->file); 1132 eina_stringshare_del(request->file);
1122 eina_stringshare_del(request->key); 1133 eina_stringshare_del(request->key);
1123 eina_stringshare_del(request->thumb); 1134 eina_stringshare_del(request->thumb);
@@ -1138,8 +1149,8 @@ _ethumb_dbus_delete_cb(E_DBus_Object *object, DBusMessage *msg)
1138{ 1149{
1139 DBusMessage *reply; 1150 DBusMessage *reply;
1140 DBusMessageIter iter; 1151 DBusMessageIter iter;
1141 struct _Ethumb_Object_Data *odata; 1152 Ethumbd_Object_Data *odata;
1142 struct _Ethumbd *ed; 1153 Ethumbd *ed;
1143 1154
1144 dbus_message_iter_init(msg, &iter); 1155 dbus_message_iter_init(msg, &iter);
1145 reply = dbus_message_new_method_return(msg); 1156 reply = dbus_message_new_method_return(msg);
@@ -1151,14 +1162,14 @@ _ethumb_dbus_delete_cb(E_DBus_Object *object, DBusMessage *msg)
1151 return reply; 1162 return reply;
1152 } 1163 }
1153 ed = odata->ed; 1164 ed = odata->ed;
1154 _ethumb_table_del(ed, odata->index); 1165 _ethumb_table_del(ed, odata->idx);
1155 free(odata); 1166 free(odata);
1156 1167
1157 return reply; 1168 return reply;
1158} 1169}
1159 1170
1160static int 1171static int
1161_ethumb_dbus_fdo_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1172_ethumb_dbus_fdo_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1162{ 1173{
1163 int type; 1174 int type;
1164 dbus_int32_t fdo; 1175 dbus_int32_t fdo;
@@ -1179,7 +1190,7 @@ _ethumb_dbus_fdo_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter
1179} 1190}
1180 1191
1181static int 1192static int
1182_ethumb_dbus_size_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1193_ethumb_dbus_size_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1183{ 1194{
1184 DBusMessageIter oiter; 1195 DBusMessageIter oiter;
1185 int type; 1196 int type;
@@ -1205,7 +1216,7 @@ _ethumb_dbus_size_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter
1205} 1216}
1206 1217
1207static int 1218static int
1208_ethumb_dbus_format_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1219_ethumb_dbus_format_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1209{ 1220{
1210 int type; 1221 int type;
1211 dbus_int32_t format; 1222 dbus_int32_t format;
@@ -1226,7 +1237,7 @@ _ethumb_dbus_format_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIt
1226} 1237}
1227 1238
1228static int 1239static int
1229_ethumb_dbus_aspect_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1240_ethumb_dbus_aspect_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1230{ 1241{
1231 int type; 1242 int type;
1232 dbus_int32_t aspect; 1243 dbus_int32_t aspect;
@@ -1247,7 +1258,7 @@ _ethumb_dbus_aspect_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIt
1247} 1258}
1248 1259
1249static int 1260static int
1250_ethumb_dbus_orientation_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1261_ethumb_dbus_orientation_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1251{ 1262{
1252 int type; 1263 int type;
1253 dbus_int32_t orientation; 1264 dbus_int32_t orientation;
@@ -1268,7 +1279,7 @@ _ethumb_dbus_orientation_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMess
1268} 1279}
1269 1280
1270static int 1281static int
1271_ethumb_dbus_crop_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1282_ethumb_dbus_crop_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1272{ 1283{
1273 DBusMessageIter oiter; 1284 DBusMessageIter oiter;
1274 int type; 1285 int type;
@@ -1294,7 +1305,7 @@ _ethumb_dbus_crop_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter
1294} 1305}
1295 1306
1296static int 1307static int
1297_ethumb_dbus_quality_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1308_ethumb_dbus_quality_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1298{ 1309{
1299 int type; 1310 int type;
1300 dbus_int32_t quality; 1311 dbus_int32_t quality;
@@ -1316,7 +1327,7 @@ _ethumb_dbus_quality_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageI
1316 1327
1317 1328
1318static int 1329static int
1319_ethumb_dbus_compress_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1330_ethumb_dbus_compress_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1320{ 1331{
1321 int type; 1332 int type;
1322 dbus_int32_t compress; 1333 dbus_int32_t compress;
@@ -1337,7 +1348,7 @@ _ethumb_dbus_compress_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessage
1337} 1348}
1338 1349
1339static int 1350static int
1340_ethumb_dbus_frame_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1351_ethumb_dbus_frame_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1341{ 1352{
1342 DBusMessageIter oiter; 1353 DBusMessageIter oiter;
1343 int type; 1354 int type;
@@ -1366,7 +1377,7 @@ _ethumb_dbus_frame_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIte
1366} 1377}
1367 1378
1368static int 1379static int
1369_ethumb_dbus_directory_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1380_ethumb_dbus_directory_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1370{ 1381{
1371 int type; 1382 int type;
1372 const char *directory; 1383 const char *directory;
@@ -1387,7 +1398,7 @@ _ethumb_dbus_directory_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessag
1387} 1398}
1388 1399
1389static int 1400static int
1390_ethumb_dbus_category_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1401_ethumb_dbus_category_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1391{ 1402{
1392 int type; 1403 int type;
1393 const char *category; 1404 const char *category;
@@ -1408,7 +1419,7 @@ _ethumb_dbus_category_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessage
1408} 1419}
1409 1420
1410static int 1421static int
1411_ethumb_dbus_video_time_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1422_ethumb_dbus_video_time_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1412{ 1423{
1413 int type; 1424 int type;
1414 double video_time; 1425 double video_time;
@@ -1429,7 +1440,7 @@ _ethumb_dbus_video_time_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessa
1429} 1440}
1430 1441
1431static int 1442static int
1432_ethumb_dbus_video_start_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1443_ethumb_dbus_video_start_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1433{ 1444{
1434 int type; 1445 int type;
1435 double video_start; 1446 double video_start;
@@ -1450,7 +1461,7 @@ _ethumb_dbus_video_start_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMess
1450} 1461}
1451 1462
1452static int 1463static int
1453_ethumb_dbus_video_interval_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1464_ethumb_dbus_video_interval_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1454{ 1465{
1455 int type; 1466 int type;
1456 double video_interval; 1467 double video_interval;
@@ -1471,7 +1482,7 @@ _ethumb_dbus_video_interval_set(struct _Ethumb_Object *eobject __UNUSED__, DBusM
1471} 1482}
1472 1483
1473static int 1484static int
1474_ethumb_dbus_video_ntimes_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1485_ethumb_dbus_video_ntimes_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1475{ 1486{
1476 int type; 1487 int type;
1477 unsigned int video_ntimes; 1488 unsigned int video_ntimes;
@@ -1492,7 +1503,7 @@ _ethumb_dbus_video_ntimes_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMes
1492} 1503}
1493 1504
1494static int 1505static int
1495_ethumb_dbus_video_fps_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1506_ethumb_dbus_video_fps_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1496{ 1507{
1497 int type; 1508 int type;
1498 unsigned int video_fps; 1509 unsigned int video_fps;
@@ -1513,7 +1524,7 @@ _ethumb_dbus_video_fps_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessag
1513} 1524}
1514 1525
1515static int 1526static int
1516_ethumb_dbus_document_page_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1527_ethumb_dbus_document_page_set(Ethumbd_Object *eobject __UNUSED__, DBusMessageIter *iter, Ethumbd_Request *request)
1517{ 1528{
1518 int type; 1529 int type;
1519 unsigned int document_page; 1530 unsigned int document_page;
@@ -1536,7 +1547,7 @@ _ethumb_dbus_document_page_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMe
1536static struct 1547static struct
1537{ 1548{
1538 const char *option; 1549 const char *option;
1539 int (*setup_func)(struct _Ethumb_Object *eobject, DBusMessageIter *iter, struct _Ethumb_Request *request); 1550 int (*setup_func)(Ethumbd_Object *eobject, DBusMessageIter *iter, Ethumbd_Request *request);
1540} _option_cbs[] = { 1551} _option_cbs[] = {
1541 {"fdo", _ethumb_dbus_fdo_set}, 1552 {"fdo", _ethumb_dbus_fdo_set},
1542 {"size", _ethumb_dbus_size_set}, 1553 {"size", _ethumb_dbus_size_set},
@@ -1559,7 +1570,7 @@ static struct
1559}; 1570};
1560 1571
1561static int 1572static int
1562_ethumb_dbus_ethumb_setup_parse_element(struct _Ethumb_Object *eobject, DBusMessageIter *iter, struct _Ethumb_Request *request) 1573_ethumb_dbus_ethumb_setup_parse_element(Ethumbd_Object *eobject, DBusMessageIter *iter, Ethumbd_Request *request)
1563{ 1574{
1564 DBusMessageIter viter, diter; 1575 DBusMessageIter viter, diter;
1565 const char *option; 1576 const char *option;
@@ -1592,10 +1603,10 @@ _ethumb_dbus_ethumb_setup_cb(E_DBus_Object *object, DBusMessage *msg)
1592{ 1603{
1593 DBusMessage *reply; 1604 DBusMessage *reply;
1594 DBusMessageIter iter, aiter; 1605 DBusMessageIter iter, aiter;
1595 struct _Ethumb_Object_Data *odata; 1606 Ethumbd_Object_Data *odata;
1596 struct _Ethumbd *ed; 1607 Ethumbd *ed;
1597 struct _Ethumb_Object *eobject; 1608 Ethumbd_Object *eobject;
1598 struct _Ethumb_Request *request; 1609 Ethumbd_Request *request;
1599 dbus_bool_t r = 0; 1610 dbus_bool_t r = 0;
1600 int atype; 1611 int atype;
1601 1612
@@ -1614,7 +1625,7 @@ _ethumb_dbus_ethumb_setup_cb(E_DBus_Object *object, DBusMessage *msg)
1614 } 1625 }
1615 1626
1616 ed = odata->ed; 1627 ed = odata->ed;
1617 eobject = &ed->queue.table[odata->index]; 1628 eobject = &ed->queue.table[odata->idx];
1618 1629
1619 request = calloc(1, sizeof(*request)); 1630 request = calloc(1, sizeof(*request));
1620 request->id = -1; 1631 request->id = -1;
@@ -1643,9 +1654,9 @@ _ethumb_dbus_ethumb_setup_cb(E_DBus_Object *object, DBusMessage *msg)
1643} 1654}
1644 1655
1645static void 1656static void
1646_ethumb_dbus_generated_signal(struct _Ethumbd *ed, int *id, const char *thumb_path, const char *thumb_key, Eina_Bool success) 1657_ethumb_dbus_generated_signal(Ethumbd *ed, int *id, const char *thumb_path, const char *thumb_key, Eina_Bool success)
1647{ 1658{
1648 DBusMessage *signal; 1659 DBusMessage *sig;
1649 int current; 1660 int current;
1650 const char *opath; 1661 const char *opath;
1651 DBusMessageIter iter; 1662 DBusMessageIter iter;
@@ -1657,17 +1668,17 @@ _ethumb_dbus_generated_signal(struct _Ethumbd *ed, int *id, const char *thumb_pa
1657 1668
1658 current = ed->queue.current; 1669 current = ed->queue.current;
1659 opath = ed->queue.table[current].path; 1670 opath = ed->queue.table[current].path;
1660 signal = dbus_message_new_signal 1671 sig = dbus_message_new_signal
1661 (opath, _ethumb_dbus_objects_interface, "generated"); 1672 (opath, _ethumb_dbus_objects_interface, "generated");
1662 1673
1663 dbus_message_iter_init_append(signal, &iter); 1674 dbus_message_iter_init_append(sig, &iter);
1664 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &id32); 1675 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &id32);
1665 _ethumb_dbus_append_bytearray(&iter, thumb_path); 1676 _ethumb_dbus_append_bytearray(&iter, thumb_path);
1666 _ethumb_dbus_append_bytearray(&iter, thumb_key); 1677 _ethumb_dbus_append_bytearray(&iter, thumb_key);
1667 dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &value); 1678 dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &value);
1668 1679
1669 e_dbus_message_send(ed->conn, signal, NULL, -1, NULL); 1680 e_dbus_message_send(ed->conn, sig, NULL, -1, NULL);
1670 dbus_message_unref(signal); 1681 dbus_message_unref(sig);
1671} 1682}
1672 1683
1673static struct _Ethumb_DBus_Method_Table _ethumb_dbus_objects_methods[] = { 1684static struct _Ethumb_DBus_Method_Table _ethumb_dbus_objects_methods[] = {
@@ -1709,7 +1720,7 @@ static void
1709_ethumb_dbus_request_name_cb(void *data, DBusMessage *msg __UNUSED__, DBusError *err) 1720_ethumb_dbus_request_name_cb(void *data, DBusMessage *msg __UNUSED__, DBusError *err)
1710{ 1721{
1711 E_DBus_Object *dbus_object; 1722 E_DBus_Object *dbus_object;
1712 struct _Ethumbd *ed = data; 1723 Ethumbd *ed = data;
1713 int r; 1724 int r;
1714 1725
1715 if (dbus_error_is_set(err)) 1726 if (dbus_error_is_set(err))
@@ -1763,7 +1774,7 @@ _ethumb_dbus_request_name_cb(void *data, DBusMessage *msg __UNUSED__, DBusError
1763} 1774}
1764 1775
1765static int 1776static int
1766_ethumb_dbus_setup(struct _Ethumbd *ed) 1777_ethumb_dbus_setup(Ethumbd *ed)
1767{ 1778{
1768 e_dbus_request_name 1779 e_dbus_request_name
1769 (ed->conn, _ethumb_dbus_bus_name, 0, _ethumb_dbus_request_name_cb, ed); 1780 (ed->conn, _ethumb_dbus_bus_name, 0, _ethumb_dbus_request_name_cb, ed);
@@ -1772,7 +1783,7 @@ _ethumb_dbus_setup(struct _Ethumbd *ed)
1772} 1783}
1773 1784
1774static void 1785static void
1775_ethumb_dbus_finish(struct _Ethumbd *ed) 1786_ethumb_dbus_finish(Ethumbd *ed)
1776{ 1787{
1777 _process_queue_stop(ed); 1788 _process_queue_stop(ed);
1778 _ethumb_table_clear(ed); 1789 _ethumb_table_clear(ed);
@@ -1785,7 +1796,7 @@ _ethumb_dbus_finish(struct _Ethumbd *ed)
1785} 1796}
1786 1797
1787static int 1798static int
1788_ethumbd_slave_spawn(struct _Ethumbd *ed) 1799_ethumbd_slave_spawn(Ethumbd *ed)
1789{ 1800{
1790 ed->slave.data_cb = ecore_event_handler_add( 1801 ed->slave.data_cb = ecore_event_handler_add(
1791 ECORE_EXE_EVENT_DATA, _ethumbd_slave_data_read_cb, ed); 1802 ECORE_EXE_EVENT_DATA, _ethumbd_slave_data_read_cb, ed);
@@ -1812,8 +1823,8 @@ main(int argc, char *argv[])
1812{ 1823{
1813 Eina_Bool quit_option = 0; 1824 Eina_Bool quit_option = 0;
1814 int exit_value = 0; 1825 int exit_value = 0;
1815 int arg_index; 1826 int arg_idx;
1816 struct _Ethumbd ed; 1827 Ethumbd ed;
1817 int child; 1828 int child;
1818 double timeout = -1; 1829 double timeout = -1;
1819 1830
@@ -1863,8 +1874,8 @@ main(int argc, char *argv[])
1863 ECORE_GETOPT_VALUE_NONE 1874 ECORE_GETOPT_VALUE_NONE
1864 }; 1875 };
1865 1876
1866 arg_index = ecore_getopt_parse(&optdesc, values, argc, argv); 1877 arg_idx = ecore_getopt_parse(&optdesc, values, argc, argv);
1867 if (arg_index < 0) 1878 if (arg_idx < 0)
1868 { 1879 {
1869 ERR("Could not parse arguments."); 1880 ERR("Could not parse arguments.");
1870 exit_value = -2; 1881 exit_value = -2;