summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2004-11-26 12:20:38 +0000
committerCarsten Haitzler <raster@rasterman.com>2004-11-26 12:20:38 +0000
commite0cdc11f4896c667534c7efd132dabec6df4128f (patch)
tree1dac8eac3ad330cdd2843aeb73e241007f5461e5 /src/bin/e_ipc.c
parent94c79d788a155362b9f6b2ee2486eafda09ff49e (diff)
some ACTUAL ipc!!!! wow! you can load, unload, enable, disable and list
modules now via enlightenment_remote (or any app that speaks the protocol over ipc - INCLUDING apps that want to go insert modules into e when ther execute) SVN revision: 12276
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c106
1 files changed, 105 insertions, 1 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index df1c3a2..e05e44d 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -68,7 +68,111 @@ _e_ipc_cb_client_data(void *data, int type, void *event)
68 68
69 e = event; 69 e = event;
70 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return 1; 70 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return 1;
71 printf("E-IPC: client sent: [%i] [%i] (%i) \"%s\"\n", e->major, e->minor, e->size, e->data); 71 switch (e->minor)
72 {
73 case E_IPC_OP_MODULE_LOAD:
74 if (e->data)
75 {
76 char *name;
77
78 name = malloc(e->size + 1);
79 name[e->size] = 0;
80 memcpy(name, e->data, e->size);
81 if (!e_module_find(name))
82 {
83 e_module_new(name);
84 }
85 free(name);
86 }
87 break;
88 case E_IPC_OP_MODULE_UNLOAD:
89 if (e->data)
90 {
91 char *name;
92 E_Module *m;
93
94 name = malloc(e->size + 1);
95 name[e->size] = 0;
96 memcpy(name, e->data, e->size);
97 if ((m = e_module_find(name)))
98 {
99 if (e_module_enabled_get(m))
100 e_module_disable(m);
101 e_object_del(E_OBJECT(m));
102 }
103 free(name);
104 }
105 break;
106 case E_IPC_OP_MODULE_ENABLE:
107 {
108 char *name;
109 E_Module *m;
110
111 name = malloc(e->size + 1);
112 name[e->size] = 0;
113 memcpy(name, e->data, e->size);
114 if ((m = e_module_find(name)))
115 {
116 if (!e_module_enabled_get(m))
117 e_module_enable(m);
118 }
119 free(name);
120 }
121 break;
122 case E_IPC_OP_MODULE_DISABLE:
123 {
124 char *name;
125 E_Module *m;
126
127 name = malloc(e->size + 1);
128 name[e->size] = 0;
129 memcpy(name, e->data, e->size);
130 if ((m = e_module_find(name)))
131 {
132 if (e_module_enabled_get(m))
133 e_module_disable(m);
134 }
135 free(name);
136 }
137 break;
138 case E_IPC_OP_MODULE_LIST:
139 {
140 Evas_List *modules, *l;
141 int bytes;
142 E_Module *m;
143 char *data, *p;
144
145 bytes = 0;
146 modules = e_module_list();
147 for (l = modules; l; l = l->next)
148 {
149 m = l->data;
150 bytes += strlen(m->name) + 1 + 1;
151 }
152 data = malloc(bytes);
153 p = data;
154 for (l = modules; l; l = l->next)
155 {
156 m = l->data;
157 strcpy(p, m->name);
158 p += strlen(m->name);
159 *p = 0;
160 p++;
161 *p = e_module_enabled_get(m);
162 p++;
163 }
164 ecore_ipc_client_send(e->client,
165 E_IPC_DOMAIN_REPLY,
166 E_IPC_OP_MODULE_LIST_REPLY,
167 0/*ref*/, 0/*ref_to*/, 0/*response*/,
168 data, bytes);
169 free(data);
170 }
171 break;
172 default:
173 break;
174 }
175 printf("E-IPC: client sent: [%i] [%i] (%i) \"%p\"\n", e->major, e->minor, e->size, e->data);
72 /* ecore_ipc_client_send(e->client, 1, 2, 7, 77, 0, "ABC", 4); */ 176 /* ecore_ipc_client_send(e->client, 1, 2, 7, 77, 0, "ABC", 4); */
73 /* we can disconnect a client like this: */ 177 /* we can disconnect a client like this: */
74 /* ecore_ipc_client_del(e->client); */ 178 /* ecore_ipc_client_del(e->client); */