kuuko pushed a commit to branch master.

commit 4a157cb0a21e67c2cd3978b52d4f4ab016d2d45f
Author: Kai Huuhko <[email protected]>
Date:   Fri Mar 29 16:36:16 2013 +0000

    Add more skeletal work for Efreet.
    
    Uri, base and trash should be fully usable now.
---
 api_coverage.py            |   1 +
 efl/efreet/desktop.pxi     | 422 +++++++++++++++++++++++++++++++++++++++++----
 efl/efreet/efreet.pxd      | 162 +++++++++++++----
 efl/efreet/efreet.pyx      |  37 ++--
 efl/efreet/enums.pxd       |  25 +++
 efl/efreet/icon.pxi        | 204 ++++++++++++++++++++++
 efl/efreet/menu.pxi        | 106 ++++++++++++
 efl/efreet/trash.pxd       |  12 ++
 efl/efreet/trash.pyx       |  83 +++++++++
 efl/efreet/uri.pxi         |  91 ++++++++++
 setup.py                   |  17 +-
 tests/efreet/test_trash.py |  41 +++++
 tests/efreet/test_uri.py   |  45 +++++
 13 files changed, 1143 insertions(+), 103 deletions(-)

diff --git a/api_coverage.py b/api_coverage.py
index ae6d114..99c5432 100755
--- a/api_coverage.py
+++ b/api_coverage.py
@@ -68,6 +68,7 @@ params = {
     "eo": ("include", "Eo", "eo"),
     "evas": ("include", "Evas", "evas"),
     "efreet": ("efl/efreet", "Efreet", "efreet"),
+    "efreet-trash": ("efl/efreet", "Efreet_Trash", "efreet_trash"),
     "ecore": ("include", "Ecore", "ecore"),
     "ecore-file": ("include", "Ecore_File", "ecore_file"),
     "edje": ("include", "Edje", "edje"),
diff --git a/efl/efreet/__init__.py b/efl/efreet/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/efl/efreet/desktop.pxi b/efl/efreet/desktop.pxi
index 190063e..e126001 100644
--- a/efl/efreet/desktop.pxi
+++ b/efl/efreet/desktop.pxi
@@ -1,41 +1,387 @@
-EAPI extern int EFREET_DESKTOP_TYPE_APPLICATION;
-EAPI extern int EFREET_DESKTOP_TYPE_LINK;
-EAPI extern int EFREET_DESKTOP_TYPE_DIRECTORY;
+from efl.eo cimport convert_python_list_strings_to_eina_list, 
convert_eina_list_strings_to_python_list
+cimport enums
+
+EFREET_DESKTOP_TYPE_APPLICATION = enums.EFREET_DESKTOP_TYPE_APPLICATION
+EFREET_DESKTOP_TYPE_LINK = enums.EFREET_DESKTOP_TYPE_LINK
+EFREET_DESKTOP_TYPE_DIRECTORY = enums.EFREET_DESKTOP_TYPE_DIRECTORY
+
+cdef void * efreet_desktop_command_cb(void *data, Efreet_Desktop *desktop, 
char *command, int remaining):
+    """A callback used with efreet_desktop_command_get()"""
+
+cdef int efreet_desktop_progress_cb(void *data, Efreet_Desktop *desktop, char 
*uri, long int total, long int current):
+    """A callback used to get download progress of remote uris"""
+
+cdef void * efreet_desktop_type_parse_cb(Efreet_Desktop *desktop, Efreet_Ini 
*ini):
+    """A callback used to parse data for custom types"""
+
+cdef void efreet_desktop_type_save_cb(Efreet_Desktop *desktop, Efreet_Ini 
*ini):
+    """A callback used to save data for custom types"""
+
+cdef void * efreet_desktop_type_free_cb(void *data):
+    """A callback used to free data for custom types"""
 
 cdef class EfreetDesktop(object):
+    cdef:
+        Efreet_Desktop *desktop
+
+        int type                # type of desktop file
+
+        int ref                 # reference count - internal
+
+        char *version           # version of spec file conforms to
+
+        char *orig_path         # original path to .desktop file
+        long long load_time     # modified time of .desktop on disk
+
+        char *name              # Specific name of the application
+        char *generic_name      # Generic name of the application
+        char *comment           # Tooltip for the entry
+        char *icon              # Icon to display in file manager, menus, etc
+        char *try_exec          # Binary to determine if app is installed
+        char *executable              # Program to execute
+        char *path              # Working directory to run app in
+        char *startup_wm_class  # If specified will map at least one window 
with
+                                # the given string as it's WM class or WM name
+        char *url               # URL to access if type is EFREET_TYPE_LINK
+
+        Eina_List  *only_show_in    # list of environments that should
+                                    # display the icon
+        Eina_List  *not_show_in     # list of environments that shoudn't
+                                    # display the icon
+        Eina_List  *categories      # Categories in which item should be shown
+        Eina_List  *mime_types      # The mime types supppored by this app
+
+        unsigned char no_display        # Don't display this application in 
menus
+        unsigned char hidden            # User delete the item
+        unsigned char terminal          # Does the program run in a terminal
+        unsigned char startup_notify    # The starup notify settings of the app
+        unsigned char eet             # The desktop file is in eet cache
+
+        Eina_Hash *x    # Keep track of all user extensions, keys that begin 
with X-
+        void *type_data # Type specific data for custom types
+
+    def __init__(self, file, new=False, cached=True):
+        if not new:
+            if cached:
+                self.desktop = efreet_desktop_new(_cfruni(file))
+                #FIXME: What's the difference between these two?
+                #self.desktop = efreet_desktop_get(_cfruni(file))
+            else:
+                self.desktop = efreet_desktop_uncached_new(_cfruni(file))
+        else:
+            self.desktop = efreet_desktop_empty_new(_cfruni(file))
+
+        # get:
+        """Gets a reference to an Efreet_Desktop structure representing the
+        contents of @a file or NULL if @a file is not a valid .desktop file.
+
+        By using efreet_desktop_get the Efreet_Desktop will be saved in an 
internal
+        cache for quicker loading.
+
+        Users of this command should listen to 
EFREET_EVENT_DESKTOP_CACHE_UPDATE
+        event, if the application is to keep the reference. When the event 
fires
+        the Efreet_Desktop struct should be invalidated and reloaded from a new
+        cache file.
+
+        :param file: The file to get the Efreet_Desktop from
+        :return: Returns a reference to a cached Efreet_Desktop on success, 
NULL
+        on failure
+
+        """
+
+        # uncached new:
+        """
+        :param file: The file to create the Efreet_Desktop from
+        :return: Returns a new Efreet_Desktop on success, NULL on failure
+        Creates a new Efreet_Desktop structure initialized from the
+        contents of @a file or NULL on failure
+
+        By using efreet_desktop_uncached_new the Efreet_Desktop structure will 
be
+        read from disk, and not from any cache.
+
+        Data in the structure is allocated with strdup, so use free and strdup 
to
+        change values.
+        """
+
+        # empty new:
+        """
+        :param file: The file to create the Efreet_Desktop from
+        :return: Returns a new empty_Efreet_Desktop on success, NULL on failure
+        Creates a new empty Efreet_Desktop structure or NULL on failure
+        """
+
+        # new:
+        """
+        :param file: The file to get the Efreet_Desktop from
+        :return: Returns a reference to a cached Efreet_Desktop on success, 
NULL
+        on failure
+        Gets a reference to an Efreet_Desktop structure representing the
+        contents of @a file or NULL if @a file is not a valid .desktop file.
+
+        Users of this command should listen to 
EFREET_EVENT_DESKTOP_CACHE_UPDATE
+        event, if the application is to keep the reference. When the event 
fires
+        the Efreet_Desktop struct should be invalidated and reloaded from a new
+        cache file.
+        """
+
+    def ref(self):
+        """ref() -> int
+
+        Increases reference count on desktop
+
+        :return: Returns the new reference count
+
+        """
+        return efreet_desktop_ref(self.desktop)
+
+    def free(self):
+        """free()
+
+        Frees the Efreet_Desktop structure and all of it's data
+
+        """
+        efreet_desktop_free(self.desktop)
+
+    def save(self):
+        """save() -> bool
+
+        Saves any changes made to @a desktop back to the file on the
+        filesystem
+
+        :return: Returns 1 on success or 0 on failure
+
+        """
+        #TODO: Check the return status here and raise exception if 0?
+        return bool(efreet_desktop_save(self.desktop))
+
+    def save_as(self, file):
+        """save_as(unicode file) -> bool
+
+        Saves @a desktop to @a file
+
+        Please use efreet_desktop_uncached_new() on an existing file
+        before using efreet_desktop_save_as()
+
+        :param file: The filename to save as
+        :return: Returns 1 on success or 0 on failure
+
+        """
+        #TODO: Check the return status here and raise exception if 0?
+        return bool(efreet_desktop_save_as(self.desktop, _cfruni(file)))
+
+    def exe_get(self, files, *args, **kwargs):
+        """exe_get(list files, *args, **kwargs) -> efl.ecore.Exe
+
+        Parses the @a desktop exec line and returns an Ecore_Exe.
+
+        :param files: The files to be substituted into the exec line
+        :param data: The data pointer to pass
+        :return: Returns the Ecore_Exce for @a desktop
+
+        """
+        pass
+        #TODO: How can this return an Exe???
+        #void efreet_desktop_exec(self.desktop, 
python_list_strings_to_eina_list(files), void *data)
+
+    def command_progress_get(self, files, cb_command, cb_prog, *args, 
**kwargs):
+        """command_progress_get(list files, cb_command, cb_prog, *args, 
**kwargs) -> bool
+
+        Get a command to use to execute a desktop entry, and receive progress
+        updates for downloading of remote URI's passed in.
+
+        :param files: an eina list of file names to execute, as either 
absolute paths,
+        relative paths, or uris
+        :param cb_command: a callback to call for each prepared command line
+        :param cb_prog: a callback to get progress for the downloads
+        :param data: user data passed to the callback
+        :return: Returns 1 on success or 0 on failure
+
+        """
+        pass
+        # XXX: Actually returns an int?
+#        EAPI void             
*efreet_desktop_command_progress_get(self.desktop,
+#                                                 Eina_List *files,
+#                                                 Efreet_Desktop_Command_Cb 
cb_command,
+#                                                 Efreet_Desktop_Progress_Cb 
cb_prog,
+#                                                 void *data);
+
+    def command_get(self, files, func, *args, **kwargs):
+        """command_get(list files, func, *args, **kwargs) -> retval
+
+        Get a command to use to execute a desktop entry.
+
+        :param files: an eina list of file names to execute, as either 
absolute paths,
+        relative paths, or uris
+        :param func: a callback to call for each prepared command line
+        :param data: user data passed to the callback
+        :return: Returns the return value of @p func on success or NULL on 
failure
+
+        """
+        # XXX: Actually returns an int?
+#        EAPI void              *efreet_desktop_command_get(self.desktop,
+#                                                 Eina_List *files,
+#                                                 Efreet_Desktop_Command_Cb 
func,
+#                                                 void *data);
+
+    def command_local_get(self, files):
+        """command_local_get(list files) -> list
+
+        Get the command to use to execute a desktop entry
+
+        The returned list and each of its elements must be freed.
+
+        :param files: an eina list of local files, as absolute paths, local 
paths, or file// uris (or NULL to get exec string with no files appended)
+        :return: Returns an eina list of exec strings
+
+        """
+        return 
convert_eina_list_strings_to_python_list(efreet_desktop_command_local_get(self.desktop,
 convert_python_list_strings_to_eina_list(files)))
+
+    property category_count:
+        """The number of categories the desktop belongs to
+
+        :type: int
+
+        """
+        def __get__(self):
+            return efreet_desktop_category_count_get(self.desktop)
+
+    def category_add(self, category):
+        """category_add(unicode category)
+
+        Add a category to a desktop
+
+        :param category: the category name
+
+        """
+        efreet_desktop_category_add(self.desktop, _cfruni(category))
+
+    def category_del(self, category):
+        """category_del(unicode category) -> bool
+
+        Removes a category from a desktop
+
+        :param category: the category name
+        :return: 1 if the desktop had his category listed, 0 otherwise
+
+        """
+        # TODO: Check return status here and raise exception if 0
+        return efreet_desktop_category_del(self.desktop, _cfruni(category))
+
+    property type_data:
+        """Type specific data for custom desktop types
+
+        :type: type specific data, or None if there is none
+
+        """
+        def __get__(self):
+            pass
+            # TODO: void * efreet_desktop_type_data_get(self.desktop)
+
+    def x_field_set(self, key, data):
+        """x_field_set(unicode key, unicode data) -> bool
+
+        Set the value for a X- field (Non spec) in the structure
+
+        The key has to start with "X-"
+
+        :param key: the key name to set
+        :param data: the value to set
+        :return: True on success
+
+        """
+        # TODO: Check return status and raise exception if 0
+        return bool(efreet_desktop_x_field_set(self.desktop, _cfruni(key), 
_cfruni(data)))
+
+    def x_field_get(self, key):
+        """x_field_get(unicode key) -> unicode
+
+        Get the value for a X- field (Non spec) in the structure
+
+        :param key: the key
+        :return: The value referenced by the key, or NULL if the key does not 
exist
+
+        """
+        return _ctouni(efreet_desktop_x_field_get(self.desktop, _cfruni(key)))
+
+    def x_field_del(self, key):
+        """x_field_del(unicode key) -> bool
+
+        Delete the key and value for a X- field (Non spec) in the structure
+
+        :param key: the key
+        :return: True if the key existed
+
+        """
+        # TODO: Check return status and raise exception if 0
+        return bool(efreet_desktop_x_field_del(self.desktop, _cfruni(key)))
+
+def environment_set(environment):
+    """Sets the global desktop environment name
+
+    :param environment: the environment name
+
+    """
+    efreet_desktop_environment_set(_cfruni(environment))
+
+def environment_get():
+    """Gets the global desktop environment name
+
+    :return: the environment name
+
+    """
+    return _ctouni(efreet_desktop_environment_get())
+
+def type_add(type, parse_func, save_func, free_func):
+    """type_add(unicode type, parse_func, save_func, free_func) -> int
+
+    Adds the given type to the list of types in the system
+
+    :param type: The type to add to the list of matching types
+    :param parse_func: a function to parse out custom fields
+    :param save_func: a function to save data returned from @a parse_func
+    :param free_func: a function to free data returned from @a parse_func
+    :return: Returns the id of the new type
+
+    """
+    pass
+    # TODO:
+#    return efreet_desktop_type_add(_cfruni(type),
+#                                        Efreet_Desktop_Type_Parse_Cb 
parse_func,
+#                                        Efreet_Desktop_Type_Save_Cb save_func,
+#                                        Efreet_Desktop_Type_Free_Cb free_func)
+
+def type_alias(int from_type, alias):
+    """type_alias(int from_type, unicode alias) -> int
+
+    Add an alias for an existing desktop type.
+
+    This allows applications to add non-standard types that behave exactly as 
standard types.
+
+    :param from_type: the type to alias (e.g. EFREE_DESKTOP_TYPE_APPLICATION)
+    :param alias: the alias
+    :return: the new type id, or -1 if @p from_type was not valid
+
+    """
+    return efreet_desktop_type_alias(from_type, _cfruni(alias))
+
+def string_list_parse(string):
+    """string_list_parse(unicode string) -> list
+
+    Parse ';' separate list of strings according to the desktop spec
+
+    :param string: the raw string list
+    :return: an Eina_List of ecore string's
+
+    """
+    return 
convert_eina_list_strings_to_python_list(efreet_desktop_string_list_parse(_cfruni(string)))
+
+def string_list_join(list lst):
+    """string_list_join(list lst) -> unicode
+
+    Create a ';' separate list of strings according to the desktop spec
+
+    :param list: Eina_List with strings
+    :return: a raw string list
 
-    int type                # type of desktop file
-
-    int ref                 # reference count - internal
-
-    char *version           # version of spec file conforms to
-
-    char *orig_path         # original path to .desktop file
-    long long load_time     # modified time of .desktop on disk
-
-    char *name              # Specific name of the application
-    char *generic_name      # Generic name of the application
-    char *comment           # Tooltip for the entry
-    char *icon              # Icon to display in file manager, menus, etc
-    char *try_exec          # Binary to determine if app is installed
-    char *exec              # Program to execute
-    char *path              # Working directory to run app in
-    char *startup_wm_class  # If specified will map at least one window with
-                            # the given string as it's WM class or WM name
-    char *url               # URL to access if type is EFREET_TYPE_LINK
-
-    Eina_List  *only_show_in    # list of environments that should
-                                # display the icon
-    Eina_List  *not_show_in     # list of environments that shoudn't
-                                # display the icon
-    Eina_List  *categories      # Categories in which item should be shown
-    Eina_List  *mime_types      # The mime types supppored by this app
-
-    unsigned char no_display        # Don't display this application in menus
-    unsigned char hidden            # User delete the item
-    unsigned char terminal          # Does the program run in a terminal
-    unsigned char startup_notify    # The starup notify settings of the app
-    unsigned char eet:1             # The desktop file is in eet cache
-
-    Eina_Hash *x    # Keep track of all user extensions, keys that begin with 
X-
-    void *type_data # Type specific data for custom types
+    """
+    return 
_ctouni(efreet_desktop_string_list_join(convert_python_list_strings_to_eina_list(lst)))
diff --git a/efl/efreet/efreet.pxd b/efl/efreet/efreet.pxd
index bf46104..e855e74 100644
--- a/efl/efreet/efreet.pxd
+++ b/efl/efreet/efreet.pxd
@@ -1,13 +1,16 @@
 from libc.string cimport const_char
 
+from efl cimport Eina_List, Eina_Bool, Eina_Stringshare, \
+    eina_stringshare_add, eina_stringshare_del
+
+from efl.efreet.enums cimport Efreet_Menu_Entry_Type, 
Efreet_Icon_Theme_Context, \
+    Efreet_Icon_Size_Type
+
 cdef extern from "Eina.h":
-    ctypedef struct Eina_List
     ctypedef struct Eina_Hash
-    ctypedef int Eina_Bool
 
 cdef extern from "Efreet.h":
-
-    struct Efreet_Desktop:
+    ctypedef struct Efreet_Desktop:
         int type                # type of desktop file
 
         int ref                 # reference count - internal
@@ -44,10 +47,79 @@ cdef extern from "Efreet.h":
         Eina_Hash *x    # Keep track of all user extensions, keys that begin 
with X-
         void *type_data # Type specific data for custom types
 
+    #ctypedef icon_theme_name icon_theme_name
+
+    #ctypedef Efreet_Icon_Theme Efreet_Icon_Theme
+
+    ctypedef struct Efreet_Icon_Theme:
+        # TODO: name *name
+
+        const_char *comment        # String describing the theme
+        const_char *example_icon   # Icon to use as an example of the theme
+
+        # An icon theme can have multiple directories that store it's icons. We
+        # need to be able to find a search each one.
+
+        Eina_List *paths           # The paths
+        Eina_List *inherits        # Icon themes we inherit from
+        Eina_List *directories     # List of subdirectories for this theme
+
+    struct size: # The size settings for the icon theme */
+        unsigned int normal        # The size for this directory */
+        unsigned int min           # The minimum size for this directory */
+        unsigned int max           # The maximum size for this directory */
+        unsigned int threshold     # Size difference threshold */
+
+    ctypedef size icon_theme_directory_size
+
+    ctypedef struct Efreet_Icon_Theme_Directory:
+        icon_theme_directory_size *size
+        const_char *name               # The directory name */
+        Efreet_Icon_Theme_Context context  # The type of icons in the dir */
+        Efreet_Icon_Size_Type type     # The size type for the icons */
+
+    struct embedded_text_rectangle: # Rectangle where text can be displayed on 
the icon */
+        int x0             # x0 position */
+        int y0             # y0 position */
+        int x1             # x1 position */
+        int y1             # y1 position */
+
+    ctypedef embedded_text_rectangle icon_rectangle
+
+    ctypedef struct Efreet_Icon:
+        # TODO: icon_rectangle embedded_text_rectangle
+        const_char *path       # Full path to the icon */
+        const_char *name       # Translated UTF8 string that can be used for 
the icon name */
+
+        Eina_List *attach_points # List of points to be used as anchor points 
for emblems/overlays */
+
+        unsigned int ref_count    # References to this icon */
+        unsigned char has_embedded_text_rectangle # Has the embedded rectangle 
set */
+
+    ctypedef struct Efreet_Icon_Point:
+        int x          # x coord */
+        int y          # y coord */
+
     struct Efreet_Ini:
         Eina_Hash *data     # Hash of string => (Hash of string => string)
         Eina_Hash *section  # currently selected section
 
+    ctypedef struct Efreet_Menu:
+        Efreet_Menu_Entry_Type type
+        const_char *id   # File-id for desktop and relative name for menu
+
+        const_char *name # Name this entry should show
+        const_char *icon # Icon for this entry
+
+        Efreet_Desktop *desktop   # The desktop we refer too
+        Eina_List      *entries   # The menu items
+
+    ctypedef struct Efreet_Uri:
+        const_char *protocol   # The protocol used (usually 'file')
+        const_char *hostname   # The name of the host if any, or NULL
+        const_char *path       # The full file path whitout protocol nor host
+
+    # Callbacks
     ctypedef void *(*Efreet_Desktop_Command_Cb) (void *data, Efreet_Desktop 
*desktop, char *command, int remaining)
     ctypedef int (*Efreet_Desktop_Progress_Cb) (void *data, Efreet_Desktop 
*desktop, char *uri, long int total, long int current)
     ctypedef void *(*Efreet_Desktop_Type_Parse_Cb) (Efreet_Desktop *desktop, 
Efreet_Ini *ini)
@@ -77,33 +149,44 @@ cdef extern from "Efreet.h":
     const_char *    efreet_hostname_get()
 
     # Desktop
-#    Efreet_Desktop *    efreet_desktop_get(const_char *file)
-#    int                 efreet_desktop_ref(Efreet_Desktop *desktop)
-#    Efreet_Desktop *    efreet_desktop_empty_new(const_char *file)
-#    Efreet_Desktop *    efreet_desktop_new(const_char *file)
-#    Efreet_Desktop *    efreet_desktop_uncached_new(const_char *file)
-#    void                efreet_desktop_free(Efreet_Desktop *desktop)
-#    int                 efreet_desktop_save(Efreet_Desktop *desktop)
-#    int                 efreet_desktop_save_as(Efreet_Desktop *desktop, 
const_char *file)
-#    void                efreet_desktop_exec(Efreet_Desktop *desktop, 
Eina_List *files, void *data)
-#    void                efreet_desktop_environment_set(const_char 
*environment)
-#    const_char *        efreet_desktop_environment_get()
-#    void *              efreet_desktop_command_progress_get(Efreet_Desktop 
*desktop, Eina_List *files, Efreet_Desktop_Command_Cb cb_command, 
Efreet_Desktop_Progress_Cb cb_prog, void *data)
-#    void *              efreet_desktop_command_get(Efreet_Desktop *desktop, 
Eina_List *files, Efreet_Desktop_Command_Cb func, void *data)
-#    Eina_List *         efreet_desktop_command_local_get(Efreet_Desktop 
*desktop, Eina_List *files)
-#    unsigned int        efreet_desktop_category_count_get(Efreet_Desktop 
*desktop)
-#    void                efreet_desktop_category_add(Efreet_Desktop *desktop, 
const_char *category)
-#    int                 efreet_desktop_category_del(Efreet_Desktop *desktop, 
const_char *category)
-#    int                 efreet_desktop_type_add(const_char *type, 
Efreet_Desktop_Type_Parse_Cb parse_func, Efreet_Desktop_Type_Save_Cb save_func, 
Efreet_Desktop_Type_Free_Cb free_func)
-#    int                 efreet_desktop_type_alias (int from_type, const_char 
*alias)
-#    void *              efreet_desktop_type_data_get(Efreet_Desktop *desktop)
-#    Eina_List *         efreet_desktop_string_list_parse(const_char *string)
-#    char *              efreet_desktop_string_list_join(Eina_List *list)
-#    Eina_Bool           efreet_desktop_x_field_set(Efreet_Desktop *desktop, 
const_char *key, const_char *data)
-#    const_char *        efreet_desktop_x_field_get(Efreet_Desktop *desktop, 
const_char *key)
-#    Eina_Bool           efreet_desktop_x_field_del(Efreet_Desktop *desktop, 
const_char *key)
+    Efreet_Desktop *    efreet_desktop_get(const_char *file)
+    int                 efreet_desktop_ref(Efreet_Desktop *desktop)
+    Efreet_Desktop *    efreet_desktop_empty_new(const_char *file)
+    Efreet_Desktop *    efreet_desktop_new(const_char *file)
+    Efreet_Desktop *    efreet_desktop_uncached_new(const_char *file)
+    void                efreet_desktop_free(Efreet_Desktop *desktop)
+    int                 efreet_desktop_save(Efreet_Desktop *desktop)
+    int                 efreet_desktop_save_as(Efreet_Desktop *desktop, 
const_char *file)
+    #TODO: void                efreet_desktop_exec(Efreet_Desktop *desktop, 
Eina_List *files, void *data)
+    void                efreet_desktop_environment_set(const_char *environment)
+    const_char *        efreet_desktop_environment_get()
+    #TODO: void *              
efreet_desktop_command_progress_get(Efreet_Desktop *desktop, Eina_List *files, 
Efreet_Desktop_Command_Cb cb_command, Efreet_Desktop_Progress_Cb cb_prog, void 
*data)
+    #TODO: void *              efreet_desktop_command_get(Efreet_Desktop 
*desktop, Eina_List *files, Efreet_Desktop_Command_Cb func, void *data)
+    Eina_List *         efreet_desktop_command_local_get(Efreet_Desktop 
*desktop, Eina_List *files)
+    unsigned int        efreet_desktop_category_count_get(Efreet_Desktop 
*desktop)
+    void                efreet_desktop_category_add(Efreet_Desktop *desktop, 
const_char *category)
+    int                 efreet_desktop_category_del(Efreet_Desktop *desktop, 
const_char *category)
+    #TODO: int                 efreet_desktop_type_add(const_char *type, 
Efreet_Desktop_Type_Parse_Cb parse_func, Efreet_Desktop_Type_Save_Cb save_func, 
Efreet_Desktop_Type_Free_Cb free_func)
+    int                 efreet_desktop_type_alias (int from_type, const_char 
*alias)
+    #TODO: void *              efreet_desktop_type_data_get(Efreet_Desktop 
*desktop)
+    Eina_List *         efreet_desktop_string_list_parse(const_char *string)
+    char *              efreet_desktop_string_list_join(Eina_List *list)
+    Eina_Bool           efreet_desktop_x_field_set(Efreet_Desktop *desktop, 
const_char *key, const_char *data)
+    const_char *        efreet_desktop_x_field_get(Efreet_Desktop *desktop, 
const_char *key)
+    Eina_Bool           efreet_desktop_x_field_del(Efreet_Desktop *desktop, 
const_char *key)
 
     # Icon
+    const_char        *efreet_icon_user_dir_get()
+    const_char        *efreet_icon_deprecated_user_dir_get()
+    void               efreet_icon_extension_add(const_char *ext)
+    Eina_List        **efreet_icon_extra_list_get()
+    Eina_List         *efreet_icon_extensions_list_get()
+    Eina_List         *efreet_icon_theme_list_get()
+    Efreet_Icon_Theme *efreet_icon_theme_find(const_char *theme_name)
+    Efreet_Icon       *efreet_icon_find(const_char *theme_name, const_char 
*icon, unsigned int size)
+    const_char        *efreet_icon_list_find(const_char *theme_name, Eina_List 
*icons, unsigned int size)
+    const_char        *efreet_icon_path_find(const_char *theme_name, 
const_char *icon, unsigned int size)
+    void               efreet_icon_free(Efreet_Icon *icon)
 
     # Ini
     Efreet_Ini *    efreet_ini_new(const_char *file)
@@ -124,11 +207,24 @@ cdef extern from "Efreet.h":
     void            efreet_ini_key_unset(Efreet_Ini *ini, const_char *key)
 
     # Menu
-
-    # Mime
-
-    # Trash
+    int              efreet_menu_kde_legacy_init()
+    Efreet_Menu     *efreet_menu_new(const_char *name)
+    void             efreet_menu_file_set(const_char *file)
+    Efreet_Menu     *efreet_menu_get()
+    Efreet_Menu     *efreet_menu_parse(const_char *path)
+    int              efreet_menu_save(Efreet_Menu *menu, const_char *path)
+    void             efreet_menu_free(Efreet_Menu *menu)
+    int              efreet_menu_desktop_insert(Efreet_Menu *menu, 
Efreet_Desktop *desktop, int pos)
+    int              efreet_menu_desktop_remove(Efreet_Menu *menu, 
Efreet_Desktop *desktop)
+    void             efreet_menu_dump(Efreet_Menu *menu, const_char *indent)
 
     # URI
+    const_char *efreet_uri_encode(Efreet_Uri *uri)
+    Efreet_Uri *efreet_uri_decode(const_char *val)
+    void        efreet_uri_free(Efreet_Uri *uri)
 
     # Utils
+
+
+cdef class Uri(object):
+    cdef Efreet_Uri *uri
diff --git a/efl/efreet/efreet.pyx b/efl/efreet/efreet.pyx
index 4710170..3cb9c62 100644
--- a/efl/efreet/efreet.pyx
+++ b/efl/efreet/efreet.pyx
@@ -19,42 +19,27 @@ that end it implements the following specifications:
 
 """
 
-def init():
-    """
-
-    Initializes the Efreet system.
-
-    :return: Value > ``0`` if the initialization was successful, ``0`` 
otherwise.
+import atexit
 
-    """
-    return efreet_init()
-
-def shutdown():
-    """
+efreet_init()
 
-    Shuts down Efreet if a balanced number of init/shutdown calls have
-    been made
-
-    :return: The number of times the init function has been called minus the
-    corresponding init call.
-
-    """
+def _shutdown():
     return efreet_shutdown()
 
+atexit.register(_shutdown)
+
 def lang_reset():
-    """
+    """lang_reset()
 
     Resets language dependent variables and resets language dependent
-    caches This must be called whenever the locale is changed.
+    caches. This must be called whenever the locale is changed.
 
     """
     efreet_lang_reset()
 
 include "base.pxi"
-#include "desktop.pxi"
-#include "icon.pxi
+include "desktop.pxi"
+include "icon.pxi"
 include "ini.pxi"
-#include "menu.pxi"
-#include "mime.pxi"
-#include "trash.pxi"
-#include "uri.pxi"
+include "menu.pxi"
+include "uri.pxi"
diff --git a/efl/efreet/enums.pxd b/efl/efreet/enums.pxd
new file mode 100644
index 0000000..63b997a
--- /dev/null
+++ b/efl/efreet/enums.pxd
@@ -0,0 +1,25 @@
+cdef extern from "Efreet.h":
+    int EFREET_DESKTOP_TYPE_APPLICATION
+    int EFREET_DESKTOP_TYPE_LINK
+    int EFREET_DESKTOP_TYPE_DIRECTORY
+
+    int EFREET_EVENT_ICON_CACHE_UPDATE
+
+    ctypedef enum Efreet_Menu_Entry_Type:
+        EFREET_MENU_ENTRY_MENU
+        EFREET_MENU_ENTRY_DESKTOP
+        EFREET_MENU_ENTRY_SEPARATOR
+        EFREET_MENU_ENTRY_HEADER
+
+    ctypedef enum Efreet_Icon_Theme_Context:
+        EFREET_ICON_THEME_CONTEXT_NONE
+        EFREET_ICON_THEME_CONTEXT_ACTIONS
+        EFREET_ICON_THEME_CONTEXT_DEVICES
+        EFREET_ICON_THEME_CONTEXT_FILESYSTEMS
+        EFREET_ICON_THEME_CONTEXT_MIMETYPES
+
+    ctypedef enum Efreet_Icon_Size_Type:
+        EFREET_ICON_SIZE_TYPE_NONE
+        EFREET_ICON_SIZE_TYPE_FIXED
+        EFREET_ICON_SIZE_TYPE_SCALABLE
+        EFREET_ICON_SIZE_TYPE_THRESHOLD
diff --git a/efl/efreet/icon.pxi b/efl/efreet/icon.pxi
new file mode 100644
index 0000000..a68433f
--- /dev/null
+++ b/efl/efreet/icon.pxi
@@ -0,0 +1,204 @@
+from efl.eo cimport convert_python_list_strings_to_eina_list, \
+    convert_eina_list_strings_to_python_list
+
+#cdef class IconRectangle(object):
+#    cdef:
+#        icon_rectangle *embedded_text_rectangle
+
+cdef class Icon(object):
+    """
+
+    Retrieves all of the information about the given icon.
+
+    :param theme_name: The icon theme to look for
+    :param icon: The icon to look for
+    :param size: The icon size to look for
+    :return: Returns the Efreet_Icon structure representing this icon or None
+        if the icon is not found
+
+    """
+    cdef:
+        Efreet_Icon       *icon
+
+    def __cinit__(self, theme_name, icon, unsigned int size):
+        self.icon = efreet_icon_find(_cfruni(theme_name), _cfruni(icon), size)
+
+    def __dealloc__(self):
+        efreet_icon_free(self.icon)
+
+    property path:
+        """Full path to the icon"""
+        def __get__(self):
+            return _ctouni(self.icon.path)
+
+    property name:
+        """Translated UTF8 string that can be used for the icon name"""
+        def __get__(self):
+            return _ctouni(self.icon.name)
+
+    property embedded_text_rectangle:
+        """Rectangle where text can be displayed on the icon"""
+        def __get__(self):
+            pass
+            #return self.icon.embedded_text_rectangle
+
+    #property attach_points:
+        #"""List of points to be used as anchor points for emblems/overlays"""
+        #Eina_List *attach_points
+
+    property ref_count:
+        """References to this icon"""
+        def __get__(self):
+            return self.icon.ref_count
+
+    property has_embedded_text_rectangle:
+        """Has the embedded rectangle set"""
+        def __get__(self):
+            return bool(self.icon.has_embedded_text_rectangle)
+
+cdef class IconTheme(object):
+    """theme_find(unicode theme_name) -> IconTheme
+
+    Tries to get the icon theme structure for the given theme name
+
+    :param theme_name: The theme to look for
+    :return: Returns the icon theme related to the given theme name or None if
+        none exists.
+
+    """
+    cdef:
+        Efreet_Icon_Theme *icon_theme
+
+    def __cinit__(self, theme_name):
+        self.icon_theme = efreet_icon_theme_find(_cfruni(theme_name))
+
+    property comment:
+        """String describing the theme"""
+        def __get__(self):
+            return self.icon_theme.comment
+
+    property example_icon:
+        """Icon to use as an example of the theme"""
+        def __get__(self):
+            return self.icon_theme.example_icon
+
+    property paths:
+        """The paths"""
+        def __get__(self):
+            return 
convert_eina_list_strings_to_python_list(self.icon_theme.paths)
+
+    property inherits:
+        """Icon themes we inherit from"""
+        def __get__(self):
+            return# TODO: Eina_List *self.icon_theme.inherits
+
+    property directories:
+        """List of subdirectories for this theme"""
+        def __get__(self):
+            return 
convert_eina_list_strings_to_python_list(self.icon_theme.directories)
+
+def user_dir_get():
+    """user_dir_get() -> unicode
+
+    Returns the user icon directory
+
+    :return: Returns the user icon directory
+
+    """
+    return _ctouni(efreet_icon_user_dir_get())
+
+def deprecated_user_icon_get():
+    """deprecated_user_icon_get() -> unicode
+
+    Returns the deprecated user icon directory
+
+    :return: Returns the deprecated user icon directory
+
+    """
+    return _ctouni(efreet_icon_deprecated_user_dir_get())
+
+def extension_add(ext):
+    """extension_add(unicode ext)
+
+    Adds the given extension to the list of possible icon extensions
+
+    :param ext: The extension to add to the list of checked extensions
+
+    """
+    efreet_icon_extension_add(_cfruni(ext))
+
+def extra_list_get():
+    """extra_list_get() -> list
+
+    Gets the list of all extra directories to look for icons. These
+    directories are used to look for icons after looking in the user icon dir
+    and before looking in standard system directories. The order of search is
+    from first to last directory in this list. the strings in the list should
+    be created with eina_stringshare_add().
+
+    :return: Returns a list of strings that are paths to other icon directories
+
+    """
+    pass
+    #EAPI Eina_List        **efreet_icon_extra_list_get()
+
+def extensions_list_get():
+    """extensions_list_get() -> list
+
+    Gets the list of all icon extensions to look for
+
+    :return: Returns a list of strings that are icon extensions to look for
+
+    """
+    return 
convert_eina_list_strings_to_python_list(efreet_icon_extensions_list_get())
+
+def theme_list_get():
+    """theme_list_get() -> list
+
+    Retrieves all of the non-hidden icon themes available on the system.
+    The returned list must be freed. Do not free the list data.
+
+    :return: Returns a list of Efreet_Icon structs for all the non-hidden icon
+    themes
+
+    """
+    pass
+    #EAPI Eina_List         *efreet_icon_theme_list_get();
+
+def list_find(theme_name, list icons, unsigned int size):
+    """list_find(unicode theme_name, list icons, int size) -> unicode
+
+    Retrieves all of the information about the first found icon in the list.
+
+    There is no guarantee for how long the pointer to the path will be valid.
+    If the pointer is to be kept, the user must create a copy of the path.
+
+    .. note ::
+
+        This function will search the given theme for all icons before falling
+        back. This is useful when searching for mimetype icons.
+
+    :param theme_name: The icon theme to look for
+    :param icons: List of icons to look for
+    :param size:; The icon size to look for
+    :return: Returns the path representing first found icon or
+        None if none of the icons are found
+
+    """
+    return _ctouni(efreet_icon_list_find(_cfruni(theme_name), 
convert_python_list_strings_to_eina_list(icons), size))
+
+def path_find(theme_name, icon, unsigned int size):
+    """path_find(unicode theme_name, unicode icon, int size) -> unicode
+
+    Retrives the path to the given icon.
+
+    There is no guarantee for how long the pointer to the path will be valid.
+    If the pointer is to be kept, the user must create a copy of the path.
+
+    :param theme_name: The icon theme to look for
+    :param icon: The icon to look for
+    :param size:; The icon size to look for
+    :return: Returns the path to the given icon or None if none found
+
+    """
+    return _ctouni(efreet_icon_path_find(_cfruni(theme_name), _cfruni(icon), 
size))
diff --git a/efl/efreet/menu.pxi b/efl/efreet/menu.pxi
new file mode 100644
index 0000000..bf86c17
--- /dev/null
+++ b/efl/efreet/menu.pxi
@@ -0,0 +1,106 @@
+cdef class EfreetMenu(object):
+
+    """Stores information on a entry in the menu"""
+
+    cdef:
+        Efreet_Menu *menu
+
+        Efreet_Menu_Entry_Type type
+        const_char *id   # File-id for desktop and relative name for menu
+
+        const_char *name # Name this entry should show
+        const_char *icon # Icon for this entry
+
+        Efreet_Desktop *desktop   # The desktop we refer too
+        Eina_List      *entries   # The menu items
+
+    def __init__(self, name=None, path=None):
+        # TODO: change two of these into class methods?
+        if name is not None:
+            """
+            Creates a new menu
+
+            :param name: The internal name of the menu
+            :return: Returns the Efreet_Menu on success or NULL on failure
+            """
+            self.menu = efreet_menu_new(_cfruni(name))
+        elif path is not None:
+            """
+            Parses the given .menu file and creates the menu representation
+
+            :param path: The path of the menu to load
+            :return: Returns the Efreet_Menu_Internal representation on success
+                or NULL on failure
+            """
+            self.menu = efreet_menu_parse(_cfruni(path))
+        else:
+            """
+            Creates the default menu representation
+
+            :return: Returns the Efreet_Menu_Internal representation of the
+                default menu or NULL if none found
+            """
+            self.menu = efreet_menu_get()
+
+    def save(self, path):
+        """
+        :param path: The path where the menu should be saved
+        :return: Returns 1 on success, 0 on failure
+        Saves the menu to file
+        """
+        # TODO: Check return status and raise exception if 0
+        return bool(efreet_menu_save(self.menu, _cfruni(path)))
+
+    def free(self):
+        """
+        Frees the given structure
+        """
+        efreet_menu_free(self.menu)
+
+    def desktop_insert(self, EfreetDesktop desktop, int pos):
+        """
+        :param desktop: The desktop to insert
+        :param pos: The position to place the new desktop
+        :return: Returns 1 on success, 0 on failure
+        Insert a desktop element in a menu structure. Only accepts desktop 
files
+        in default directories.
+        """
+        return efreet_menu_desktop_insert(self.menu, desktop.desktop, pos)
+
+    def desktop_remove(self, EfreetDesktop desktop):
+        """
+        :param desktop: The desktop to remove
+        :return: Returns 1 on success, 0 on failure
+        Remove a desktop element in a menu structure. Only accepts desktop 
files
+        in default directories.
+        """
+        return efreet_menu_desktop_remove(self.menu, desktop.desktop)
+
+    def dump(self, indent):
+        """
+        :param indent: The indent level to print the menu at
+        :return: Returns no value
+        Dumps the contents of the menu to the command line
+        """
+        # XXX: indent level?
+        efreet_menu_dump(self.menu, _cfruni(indent))
+
+def menu_kde_legacy_init():
+    """
+    :return: Returns no value
+    Initialize legacy kde support. This function blocks while
+    the kde-config script is run.
+    """
+    # XXX: Returns an int?
+    efreet_menu_kde_legacy_init()
+
+def menu_file_set(file):
+    """
+    Override which file is used for menu creation
+    :param file: The file to use for menu creation
+
+    This file is only used if it exists, else the standard files will be used
+    for the menu.
+    """
+    efreet_menu_file_set(_cfruni(file))
+
diff --git a/efl/efreet/trash.pxd b/efl/efreet/trash.pxd
new file mode 100644
index 0000000..7cc0c4c
--- /dev/null
+++ b/efl/efreet/trash.pxd
@@ -0,0 +1,12 @@
+from libc.string cimport const_char
+from efl.efreet.efreet cimport Efreet_Uri
+from efl cimport Eina_List
+
+cdef extern from "Efreet_Trash.h":
+    int         efreet_trash_init()
+    int         efreet_trash_shutdown()
+    const_char *efreet_trash_dir_get(const_char *for_file)
+    int         efreet_trash_delete_uri(Efreet_Uri *uri, int force_delete)
+    Eina_List  *efreet_trash_ls()
+    int         efreet_trash_is_empty()
+    int         efreet_trash_empty_trash()
diff --git a/efl/efreet/trash.pyx b/efl/efreet/trash.pyx
new file mode 100644
index 0000000..c37fa15
--- /dev/null
+++ b/efl/efreet/trash.pyx
@@ -0,0 +1,83 @@
+"""
+
+Contains the methods used to support the FDO trash specification.
+
+"""
+
+from efl cimport eina_list_free, Eina_Stringshare, eina_stringshare_del
+from efl.eo cimport convert_eina_list_strings_to_python_list
+from efl.eo cimport _ctouni, _cfruni
+from efl.efreet.efreet cimport Uri
+import atexit
+
+efreet_trash_init()
+
+def _shutdown():
+    """Don't call this directly, it will be called when the module is exit."""
+    return bool(efreet_trash_shutdown())
+
+atexit.register(_shutdown)
+
+def dir_get(for_file):
+    """dir_get(unicode for_file) -> unicode
+
+    Retrieves the XDG Trash local directory
+
+    :return: The XDG Trash local directory or None on errors.
+        Return value must be freed with eina_stringshare_del.
+    """
+    cdef const_char *s = efreet_trash_dir_get(_cfruni(for_file))
+    ret = _ctouni(s)
+    eina_stringshare_del(s)
+    return ret
+
+def delete_uri(Uri uri, force_delete):
+    """delete_uri(efl.efreet.EfreetUri uri, bool force_delete) -> bool
+
+    This function try to move the given uri to the trash. Files on different
+    filesystem can't be moved to trash. If force_delete is False than
+    non-local files will be ignored and -1 is returned, if you set
+    force_delete to True non-local files will be deleted without asking.
+
+    :param uri: The local uri to move in the trash
+    :param force_delete: If you set this to True than files on different
+        filesystems will be deleted permanently
+    :return: 1 on success, 0 on failure or -1 in case the uri is
+        not on the same filesystem and force_delete is not set.
+
+    """
+    return int(efreet_trash_delete_uri(uri.uri, force_delete))
+
+def ls():
+    """ls() -> list
+
+    List all the files and directory currently inside the trash.
+
+    :return: A list of strings with filename (remember to free the list
+    when you don't need anymore).
+
+    """
+    cdef Eina_List *lst = efreet_trash_ls()
+    ret = convert_eina_list_strings_to_python_list(lst)
+    eina_list_free(lst)
+    return ret
+
+def is_empty():
+    """is_empty() -> bool
+
+    Check if the trash is currently empty
+
+    :return: True if the trash is empty or False if some file are in.
+
+    """
+    return bool(efreet_trash_is_empty())
+
+def empty_trash():
+    """empty_trash() -> bool
+
+    Delete all the files inside the trash.
+
+    :return: True on success or False on failure.
+
+    """
+    return bool(efreet_trash_empty_trash())
diff --git a/efl/efreet/uri.pxi b/efl/efreet/uri.pxi
new file mode 100644
index 0000000..1fc46f4
--- /dev/null
+++ b/efl/efreet/uri.pxi
@@ -0,0 +1,91 @@
+from libc.stdlib cimport malloc, free
+from libc.string cimport strdup
+from efl cimport eina_list_free
+
+cdef class Uri(object):
+    """
+
+    Contains the methods used to support the FDO URI specification.
+
+    """
+
+    def __cinit__(self):
+        self.uri = <Efreet_Uri *>malloc(3 * sizeof(const_char *))
+        self.uri.protocol = NULL
+        self.uri.hostname = NULL
+        self.uri.path = NULL
+
+    def __init__(self, protocol = None, hostname = None, path = None):
+        if protocol is not None:
+            self.protocol = protocol
+        if hostname is not None:
+            self.hostname = hostname
+        if path is not None:
+            self.path = path
+
+    def __dealloc__(self):
+        efreet_uri_free(self.uri)
+
+    @classmethod
+    def decode(cls, val):
+        """decode(unicode val)
+
+        Read a single uri and return an EfreetUri. If there's no
+        hostname in the uri then the hostname parameter will be None. All
+        the uri escaped chars will be converted to normal.
+
+        """
+        cdef Uri ret
+        ret = cls.__new__(cls)
+        ret.uri = efreet_uri_decode(_cfruni(val))
+        return ret
+
+    def encode(self):
+        """encode() -> unicode
+
+        Get the string representation of the given uri struct escaping
+        illegal characters.
+
+        .. note::
+
+            The resulting string will contain the protocol and the path but not
+            the hostname, as many apps can't handle it.
+
+        :param uri: Create an URI string from an Efreet_Uri struct
+        :return: The string representation of uri ``(ex: 
'file:///home/my%20name')``
+
+        """
+        cdef const_char *s = efreet_uri_encode(self.uri)
+        ret = _ctouni(s)
+        eina_stringshare_del(s)
+        return ret
+
+    property protocol:
+        """The protocol used (usually 'file')"""
+        def __set__(self, value):
+            if self.uri.protocol != NULL:
+                eina_stringshare_del(self.uri.protocol)
+            self.uri.protocol = eina_stringshare_add(_cfruni(value))
+
+        def __get__(self):
+            return _ctouni(self.uri.protocol)
+
+    property hostname:
+        """The name of the host, if any"""
+        def __set__(self, value):
+            if self.uri.hostname != NULL:
+                eina_stringshare_del(self.uri.hostname)
+            self.uri.hostname = eina_stringshare_add(_cfruni(value))
+
+        def __get__(self):
+            return _ctouni(self.uri.hostname)
+
+    property path:
+        """The full file path without protocol nor host"""
+        def __set__(self, value):
+            if self.uri.path != NULL:
+                eina_stringshare_del(self.uri.path)
+            self.uri.path = eina_stringshare_add(_cfruni(value))
+
+        def __get__(self):
+            return _ctouni(self.uri.path)
diff --git a/setup.py b/setup.py
index cb07a64..5b741b9 100755
--- a/setup.py
+++ b/setup.py
@@ -86,11 +86,16 @@ else:
 
     # Efreet
     efreet_cflags, efreet_libs = pkg_config('Efreet', 'efreet', "1.7.99")
-    efreet_ext = Extension("efl.efreet", ["efl/efreet/efreet.pyx"],
-                            include_dirs = ['include/'],
-                            extra_compile_args = efreet_cflags,
-                            extra_link_args = efreet_libs + eina_libs)
-    modules.append(efreet_ext)
+    efreet_trash_cflags, efreet_trash_libs = pkg_config('EfreetTrash', 
'efreet-trash', "1.7.99")
+    efreet_exts = [
+        Extension("efl.efreet.efreet", ["efl/efreet/efreet.pyx"]),
+        Extension("efl.efreet.trash", ["efl/efreet/trash.pyx"], 
extra_link_args = efreet_trash_libs),
+    ]
+    for ext in efreet_exts:
+        ext.include_dirs = ['include/']
+        ext.extra_compile_args += efreet_cflags + eina_cflags
+        ext.extra_link_args += efreet_libs + eina_libs
+    modules += efreet_exts
 
     # Ecore
     ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', "1.7.99")
@@ -218,7 +223,7 @@ if __name__ == "__main__":
         url = "http://www.enlightenment.org";,
         description = "Python bindings for the EFL stack",
         license = "GNU Lesser General Public License (LGPL)",
-        packages = ["efl", "efl.elementary"],
+        packages = ["efl", "efl.elementary", "efl.efreet"],
         cmdclass = {'build_ext': build_ext, 'build_sphinx': BuildDoc, 
'build_doc': BuildDoc},
         command_options = {
             "build_doc": {
diff --git a/tests/efreet/test_trash.py b/tests/efreet/test_trash.py
new file mode 100644
index 0000000..1f1c395
--- /dev/null
+++ b/tests/efreet/test_trash.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python2
+
+import os
+from efl.efreet.efreet import Uri
+from efl.efreet import trash
+import unittest
+
+class TestEfreetTrash(unittest.TestCase):
+
+    def setUp(self):
+        protocol = "file"
+        hostname = "localhost"
+        f = self.f = "efreet_trash_test"
+        path = self.path = os.path.join("/tmp", f)
+        self.u = Uri(protocol, hostname, path)
+        open(path, "w").close()
+
+    def test_dir_get(self):
+        self.assertIsNotNone(trash.dir_get(self.path))
+
+    def test_delete_uri(self):
+        self.assertTrue(trash.delete_uri(self.u, True))
+
+    def test_ls(self):
+        trash.empty_trash()
+        trash.delete_uri(self.u, True)
+        self.assertEqual(trash.ls()[0], self.f)
+
+    def test_is_empty(self):
+        trash.empty_trash()
+        self.assertTrue(trash.is_empty())
+        trash.delete_uri(self.u, True)
+        self.assertFalse(trash.is_empty())
+        trash.empty_trash()
+
+    def test_empty_trash(self):
+        trash.delete_uri(self.u, True)
+        self.assertTrue(trash.empty_trash())
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/tests/efreet/test_uri.py b/tests/efreet/test_uri.py
new file mode 100644
index 0000000..81831de
--- /dev/null
+++ b/tests/efreet/test_uri.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python2
+
+from efl.efreet.efreet import Uri
+import unittest
+
+class TestEfreetUri(unittest.TestCase):
+
+    def setUp(self):
+        self.protocol = "file"
+        self.hostname = "localhost"
+        self.path = "/home/test"
+        self.uri = self.protocol + "://" + self.hostname + self.path
+
+    def test_default_constructor(self):
+        u = Uri(self.protocol, self.hostname, self.path)
+        self.assertEqual(u.protocol + "://" + u.hostname + u.path, self.uri)
+
+    def test_decode_constructor(self):
+        u = Uri.decode(self.protocol + "://" + self.hostname + self.path)
+        self.assertEqual(u.protocol + "://" + u.hostname + u.path, self.uri)
+
+    def test_encode(self):
+        u = Uri(self.protocol, self.hostname, self.path)
+        self.assertEqual(u.encode(), self.protocol + "://" + self.path)
+
+    def test_protocol(self):
+        u = Uri(self.protocol, self.hostname, self.path)
+        self.assertEqual(u.protocol, self.protocol)
+        u.protocol = self.protocol
+        self.assertEqual(u.protocol, self.protocol)
+
+    def test_hostname(self):
+        u = Uri(self.protocol, self.hostname, self.path)
+        self.assertEqual(u.hostname, self.hostname)
+        u.hostname = self.hostname
+        self.assertEqual(u.hostname, self.hostname)
+
+    def test_path(self):
+        u = Uri(self.protocol, self.hostname, self.path)
+        self.assertEqual(u.path, self.path)
+        u.path = self.path
+        self.assertEqual(u.path, self.path)
+
+if __name__ == "__main__":
+    unittest.main()

-- 

------------------------------------------------------------------------------
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