kuuko pushed a commit to branch master.

commit 259cb4d083ffe4a60665a37422d3a6f7f2d498c2
Author: Kai Huuhko <[email protected]>
Date:   Wed Apr 3 13:32:25 2013 +0000

    Elm: Hopefully the last batch of _(c)fruni removal.
---
 efl/elementary/calendar_elm.pyx    | 20 +++++------
 efl/elementary/entry.pxd           |  4 +--
 efl/elementary/entry.pyx           |  8 +++--
 efl/elementary/gengrid.pyx         | 16 ++++-----
 efl/elementary/layout.pyx          |  2 ++
 efl/elementary/scroller.pyx        |  6 +++-
 efl/elementary/segment_control.pyx |  8 +++--
 efl/elementary/slider.pyx          | 28 ++++++++-------
 efl/elementary/slideshow.pyx       |  8 +++--
 efl/elementary/spinner.pyx         | 18 ++++++----
 efl/elementary/theme.pyx           | 36 ++++++++++++++-----
 efl/elementary/thumb.pyx           | 18 +++++-----
 efl/elementary/toolbar.pyx         | 60 ++++++++++++++++++++------------
 efl/elementary/video.pyx           | 11 +++---
 efl/elementary/widget_header.pxi   |  2 +-
 efl/elementary/window.pyx          | 71 +++++++++++++++++++++++---------------
 16 files changed, 197 insertions(+), 119 deletions(-)

diff --git a/efl/elementary/calendar_elm.pyx b/efl/elementary/calendar_elm.pyx
index a7ff3d0..cfd5c5d 100644
--- a/efl/elementary/calendar_elm.pyx
+++ b/efl/elementary/calendar_elm.pyx
@@ -244,11 +244,11 @@ cdef class Calendar(LayoutClass):
 
         """
         def __get__(self):
-            cdef const_char **lst
-            cdef const_char *weekday
+            cdef const_char **lst, *weekday
+            cdef int i
             ret = []
             lst = elm_calendar_weekdays_names_get(self.obj)
-            for i from 0 <= i < 7:
+            for i in range(7):
                 weekday = lst[i]
                 if weekday != NULL:
                     ret.append(_ctouni(weekday))
@@ -256,13 +256,13 @@ cdef class Calendar(LayoutClass):
 
         def __set__(self, weekdays):
             cdef int i, day_len
-            cdef char **days, *weekday
-            days = <char **>PyMem_Malloc(7 * sizeof(char*))
-            for i from 0 <= i < 7:
-                weekday = _fruni(weekdays[i])
-                day_len = len(weekday)
-                days[i] = <char *>PyMem_Malloc(day_len + 1)
-                memcpy(days[i], weekday, day_len + 1)
+            cdef const_char **days, *day
+            days = <const_char **>PyMem_Malloc(7 * sizeof(const_char *))
+            for i in range(7):
+                weekday = weekdays[i]
+                if isinstance(weekday, unicode): weekday = 
weekday.encode("UTF-8")
+                day = <const_char *>weekday if weekday is not None else NULL
+                days[i] = <const_char *>strdup(day)
             elm_calendar_weekdays_names_set(self.obj, <const_char **>days)
 
     property min_max_year:
diff --git a/efl/elementary/entry.pxd b/efl/elementary/entry.pxd
index b76d1be..c4ae534 100644
--- a/efl/elementary/entry.pxd
+++ b/efl/elementary/entry.pxd
@@ -63,8 +63,8 @@ cdef extern from "Elementary.h":
     void                    elm_entry_selection_cut(Evas_Object *obj)
     void                    elm_entry_selection_copy(Evas_Object *obj)
     void                    elm_entry_selection_paste(Evas_Object *obj)
-    const_char *            elm_entry_markup_to_utf8(const_char *s)
-    const_char *            elm_entry_utf8_to_markup(const_char *s)
+    char *                  elm_entry_markup_to_utf8(const_char *s)
+    char *                  elm_entry_utf8_to_markup(const_char *s)
     Eina_Bool               elm_entry_file_set(Evas_Object *obj, const_char 
*file, Elm_Text_Format format)
     void                    elm_entry_file_get(Evas_Object *obj, const_char 
**file, Elm_Text_Format *format)
     void                    elm_entry_file_save(Evas_Object *obj)
diff --git a/efl/elementary/entry.pyx b/efl/elementary/entry.pyx
index 6a26731..f955c11 100644
--- a/efl/elementary/entry.pyx
+++ b/efl/elementary/entry.pyx
@@ -225,10 +225,14 @@ ELM_WRAP_WORD = enums.ELM_WRAP_WORD
 ELM_WRAP_MIXED = enums.ELM_WRAP_MIXED
 
 def Entry_markup_to_utf8(string):
-    return _ctouni(elm_entry_markup_to_utf8(_fruni(str)))
+    if isinstance(string, unicode): string = string.encode("UTF-8")
+    return _touni(elm_entry_markup_to_utf8(
+        <const_char *>string if string is not None else NULL))
 
 def Entry_utf8_to_markup(string):
-    return _ctouni(elm_entry_utf8_to_markup(_fruni(str)))
+    if isinstance(string, unicode): string = string.encode("UTF-8")
+    return _touni(elm_entry_utf8_to_markup(
+        <const_char *>string if string is not None else NULL))
 
 class EntryAnchorInfo(object):
     """
diff --git a/efl/elementary/gengrid.pyx b/efl/elementary/gengrid.pyx
index 92c4c37..04f9eaf 100644
--- a/efl/elementary/gengrid.pyx
+++ b/efl/elementary/gengrid.pyx
@@ -77,10 +77,8 @@ cdef char *_py_elm_gengrid_item_text_get(void *data, 
Evas_Object *obj, const_cha
         return NULL
 
     ret = _py_elm_gengrid_item_call(func, obj, part, params[1])
-    if ret is not None:
-        return strdup(_fruni(ret))
-    else:
-        return NULL
+    if isinstance(ret, unicode): ret = ret.encode("UTF-8")
+    return strdup(ret) if ret is not None else NULL
 
 cdef Evas_Object *_py_elm_gengrid_item_content_get(void *data, Evas_Object 
*obj, const_char *part) with gil:
     cdef GengridItem item = <object>data
@@ -581,13 +579,13 @@ cdef class GengridItem(ObjectItem):
         def __del__(self):
             self.cursor_unset()
 
-    def cursor_set(self, cursor):
+    cpdef cursor_set(self, cursor):
         if isinstance(cursor, unicode): cursor = cursor.encode("UTF-8")
         elm_gengrid_item_cursor_set(self.item,
             <const_char *>cursor if cursor is not None else NULL)
-    def cursor_get(self):
+    cpdef cursor_get(self):
         return _ctouni(elm_gengrid_item_cursor_get(self.item))
-    def cursor_unset(self):
+    cpdef cursor_unset(self):
         elm_gengrid_item_cursor_unset(self.item)
 
     property cursor_style:
@@ -598,11 +596,11 @@ cdef class GengridItem(ObjectItem):
         def __set__(self, style):
             self.cursor_style_set(style)
 
-    def cursor_style_set(self, style=None):
+    cpdef cursor_style_set(self, style=None):
         if isinstance(style, unicode): style = style.encode("UTF-8")
         elm_gengrid_item_cursor_style_set(self.item,
             <const_char *>style if style is not None else NULL)
-    def cursor_style_get(self):
+    cpdef cursor_style_get(self):
         return _ctouni(elm_gengrid_item_cursor_style_get(self.item))
 
     property cursor_engine_only:
diff --git a/efl/elementary/layout.pyx b/efl/elementary/layout.pyx
index 858d06c..67338ad 100644
--- a/efl/elementary/layout.pyx
+++ b/efl/elementary/layout.pyx
@@ -203,6 +203,7 @@ cdef class Layout(LayoutClass):
         return object_from_instance(elm_layout_content_unset(self.obj,
             <const_char *>swallow if swallow is not None else NULL))
 
+    # XXX: clash with object.text_set
     def text_set(self, part, text):
         """text_set(unicode part, unicode text)
 
@@ -221,6 +222,7 @@ cdef class Layout(LayoutClass):
             <const_char *>part if part is not None else NULL,
             <const_char *>text if text is not None else NULL)
 
+    # XXX: clash with object.text_get
     def text_get(self, part):
         """text_get(unicode part) -> unicode
 
diff --git a/efl/elementary/scroller.pyx b/efl/elementary/scroller.pyx
index d49942d..d9e27ee 100644
--- a/efl/elementary/scroller.pyx
+++ b/efl/elementary/scroller.pyx
@@ -68,7 +68,11 @@ cdef class ScrollableInterface(Object):
         :type base: string
 
         """
-        elm_scroller_custom_widget_base_theme_set(self.obj, _cfruni(widget), 
_cfruni(base))
+        if isinstance(widget, unicode): widget = widget.encode("UTF-8")
+        if isinstance(base, unicode): base = base.encode("UTF-8")
+        elm_scroller_custom_widget_base_theme_set(self.obj,
+            <const_char *>widget if widget is not None else NULL,
+            <const_char *>base if base is not None else NULL)
 
     def content_min_limit(self, w, h):
         """content_min_limit(bool w, bool h)
diff --git a/efl/elementary/segment_control.pyx 
b/efl/elementary/segment_control.pyx
index ae08176..c13b476 100644
--- a/efl/elementary/segment_control.pyx
+++ b/efl/elementary/segment_control.pyx
@@ -155,7 +155,9 @@ cdef class SegmentControl(LayoutClass):
         cdef SegmentControlItem ret = SegmentControlItem()
         cdef Elm_Object_Item *item
 
-        item = elm_segment_control_item_add(self.obj, icon.obj, _cfruni(label) 
if label is not None else NULL)
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        item = elm_segment_control_item_add(self.obj, icon.obj,
+            <const_char *>label if label is not None else NULL)
         if item != NULL:
             ret._set_obj(item)
             return ret
@@ -200,7 +202,9 @@ cdef class SegmentControl(LayoutClass):
         cdef SegmentControlItem ret = SegmentControlItem()
         cdef Elm_Object_Item *item
 
-        item = elm_segment_control_item_insert_at(self.obj, icon.obj, 
_cfruni(label) if label is not None else NULL, index)
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        item = elm_segment_control_item_insert_at(self.obj, icon.obj,
+            <const_char *>label if label is not None else NULL, index)
         if item != NULL:
             ret._set_obj(item)
             return ret
diff --git a/efl/elementary/slider.pyx b/efl/elementary/slider.pyx
index b15d09c..0dbdce2 100644
--- a/efl/elementary/slider.pyx
+++ b/efl/elementary/slider.pyx
@@ -123,14 +123,16 @@ cdef class Slider(LayoutClass):
 
         """
         def __get__(self):
-            return _ctouni(elm_slider_unit_format_get(self.obj))
+            return self.unit_format_get()
 
-        def __set__(self, format):
-            elm_slider_unit_format_set(self.obj, _cfruni(format))
+        def __set__(self, unit_format):
+            self.unit_format_set(unit_format)
 
-    def unit_format_set(self, format):
-        elm_slider_unit_format_set(self.obj, _cfruni(format))
-    def unit_format_get(self):
+    cpdef unit_format_set(self, unit_format):
+        if isinstance(unit_format, unicode): unit_format = 
unit_format.encode("UTF-8")
+        elm_slider_unit_format_set(self.obj,
+            <const_char *>unit_format if unit_format is not None else NULL)
+    cpdef unit_format_get(self):
         return _ctouni(elm_slider_unit_format_get(self.obj))
 
     property indicator_format:
@@ -154,14 +156,16 @@ cdef class Slider(LayoutClass):
 
         """
         def __get__(self):
-            return _ctouni(elm_slider_indicator_format_get(self.obj))
+            return self.indicator_format_get()
 
-        def __set__(self, format):
-            elm_slider_indicator_format_set(self.obj, _cfruni(format))
+        def __set__(self, ind_format):
+            self.indicator_format_set(ind_format)
 
-    def indicator_format_set(self, format):
-        elm_slider_indicator_format_set(self.obj, _cfruni(format))
-    def indicator_format_get(self):
+    cpdef indicator_format_set(self, ind_format):
+        if isinstance(ind_format, unicode): ind_format = 
ind_format.encode("UTF-8")
+        elm_slider_indicator_format_set(self.obj,
+            <const_char *>ind_format if ind_format is not None else NULL)
+    cpdef indicator_format_get(self):
         return _ctouni(elm_slider_indicator_format_get(self.obj))
 
     #TODO: def indicator_format_function_set(self, func, free_func)
diff --git a/efl/elementary/slideshow.pyx b/efl/elementary/slideshow.pyx
index e01fb95..57b55dc 100644
--- a/efl/elementary/slideshow.pyx
+++ b/efl/elementary/slideshow.pyx
@@ -457,7 +457,9 @@ cdef class Slideshow(LayoutClass):
 
         """
         def __set__(self, transition):
-            elm_slideshow_transition_set(self.obj, _cfruni(transition))
+            if isinstance(transition, unicode): transition = 
transition.encode("UTF-8")
+            elm_slideshow_transition_set(self.obj,
+                <const_char *>transition if transition is not None else NULL)
         def __get__(self):
             return _ctouni(elm_slideshow_transition_get(self.obj))
 
@@ -567,7 +569,9 @@ cdef class Slideshow(LayoutClass):
 
         """
         def __set__(self, layout):
-            elm_slideshow_layout_set(self.obj, _cfruni(layout))
+            if isinstance(layout, unicode): layout = layout.encode("UTF-8")
+            elm_slideshow_layout_set(self.obj,
+                <const_char *>layout if layout is not None else NULL)
         def __get__(self):
             return _ctouni(elm_slideshow_layout_get(self.obj))
 
diff --git a/efl/elementary/spinner.pyx b/efl/elementary/spinner.pyx
index f56c11a..c8cb84f 100644
--- a/efl/elementary/spinner.pyx
+++ b/efl/elementary/spinner.pyx
@@ -72,14 +72,16 @@ cdef class Spinner(LayoutClass):
 
         """
         def __get__(self):
-            return _ctouni(elm_spinner_label_format_get(self.obj))
+            return self.label_format_get()
 
-        def __set__(self, format):
-            elm_spinner_label_format_set(self.obj, _cfruni(format))
+        def __set__(self, label_format):
+            self.label_format_set(label_format)
 
-    def label_format_set(self, format):
-        elm_spinner_label_format_set(self.obj, _cfruni(format))
-    def label_format_get(self):
+    cpdef label_format_set(self, label_format):
+        if isinstance(label_format, unicode): label_format = 
label_format.encode("UTF-8")
+        elm_spinner_label_format_set(self.obj,
+            <const_char *>label_format if label_format is not None else NULL)
+    cpdef label_format_get(self):
         return _ctouni(elm_spinner_label_format_get(self.obj))
 
     property min_max:
@@ -246,7 +248,9 @@ cdef class Spinner(LayoutClass):
         :type label: string
 
         """
-        elm_spinner_special_value_add(self.obj, value, _cfruni(label))
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        elm_spinner_special_value_add(self.obj, value,
+            <const_char *>label if label is not None else NULL)
 
     property interval:
         """The interval on time updates for an user mouse button hold
diff --git a/efl/elementary/theme.pyx b/efl/elementary/theme.pyx
index 2946583..7d01208 100644
--- a/efl/elementary/theme.pyx
+++ b/efl/elementary/theme.pyx
@@ -181,7 +181,9 @@ cdef class Theme(object):
         :type item: string
 
         """
-        elm_theme_overlay_add(self.th, _cfruni(item))
+        if isinstance(item, unicode): item = item.encode("UTF-8")
+        elm_theme_overlay_add(self.th,
+            <const_char *>item if item is not None else NULL)
 
     def overlay_del(self, item):
         """overlay_del(unicode item)
@@ -194,7 +196,9 @@ cdef class Theme(object):
         :type item: string
 
         """
-        elm_theme_overlay_del(self.th, _cfruni(item))
+        if isinstance(item, unicode): item = item.encode("UTF-8")
+        elm_theme_overlay_del(self.th,
+            <const_char *>item if item is not None else NULL)
 
     property overlay_list:
         """Get the list of registered overlays for the given theme
@@ -230,7 +234,9 @@ cdef class Theme(object):
         :type item: string
 
         """
-        elm_theme_extension_add(self.th, _cfruni(item))
+        if isinstance(item, unicode): item = item.encode("UTF-8")
+        elm_theme_extension_add(self.th,
+            <const_char *>item if item is not None else NULL)
 
     def extension_del(self, item):
         """extension_del(unicode item)
@@ -243,7 +249,9 @@ cdef class Theme(object):
         :type item: string
 
         """
-        elm_theme_extension_del(self.th, _cfruni(item))
+        if isinstance(item, unicode): item = item.encode("UTF-8")
+        elm_theme_extension_del(self.th,
+            <const_char *>item if item is not None else NULL)
 
     property extension_list:
         """Get the list of registered extensions for the given theme
@@ -272,7 +280,9 @@ cdef class Theme(object):
 
         """
         def __set__(self, theme):
-            elm_theme_set(self.th, _cfruni(theme))
+            if isinstance(theme, unicode): theme = theme.encode("UTF-8")
+            elm_theme_set(self.th,
+                <const_char *>theme if theme is not None else NULL)
 
         def __get__(self):
             return _ctouni(elm_theme_get(self.th))
@@ -327,7 +337,9 @@ cdef class Theme(object):
         :rtype: string
 
         """
-        return _ctouni(elm_theme_data_get(self.th, _cfruni(key)))
+        if isinstance(key, unicode): key = key.encode("UTF-8")
+        return _ctouni(elm_theme_data_get(self.th,
+            <const_char *>key if key is not None else NULL))
 
 def theme_list_item_path_get(f, in_search_path):
     """theme_list_item_path_get(unicode f, bool in_search_path) -> unicode
@@ -353,7 +365,9 @@ def theme_list_item_path_get(f, in_search_path):
 
     """
     cdef Eina_Bool path = in_search_path
-    return _ctouni(elm_theme_list_item_path_get(_cfruni(f), &path))
+    if isinstance(f, unicode): f = f.encode("UTF-8")
+    return _ctouni(elm_theme_list_item_path_get(
+        <const_char *>f if f is not None else NULL, &path))
 
 def theme_full_flush():
     """theme_full_flush()
@@ -387,7 +401,11 @@ def theme_name_available_list():
 
 # for compatibility
 def theme_overlay_add(item):
-    elm_theme_overlay_add(NULL, _cfruni(item))
+    if isinstance(item, unicode): item = item.encode("UTF-8")
+    elm_theme_overlay_add(NULL,
+        <const_char *>item if item is not None else NULL)
 
 def theme_extension_add(item):
-    elm_theme_extension_add(NULL, _cfruni(item))
+    if isinstance(item, unicode): item = item.encode("UTF-8")
+    elm_theme_extension_add(NULL,
+        <const_char *>item if item is not None else NULL)
diff --git a/efl/elementary/thumb.pyx b/efl/elementary/thumb.pyx
index 87bc80f..5efd01c 100644
--- a/efl/elementary/thumb.pyx
+++ b/efl/elementary/thumb.pyx
@@ -120,17 +120,19 @@ cdef class Thumb(Object):
         """
         def __set__(self, value):
             if isinstance(value, tuple) or isinstance(value, list):
-                file, key = value
+                file_name, key = value
             else:
-                file = value
+                file_name = value
                 key = None
-            elm_thumb_file_set( self.obj,
-                                _cfruni(file) if file is not None else NULL,
-                                _cfruni(key) if key is not None else NULL)
+            if isinstance(file_name, unicode): file_name = 
file_name.encode("UTF-8")
+            if isinstance(key, unicode): key = key.encode("UTF-8")
+            elm_thumb_file_set(self.obj,
+                <const_char *>file_name if file_name is not None else NULL,
+                <const_char *>key if key is not None else NULL)
         def __get__(self):
-            cdef const_char *file, *key
-            elm_thumb_file_get(self.obj, &file, &key)
-            return(_ctouni(file), _ctouni(key))
+            cdef const_char *file_name, *key
+            elm_thumb_file_get(self.obj, &file_name, &key)
+            return(_ctouni(file_name), _ctouni(key))
 
     property path:
         """Get the path and key to the image or video thumbnail generated by
diff --git a/efl/elementary/toolbar.pyx b/efl/elementary/toolbar.pyx
index 7231300..43c15df 100644
--- a/efl/elementary/toolbar.pyx
+++ b/efl/elementary/toolbar.pyx
@@ -124,7 +124,12 @@ cdef class ToolbarItemState(object):
 
         self.params = (callback, args, kwargs)
 
-        self.obj = elm_toolbar_item_state_add(it.item, _cfruni(icon), 
_cfruni(label), cb, <void*>self)
+        if isinstance(icon, unicode): icon = icon.encode("UTF-8")
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        self.obj = elm_toolbar_item_state_add(it.item,
+            <const_char *>icon if icon is not None else NULL,
+            <const_char *>label if label is not None else NULL,
+            cb, <void*>self)
         if self.obj == NULL:
             Py_DECREF(self)
 
@@ -149,7 +154,12 @@ cdef class ToolbarItem(ObjectItem):
 
         self.params = (callback, args, kargs)
 
-        item = elm_toolbar_item_append(toolbar.obj, _cfruni(icon), 
_cfruni(label), cb, <void*>self)
+        if isinstance(icon, unicode): icon = icon.encode("UTF-8")
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        item = elm_toolbar_item_append(toolbar.obj,
+            <const_char *>icon if icon is not None else NULL,
+            <const_char *>label if label is not None else NULL,
+            cb, <void*>self)
 
         if item != NULL:
             self._set_obj(item)
@@ -253,14 +263,16 @@ cdef class ToolbarItem(ObjectItem):
 
         """
         def __get__(self):
-            return _ctouni(elm_toolbar_item_icon_get(self.item))
+            return self.icon_get()
 
         def __set__(self, ic):
-            elm_toolbar_item_icon_set(self.item, _cfruni(ic))
+            self.icon_set(ic)
 
-    def icon_set(self, ic):
-        elm_toolbar_item_icon_set(self.item, _cfruni(ic))
-    def icon_get(self):
+    cpdef icon_set(self, ic):
+        if isinstance(ic, unicode): ic = ic.encode("UTF-8")
+        elm_toolbar_item_icon_set(self.item,
+            <const_char *>ic if ic is not None else NULL)
+    cpdef icon_get(self):
         return _ctouni(elm_toolbar_item_icon_get(self.item))
 
     property object:
@@ -325,16 +337,20 @@ cdef class ToolbarItem(ObjectItem):
         """
         def __set__(self, value):
             if isinstance(value, tuple):
-                file, key = value
+                file_name, key = value
             else:
-                file = value
+                file_name = value
                 key = None
-            if not bool(elm_toolbar_item_icon_file_set(self.item, 
_cfruni(file), _cfruni(key))):
+            self.icon_file_set(file_name, key)
+
+    def icon_file_set(self, file_name, key):
+        if isinstance(file_name, unicode): file_name = 
file_name.encode("UTF-8")
+        if isinstance(key, unicode): key = key.encode("UTF-8")
+        if not elm_toolbar_item_icon_file_set(self.item,
+            <const_char *>file_name if file_name is not None else NULL,
+            <const_char *>key if key is not None else NULL):
                 raise RuntimeError("Could not set icon_file.")
 
-    def icon_file_set(self, file, key):
-        return bool(elm_toolbar_item_icon_file_set(self.item, _cfruni(file), 
_cfruni(key)))
-
     property separator:
         """Whether item is a separator or not.
 
@@ -387,19 +403,15 @@ cdef class ToolbarItem(ObjectItem):
 
         """
         def __get__(self):
-            cdef Evas_Object *menu
-            menu = elm_toolbar_item_menu_get(self.item)
-            if menu == NULL:
-                return None
-            else:
-                return Menu(None, <object>menu)
+            return self.menu_get()
 
         def __set__(self, menu):
-            elm_toolbar_item_menu_set(self.item, menu)
+            self.menu_set(menu)
 
-    def menu_set(self, menu):
+    cpdef menu_set(self, menu):
         elm_toolbar_item_menu_set(self.item, menu)
-    def menu_get(self):
+    cpdef menu_get(self):
+        # TODO: Improve this
         cdef Evas_Object *menu
         menu = elm_toolbar_item_menu_get(self.item)
         if menu == NULL:
@@ -678,7 +690,9 @@ cdef class Toolbar(Object):
         :rtype: :py:class:`ToolbarItem`
 
         """
-        return _object_item_to_python(elm_toolbar_item_find_by_label(self.obj, 
_cfruni(label)))
+        if isinstance(label, unicode): label = label.encode("UTF-8")
+        return _object_item_to_python(elm_toolbar_item_find_by_label(self.obj,
+            <const_char *>label if label is not None else NULL))
 
     property selected_item:
         """The selected item.
diff --git a/efl/elementary/video.pyx b/efl/elementary/video.pyx
index a5ef426..5645808 100644
--- a/efl/elementary/video.pyx
+++ b/efl/elementary/video.pyx
@@ -49,11 +49,14 @@ cdef class Video(LayoutClass):
 
         """
         def __set__(self, filename):
-            if not bool(elm_video_file_set(self.obj, _cfruni(filename))):
-                raise RuntimeError("Could not set file.")
+            self.file_set(filename)
 
-    def file_set(self, filename):
-        return bool(elm_video_file_set(self.obj, _cfruni(filename)))
+    # NOTE: clash with layout.file_set
+    cpdef file_set(self, filename, group = None):
+        if isinstance(filename, unicode): filename = filename.encode("UTF-8")
+        if not elm_video_file_set(self.obj,
+            <const_char *>filename if filename is not None else NULL):
+                raise RuntimeError("Could not set file.")
 
     property emotion:
         """The underlying Emotion object.
diff --git a/efl/elementary/widget_header.pxi b/efl/elementary/widget_header.pxi
index e67ceda..10d119e 100644
--- a/efl/elementary/widget_header.pxi
+++ b/efl/elementary/widget_header.pxi
@@ -3,7 +3,7 @@ from efl.eo cimport PY_REFCOUNT
 from efl.evas cimport Object as evasObject
 from efl.eo cimport object_from_instance
 from efl.eo cimport _object_mapping_register
-from efl.eo cimport _cfruni, _ctouni, _fruni, _touni
+from efl.eo cimport _ctouni, _touni
 
 import logging
 log = logging.getLogger("elementary")
diff --git a/efl/elementary/window.pyx b/efl/elementary/window.pyx
index 64b9dbd..8e4f734 100644
--- a/efl/elementary/window.pyx
+++ b/efl/elementary/window.pyx
@@ -371,7 +371,10 @@ cdef class Window(Object):
     """
 
     def __init__(self, name, type, evasObject parent=None):
-        self._set_obj(elm_win_add(parent.obj if parent is not None else NULL, 
_cfruni(name), type))
+        if isinstance(name, unicode): name = name.encode("UTF-8")
+        self._set_obj(elm_win_add(parent.obj if parent is not None else NULL,
+            <const_char *>name if name is not None else NULL,
+            type))
 
     def resize_object_add(self, evasObject subobj):
         """resize_object_add(evas.Object subobj)
@@ -427,13 +430,15 @@ cdef class Window(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_win_title_get(self.obj))
+            return self.title_get()
         def __set__(self, title):
-            elm_win_title_set(self.obj, _cfruni(title))
+            self.title_set(title)
 
-    def title_set(self, title):
-        elm_win_title_set(self.obj, _cfruni(title))
-    def title_get(self):
+    cpdef title_set(self, title):
+        if isinstance(title, unicode): title = title.encode("UTF-8")
+        elm_win_title_set(self.obj,
+            <const_char *>title if title is not None else NULL)
+    cpdef title_get(self):
         return _ctouni(elm_win_title_get(self.obj))
 
     property icon_name:
@@ -443,12 +448,14 @@ cdef class Window(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_win_icon_name_get(self.obj))
+            return self.icon_name_get()
         def __set__(self, icon_name):
-            elm_win_icon_name_set(self.obj, _cfruni(icon_name))
+            self.icon_name_set(icon_name)
 
     def icon_name_set(self, icon_name):
-        elm_win_icon_name_set(self.obj, _cfruni(icon_name))
+        if isinstance(icon_name, unicode): icon_name = 
icon_name.encode("UTF-8")
+        elm_win_icon_name_set(self.obj,
+            <const_char *>icon_name if icon_name is not None else NULL)
     def icon_name_get(self):
         return _ctouni(elm_win_icon_name_get(self.obj))
 
@@ -459,12 +466,14 @@ cdef class Window(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_win_role_get(self.obj))
+            return self.role_get()
         def __set__(self, role):
-            elm_win_role_set(self.obj, _cfruni(role))
+            self.role_set(role)
 
     def role_set(self, role):
-        elm_win_role_set(self.obj, _cfruni(role))
+        if isinstance(role, unicode): role = role.encode("UTF-8")
+        elm_win_role_set(self.obj,
+            <const_char *>role if role is not None else NULL)
     def role_get(self):
         return _ctouni(elm_win_role_get(self.obj))
 
@@ -792,14 +801,16 @@ cdef class Window(Object):
 
         """
         def __set__(self, profile):
-            elm_win_profile_set(self.obj, _cfruni(profile))
+            self.profile_set(profile)
 
         def __get__(self):
-            return _ctouni(elm_win_profile_get(self.obj))
+            return self.profile_get()
 
-    def profile_set(self, profile):
-        elm_win_profile_set(self.obj, _cfruni(profile))
-    def profile_get(self):
+    cpdef profile_set(self, profile):
+        if isinstance(profile, unicode): profile = profile.encode("UTF-8")
+        elm_win_profile_set(self.obj,
+            <const_char *>profile if profile is not None else NULL)
+    cpdef profile_get(self):
         return _ctouni(elm_win_profile_get(self.obj))
 
     property urgent:
@@ -1307,13 +1318,15 @@ cdef class Window(Object):
 
         """
         def __get__(self):
-            return _ctouni(elm_win_focus_highlight_style_get(self.obj))
+            return self.focus_highlight_style_get()
         def __set__(self, style):
-            elm_win_focus_highlight_style_set(self.obj, _cfruni(style))
+            self.focus_highlight_style_set(style)
 
-    def focus_highlight_style_set(self, style):
-        elm_win_focus_highlight_style_set(self.obj, _cfruni(style))
-    def focus_highlight_style_get(self):
+    cpdef focus_highlight_style_set(self, style):
+        if isinstance(style, unicode): style = style.encode("UTF-8")
+        elm_win_focus_highlight_style_set(self.obj,
+            <const_char *>style if style is not None else NULL)
+    cpdef focus_highlight_style_get(self):
         return _ctouni(elm_win_focus_highlight_style_get(self.obj))
 
     property keyboard_mode:
@@ -1413,7 +1426,10 @@ cdef class Window(Object):
         :type svcsys: bool
 
         """
-        return bool(elm_win_socket_listen(self.obj, _cfruni(svcname), svcnum, 
svcsys))
+        if isinstance(svcname, unicode): svcname = svcname.encode("UTF-8")
+        return bool(elm_win_socket_listen(self.obj,
+            <const_char *>svcname if svcname is not None else NULL,
+            svcnum, svcsys))
 
     property xwindow_xid:
         """Returns the X Window id.
@@ -1567,7 +1583,8 @@ cdef class StandardWindow(Window):
     """
 
     def __init__(self, name, title):
-        self._set_obj(elm_win_util_standard_add(_cfruni(name), _cfruni(title)))
-
-
-_object_mapping_register("elm_standardwin", StandardWindow)
+        if isinstance(name, unicode): name = name.encode("UTF-8")
+        if isinstance(title, unicode): title = title.encode("UTF-8")
+        self._set_obj(elm_win_util_standard_add(
+            <const_char *>name if name is not None else NULL,
+            <const_char *>title if title is not None else NULL))

-- 

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html

Reply via email to