You can now change the theme for different parts of your desktop; menus/borders etc...
authorstffrdhrn <stffrdhrn>
Mon, 11 Jul 2005 12:43:27 +0000 (12:43 +0000)
committerstffrdhrn <stffrdhrn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 11 Jul 2005 12:43:27 +0000 (12:43 +0000)
SVN revision: 15733

src/bin/e_ipc_handlers.h
src/bin/e_ipc_handlers_list.h
src/bin/e_theme.c
src/bin/e_theme.h

index 60501ef..5d1631b 100644 (file)
@@ -4116,35 +4116,98 @@ break;
 #undef HDL
 
 /****************************************************************************/
-#define HDL E_IPC_OP_THEMES_LIST
+#define HDL E_IPC_OP_THEME_LIST
 #if (TYPE == E_REMOTE_OPTIONS)
-   OP("-themes-list", 0, "List themes and associated categories", 1, HDL)
+   OP("-theme-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);
+   END_SEND_STRING2_LIST(v, E_IPC_OP_THEME_LIST_REPLY);
 #elif (TYPE == E_REMOTE_IN)
 #endif
 #undef HDL
-     
+    
 /****************************************************************************/
-#define HDL E_IPC_OP_THEMES_LIST_REPLY
+#define HDL E_IPC_OP_THEME_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);
+   printf("REPLY: CATEGORY=\"%s\" FILE=\"%s\"\n", v->str1, v->str2);
    END_STRING2_LIST(v);
 #endif
 #undef HDL
      
 /****************************************************************************/
 
+#define HDL E_IPC_OP_THEME_SET
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-theme-set", 2, "Set theme category (OPT1) and edje file (OPT2)", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_2STRING(params[0], params[1], HDL) 
+#elif (TYPE == E_WM_IN)
+   STRING2(category, file, e_2str, HDL);
+   e_theme_config_set(category, file);
+   SAVE;   
+   END_STRING2(e_2str);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_THEME_GET
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-theme-get", 1, "List the theme associated with the category OPT1", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_STRING(params[0], HDL);
+#elif (TYPE == E_WM_IN)
+   STRING(category, HDL);
+   E_Config_Theme *ect;
+   void *data;
+   int bytes;
+   
+   ect = e_theme_config_get(category);
+   data = e_ipc_codec_2str_enc(ect->category, ect->file, &bytes);   
+   SEND_DATA(E_IPC_OP_THEME_GET_REPLY);
+
+   END_STRING(category);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_THEME_GET_REPLY
+#if (TYPE == E_REMOTE_OPTIONS)
+#elif (TYPE == E_REMOTE_OUT)
+#elif (TYPE == E_WM_IN)
+#elif (TYPE == E_REMOTE_IN)
+   STRING2(category, file, e_2str, HDL);
+   printf("REPLY: DEFAULT CATEGORY=\"%s\" FILE=\"%s\"\n",
+                    category, file); 
+   END_STRING2(e_2str);
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_THEME_REMOVE
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-theme-remove", 1, "Remove the theme category OPT1", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_STRING(params[0], HDL);
+#elif (TYPE == E_WM_IN)
+   STRING(category, HDL);
+   e_theme_config_remove(category);
+   SAVE;
+   END_STRING(category);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
 
+/****************************************************************************/
 
 #if 0
 }
index 6d650b3..77f06b4 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
+#define E_IPC_OP_THEME_LIST 200
+#define E_IPC_OP_THEME_LIST_REPLY 201
+#define E_IPC_OP_THEME_GET 202
+#define E_IPC_OP_THEME_GET_REPLY 203
+#define E_IPC_OP_THEME_REMOVE 204
+#define E_IPC_OP_THEME_SET 205
index 70b9b3c..9915197 100644 (file)
@@ -243,6 +243,81 @@ e_theme_file_set(char *category, char *file)
 }
 
 void
+e_theme_config_set(const char *category, const char *file)
+{
+   E_Config_Theme *ect;
+   Evas_List *next;
+
+   /* search for the category */
+   for (next = e_config->themes; next; next = next->next)
+     {
+       ect = evas_list_data(next);
+       if (!strcmp(ect->category, category))
+         {
+            E_FREE(ect->file);
+            ect->file = strdup(file);
+            return;
+         }
+     }
+
+   /* the text class doesnt exist */
+   ect = E_NEW(E_Config_Theme, 1);
+   ect->category = strdup(category);
+   ect->file = strdup(file);
+   
+   e_config->themes = evas_list_append(e_config->themes, ect);
+}
+
+/*
+ * returns a pointer to the data, return null if nothing if found.
+ */
+E_Config_Theme *
+e_theme_config_get(const char *category)
+{
+   E_Config_Theme *ect = NULL;
+   Evas_List *next;
+
+   /* search for the category */
+   for (next = e_config->themes; next; next = next->next)
+     {
+       ect = evas_list_data(next);
+       if (!strcmp(ect->category, category))
+         {
+            return ect;
+         }
+     }
+   return NULL;
+}
+
+void
+e_theme_config_remove(const char *category)
+{
+   E_Config_Theme *ect;
+   Evas_List *next;
+   
+   /* search for the category */
+   for (next = e_config->themes; next; next = next->next)
+     {
+       ect = evas_list_data(next);
+       if (!strcmp(ect->category, category))
+         {
+            e_config->themes = evas_list_remove_list(
+                                       e_config->themes, next);
+            E_FREE(ect->category);
+            E_FREE(ect->file);
+            E_FREE(ect);
+            return;
+         }
+    }
+}
+
+Evas_List *
+e_theme_config_list(void)
+{
+   return e_config->themes;
+}
+
+void
 e_theme_about(E_Zone *zone, const char *file)
 {
    static E_Popup *pop = NULL;
index bf3987c..a865fa1 100644 (file)
@@ -12,6 +12,11 @@ EAPI int         e_theme_shutdown(void);
 EAPI int         e_theme_edje_object_set(Evas_Object *o, char *category, char *group);
 EAPI const char *e_theme_edje_file_get(char *category, char *group);
 EAPI void        e_theme_file_set(char *category, char *file);
+
+EAPI void       e_theme_config_set(const char *category, const char *file);
+EAPI E_Config_Theme *e_theme_config_get(const char *category);
+EAPI void       e_theme_config_remove(const char *category);
+EAPI Evas_List *e_theme_config_list(void);
     
 #endif
 #endif