kuuko pushed a commit to branch master.

commit bd1dd50bc684a9f23b1cfddfb0f9990fb79245bb
Author: Kai Huuhko <[email protected]>
Date:   Tue Apr 2 11:35:20 2013 +0000

    Elm: First batch of _cfruni extermination
---
 efl/elementary/background.pyx          |  19 +++--
 efl/elementary/calendar_elm.pyx        |   5 +-
 efl/elementary/colorselector.pyx       |  15 ++--
 efl/elementary/configuration.pyx       |  38 +++++++--
 efl/elementary/ctxpopup.pyx            |   3 +-
 efl/elementary/datetime_elm.pyx        |   4 +-
 efl/elementary/diskselector.pyx        |   5 +-
 efl/elementary/entry.pyx               |  55 +++++++-----
 efl/elementary/fileselector.pyx        |  26 +++---
 efl/elementary/fileselector_button.pyx |  24 +++---
 efl/elementary/fileselector_entry.pyx  |  36 ++++----
 efl/elementary/flipselector.pyx        |  14 +--
 efl/elementary/general.pyx             |  10 +--
 efl/elementary/gengrid.pyx             |  21 +++--
 efl/elementary/genlist.pyx             | 151 +++++++++++++++++++++++----------
 15 files changed, 277 insertions(+), 149 deletions(-)

diff --git a/efl/elementary/background.pyx b/efl/elementary/background.pyx
index be6edb9..4eb7579 100644
--- a/efl/elementary/background.pyx
+++ b/efl/elementary/background.pyx
@@ -98,9 +98,7 @@ cdef class Background(LayoutClass):
 
         """
         def __get__(self):
-            cdef const_char *filename, *group
-            elm_bg_file_get(self.obj, &filename, &group)
-            return (_ctouni(filename), _ctouni(group))
+            return self.file_get()
 
         def __set__(self, value):
             cdef int ret
@@ -109,13 +107,16 @@ cdef class Background(LayoutClass):
             else:
                 filename = value
                 group = ""
-            ret = elm_bg_file_set(self.obj, _cfruni(filename), _cfruni(group))
-            if not ret:
+            self.file_set(filename, group)
+
+    cpdef file_set(self, filename, group = ""):
+        if isinstance(filename, unicode): filename = filename.encode("UTF-8")
+        if isinstance(group, unicode): group = group.encode("UTF-8")
+        if not elm_bg_file_set(self.obj,
+            <const_char *>filename if filename is not None else NULL,
+            <const_char *>group if group is not None else NULL):
                 raise RuntimeError("Could not set background file.")
-
-    def file_set(self, filename, group = ""):
-        return bool(elm_bg_file_set(self.obj, _cfruni(filename), 
_cfruni(group)))
-    def file_get(self):
+    cpdef file_get(self):
         cdef const_char *filename, *group
         elm_bg_file_get(self.obj, &filename, &group)
         return (_ctouni(filename), _ctouni(group))
diff --git a/efl/elementary/calendar_elm.pyx b/efl/elementary/calendar_elm.pyx
index 9f6a5ce..a7ff3d0 100644
--- a/efl/elementary/calendar_elm.pyx
+++ b/efl/elementary/calendar_elm.pyx
@@ -174,7 +174,10 @@ cdef class CalendarMark(object):
         time.tm_wday = tmtup.tm_wday
         time.tm_yday = tmtup.tm_yday
         time.tm_isdst = tmtup.tm_isdst
-        self.obj = elm_calendar_mark_add(cal.obj, _cfruni(mark_type), &time, 
repeat)
+        if isinstance(mark_type, unicode): mark_type = 
mark_type.encode("UTF-8")
+        self.obj = elm_calendar_mark_add(cal.obj,
+            <const_char *>mark_type if mark_type is not None else NULL,
+            &time, repeat)
 
     def delete(self):
         """delete()
diff --git a/efl/elementary/colorselector.pyx b/efl/elementary/colorselector.pyx
index 33a9730..3c147ee 100644
--- a/efl/elementary/colorselector.pyx
+++ b/efl/elementary/colorselector.pyx
@@ -187,13 +187,16 @@ cdef class Colorselector(LayoutClass):
 
         """
         def __get__(self):
-            return _ctouni(elm_colorselector_palette_name_get(self.obj))
+            return self.palette_name_get()
         def __set__(self, palette_name):
-            elm_colorselector_palette_name_set(self.obj, _cfruni(palette_name))
-
-    def palette_name_set(self, palette_name):
-        elm_colorselector_palette_name_set(self.obj, _cfruni(palette_name))
-    def palette_name_get(self):
+            self.palette_name_set(palette_name)
+
+    cpdef palette_name_set(self, palette_name):
+        s = palette_name
+        if isinstance(s, unicode): s = s.encode("UTF-8")
+        elm_colorselector_palette_name_set(self.obj,
+            <const_char *>s if s is not None else NULL)
+    cpdef palette_name_get(self):
         return _ctouni(elm_colorselector_palette_name_get(self.obj))
 
     def callback_changed_add(self, func, *args, **kwargs):
diff --git a/efl/elementary/configuration.pyx b/efl/elementary/configuration.pyx
index 2b2af72..5bdcd08 100644
--- a/efl/elementary/configuration.pyx
+++ b/efl/elementary/configuration.pyx
@@ -130,7 +130,8 @@ cdef class Configuration(object):
         def __get__(self):
             return _ctouni(elm_config_profile_get())
         def __set__(self, profile):
-            elm_config_profile_set(_cfruni(profile))
+            if isinstance(profile, unicode): profile = profile.encode("UTF-8")
+            elm_config_profile_set(<const_char *>profile if profile is not 
None else NULL)
 
     def profile_dir_get(self, profile, is_user):
         """profile_dir_get(unicode profile, bool is_user)
@@ -148,7 +149,10 @@ cdef class Configuration(object):
         :rtype: string
 
         """
-        return _ctouni(elm_config_profile_dir_get(_cfruni(profile), is_user))
+        if isinstance(profile, unicode): profile = profile.encode("UTF-8")
+        return _ctouni(elm_config_profile_dir_get(
+            <const_char *>profile if profile is not None else NULL,
+            is_user))
 
     property profile_list:
         """Get Elementary's list of available profiles.
@@ -391,7 +395,9 @@ cdef class Configuration(object):
         def __get__(self):
             return _ctouni(elm_config_engine_get())
         def __set__(self, engine):
-            elm_config_engine_set(_cfruni(engine))
+            if isinstance(engine, unicode): engine = engine.encode("UTF-8")
+            elm_config_engine_set(
+                <const_char *>engine if engine is not None else NULL)
 
     property preferred_engine:
         """Get Elementary's preferred engine to use.
@@ -409,7 +415,9 @@ cdef class Configuration(object):
         def __get__(self):
             return _ctouni(elm_config_preferred_engine_get())
         def __set__(self, engine):
-            elm_config_preferred_engine_set(_cfruni(engine))
+            if isinstance(engine, unicode): engine = engine.encode("UTF-8")
+            elm_config_preferred_engine_set(
+                <const_char *>engine if engine is not None else NULL)
 
     property text_classes_list:
         """Get Elementary's list of supported text classes.
@@ -481,7 +489,14 @@ cdef class Configuration(object):
         :type size: Evas_Font_Size
 
         """
-        elm_config_font_overlay_set(_cfruni(text_class), _cfruni(font), size)
+        a1 = text_class
+        a2 = font
+        if isinstance(a1, unicode): a1 = a1.encode("UTF-8")
+        if isinstance(a2, unicode): a2 = a2.encode("UTF-8")
+        elm_config_font_overlay_set(
+            <const_char *>a1 if a1 is not None else NULL,
+            <const_char *>a2 if a2 is not None else NULL,
+            size)
 
     def font_overlay_unset(self, text_class):
         """font_overlay_unset(unicode text_class)
@@ -495,7 +510,10 @@ cdef class Configuration(object):
         :type text_class: string
 
         """
-        elm_config_font_overlay_unset(_cfruni(text_class))
+        a1 = text_class
+        if isinstance(a1, unicode): a1 = a1.encode("UTF-8")
+        elm_config_font_overlay_unset(
+            <const_char *>a1 if a1 is not None else NULL)
 
     def font_overlay_apply(self):
         """font_overlay_apply()
@@ -673,12 +691,16 @@ def focus_highlight_animate_set(animate):
 def preferred_engine_get():
     return _ctouni(elm_config_preferred_engine_get())
 def preferred_engine_set(engine):
-    elm_config_preferred_engine_set(_cfruni(engine))
+    if isinstance(engine, unicode): engine = engine.encode("UTF-8")
+    elm_config_preferred_engine_set(
+        <const_char *>engine if engine is not None else NULL)
 
 def engine_get():
     return _ctouni(elm_config_engine_get())
 def engine_set(engine):
-    elm_config_engine_set(_cfruni(engine))
+    if isinstance(engine, unicode): engine = engine.encode("UTF-8")
+    elm_config_engine_set(
+        <const_char *>engine if engine is not None else NULL)
 
 def scale_get():
     return elm_config_scale_get()
diff --git a/efl/elementary/ctxpopup.pyx b/efl/elementary/ctxpopup.pyx
index 8bd741f..b7e48db 100644
--- a/efl/elementary/ctxpopup.pyx
+++ b/efl/elementary/ctxpopup.pyx
@@ -65,8 +65,9 @@ cdef class CtxpopupItem(ObjectItem):
             cb = _object_item_callback
 
         self.params = (callback, args, kargs)
+        if isinstance(label, unicode): label = label.encode("UTF-8")
         item = elm_ctxpopup_item_append(ctxpopup.obj,
-                                        _cfruni(label) if label is not None 
else NULL,
+                                        <const_char *>label if label is not 
None else NULL,
                                         icon.obj if icon is not None else NULL,
                                         cb,
                                         <void*>self)
diff --git a/efl/elementary/datetime_elm.pyx b/efl/elementary/datetime_elm.pyx
index c297b29..4f84b11 100644
--- a/efl/elementary/datetime_elm.pyx
+++ b/efl/elementary/datetime_elm.pyx
@@ -313,7 +313,9 @@ cdef class Datetime(Object):
         def __get__(self):
             return _ctouni(elm_datetime_format_get(self.obj))
         def __set__(self, fmt):
-            elm_datetime_format_set(self.obj, _cfruni(fmt))
+            if isinstance(fmt, unicode): fmt = fmt.encode("UTF-8")
+            elm_datetime_format_set(self.obj,
+                <const_char *>fmt if fmt is not None else NULL)
 
     property value_max:
         """The upper boundary of a field.
diff --git a/efl/elementary/diskselector.pyx b/efl/elementary/diskselector.pyx
index da45727..967b0b7 100644
--- a/efl/elementary/diskselector.pyx
+++ b/efl/elementary/diskselector.pyx
@@ -45,7 +45,10 @@ cdef class DiskselectorItem(ObjectItem):
 
         self.params = (callback, args, kargs)
 
-        item = elm_diskselector_item_append(diskselector.obj, _cfruni(label) 
if label is not None else NULL, icon_obj, cb, <void*>self)
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        item = elm_diskselector_item_append(diskselector.obj,
+            <const_char *>label if label is not None else NULL,
+            icon_obj, cb, <void*>self)
 
         if item != NULL:
             self._set_obj(item)
diff --git a/efl/elementary/entry.pyx b/efl/elementary/entry.pyx
index 9fccfef..6a26731 100644
--- a/efl/elementary/entry.pyx
+++ b/efl/elementary/entry.pyx
@@ -587,14 +587,16 @@ cdef class Entry(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_entry_entry_get(self.obj))
+            return self.entry_get()
 
         def __set__(self, entry):
-            elm_entry_entry_set(self.obj, _cfruni(entry))
+            self.entry_set(entry)
 
-    def entry_set(self, entry):
-        elm_entry_entry_set(self.obj, _cfruni(entry))
-    def entry_get(self):
+    cpdef entry_set(self, entry):
+        if isinstance(entry, unicode): entry = entry.encode("UTF-8")
+        elm_entry_entry_set(self.obj,
+            <const_char *>entry if entry is not None else NULL)
+    cpdef entry_get(self):
         return _ctouni(elm_entry_entry_get(self.obj))
 
     def entry_append(self, text):
@@ -613,7 +615,9 @@ cdef class Entry(Object):
         :type entry: string
 
         """
-        elm_entry_entry_append(self.obj, _cfruni(text))
+        if isinstance(text, unicode): text = text.encode("UTF-8")
+        elm_entry_entry_append(self.obj,
+            <const_char *>text if text is not None else NULL)
 
     property is_empty:
         """Gets whether the entry is empty.
@@ -715,7 +719,9 @@ cdef class Entry(Object):
         :type entry: string
 
         """
-        elm_entry_entry_insert(self.obj, _cfruni(entry))
+        if isinstance(entry, unicode): entry = entry.encode("UTF-8")
+        elm_entry_entry_insert(self.obj,
+            <const_char *>entry if entry is not None else NULL)
 
     property line_wrap:
         """The line wrap type to use on multi-line entries.
@@ -1050,18 +1056,23 @@ cdef class Entry(Object):
 
         """
         def __get__(self):
-            cdef const_char *file
-            cdef Elm_Text_Format format
-            elm_entry_file_get(self.obj, &file, &format)
-            return (_ctouni(file), format)
+            return self.file_get()
 
         def __set__(self, value):
             file, format = value
-            elm_entry_file_set(self.obj, _cfruni(file), format)
-
-    def file_set(self, file, format):
-        return bool(elm_entry_file_set(self.obj, _cfruni(file), format))
-    def file_get(self):
+            self.file_set(file, format)
+
+    cpdef file_set(self, file_name, file_format):
+        # TODO: Check that Elm_Text_Format is being used correctly here
+        a1 = file_name
+        a2 = file_format
+        if isinstance(a1, unicode): a1 = a1.encode("UTF-8")
+        if isinstance(a2, unicode): a2 = a2.encode("UTF-8")
+        if not elm_entry_file_set(self.obj,
+            <const_char *>a1 if a1 is not None else NULL,
+            <Elm_Text_Format>a2 if a2 is not None else ""):
+            raise RuntimeError
+    cpdef file_get(self):
         cdef const_char *file
         cdef Elm_Text_Format format
         elm_entry_file_get(self.obj, &file, &format)
@@ -1402,14 +1413,16 @@ cdef class Entry(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_entry_anchor_hover_style_get(self.obj))
+            return self.anchor_hover_style_get()
 
         def __set__(self, style):
-            elm_entry_anchor_hover_style_set(self.obj, _cfruni(style))
+            self.anchor_hover_style_set(style)
 
-    def anchor_hover_style_set(self, style):
-        elm_entry_anchor_hover_style_set(self.obj, _cfruni(style))
-    def anchor_hover_style_get(self):
+    cpdef anchor_hover_style_set(self, style):
+        if isinstance(style, unicode): style = style.encode("UTF-8")
+        elm_entry_anchor_hover_style_set(self.obj,
+            <const_char *>style if style is not None else NULL)
+    cpdef anchor_hover_style_get(self):
         return _ctouni(elm_entry_anchor_hover_style_get(self.obj))
 
     def anchor_hover_end(self):
diff --git a/efl/elementary/fileselector.pyx b/efl/elementary/fileselector.pyx
index 8a260fb..3048f04 100644
--- a/efl/elementary/fileselector.pyx
+++ b/efl/elementary/fileselector.pyx
@@ -188,14 +188,16 @@ cdef class Fileselector(LayoutClass):
 
         """
         def __get__(self):
-            return _ctouni(elm_fileselector_path_get(self.obj))
+            return self.path_get()
 
         def __set__(self, path):
-            elm_fileselector_path_set(self.obj, _cfruni(path))
+            self.path_set(path)
 
-    def path_set(self, path):
-        elm_fileselector_path_set(self.obj, _cfruni(path))
-    def path_get(self):
+    cpdef path_set(self, path):
+        if isinstance(path, unicode): path = path.encode("UTF-8")
+        elm_fileselector_path_set(self.obj,
+            <const_char *>path if path is not None else NULL)
+    cpdef path_get(self):
         return _ctouni(elm_fileselector_path_get(self.obj))
 
     property selected:
@@ -206,15 +208,17 @@ cdef class Fileselector(LayoutClass):
 
         """
         def __get__(self):
-            return _ctouni(elm_fileselector_selected_get(self.obj))
+            return self.selected_get()
 
         def __set__(self, path):
-            if not bool(elm_fileselector_selected_set(self.obj, 
_cfruni(path))):
-                raise RuntimeError("Setting the selected path failed")
+            self.selected_set(path)
 
-    def selected_set(self, path):
-        return elm_fileselector_selected_set(self.obj, _cfruni(path))
-    def selected_get(self):
+    cpdef selected_set(self, path):
+        if isinstance(path, unicode): path = path.encode("UTF-8")
+        if not elm_fileselector_selected_set(self.obj,
+            <const_char *>path if path is not None else NULL):
+                raise RuntimeError("Setting the selected path failed")
+    cpdef selected_get(self):
         return _ctouni(elm_fileselector_selected_get(self.obj))
 
     property mode:
diff --git a/efl/elementary/fileselector_button.pyx 
b/efl/elementary/fileselector_button.pyx
index 52bbc9e..2a74d9e 100644
--- a/efl/elementary/fileselector_button.pyx
+++ b/efl/elementary/fileselector_button.pyx
@@ -100,14 +100,16 @@ cdef class FileselectorButton(Button):
 
         """
         def __get__(self):
-            return _ctouni(elm_fileselector_button_window_title_get(self.obj))
+            return self.window_title_get()
 
         def __set__(self, title):
-            elm_fileselector_button_window_title_set(self.obj, _cfruni(title))
+            self.window_title_set(title)
 
-    def window_title_set(self, title):
-        elm_fileselector_button_window_title_set(self.obj, _cfruni(title))
-    def window_title_get(self):
+    cpdef window_title_set(self, title):
+        if isinstance(title, unicode): title = title.encode("UTF-8")
+        elm_fileselector_button_window_title_set(self.obj,
+            <const_char *>title if title is not None else NULL)
+    cpdef window_title_get(self):
         return _ctouni(elm_fileselector_button_window_title_get(self.obj))
 
     property window_size:
@@ -150,14 +152,16 @@ cdef class FileselectorButton(Button):
 
         """
         def __get__(self):
-            return _ctouni(elm_fileselector_button_path_get(self.obj))
+            return self.path_get()
 
         def __set__(self, path):
-            elm_fileselector_button_path_set(self.obj, _cfruni(path))
+            self.path_set(path)
 
-    def path_set(self, path):
-        elm_fileselector_button_path_set(self.obj, _cfruni(path))
-    def path_get(self):
+    cpdef path_set(self, path):
+        if isinstance(path, unicode): path = path.encode("UTF-8")
+        elm_fileselector_button_path_set(self.obj,
+            <const_char *>path if path is not None else NULL)
+    cpdef path_get(self):
         return _ctouni(elm_fileselector_button_path_get(self.obj))
 
     property expandable:
diff --git a/efl/elementary/fileselector_entry.pyx 
b/efl/elementary/fileselector_entry.pyx
index 6e2c4a4..37d22e3 100644
--- a/efl/elementary/fileselector_entry.pyx
+++ b/efl/elementary/fileselector_entry.pyx
@@ -116,14 +116,16 @@ cdef class FileselectorEntry(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_fileselector_entry_window_title_get(self.obj))
+            return self.window_title_get()
 
         def __set__(self, title):
-            elm_fileselector_entry_window_title_set(self.obj, _cfruni(title))
+            self.window_title_set(title)
 
-    def window_title_set(self, title):
-        elm_fileselector_entry_window_title_set(self.obj, _cfruni(title))
-    def window_title_get(self):
+    cpdef window_title_set(self, title):
+        if isinstance(title, unicode): title = title.encode("UTF-8")
+        elm_fileselector_entry_window_title_set(self.obj,
+            <const_char *>title if title is not None else NULL)
+    cpdef window_title_get(self):
         return _ctouni(elm_fileselector_entry_window_title_get(self.obj))
 
     property window_size:
@@ -166,14 +168,16 @@ cdef class FileselectorEntry(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_fileselector_entry_path_get(self.obj))
+            return self.path_get()
 
         def __set__(self, path):
-            elm_fileselector_entry_path_set(self.obj, _cfruni(path))
+            self.path_set(path)
 
-    def path_set(self, path):
-        elm_fileselector_entry_path_set(self.obj, _cfruni(path))
-    def path_get(self):
+    cpdef path_set(self, path):
+        if isinstance(path, unicode): path = path.encode("UTF-8")
+        elm_fileselector_entry_path_set(self.obj,
+            <const_char *>path if path is not None else NULL)
+    cpdef path_get(self):
         return _ctouni(elm_fileselector_entry_path_get(self.obj))
 
     property expandable:
@@ -282,14 +286,16 @@ cdef class FileselectorEntry(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_fileselector_entry_selected_get(self.obj))
+            return self.selected_get()
 
         def __set__(self, path):
-            elm_fileselector_entry_selected_set(self.obj, _cfruni(path))
+            self.selected_set(path)
 
-    def selected_set(self, path):
-        elm_fileselector_entry_selected_set(self.obj, _cfruni(path))
-    def selected_get(self):
+    cpdef selected_set(self, path):
+        if isinstance(path, unicode): path = path.encode("UTF-8")
+        elm_fileselector_entry_selected_set(self.obj,
+            <const_char *>path if path is not None else NULL)
+    cpdef selected_get(self):
         return _ctouni(elm_fileselector_entry_selected_get(self.obj))
 
     def callback_changed_add(self, func, *args, **kwargs):
diff --git a/efl/elementary/flipselector.pyx b/efl/elementary/flipselector.pyx
index d296eb9..fc1751c 100644
--- a/efl/elementary/flipselector.pyx
+++ b/efl/elementary/flipselector.pyx
@@ -169,10 +169,10 @@ cdef class FlipSelector(Object):
             cb = _object_item_callback
 
         ret.params = (callback, args, kwargs)
+        if isinstance(label, unicode): label = label.encode("UTF-8")
         item = elm_flipselector_item_append(self.obj,
-                                            _cfruni(label),
-                                            cb,
-                                            <void *>self)
+            <const_char *>label if label is not None else NULL,
+            cb, <void *>self)
 
         if item != NULL:
             ret._set_obj(item)
@@ -217,10 +217,10 @@ cdef class FlipSelector(Object):
             cb = _object_item_callback
 
         ret.params = (callback, args, kwargs)
-        item = elm_flipselector_item_append(self.obj,
-                                            _cfruni(label),
-                                            cb,
-                                            <void *>self)
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        item = elm_flipselector_item_prepend(self.obj,
+            <const_char *>label if label is not None else NULL,
+            cb, <void *>self)
 
         if item != NULL:
             ret._set_obj(item)
diff --git a/efl/elementary/general.pyx b/efl/elementary/general.pyx
index 6b33684..51b13f6 100644
--- a/efl/elementary/general.pyx
+++ b/efl/elementary/general.pyx
@@ -42,7 +42,7 @@ from cpython cimport PyObject, Py_INCREF, Py_DECREF
 from cpython cimport PyMem_Malloc, PyMem_Free
 from cpython cimport bool
 
-from efl.eo cimport _touni, _fruni, _ctouni, _cfruni
+from efl.eo cimport _touni, _ctouni
 
 import sys
 import traceback
@@ -143,13 +143,13 @@ def init():
     log.propagate = False
     log.addHandler(logging.NullHandler())
 
-    # NOTE: Why pass the cl args to elm_init?
+    # FIXME: Why pass the cl args to elm_init?
     cdef int argc, i, arg_len
     cdef char **argv, *arg
     argc = len(sys.argv)
     argv = <char **>PyMem_Malloc(argc * sizeof(char *))
     for i from 0 <= i < argc:
-        arg = _fruni(sys.argv[i])
+        arg = sys.argv[i]
         arg_len = len(arg)
         argv[i] = <char *>PyMem_Malloc(arg_len + 1)
         memcpy(argv[i], arg, arg_len + 1)
@@ -208,11 +208,11 @@ def coords_finger_size_adjust(times_w, w, times_h, h):
 
 def cache_all_flush():
     """cache_all_flush()
-    
+
     Frees all data that was in cache and is not currently being used to reduce
     memory usage. This frees Edje's, Evas' and Eet's cache.
 
     .. note:: Evas caches are flushed for every canvas associated with a 
window.
 
     """
-    elm_cache_all_flush()
\ No newline at end of file
+    elm_cache_all_flush()
diff --git a/efl/elementary/gengrid.pyx b/efl/elementary/gengrid.pyx
index 6576137..3fcb4d0 100644
--- a/efl/elementary/gengrid.pyx
+++ b/efl/elementary/gengrid.pyx
@@ -223,9 +223,6 @@ cdef class GengridItemClass:
             'item_data' is the value given to Gengrid item append/prepend
             methods, it should represent your item model as you want.
         """
-        if item_style:
-            self._item_style = item_style
-
         if text_get_func and not callable(text_get_func):
             raise TypeError("text_get_func is not callable!")
         elif text_get_func:
@@ -257,7 +254,11 @@ cdef class GengridItemClass:
             except AttributeError:
                 pass
 
-        self.obj.item_style = _cfruni(self._item_style)
+        a1 = item_style
+        if isinstance(a1, unicode): a1 = a1.encode("UTF-8")
+        if a1 is not None:
+            self._item_style = a1
+        self.obj.item_style = <char *>self._item_style
 
     def __str__(self):
         return ("%s(item_style=%r, text_get_func=%s, content_get_func=%s, "
@@ -474,9 +475,6 @@ cdef class GengridItem(ObjectItem):
 
     # XXX TODO elm_gengrid_item_item_class_get
 
-    def tooltip_text_set(self, text):
-        elm_gengrid_item_tooltip_text_set(self.item, _cfruni(text))
-
     property tooltip_text:
         """Set the text to be shown in the tooltip object
 
@@ -485,8 +483,13 @@ cdef class GengridItem(ObjectItem):
         Internally, this method calls :py:func:`tooltip_content_cb_set`
 
         """
-        def __get__(self):
-            return self.tooltip_text_get()
+        def __set__(self, value):
+            self.tooltip_text_set(value)
+
+    cpdef tooltip_text_set(self, text):
+        if isinstance(text, unicode): text = text.encode("UTF-8")
+        elm_gengrid_item_tooltip_text_set(self.item,
+            <const_char *>text if text is not None else NULL)
 
     def tooltip_content_cb_set(self, func, *args, **kargs):
         """tooltip_content_cb_set(func, *args, **kargs)
diff --git a/efl/elementary/genlist.pyx b/efl/elementary/genlist.pyx
index b9def85..14a4c04 100644
--- a/efl/elementary/genlist.pyx
+++ b/efl/elementary/genlist.pyx
@@ -209,12 +209,14 @@ cdef char *_py_elm_genlist_item_text_get(void *data, 
Evas_Object *obj, const_cha
     cdef GenlistItemClass itc = params[0]
 
     func = itc._text_get_func
+
     if func is None:
         return NULL
 
     ret = _py_elm_genlist_item_call(func, obj, part, params[1])
     if ret is not None:
-        return strdup(_fruni(ret))
+        if isinstance(ret, unicode): ret = ret.encode("UTF-8")
+        return strdup(ret)
     else:
         return NULL
 
@@ -335,14 +337,18 @@ cdef class GenlistItemClass(object):
     constructor parameters.
 
     """
-    cdef Elm_Genlist_Item_Class cls
-    cdef Elm_Genlist_Item_Class *obj
-    cdef object _text_get_func
-    cdef object _content_get_func
-    cdef object _state_get_func
-    cdef object _del_func
-
-    def __cinit__(self, *a, **ka):
+    cdef:
+        Elm_Genlist_Item_Class cls
+        Elm_Genlist_Item_Class *obj
+        object _text_get_func
+        object _content_get_func
+        object _state_get_func
+        object _del_func
+        object _item_style
+        object _decorate_item_style
+        object _decorate_all_item_style
+
+    def __cinit__(self):
         self.obj = &self.cls
         self.obj.item_style = NULL
         self.obj.decorate_item_style = NULL
@@ -350,6 +356,7 @@ cdef class GenlistItemClass(object):
         self.obj.func.text_get = _py_elm_genlist_item_text_get
         self.obj.func.content_get = _py_elm_genlist_item_content_get
         self.obj.func.state_get = _py_elm_genlist_item_state_get
+        # TODO: Check if the struct member is named del_
         self.obj.func.del_ = _py_elm_genlist_object_item_del
 
     def __init__(self, item_style=None, text_get_func=None,
@@ -394,6 +401,10 @@ cdef class GenlistItemClass(object):
             methods, it should represent your row model as you want.
         """
 
+        #
+        # Use argument if found, else a function that was defined by child
+        # class, or finally the fallback function defined in this class.
+        #
         if text_get_func is not None:
             if callable(text_get_func):
                 self._text_get_func = text_get_func
@@ -429,9 +440,21 @@ cdef class GenlistItemClass(object):
             except AttributeError:
                 pass
 
-        self.obj.item_style = _cfruni(item_style) if item_style is not None 
else _cfruni(u"default")
-        self.obj.decorate_item_style = _cfruni(decorate_item_style) if 
decorate_item_style is not None else NULL
-        self.obj.decorate_all_item_style = _cfruni(decorate_all_item_style) if 
decorate_all_item_style is not None else NULL
+        a1 = item_style
+        a2 = decorate_item_style
+        a3 = decorate_all_item_style
+
+        if isinstance(a1, unicode): a1 = a1.encode("UTF-8")
+        if isinstance(a2, unicode): a2 = a2.encode("UTF-8")
+        if isinstance(a3, unicode): a3 = a3.encode("UTF-8")
+
+        self._item_style = a1
+        self._decorate_item_style = a2
+        self._decorate_all_item_style = a3
+
+        self.obj.item_style = <char *>self._item_style if self._item_style is 
not None else NULL
+        self.obj.decorate_item_style = <char *>self._decorate_item_style if 
self._decorate_item_style is not None else NULL
+        self.obj.decorate_all_item_style = <char 
*>self._decorate_all_item_style if self._decorate_all_item_style is not None 
else NULL
 
     def __str__(self):
         return ("%s(item_style=%r, text_get_func=%s, content_get_func=%s, "
@@ -460,7 +483,32 @@ cdef class GenlistItemClass(object):
     property item_style:
         """The style of this item class."""
         def __get__(self):
-            return self._item_style
+            return self._item_style.decode("UTF-8")
+
+        def __set__(self, style):
+            if isinstance(style, unicode): style = style.encode("UTF-8")
+            self._item_style = style
+            self.obj.item_style = <char *>style if style is not None else NULL
+
+    property decorate_item_style:
+        """The decoration style of this item class."""
+        def __get__(self):
+            return self._decorate_item_style.decode("UTF-8")
+
+        def __set__(self, style):
+            if isinstance(style, unicode): style = style.encode("UTF-8")
+            self._decorate_item_style = style
+            self.obj.decorate_item_style = <char *>style if style is not None 
else NULL
+
+    property decorate_all_item_style:
+        """Decorate all style of this item class."""
+        def __get__(self):
+            return self._decorate_all_item_style.decode("UTF-8")
+
+        def __set__(self, style):
+            if isinstance(style, unicode): style = style.encode("UTF-8")
+            self._decorate_all_item_style = style
+            self.obj.decorate_all_item_style = <char *>style if style is not 
None else NULL
 
     def text_get(self, evasObject obj, part, item_data):
         """To be called by Genlist for each row to get its label.
@@ -888,7 +936,9 @@ cdef class GenlistItem(ObjectItem):
         Internally, this method calls :py:func:`tooltip_content_cb_set`
 
         """
-        elm_genlist_item_tooltip_text_set(self.item, _cfruni(text))
+        if isinstance(text, unicode): text = text.encode("UTF-8")
+        elm_genlist_item_tooltip_text_set(self.item,
+            <const_char *>text if text is not None else NULL)
 
     def tooltip_content_cb_set(self, func, *args, **kargs):
         """tooltip_content_cb_set(func, *args, **kargs)
@@ -946,31 +996,35 @@ cdef class GenlistItem(ObjectItem):
 
         """
         def __set__(self, style):
-            elm_genlist_item_tooltip_style_set(self.item, _cfruni(style) if 
style is not None else NULL)
+            self.tooltip_style_set(style)
 
         def __get__(self):
-            return _ctouni(elm_genlist_item_tooltip_style_get(self.item))
+            return self.tooltip_style_get()
 
-    def tooltip_style_set(self, style=None):
-        elm_genlist_item_tooltip_style_set(self.item, _cfruni(style) if style 
is not None else NULL)
-    def tooltip_style_get(self):
+    cpdef tooltip_style_set(self, style=None):
+        if isinstance(style, unicode): style = style.encode("UTF-8")
+        elm_genlist_item_tooltip_style_set(self.item,
+            <const_char *>style if style is not None else NULL)
+    cpdef tooltip_style_get(self):
         return _ctouni(elm_genlist_item_tooltip_style_get(self.item))
 
     property tooltip_window_mode:
         """This property allows a tooltip to expand beyond its parent window's 
canvas.
         It will instead be limited only by the size of the display.
 
+        :type: bool
+
         """
         def __set__(self, disable):
-            if not bool(elm_genlist_item_tooltip_window_mode_set(self.item, 
disable)):
-                raise RuntimeError("Setting tooltip_window_mode failed")
+            self.tooltip_window_mode_set(disable)
 
         def __get__(self):
-            return bool(elm_genlist_item_tooltip_window_mode_get(self.item))
+            return self.tooltip_window_mode_get()
 
-    def tooltip_window_mode_set(self, disable):
-        return bool(elm_genlist_item_tooltip_window_mode_set(self.item, 
disable))
-    def tooltip_window_mode_get(self):
+    cpdef tooltip_window_mode_set(self, disable):
+        if not elm_genlist_item_tooltip_window_mode_set(self.item, disable):
+            raise RuntimeError("Setting tooltip_window_mode failed")
+    cpdef tooltip_window_mode_get(self):
         return bool(elm_genlist_item_tooltip_window_mode_get(self.item))
 
     property cursor:
@@ -981,19 +1035,21 @@ cdef class GenlistItem(ObjectItem):
 
         """
         def __set__(self, cursor):
-            elm_genlist_item_cursor_set(self.item, _cfruni(cursor))
+            self.cursor_set(cursor)
 
         def __get__(self):
-            return _ctouni(elm_genlist_item_cursor_get(self.item))
+            return self.cursor_get()
 
         def __del__(self):
-            elm_genlist_item_cursor_unset(self.item)
+            self.cursor_unset()
 
-    def cursor_set(self, cursor):
-        elm_genlist_item_cursor_set(self.item, _cfruni(cursor))
-    def cursor_get(self):
+    cpdef cursor_set(self, cursor):
+        if isinstance(cursor, unicode): cursor = cursor.encode("UTF-8")
+        elm_genlist_item_cursor_set(self.item,
+            <const_char *>cursor if cursor is not None else NULL)
+    cpdef cursor_get(self):
         return _ctouni(elm_genlist_item_cursor_get(self.item))
-    def cursor_unset(self):
+    cpdef cursor_unset(self):
         elm_genlist_item_cursor_unset(self.item)
 
     property cursor_style:
@@ -1004,17 +1060,16 @@ cdef class GenlistItem(ObjectItem):
 
         """
         def __set__(self, style):
-            elm_genlist_item_cursor_style_set(self.item, _cfruni(style) if 
style is not None else NULL)
+            self.cursor_style_set(style)
 
         def __get__(self):
-            return _ctouni(elm_genlist_item_cursor_style_get(self.item))
+            return self.cursor_style_get()
 
-    def cursor_style_set(self, style=None):
-        if style:
-            elm_genlist_item_cursor_style_set(self.item, _cfruni(style))
-        else:
-            elm_genlist_item_cursor_style_set(self.item, NULL)
-    def cursor_style_get(self):
+    cpdef cursor_style_set(self, style=None):
+        if isinstance(style, unicode): style = style.encode("UTF-8")
+        elm_genlist_item_cursor_style_set(self.item,
+            <const_char *>style if style is not None else NULL)
+    cpdef cursor_style_get(self):
         return _ctouni(elm_genlist_item_cursor_style_get(self.item))
 
     property cursor_engine_only:
@@ -1138,7 +1193,11 @@ cdef class GenlistItem(ObjectItem):
         .. seealso:: :py:func:`update()`
 
         """
-        elm_genlist_item_fields_update(self.item, _cfruni(parts), itf)
+        # TODO: itf type?
+        if isinstance(parts, unicode): parts = parts.encode("UTF-8")
+        elm_genlist_item_fields_update(self.item,
+            <const_char *>parts if parts is not None else NULL,
+            itf)
 
     property decorate_mode:
         """A genlist mode is a different way of selecting an item. Once a
@@ -1176,13 +1235,17 @@ cdef class GenlistItem(ObjectItem):
         """
         def __set__(self, value):
             decorate_it_type, decorate_it_set = value
-            elm_genlist_item_decorate_mode_set(self.item, 
_cfruni(decorate_it_type), decorate_it_set)
+            self.decorate_mode_set(decorate_it_type, decorate_it_set)
 
         def __get__(self):
-            return _ctouni(elm_genlist_item_decorate_mode_get(self.item))
+            return self.decorate_mode_get()
 
     def decorate_mode_set(self, decorate_it_type, decorate_it_set):
-        elm_genlist_item_decorate_mode_set(self.item, 
_cfruni(decorate_it_type), decorate_it_set)
+        a1 = decorate_it_type
+        if isinstance(a1, unicode): a1 = a1.encode("UTF-8")
+        elm_genlist_item_decorate_mode_set(self.item,
+            <const_char *>a1 if a1 is not None else NULL,
+            decorate_it_set)
     def decorate_mode_get(self):
         return _ctouni(elm_genlist_item_decorate_mode_get(self.item))
 

-- 

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2

Reply via email to