Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_entry.c 


Log Message:
becasue "text/plain" is not UTF-8 encoded, but uses the local charset, the 
entry converts the dropped text now to utf8

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_entry.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- ewl_entry.c 8 Sep 2006 20:45:48 -0000       1.67
+++ ewl_entry.c 28 Sep 2006 22:09:31 -0000      1.68
@@ -1,4 +1,6 @@
 #include <Ewl.h>
+#include <Ecore_Txt.h>
+#include <langinfo.h>
 #include "ewl_debug.h"
 #include "ewl_macros.h"
 #include "ewl_private.h"
@@ -35,7 +37,7 @@
 int
 ewl_entry_init(Ewl_Entry *e)
 {
-       const char *text_types[] = { "text/plain", NULL };
+       const char *text_types[] = { "UTF8_STRING", "text/plain", NULL };
        Ewl_Widget *w;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
@@ -575,7 +577,25 @@
        txt = EWL_TEXT(w);
 
        if (EWL_ENTRY(w)->editable && !DISABLED(w)) {
-               ewl_text_text_insert(txt, event->data, 
+               if (!strcmp(event->type, "text/plain") 
+                               && strcmp(nl_langinfo(CODESET), "UTF-8")) {
+                       char *text;
+
+                       text = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8",
+                                       event->data);
+                       if (text) {
+                               ewl_text_text_insert(txt, text,
+                                       ewl_text_cursor_position_get(txt));
+                       }
+                       else {
+                               ewl_text_text_insert(txt, event->data,
+                                       ewl_text_cursor_position_get(txt));
+                       }
+
+                       IF_FREE(text);
+               }
+               else
+                       ewl_text_text_insert(txt, event->data, 
                                        ewl_text_cursor_position_get(txt));
        }
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to