Begin adding e_themes to ipc
authorstffrdhrn <stffrdhrn>
Sun, 10 Jul 2005 23:26:51 +0000 (23:26 +0000)
committerstffrdhrn <stffrdhrn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 10 Jul 2005 23:26:51 +0000 (23:26 +0000)
SVN revision: 15724

src/bin/e_bg.c
src/bin/e_config.c
src/bin/e_ipc_codec.c
src/bin/e_ipc_codec.h
src/bin/e_ipc_handlers.h
src/bin/e_ipc_handlers_list.h

index 714c5be96ad2b8e5d619dd72846e738fd9d24b56..f4369489eeda593f67cd0a96a6c039c12958b5c6 100644 (file)
@@ -98,8 +98,8 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
        
        edje_object_file_get(zone->prev_bg_object, &pfile, &pgroup);
        edje_object_file_get(zone->bg_object, &file, &group);
-       if ((!e_util_strcmp(pfile, file)) &&
-           (!e_util_strcmp(pgroup, group)))
+       if ((!e_util_strcmp((char *)pfile, (char *)file)) &&
+           (!e_util_strcmp((char *)pgroup, (char *)group)))
          {
             evas_object_del(zone->bg_object);
             zone->bg_object = zone->prev_bg_object;
index 1c99dff73331e35080ad190238c4f051f86a4c95..ae83bb83608fe5339ad08084806e81fc34cb907e 100644 (file)
@@ -3,11 +3,6 @@
  */
 #include "e.h"
 
-/* TODO List
- *
- * * setting up a new config value and a listener callback is too long winded - need to have helper funcs and macros do this so it's more like 1 line per new config value or 2
- */
-
 #if ((E17_PROFILE >= LOWRES_PDA) && (E17_PROFILE <= HIRES_PDA))
 #define DEF_MENUCLICK 1.25
 #else
index db03851a4129b6e91bab0fb870d57ac2e9ce07fb..a2e39eff9bcaae3274b9264bf7073cdf4fcc9157 100644 (file)
@@ -9,8 +9,9 @@ static Eet_Data_Descriptor *_e_ipc_int_edd = NULL;
 static Eet_Data_Descriptor *_e_ipc_double_edd = NULL;
 static Eet_Data_Descriptor *_e_ipc_2int_edd = NULL;
 static Eet_Data_Descriptor *_e_ipc_str_edd = NULL;
-static Eet_Data_Descriptor *_e_ipc_2str_edd = NULL;
 static Eet_Data_Descriptor *_e_ipc_str_list_edd = NULL;
+static Eet_Data_Descriptor *_e_ipc_2str_edd = NULL;
+static Eet_Data_Descriptor *_e_ipc_2str_list_edd = NULL;
 static Eet_Data_Descriptor *_e_ipc_str_int_edd = NULL;
 static Eet_Data_Descriptor *_e_ipc_str_int_list_edd = NULL;
 static Eet_Data_Descriptor *_e_ipc_2str_int_edd = NULL;
@@ -37,12 +38,15 @@ e_ipc_codec_init(void)
    _e_ipc_str_edd = E_CONFIG_DD_NEW("str", E_Ipc_Str);
    E_CONFIG_VAL(_e_ipc_str_edd, E_Ipc_Str, str, STR);
 
+   _e_ipc_str_list_edd = E_CONFIG_DD_NEW("str_list", E_Ipc_List);
+   E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_List, list, _e_ipc_str_edd);
+
    _e_ipc_2str_edd = E_CONFIG_DD_NEW("2str", E_Ipc_2Str);
    E_CONFIG_VAL(_e_ipc_2str_edd, E_Ipc_2Str, str1, STR);
    E_CONFIG_VAL(_e_ipc_2str_edd, E_Ipc_2Str, str2, STR);
    
-   _e_ipc_str_list_edd = E_CONFIG_DD_NEW("str_list", E_Ipc_List);
-   E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_List, list, _e_ipc_str_edd);
+   _e_ipc_2str_list_edd = E_CONFIG_DD_NEW("2str_list", E_Ipc_List);
+   E_CONFIG_LIST(_e_ipc_2str_list_edd, E_Ipc_List, list, _e_ipc_2str_edd);
 
    _e_ipc_str_int_edd = E_CONFIG_DD_NEW("str_int", E_Ipc_Str_Int);
    E_CONFIG_VAL(_e_ipc_str_int_edd, E_Ipc_Str_Int, str, STR);
@@ -90,8 +94,9 @@ e_ipc_codec_shutdown(void)
    E_CONFIG_DD_FREE(_e_ipc_double_edd);
    E_CONFIG_DD_FREE(_e_ipc_2int_edd);
    E_CONFIG_DD_FREE(_e_ipc_str_edd);
-   E_CONFIG_DD_FREE(_e_ipc_2str_edd);
    E_CONFIG_DD_FREE(_e_ipc_str_list_edd);
+   E_CONFIG_DD_FREE(_e_ipc_2str_edd);
+   E_CONFIG_DD_FREE(_e_ipc_2str_list_edd);
    E_CONFIG_DD_FREE(_e_ipc_str_int_edd);
    E_CONFIG_DD_FREE(_e_ipc_str_int_list_edd);
    E_CONFIG_DD_FREE(_e_ipc_2str_int_edd);
@@ -214,6 +219,27 @@ e_ipc_codec_2str_enc(char *str1, char *str2, int *size_ret)
    return eet_data_descriptor_encode(_e_ipc_2str_edd, &dat, size_ret);
 }
 
+int
+e_ipc_codec_2str_list_dec(char *data, int bytes, Evas_List **dest)
+{
+   E_Ipc_List *dat;
+   
+   if (!data) return 0;
+   dat = eet_data_descriptor_decode(_e_ipc_2str_list_edd, data, bytes);
+   if (!dat) return 0;
+   if (dest) *dest = dat->list;
+   free(dat);
+   return 1;
+}
+
+void *
+e_ipc_codec_2str_list_enc(Evas_List *list, int *size_ret)
+{
+   E_Ipc_List dat;
+   dat.list = list;
+   return eet_data_descriptor_encode(_e_ipc_2str_list_edd, &dat, size_ret);
+}
+
 int
 e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest)
 {
index c8ea53352b60fcf0f83f2ca08cfdacc6fd1c1952..4fe55a980df0fbaddd46b35e195a07085a337414 100644 (file)
@@ -83,12 +83,17 @@ EAPI int      e_ipc_codec_double_dec(char *data, int bytes, double *dest);
 EAPI void    *e_ipc_codec_double_enc(double val, int *size_ret);
 EAPI int      e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2x);
 EAPI void    *e_ipc_codec_2int_enc(int val1, int val2, int *size_ret);
+
 EAPI int      e_ipc_codec_str_dec(char *data, int bytes, char **dest);
 EAPI void    *e_ipc_codec_str_enc(char *str, int *size_ret);
-EAPI int      e_ipc_codec_2str_dec(char *data, int bytes, E_Ipc_2Str **dest);
-EAPI void    *e_ipc_codec_2str_enc(char *str1, char *str2, int *size_ret);
 EAPI int      e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest);
 EAPI void    *e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret);
+
+EAPI int      e_ipc_codec_2str_dec(char *data, int bytes, E_Ipc_2Str **dest);
+EAPI void    *e_ipc_codec_2str_enc(char *str1, char *str2, int *size_ret);
+EAPI int      e_ipc_codec_2str_list_dec(char *data, int bytes, Evas_List **dest);
+EAPI void    *e_ipc_codec_2str_list_enc(Evas_List *list, int *size_ret);
+
 EAPI int      e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest);
 EAPI void    *e_ipc_codec_str_int_enc(char *str, int val, int *size_ret);
 EAPI int      e_ipc_codec_str_int_list_dec(char *data, int bytes, Evas_List **dest);
index 7d9091ff806538f56f3157970b5cfeec040e659a..60501ef50c244e7911ee2e48eb5b44b41a1dac5b 100644 (file)
@@ -34,6 +34,10 @@ if (e->data) { \
 } \
 break;
 
+/**
+ * STRING2:
+ * decode event data of type E_Ipc_2Str
+ */
 # define STRING2(__str1, __str2, __2str, HDL) \
 case HDL: \
 if (e->data) { \
@@ -138,6 +142,9 @@ if (e->data) { \
 } \
 break;
 
+/**
+ * Get event data for libe processing
+ */
 # define RESPONSE(__res, __store, HDL) \
    __store *__res = calloc(1, sizeof(__store)); \
    if (e->data) {
@@ -448,6 +455,60 @@ free(data);
  } \
    break;
 
+/**
+ * STRING2_LIST:
+ * Decode event data which is a list of E_Ipc_2Str objects and iterate 
+ * the list. For each iteration the object __v will contain a decoded list
+ * element. 
+ *
+ * Use END_STRING2_LIST to terminate the loop and free all data.
+ */
+#define STRING2_LIST(__v, HDL) \
+ case HDL: { \
+    Evas_List *dat = NULL, *l; \
+    if (e_ipc_codec_2str_list_dec(e->data, e->size, &dat)) { \
+       for (l = dat; l; l = l->next) { \
+         E_Ipc_2Str *__v; \
+         __v = l->data;
+#define END_STRING2_LIST(__v) \
+         free(__v->str1); \
+         free(__v->str2); \
+         free(__v); \
+       } \
+       evas_list_free(dat); \
+    } \
+    reply_count++; \
+ } \
+   break;
+
+/** 
+ * SEND_STRING2_LIST:
+ * Start to encode a list of objects to prepare them for sending via
+ * ipc. The object __v1 will be of type __typ1 and __v2 will be of type
+ * E_Ipc_2Str. 
+ *
+ * Use END_SEND_STRING2_LIST to terminate the encode iteration and 
+ * send that data. The list will be freed.
+ */
+#define SEND_STRING2_LIST(__list, __typ1, __v1, __v2, HDL) \
+ case HDL: { \
+    Evas_List *dat = NULL, *l; \
+    void *data; int bytes; \
+    for (l = __list; l; l = l->next) { \
+       __typ1 *__v1; \
+       E_Ipc_2Str *__v2; \
+       __v1 = l->data; \
+       __v2 = calloc(1, sizeof(E_Ipc_2Str));
+#define END_SEND_STRING2_LIST(__v1, __op) \
+       dat = evas_list_append(dat, __v1); \
+    } \
+    data = e_ipc_codec_2str_list_enc(dat, &bytes); \
+    SEND_DATA(__op); \
+    FREE_LIST(dat); \
+ } \
+   break;
+
+
 #define SEND_STRING(__str, __op, HDL) \
 case HDL: { void *data; int bytes; \
    data = e_ipc_codec_str_enc(__str, &bytes); \
@@ -4054,6 +4115,37 @@ break;
 #endif
 #undef HDL
 
+/****************************************************************************/
+#define HDL E_IPC_OP_THEMES_LIST
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-themes-list", 0, "List themes and associated categories", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+   SEND_STRING2_LIST(e_config->themes, E_Config_Theme, theme, v, HDL);
+   v->str1 = theme->category;
+   v->str2 = theme->file;
+   END_SEND_STRING2_LIST(v, E_IPC_OP_THEMES_LIST_REPLY);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+     
+/****************************************************************************/
+#define HDL E_IPC_OP_THEMES_LIST_REPLY
+#if (TYPE == E_REMOTE_OPTIONS)
+#elif (TYPE == E_REMOTE_OUT)
+#elif (TYPE == E_WM_IN)
+#elif (TYPE == E_REMOTE_IN)
+   STRING2_LIST(v, HDL);
+   printf("REPLY: CATEGORY=\"%s\" EDJE=\"%s\"\n", v->str1, v->str2);
+   END_STRING2_LIST(v);
+#endif
+#undef HDL
+     
+/****************************************************************************/
+
+
+
 #if 0
 }
 #endif
index e269bfb9a2d9725e6108a04d54cee6cd972ebbec..6d650b3b0432bc87bc91bcbccf68bad36889d18e 100644 (file)
 #define E_IPC_OP_FOCUS_SETTING_GET 197
 #define E_IPC_OP_FOCUS_SETTING_GET_REPLY 198
 #define E_IPC_OP_EXEC_ACTION 199
+#define E_IPC_OP_THEMES_LIST 200
+#define E_IPC_OP_THEMES_LIST_REPLY 201