summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorDan Sinclair <dj2>2005-04-09 06:06:39 +0000
committerDan Sinclair <dj2@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-04-09 06:06:39 +0000
commitdf5b523477da8af2d5dbf3c1b9e50ec1c27d6390 (patch)
treef01f3fce49c6f60abcef20b5288685e1a7f7e3cf /src/bin/e_ipc.c
parent6ca778ea552856ba6a329f70deb55cf753034817 (diff)
- extend E's ipc a bit more
- this change the way the module-list call returns from libe, it will return a list now, instead of a event per entry in the list - adds a module directory list and background directory list call - adds a shutdown call to shutdown E - extends enlightenment_remote to handle the above and implments a -bg-get call SVN revision: 14125
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index c743cad..89b64cd 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -1,9 +1,11 @@
1#include "e.h" 1#include "e.h"
2#include "config.h"
2 3
3/* local subsystem functions */ 4/* local subsystem functions */
4static int _e_ipc_cb_client_add(void *data, int type, void *event); 5static int _e_ipc_cb_client_add(void *data, int type, void *event);
5static int _e_ipc_cb_client_del(void *data, int type, void *event); 6static int _e_ipc_cb_client_del(void *data, int type, void *event);
6static int _e_ipc_cb_client_data(void *data, int type, void *event); 7static int _e_ipc_cb_client_data(void *data, int type, void *event);
8static char *_e_ipc_path_str_get(char **paths, int *bytes);
7 9
8/* local subsystem globals */ 10/* local subsystem globals */
9static Ecore_Ipc_Server *_e_ipc_server = NULL; 11static Ecore_Ipc_Server *_e_ipc_server = NULL;
@@ -169,6 +171,26 @@ _e_ipc_cb_client_data(void *data, int type, void *event)
169 free(data); 171 free(data);
170 } 172 }
171 break; 173 break;
174 case E_IPC_OP_MODULE_DIRS_LIST:
175 {
176 char *dirs[] = {
177 PACKAGE_LIB_DIR"/enlightenment/modules",
178 PACKAGE_LIB_DIR"/enlightenment/modules_extra",
179 "~/.e/e/modules",
180 NULL
181 };
182 char *data;
183 int bytes = 0;
184
185 data = _e_ipc_path_str_get(dirs, &bytes);
186 ecore_ipc_client_send(e->client,
187 E_IPC_DOMAIN_REPLY,
188 E_IPC_OP_MODULE_DIRS_LIST_REPLY,
189 0/*ref*/, 0/*ref_to*/, 0/*response*/,
190 data, bytes);
191 free(data);
192 }
193 break;
172 case E_IPC_OP_BG_SET: 194 case E_IPC_OP_BG_SET:
173 { 195 {
174 char *file; 196 char *file;
@@ -460,12 +482,37 @@ _e_ipc_cb_client_data(void *data, int type, void *event)
460 482
461 } 483 }
462 break; 484 break;
485 case E_IPC_OP_BG_DIRS_LIST:
486 {
487 char *dirs[] = {
488 PACKAGE_DATA_DIR"/data/themes",
489 "~/.e/e/backgrounds",
490 "~/.e/e/themes",
491 NULL
492 };
493 char *data;
494 int bytes = 0;
495
496 data = _e_ipc_path_str_get(dirs, &bytes);
497 ecore_ipc_client_send(e->client,
498 E_IPC_DOMAIN_REPLY,
499 E_IPC_OP_BG_DIRS_LIST_REPLY,
500 0/*ref*/, 0/*ref_to*/, 0/*response*/,
501 data, bytes);
502 free(data);
503 }
504 break;
463 case E_IPC_OP_RESTART: 505 case E_IPC_OP_RESTART:
464 { 506 {
465 restart = 1; 507 restart = 1;
466 ecore_main_loop_quit(); 508 ecore_main_loop_quit();
467 } 509 }
468 break; 510 break;
511 case E_IPC_OP_SHUTDOWN:
512 {
513 ecore_main_loop_quit();
514 }
515 break;
469 default: 516 default:
470 break; 517 break;
471 } 518 }
@@ -477,3 +524,39 @@ _e_ipc_cb_client_data(void *data, int type, void *event)
477 /* ecore_ipc_server_del(ecore_ipc_client_server_get(e->client)); */ 524 /* ecore_ipc_server_del(ecore_ipc_client_server_get(e->client)); */
478 return 1; 525 return 1;
479} 526}
527
528/*
529 * FIXME: This dosen't handle the case where one of the paths is of the
530 * form: ~moo/bar/baz need to figure out the correct path to the
531 * specified users homedir
532 */
533static char *
534_e_ipc_path_str_get(char **paths, int *bytes)
535{
536 char *data = NULL, **cur, *home;
537 int pos = 0;
538 char tmp[PATH_MAX];
539
540 *bytes = 0;
541 home = e_user_homedir_get();
542 for (cur = paths; *cur != NULL; cur++)
543 {
544 int len;
545 char *p;
546
547 p = *cur;
548 if (*p == '~') snprintf(tmp, PATH_MAX, "%s%s", home, ++p);
549 else snprintf(tmp, PATH_MAX, "%s", p);
550
551 *bytes += strlen(tmp) + 1;
552 data = realloc(data, *bytes);
553
554 memcpy(data + pos, tmp, strlen(tmp));
555 pos = *bytes;
556 data[pos - 1] = 0;
557 }
558 free(home);
559 return data;
560}
561
562