dan sinclair wrote:

I have a feeling that using chars will just make stuff harder to deal
with in the long run. We'll be getting counts of containers and zones
back from e and we have to change the numbers to chars to call the set
functions?

I think it would be better to make this work with ints, even if it has
to do a conversion later.
Changed. I used an arbitrary fixed length string (5) for con, zone, and desk_{x,y}, instead of calculating the length of each. AFAICT, this should be fine unless arbitrary assignment of container of zone numbers is allowed.

Aaron
Index: e17/apps/e/src/lib/E_Lib.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/E_Lib.h,v
retrieving revision 1.3
diff -u -d -3 -r1.3 E_Lib.h
--- e17/apps/e/src/lib/E_Lib.h  19 Jul 2005 07:07:23 -0000      1.3
+++ e17/apps/e/src/lib/E_Lib.h  29 Jul 2005 00:05:13 -0000
@@ -94,6 +94,8 @@
    /* E desktop manipulation */
    EAPI void         e_lib_background_set             (const char *bgfile);
    EAPI void         e_lib_background_get             (void);
+   EAPI void         e_lib_desktop_background_add     (const int con, const 
int zone, const int desk_x, const int desk_y, const char *bgfile);
+   EAPI void         e_lib_desktop_background_del     (const int con, const 
int zone, const int desk_x, const int desk_y);
 
    /* E current theme manipulation */
    EAPI void         e_lib_theme_get                  (const char *category);
Index: e17/apps/e/src/lib/e_main.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/e_main.c,v
retrieving revision 1.25
diff -u -d -3 -r1.25 e_main.c
--- e17/apps/e/src/lib/e_main.c 19 Jul 2005 07:07:23 -0000      1.25
+++ e17/apps/e/src/lib/e_main.c 29 Jul 2005 00:05:13 -0000
@@ -243,6 +243,50 @@
 }
 
 void
+e_lib_desktop_background_add(const int con, const int zone, const int desk_x, 
const int desk_y, const char *bgfile)
+{
+   char *params[5];
+   int i;
+   if(!bgfile)
+     return;
+   for(i = 0; i < 4; i++)
+     params[i] = (char *)calloc(5,sizeof(char));
+   sprintf(params[0],"%i",con);
+   sprintf(params[1],"%i",zone);
+   sprintf(params[2],"%i",desk_x);
+   sprintf(params[3],"%i",desk_y);
+   params[4] = strdup(bgfile);
+   if(!params[0] | !params[1] | !params[2] | !params[3] | !params[4])
+     return;
+   _e_ipc_call(E_IPC_OP_DESKTOP_BG_ADD, params);
+   free(params[0]);
+   free(params[1]);
+   free(params[2]);
+   free(params[3]);
+   free(params[4]);
+}
+
+void
+e_lib_desktop_background_del(const int con, const int zone, const int desk_x, 
const int desk_y)
+{
+   int i;
+   char *params[4];
+   for(i = 0; i < 4; i++)
+     params[i] = (char *)calloc(5,sizeof(char));
+   sprintf(params[0],"%i",con);
+   sprintf(params[1],"%i",zone);
+   sprintf(params[2],"%i",desk_x);
+   sprintf(params[3],"%i",desk_y);
+   if(!params[0] | !params[1] | !params[2] | !params[3])
+     return;
+   _e_ipc_call(E_IPC_OP_DESKTOP_BG_DEL, params);
+   free(params[0]);
+   free(params[1]);
+   free(params[2]);
+   free(params[3]);
+}
+
+void
 e_lib_theme_get(const char *category)
 {
    char *tmp;

Reply via email to