Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : apps/efsd
Dir : e17/apps/efsd/efsd
Modified Files:
efsd_commands.c efsd_io.c libefsd.c libefsd.h
Log Message:
Added event callback mechanism. See ecore_efsddemo.c in /demo/
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_commands.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- efsd_commands.c 6 Aug 2005 13:51:54 -0000 1.17
+++ efsd_commands.c 8 Aug 2005 12:26:31 -0000 1.18
@@ -516,12 +516,12 @@
D_ENTER;
- printf ("ERR: Running get filetype on %s\n",cmd->efsd_file_cmd.files[0] );
+ /*printf ("ERR: Running get filetype on %s\n",cmd->efsd_file_cmd.files[0]
);*/
if (efsd_filetype_get(cmd->efsd_file_cmd.files[0], type, MAXPATHLEN))
{
D("FILE lookup succeded: %s\n", type);
- printf("ERR: Type is %s\n", type);
+ /*printf("ERR: Type is %s\n", type);*/
result = send_reply(cmd, 0, strlen(type)+1, type, client);
}
else
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_io.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- efsd_io.c 8 Aug 2005 05:04:09 -0000 1.47
+++ efsd_io.c 8 Aug 2005 12:26:31 -0000 1.48
@@ -87,36 +87,36 @@
}
void deserialize_command(ecore_ipc_message* msg, EfsdCommand* ec) {
- printf (" ERR: We have a command on our hands..\n");
+ /*printf (" ERR: We have a command on our hands..\n");*/
if (msg->minor == 1) {
/*An efsdCommandType*/
- printf(" ERR: Receiving command type, building a
new EfsdCommand struct!\n");
+ /*printf(" ERR: Receiving command type, building
a new EfsdCommand struct!\n");*/
memcpy(&ec->type, msg->data,
sizeof(EfsdCommandType));
- printf (" ERR: Command type is %d\n", ec->type);
+ /*printf (" ERR: Command type is %d\n",
ec->type);*/
} else if (msg->minor == 2) {
/*An efsdCommandId*/
- printf(" ERR: Receiving a command id\n");
+ /*printf(" ERR: Receiving a command id\n");*/
/*Retrieve the inprogress event*/
- printf (" ERR: Our in-progress command has type
%d\n", ec->type);
+ /*printf (" ERR: Our in-progress command has type
%d\n", ec->type);*/
memcpy(&ec->efsd_file_cmd.id, msg->data,
sizeof(EfsdCmdId));
- printf (" ERR: Received command id %d\n",
ec->efsd_file_cmd.id);
+ /*printf (" ERR: Received command id %d\n",
ec->efsd_file_cmd.id);*/
} else if (msg->minor == 3) {
/*A file*/
- printf ( " ERR: Receiving a filename\n");
- printf ("We have %d files so far..\n",
ec->efsd_file_cmd.num_files);
+ /*printf ( " ERR: Receiving a filename\n");*/
+ /*printf ("We have %d files so far..\n",
ec->efsd_file_cmd.num_files);*/
if (!ec->efsd_file_cmd.num_files) {
ec->efsd_file_cmd.files =
malloc(sizeof(char*));
} else {
ec->efsd_file_cmd.files =
realloc(ec->efsd_file_cmd.files, sizeof(char*) *
(ec->efsd_file_cmd.num_files)+1);
}
ec->efsd_file_cmd.files[ec->efsd_file_cmd.num_files] = strdup(msg->data);
- printf ("Received a filename\n, it is '%s'\n",
ec->efsd_file_cmd.files[ec->efsd_file_cmd.num_files]);
+ /*printf ("Received a filename\n, it is '%s'\n",
ec->efsd_file_cmd.files[ec->efsd_file_cmd.num_files]);*/
ec->efsd_file_cmd.num_files+=1;
} else if (msg->minor == 4) {
/*An efsdOption*/
/*Basically two ints*/
- printf ( " ERR: Receiving an option\n");
+ /*printf ( " ERR: Receiving an option\n");*/
if (!ec->efsd_file_cmd.num_options) {
ec->efsd_file_cmd.options =
malloc(sizeof(EfsdOption));
} else {
@@ -612,12 +612,12 @@
ecore_list_append(el, ecore_ipc_message_new(1, 2, 0,0,0,
&ec->efsd_file_cmd.id, sizeof(EfsdCmdId)));
for (i = 0; i < ec->efsd_file_cmd.num_files; i++) {
- printf ("ERR: Writing filename %s\n", ec->efsd_file_cmd.files[i]);
+ /*printf ("ERR: Writing filename %s\n", ec->efsd_file_cmd.files[i]);*/
ecore_list_append(el, ecore_ipc_message_new(1, 3, 0,0,0,
ec->efsd_file_cmd.files[i], strlen(ec->efsd_file_cmd.files[i]) + 1));
}
for (i = 0; i < ec->efsd_file_cmd.num_options; i++) {
- printf ("ERR: Writing option %d\n", ec->efsd_file_cmd.options[i]);
+ /*printf ("ERR: Writing option %d\n", ec->efsd_file_cmd.options[i]);*/
ecore_list_append(el, ecore_ipc_message_new(1, 4, 0,0,0,
&ec->efsd_file_cmd.options[i], sizeof(EfsdOption)));
}
@@ -1044,7 +1044,7 @@
#if HAVE_ECORE
- printf("ERR: ecore Sending command: efsd_io_write_command\n");
+ /*printf("ERR: ecore Sending command: efsd_io_write_command\n");*/
cmd = fill_command(ec);
@@ -1155,7 +1155,7 @@
Ecore_List* cmd;
ecore_ipc_message* msg;
- printf("ERR: Sending event..\n");
+ /*printf("ERR: Sending event..\n");*/
/*ecore_ipc_client_send(sockfd, ee->type, 1, 0,0,0,
ee->efsd_reply_event.data,strlen(ee->efsd_reply_event.data)+1);*/
cmd = fill_event(ee);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/libefsd.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- libefsd.c 8 Aug 2005 05:04:10 -0000 1.61
+++ libefsd.c 8 Aug 2005 12:26:32 -0000 1.62
@@ -79,6 +79,8 @@
};
+void (*event_cb)(EfsdEvent* ev) = NULL;
+
static EfsdHash *callbacks_hash = NULL;
@@ -105,6 +107,12 @@
#if HAVE_ECORE
static Ecore_Hash* partial_command_hash = NULL;
static Ecore_Hash* partial_event_hash = NULL;
+
+
+void efsd_event_callback_register(void* func) {
+ event_cb = func;
+}
+
#endif
@@ -115,7 +123,7 @@
{
Ecore_Ipc_Event_Server_Data *e;
- printf("Received event from server..\n");
+ /*printf("Received event from server..\n");*/
if ((e = (Ecore_Ipc_Event_Server_Data *) event))
{
@@ -132,7 +140,7 @@
switch (e->major) {
- case 1: printf("It's a command..\n");
+ case 1: /*printf("It's a command..\n");*/
{
ec = ecore_hash_get(partial_command_hash, e->server);
@@ -146,7 +154,7 @@
if (e->minor != 100) {
deserialize_command(msg,ec);
} else {
- printf("Command finished..processing..\n");
+ /*printf("Command finished..processing..\n");*/
ec = ecore_hash_get(partial_command_hash,
e->server);
/*main_thread_launch(ec, e->client);*/
}
@@ -157,7 +165,7 @@
break;
case 2:
- printf ("it's an event!\n");
+ /*printf ("it's an event!\n");*/
event = ecore_hash_get(partial_event_hash, e->server);
if (!event) {
@@ -167,20 +175,20 @@
switch(e->minor) {
- case 1: printf("An EFSD Event type..\n");
+ case 1: /*printf("An EFSD Event type..\n");*/
memcpy(&event->type, e->data,
sizeof(EfsdEventType));
break;
case 2:
- printf ("It's a data section..\n");
- printf ("Data is: %s\n", e->data);
+ /*printf ("It's a data section..\n");*/
+ /*printf ("Data is: %s\n", e->data);*/
event->efsd_reply_event.data =
malloc(sizeof(char)*e->size);
strncpy(event->efsd_reply_event.data,
e->data, e->size);
break;
case 100:
- printf("Event complete,
assembling...\n");
+ /*printf("Event complete,
assembling...\n");*/
ec =
ecore_hash_get(partial_command_hash, e->server);
if (ec) {
@@ -188,7 +196,11 @@
}
- printf("Filename is (from ec): %s\n",
event->efsd_reply_event.command.efsd_file_cmd.files[0]);
+ /*printf("Filename is (from ec): %s\n",
event->efsd_reply_event.command.efsd_file_cmd.files[0]);*/
+
+ if (event_cb) {
+ (*event_cb)(event);
+ }
break;
}
@@ -246,7 +258,7 @@
{
D_ENTER;
- printf("ERR: libefsd_send_command to ecore efsd_io_write_command\n");
+ /*printf("ERR: libefsd_send_command to ecore efsd_io_write_command\n");*/
if (!ec || !com)
D_RETURN_(-1);
@@ -308,7 +320,7 @@
for (i = 0, used_files = 0; i < num_files; i++)
{
full_files[used_files] = libefsd_get_full_path(files[i]);
- printf("File with full path: %s\n", full_files[used_files]);
+ /*printf("File with full path: %s\n", full_files[used_files]);*/
if (full_files[used_files])
used_files++;
}
@@ -326,7 +338,7 @@
full_files = realloc(full_files, sizeof(char*) * used_files);
}
- printf("ERR: Libefsd file_cmd_absolute\n");
+ /*printf("ERR: Libefsd file_cmd_absolute\n");*/
id = libefsd_file_cmd(ec, type, used_files, full_files, num_options, ops);
D_RETURN_(id);
@@ -362,7 +374,7 @@
/* And send it! */
- printf("ERR: Libefsd file_cmd\n");
+ /*printf("ERR: Libefsd file_cmd\n");*/
if (libefsd_send_command(ec, &cmd) < 0)
{
efsd_cmd_cleanup(&cmd);
@@ -1341,7 +1353,7 @@
efsd_get_filetype(EfsdConnection *ec, char *filename)
{
D_ENTER;
- printf("ERR: A call to get filetype with %s\n", filename);
+ /*printf("ERR: A call to get filetype with %s\n", filename);*/
D_RETURN_(libefsd_file_cmd_absolute(ec, EFSD_CMD_GETFILETYPE, 1, &filename,
0, NULL));
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/libefsd.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- libefsd.h 14 May 2002 09:46:18 -0000 1.45
+++ libefsd.h 8 Aug 2005 12:26:32 -0000 1.46
@@ -95,6 +95,16 @@
int efsd_close(EfsdConnection *ec);
+#if HAVE_ECORE
+/**
+ * efsd_event_callback_register
+ * @func: the function to register
+ *
+ */
+void efsd_event_callback_register(void* func);
+#endif
+
+
/**
* efsd_get_connection_fd - Returns file descriptor of an Efsd connection.
* @ec: The Efsd connection
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs