Hi, 

This _might_ be a valid for for a FIXME in e_main.c to get the fontset
to be configurable.  I tested it through enlightenment_remote and it
seems to work nicely.  

One will need to put his/her mouse over the title to notice the update
changes. 

This is pretty useful for testing out different asian fonts, it doesn't
require a new build. Next I suppose I can make a configuration for
changing the default "Vera" font.  But as this is not a FIXME and we are
in a Code Freeze I better not. 

Stafford
Index: src/bin/e_config.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config.c,v
retrieving revision 1.26
diff -u -r1.26 e_config.c
--- src/bin/e_config.c	24 Mar 2005 08:30:44 -0000	1.26
+++ src/bin/e_config.c	25 Mar 2005 12:56:16 -0000
@@ -55,6 +55,7 @@
 #define T E_Config
 #define D _e_config_edd
    E_CONFIG_VAL(D, T, desktop_default_background, STR);
+   E_CONFIG_VAL(D, T, fontset, STR);
    E_CONFIG_VAL(D, T, menus_scroll_speed, DOUBLE);
    E_CONFIG_VAL(D, T, menus_fast_mouse_move_thresthold, DOUBLE);
    E_CONFIG_VAL(D, T, menus_click_drag_timeout, DOUBLE);
@@ -75,6 +76,7 @@
 	/* DEFAULT CONFIG */
 	e_config = E_NEW(E_Config, 1);
 	e_config->desktop_default_background = strdup(PACKAGE_DATA_DIR"/data/themes/default.edj");
+	e_config->fontset = strdup("Kochi-Gothic,Baekmuk-Dotum");
 	e_config->menus_scroll_speed = 1000.0;
 	e_config->menus_fast_mouse_move_thresthold = 300.0;
 	e_config->menus_click_drag_timeout = DEF_MENUCLICK;
@@ -180,6 +182,7 @@
 	     e_config->bindings = evas_list_remove_list(e_config->bindings, e_config->bindings);
 	     E_FREE(eb);
 	  }
+	E_FREE(e_config->fontset);
 	E_FREE(e_config->desktop_default_background);
 	E_FREE(e_config);
      }
Index: src/bin/e_config.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config.h,v
retrieving revision 1.11
diff -u -r1.11 e_config.h
--- src/bin/e_config.h	11 Mar 2005 13:09:06 -0000	1.11
+++ src/bin/e_config.h	25 Mar 2005 12:56:16 -0000
@@ -50,6 +50,7 @@
 struct _E_Config
 {
    char       *desktop_default_background;
+   char       *fontset;
    double      menus_scroll_speed;
    double      menus_fast_mouse_move_thresthold;
    double      menus_click_drag_timeout;
Index: src/bin/e_ipc.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc.c,v
retrieving revision 1.9
diff -u -r1.9 e_ipc.c
--- src/bin/e_ipc.c	17 Mar 2005 01:30:50 -0000	1.9
+++ src/bin/e_ipc.c	25 Mar 2005 12:56:17 -0000
@@ -213,6 +213,36 @@
 				   bg, strlen(bg) + 1);
  	  }
 	break;
+      case E_IPC_OP_FONTSET_SET:
+	  {
+	     char *fontset;
+	     
+	     fontset = malloc(e->size + 1);
+	     fontset[e->size] = 0;
+	     memcpy(fontset, e->data, e->size);
+	     E_FREE(e_config->fontset);
+	     e_config->fontset = fontset;
+	     
+             edje_fontset_append_set(e_config->fontset);
+	     e_canvas_recache();
+ 
+	     e_config_save_queue();
+          }
+	break;
+      case E_IPC_OP_FONTSET_GET:
+	  {
+	     char *fontset;
+	     fontset = e_config->fontset;
+	     if (!fontset)
+	       fontset = "";
+	     ecore_ipc_client_send(e->client,
+				   E_IPC_DOMAIN_REPLY,
+				   E_IPC_OP_FONTSET_GET_REPLY,
+				   0/*ref*/, 0/*ref_to*/, 0/*response*/,
+				   fontset, strlen(fontset) + 1);
+ 	  }
+	break;
+
       case E_IPC_OP_RESTART:
 	  {
 	     restart = 1;
Index: src/bin/e_ipc.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc.h,v
retrieving revision 1.8
diff -u -r1.8 e_ipc.h
--- src/bin/e_ipc.h	17 Mar 2005 01:30:50 -0000	1.8
+++ src/bin/e_ipc.h	25 Mar 2005 12:56:17 -0000
@@ -23,6 +23,9 @@
    E_IPC_OP_BG_SET,
    E_IPC_OP_BG_GET,
    E_IPC_OP_BG_GET_REPLY,
+   E_IPC_OP_FONTSET_SET,
+   E_IPC_OP_FONTSET_GET,
+   E_IPC_OP_FONTSET_GET_REPLY,
    E_IPC_OP_RESTART,
    E_IPC_OP_LAST
 } E_Ipc_Op;
Index: src/bin/e_main.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_main.c,v
retrieving revision 1.57
diff -u -r1.57 e_main.c
--- src/bin/e_main.c	22 Mar 2005 09:09:12 -0000	1.57
+++ src/bin/e_main.c	25 Mar 2005 12:56:17 -0000
@@ -221,6 +221,9 @@
      }
    _e_main_shutdown_push(ecore_evas_shutdown);
    
+	 
+   /*** Finished loading subsystems, Loading WM Specifics ***/
+	 
    /* setup directories we will be using for configurations sotrage etc. */
    if (!_e_main_dirs_init())
      {
@@ -247,9 +250,8 @@
    
    /* setup edje to animate @ e_config->framerate frames per sec. */
    edje_frametime_set(1.0 / e_config->framerate);
-   /* FIXME: this is just appending Kochi if Vera doesnt have it. We need
-    * a full config support subsystem for this */
-   edje_fontset_append_set("Kochi-Gothic,Baekmuk-Dotum");
+   if(e_config->fontset)
+	edje_fontset_append_set(e_config->fontset);
    e_canvas_recache();
    
    /* setup init status window/screen */
@@ -376,7 +378,7 @@
    return 0;
 }
 
-/* FIXME: make save to delete within a callback */
+/* FIXME: make safe to delete within a callback */
 E_Before_Idler *
 e_main_idler_before_add(int (*func) (void *data), void *data, int once)
 {
Index: src/bin/e_remote_main.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_remote_main.c,v
retrieving revision 1.9
diff -u -r1.9 e_remote_main.c
--- src/bin/e_remote_main.c	17 Mar 2005 01:30:50 -0000	1.9
+++ src/bin/e_remote_main.c	25 Mar 2005 12:56:17 -0000
@@ -49,6 +49,7 @@
    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),
    OSTR("-bg-set", "Set the background edje file to be OPT1", E_IPC_OP_BG_SET, 0),
+   OSTR("-fs-set", "Set the edje append fonset to be OPT1", E_IPC_OP_FONTSET_SET, 0),
    OREQ("-restart", "Restart E17", E_IPC_OP_RESTART, 0)
 };
 
Index: src/lib/E.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/E.h,v
retrieving revision 1.4
diff -u -r1.4 E.h
--- src/lib/E.h	17 Mar 2005 13:55:20 -0000	1.4
+++ src/lib/E.h	25 Mar 2005 12:56:17 -0000
@@ -20,6 +20,7 @@
 
 typedef struct _E_Response_Module_List    E_Response_Module_List;
 typedef struct _E_Response_Background_Get E_Response_Background_Get;
+typedef struct _E_Response_Fontset_Get    E_Response_Fontset_Get;
 
 struct _E_Response_Module_List
 {
@@ -32,8 +33,14 @@
    char   *data;
 };
 
+struct _E_Response_Fontset_Get
+{
+   char   *data;
+};
+
 extern EAPI int E_RESPONSE_MODULE_LIST;
 extern EAPI int E_RESPONSE_BACKGROUND_GET;
+extern EAPI int E_RESPONSE_FONTSET_GET;
 
 #ifdef __cplusplus
 extern "C" {
Index: src/lib/e_main.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/e_main.c,v
retrieving revision 1.7
diff -u -r1.7 e_main.c
--- src/lib/e_main.c	17 Mar 2005 13:55:20 -0000	1.7
+++ src/lib/e_main.c	25 Mar 2005 12:56:17 -0000
@@ -30,6 +30,7 @@
 
 int E_RESPONSE_MODULE_LIST = 0;
 int E_RESPONSE_BACKGROUND_GET = 0;
+int E_RESPONSE_FONTSET_GET = 0;
 
 /*
  * initialise connection to the current E running on "display".
@@ -103,6 +104,7 @@
      {
 	E_RESPONSE_MODULE_LIST = ecore_event_type_new();
 	E_RESPONSE_BACKGROUND_GET = ecore_event_type_new();
+	E_RESPONSE_FONTSET_GET = ecore_event_type_new();
      }
    
    if (free_disp)
@@ -198,6 +200,25 @@
 			 0/*response*/, NULL, 0);
 }
 
+void
+e_fontset_set(const char *fontset)
+{
+   if (!fontset)
+     return;
+
+   ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST, 
+			 E_IPC_OP_FONTSET_SET, 0/*ref*/, 0/*ref_to*/, 
+                         0/*response*/, (void *)fontset, strlen(fontset));
+}
+
+void
+e_fontset_get(void)
+{
+   ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST,
+			 E_IPC_OP_FONTSET_GET, 0/*ref*/, 0/*ref_to*/,
+			 0/*response*/, NULL, 0);
+}
+
 static int
 _e_ipc_init(const char *display)
 {
@@ -275,6 +296,16 @@
 	       ecore_event_add(E_RESPONSE_BACKGROUND_GET, res, NULL, NULL);
 	       break;
 	    }
+	case E_IPC_OP_FONTSET_GET_REPLY:
+	    {
+	       E_Response_Fontset_Get *res;
+
+	       res = calloc(1, sizeof(E_Response_Fontset_Get));
+	       res->data = e->data;
+	       ecore_event_add(E_RESPONSE_FONTSET_GET, res, NULL, NULL);
+	       break;
+	    }
+
 	default:
           break;
      }

Reply via email to