Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_ipc.c e_ipc.h e_remote_main.c 


Log Message:
- 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

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- e_ipc.c     2 Apr 2005 16:40:31 -0000       1.10
+++ e_ipc.c     9 Apr 2005 06:06:38 -0000       1.11
@@ -1,9 +1,11 @@
 #include "e.h"
+#include "config.h"
 
 /* local subsystem functions */
 static int _e_ipc_cb_client_add(void *data, int type, void *event);
 static int _e_ipc_cb_client_del(void *data, int type, void *event);
 static int _e_ipc_cb_client_data(void *data, int type, void *event);
+static char *_e_ipc_path_str_get(char **paths, int *bytes);
 
 /* local subsystem globals */
 static Ecore_Ipc_Server *_e_ipc_server  = NULL;
@@ -169,6 +171,26 @@
             free(data);
          }
        break;
+      case E_IPC_OP_MODULE_DIRS_LIST:
+         {
+            char *dirs[] = {
+               PACKAGE_LIB_DIR"/enlightenment/modules",
+               PACKAGE_LIB_DIR"/enlightenment/modules_extra",
+               "~/.e/e/modules",
+               NULL
+            };
+            char *data;
+            int bytes = 0;
+
+            data = _e_ipc_path_str_get(dirs, &bytes);
+            ecore_ipc_client_send(e->client,
+                                  E_IPC_DOMAIN_REPLY,
+                                  E_IPC_OP_MODULE_DIRS_LIST_REPLY,
+                                  0/*ref*/, 0/*ref_to*/, 0/*response*/,
+                                  data, bytes);
+            free(data);
+         }
+       break;
       case E_IPC_OP_BG_SET:
          {
             char *file;
@@ -460,12 +482,37 @@
 
          }
        break;
+      case E_IPC_OP_BG_DIRS_LIST:
+         {
+            char *dirs[] = {
+               PACKAGE_DATA_DIR"/data/themes",
+               "~/.e/e/backgrounds",
+               "~/.e/e/themes",
+               NULL
+            };
+            char *data;
+            int bytes = 0;
+
+            data = _e_ipc_path_str_get(dirs, &bytes);
+            ecore_ipc_client_send(e->client,
+                                  E_IPC_DOMAIN_REPLY,
+                                  E_IPC_OP_BG_DIRS_LIST_REPLY,
+                                  0/*ref*/, 0/*ref_to*/, 0/*response*/,
+                                  data, bytes);
+            free(data);
+         }
+       break;
       case E_IPC_OP_RESTART:
          {
             restart = 1;
             ecore_main_loop_quit();
          }
        break;
+      case E_IPC_OP_SHUTDOWN:
+         {
+            ecore_main_loop_quit();
+         }
+       break;
       default:
        break;
      }
@@ -477,3 +524,39 @@
    /* ecore_ipc_server_del(ecore_ipc_client_server_get(e->client)); */
    return 1;
 }  
+
+/*
+ * FIXME: This dosen't handle the case where one of the paths is of the
+ *        form: ~moo/bar/baz need to figure out the correct path to the 
+ *        specified users homedir
+ */
+static char *
+_e_ipc_path_str_get(char **paths, int *bytes)
+{
+   char *data = NULL, **cur, *home;
+   int pos = 0;
+   char tmp[PATH_MAX];
+
+   *bytes = 0;
+   home = e_user_homedir_get();
+   for (cur = paths; *cur != NULL; cur++)
+     {
+       int len;
+       char *p;
+
+       p = *cur;
+       if (*p == '~') snprintf(tmp, PATH_MAX, "%s%s", home, ++p);
+       else snprintf(tmp, PATH_MAX, "%s", p);
+
+       *bytes += strlen(tmp) + 1;
+       data = realloc(data, *bytes);
+
+       memcpy(data + pos, tmp, strlen(tmp));
+       pos = *bytes;
+       data[pos - 1] = 0;
+     }
+   free(home);
+   return data;
+}
+
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_ipc.h     2 Apr 2005 16:40:37 -0000       1.9
+++ e_ipc.h     9 Apr 2005 06:06:38 -0000       1.10
@@ -20,9 +20,13 @@
    E_IPC_OP_MODULE_DISABLE,
    E_IPC_OP_MODULE_LIST,
    E_IPC_OP_MODULE_LIST_REPLY,
+   E_IPC_OP_MODULE_DIRS_LIST,
+   E_IPC_OP_MODULE_DIRS_LIST_REPLY,
    E_IPC_OP_BG_SET,
    E_IPC_OP_BG_GET,
    E_IPC_OP_BG_GET_REPLY,
+   E_IPC_OP_BG_DIRS_LIST,
+   E_IPC_OP_BG_DIRS_LIST_REPLY,
    E_IPC_OP_FONT_AVAILABLE_LIST,
    E_IPC_OP_FONT_AVAILABLE_LIST_REPLY,
    E_IPC_OP_FONT_APPLY,
@@ -39,6 +43,7 @@
    E_IPC_OP_FONT_DEFAULT_LIST,
    E_IPC_OP_FONT_DEFAULT_LIST_REPLY,
    E_IPC_OP_RESTART,
+   E_IPC_OP_SHUTDOWN,
    E_IPC_OP_LAST
 } E_Ipc_Op;
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_remote_main.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- e_remote_main.c     2 Apr 2005 16:40:37 -0000       1.10
+++ e_remote_main.c     9 Apr 2005 06:06:38 -0000       1.11
@@ -50,7 +50,10 @@
    OSTR("-module-enable", "Enable module OPT1 if not enabled", 
E_IPC_OP_MODULE_ENABLE, 0),
    OSTR("-module-disable", "Disable module OPT1 if not disabled", 
E_IPC_OP_MODULE_DISABLE, 0),
    OREQ("-module-list", "List all loaded modules and their states", 
E_IPC_OP_MODULE_LIST, 1),
+   OREQ("-module-dirs-list", "List all modules directories", 
E_IPC_OP_MODULE_DIRS_LIST, 1),
    OSTR("-bg-set", "Set the background edje file to be OPT1", E_IPC_OP_BG_SET, 
0),
+   OREQ("-bg-get", "Get the background edje file", E_IPC_OP_BG_GET, 1),
+   OREQ("-bg-dirs-list", "Get the background directories", 
E_IPC_OP_BG_DIRS_LIST, 1),
    OSTR("-font-fallback-remove", "Remove OPT1 from the fontset", 
E_IPC_OP_FONT_FALLBACK_REMOVE, 0),
    OSTR("-font-fallback-prepend", "Prepend OPT1 to the fontset", 
E_IPC_OP_FONT_FALLBACK_PREPEND, 0),
    OSTR("-font-fallback-append", "Append OPT1 to the fontset", 
E_IPC_OP_FONT_FALLBACK_APPEND, 0),
@@ -62,7 +65,8 @@
    OSTR("-font-default-remove", "Remove the default text class OPT1", 
E_IPC_OP_FONT_DEFAULT_REMOVE, 0),
    OREQ("-font-default-list", "List all configured text classes", 
E_IPC_OP_FONT_DEFAULT_LIST, 1),
    OMUL("-font-default-set", "Set textclass (OPT1) font (OPT2) and size 
(OPT3)", E_IPC_OP_FONT_DEFAULT_SET, 0, 3),
-   OREQ("-restart", "Restart E17", E_IPC_OP_RESTART, 0)
+   OREQ("-restart", "Restart E17", E_IPC_OP_RESTART, 0),
+   OREQ("-shutdown", "Shutdown E17", E_IPC_OP_SHUTDOWN, 0)
 };
 
 /* externally accessible functions */
@@ -338,6 +342,44 @@
        else
          printf("REPLY: MODULE NONE\n");
        break;
+       case E_IPC_OP_MODULE_DIRS_LIST_REPLY:
+       if (e->data)
+         {
+            char *p;
+
+            p = e->data;
+            while (p < (char *)(e->data + e->size))
+              {
+                 char *dir;
+
+                 dir = p;
+                 printf("REPLY: MODULE DIR=%s\n", dir);
+                 p += strlen(dir) + 1;
+              }
+         }
+      break;
+      case E_IPC_OP_BG_GET_REPLY:
+      if (e->data)
+       {
+          printf("REPLY: %s\n", e->data);
+       }
+      break;
+      case E_IPC_OP_BG_DIRS_LIST_REPLY:
+      if (e->data)
+       {
+          char *p;
+ 
+          p = e->data;
+          while (p < (char *)(e->data + e->size))
+            {
+                char *dir;
+
+                dir = p;
+                printf("REPLY: BG DIR=%s\n", dir);
+                p += strlen(dir) + 1;
+            }
+        }
+      break;
       case E_IPC_OP_FONT_FALLBACK_LIST_REPLY:
        if (e->data)
          {




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to