diff --git a/efl/efreet/__init__.py b/efl/efreet/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/efl/efreet/base.pxi b/efl/efreet/base.pxi deleted file mode 100644 index 7824dcd..0000000 --- a/efl/efreet/base.pxi +++ /dev/null @@ -1,225 +0,0 @@ -from efl.eo cimport _ctouni, convert_eina_list_strings_to_python_list - -def data_home_get(): - """ - - Retrieves the XDG Data Home directory - :return: Returns the XDG Data Home directory - - """ - return _ctouni(efreet_data_home_get()) - -def data_dirs_get(): - """ - - Returns the Eina_List of preference ordered extra data directories - :return: Returns the Eina_List of preference ordered extra data directories - - .. note:: The returned list is static inside Efreet. If you add/remove from the - list then the next call to efreet_data_dirs_get() will return your - modified values. DO NOT free this list. - - """ - return convert_eina_list_strings_to_python_list(efreet_data_dirs_get()) - -def config_home_get(): - """ - - Retrieves the XDG Config Home directory - :return: Returns the XDG Config Home directory - - """ - return _ctouni(efreet_config_home_get()) - -def desktop_dir_get(): - """ - - Retrieves the XDG Desktop directory - :return: Returns the XDG Desktop directory - - """ - return _ctouni(efreet_desktop_dir_get()) - -def download_dir_get(): - """ - - Retrieves the XDG Download directory - - This is where user-specific download files should be located. It's - localized (translated) to current user locale - (~/.config/user-dirs.locale and ~/.config/user-dirs.dirs). - - It's meant for large download or in-progress downloads, it's - private for the user but may be shared among different - machines. It's not automatically cleaned up. - - @see efreet_cache_home_get() - @see efreet_runtime_dir_get() - @see http://0pointer.de/blog/projects/tmp.html - - @return Returns the XDG Download directory - - """ - return _ctouni(efreet_download_dir_get()) - -def templates_dir_get(): - """ - - Retrieves the XDG Templates directory - - This is where user-specific template files should be located. It's - localized (translated) to current user locale - (~/.config/user-dirs.locale and ~/.config/user-dirs.dirs). - - @return Returns the XDG Templates directory - - """ - return _ctouni(efreet_templates_dir_get()) - -def public_share_dir_get(): - """ - - Retrieves the XDG Public Share directory - - This is where user-specific public shareable files should be - located. It's localized (translated) to current user locale - (~/.config/user-dirs.locale and ~/.config/user-dirs.dirs). - - Usually local file servers should look here (Apache, Samba, FTP). - - @return Returns the XDG Public Share directory - - """ - return _ctouni(efreet_public_share_dir_get()) - -def documents_dir_get(): - """ - - @return Returns the XDG Documents directory - @brief Retrieves the XDG Documents directory - - This is where user-specific documents files should be located. It's - localized (translated) to current user locale - (~/.config/user-dirs.locale and ~/.config/user-dirs.dirs). - - """ - return _ctouni(efreet_documents_dir_get()) - -def music_dir_get(): - """ - - @return Returns the XDG Music directory - @brief Retrieves the XDG Music directory - - This is where user-specific music files should be located. It's - localized (translated) to current user locale - (~/.config/user-dirs.locale and ~/.config/user-dirs.dirs). - - """ - return _ctouni(efreet_music_dir_get()) - -def pictures_dir_get(): - """ - - @return Returns the XDG Pictures directory - @brief Retrieves the XDG Pictures directory - - This is where user-specific pictures files should be located. It's - localized (translated) to current user locale - (~/.config/user-dirs.locale and ~/.config/user-dirs.dirs). - - """ - return _ctouni(efreet_pictures_dir_get()) - -def videos_dir_get(): - """ - - @return Returns the XDG Videos directory - @brief Retrieves the XDG Videos directory - - This is where user-specific video files should be located. It's - localized (translated) to current user locale - (~/.config/user-dirs.locale and ~/.config/user-dirs.dirs). - - """ - return _ctouni(efreet_videos_dir_get()) - -def config_dirs_get(): - """ - - Returns the Eina_List of preference ordered extra config - directories - :return: Returns the Eina_List of preference ordered extra config directories - - .. note:: The returned list is static inside Efreet. If you add/remove from the - list then the next call to efreet_config_dirs_get() will return your - modified values. DO NOT free this list. - - """ - return convert_eina_list_strings_to_python_list(efreet_config_dirs_get()) - -def cache_home_get(): - """ - - Retrieves the XDG Cache Home directory - :return: Returns the XDG Cache Home directory - - """ - return _ctouni(efreet_cache_home_get()) - -def runtime_dir_get(): - """ - - @return Returns the XDG User Runtime directory. - @brief Retrieves the XDG User Runtime directory. - - This is the base directory relative to which user-specific - non-essential runtime files and other file objects (such as - sockets, named pipes, ...) should be stored. The directory @b must - be owned by the user, and he @b must be the only one having read - and write access to it. Its Unix access mode @b must be 0700. - - The lifetime of this directory @b must be bound to the user being - logged in. It @b must be created when the user first logs in and if - the user fully logs out the directory @b must be removed. If the - user logs in more than once he should get pointed to the same - directory, and it is mandatory that the directory continues to - exist from his first login to his last logout on the system, and - not removed in between. Files in the directory @b must not survive - reboot or a full logout/login cycle. - - The directory @b must be on a local file system and not shared with - any other system. The directory @b must by fully-featured by the - standards of the operating system. More specifically, on Unix-like - operating systems AF_UNIX sockets, symbolic links, hard links, - proper permissions, file locking, sparse files, memory mapping, - file change notifications, a reliable hard link count must be - supported, and no restrictions on the file name character set - should be imposed. Files in this directory @b may be subjected to - periodic clean-up. To ensure that your files are not removed, they - should have their access time timestamp modified at least once - every 6 hours of monotonic time or the 'sticky' bit should be set - on the file. - - If @c NULL applications should fall back to a replacement directory - with similar capabilities and print a warning message. Applications - should use this directory for communication and synchronization - purposes and should not place larger files in it, since it might - reside in runtime memory and cannot necessarily be swapped out to - disk. - - @note this directory is similar to @c /run and is often created in - tmpfs (memory-only/RAM filesystem). It is created, managed and - cleaned automatically by systemd. - - """ - return _ctouni(efreet_runtime_dir_get()) - -def hostname_get(): - """ - - Returns the current hostname or empty string if not found - :return: Returns the current hostname - - """ - return _ctouni(efreet_hostname_get()) diff --git a/efl/efreet/desktop.pxi b/efl/efreet/desktop.pxi deleted file mode 100644 index e126001..0000000 --- a/efl/efreet/desktop.pxi +++ /dev/null @@ -1,387 +0,0 @@ -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 - - """ - 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 deleted file mode 100644 index e855e74..0000000 --- a/efl/efreet/efreet.pxd +++ /dev/null @@ -1,230 +0,0 @@ -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_Hash - -cdef extern from "Efreet.h": - ctypedef struct Efreet_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 "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 # 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 - - #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) - ctypedef void (*Efreet_Desktop_Type_Save_Cb) (Efreet_Desktop *desktop, Efreet_Ini *ini) - ctypedef void *(*Efreet_Desktop_Type_Free_Cb) (void *data) - - # Functions - int efreet_init() - int efreet_shutdown() - void efreet_lang_reset() - - # Base - const_char * efreet_data_home_get() - Eina_List * efreet_data_dirs_get() - const_char * efreet_config_home_get() - const_char * efreet_desktop_dir_get() - const_char * efreet_download_dir_get() - const_char * efreet_templates_dir_get() - const_char * efreet_public_share_dir_get() - const_char * efreet_documents_dir_get() - const_char * efreet_music_dir_get() - const_char * efreet_pictures_dir_get() - const_char * efreet_videos_dir_get() - Eina_List * efreet_config_dirs_get() - const_char * efreet_cache_home_get() - const_char * efreet_runtime_dir_get() - 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) - #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) - void efreet_ini_free(Efreet_Ini *ini) - int efreet_ini_save(Efreet_Ini *ini, const_char *path) - int efreet_ini_section_set(Efreet_Ini *ini, const_char *section) - void efreet_ini_section_add(Efreet_Ini *ini, const_char *section) - const_char * efreet_ini_string_get(Efreet_Ini *ini, const_char *key) - void efreet_ini_string_set(Efreet_Ini *ini, const_char *key, const_char *value) - const_char * efreet_ini_localestring_get(Efreet_Ini *ini, const_char *key) - void efreet_ini_localestring_set(Efreet_Ini *ini, const_char *key, const_char *value) - unsigned int efreet_ini_boolean_get(Efreet_Ini *ini, const_char *key) - void efreet_ini_boolean_set(Efreet_Ini *ini, const_char *key, unsigned int value) - int efreet_ini_int_get(Efreet_Ini *ini, const_char *key) - void efreet_ini_int_set(Efreet_Ini *ini, const_char *key, int value) - double efreet_ini_double_get(Efreet_Ini *ini, const_char *key) - void efreet_ini_double_set(Efreet_Ini *ini, const_char *key, double value) - void efreet_ini_key_unset(Efreet_Ini *ini, const_char *key) - - # Menu - 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 deleted file mode 100644 index 3cb9c62..0000000 --- a/efl/efreet/efreet.pyx +++ /dev/null @@ -1,45 +0,0 @@ - -""" - -The Efreet Library - -.. rubric:: Introduction - -Efreet is a library designed to help apps work several of the -Freedesktop.org standards regarding Icons, Desktop files and Menus. To -that end it implements the following specifications: - - - XDG Base Directory Specification - - Icon Theme Specification - - Desktop Entry Specification - - Desktop Menu Specification - - FDO URI Specification - - Shared Mime Info Specification - - Trash Specification - -""" - -import atexit - -efreet_init() - -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. - - """ - efreet_lang_reset() - -include "base.pxi" -include "desktop.pxi" -include "icon.pxi" -include "ini.pxi" -include "menu.pxi" -include "uri.pxi" diff --git a/efl/efreet/enums.pxd b/efl/efreet/enums.pxd deleted file mode 100644 index 63b997a..0000000 --- a/efl/efreet/enums.pxd +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index a68433f..0000000 --- a/efl/efreet/icon.pxi +++ /dev/null @@ -1,204 +0,0 @@ -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/ini.pxi b/efl/efreet/ini.pxi deleted file mode 100644 index 5e20640..0000000 --- a/efl/efreet/ini.pxi +++ /dev/null @@ -1,192 +0,0 @@ -from efl.eo cimport _cfruni, _ctouni - -cdef class Ini(object): - - """ - - Contains all the information about an ini file. - - """ - - cdef Efreet_Ini *ini - #cdef Eina_Hash *data # Hash of string => (Hash of string => string) - #cdef Eina_Hash *section # currently selected section - - def __cinit__(self, file): - """ - :param file: The file to parse - :return: Returns a new Efreet_Ini structure initialized with the contents - of @a file, or NULL on memory allocation failure - Creates and initializes a new Ini structure with the contents of - @a file, or NULL on failure - - """ - self.ini = efreet_ini_new(_cfruni(file)) - - def __dealloc__(self): - if self.ini is not NULL: - efreet_ini_free(self.ini) - - def save(self, path): - """save(unicode path) -> bool - - Saves the given Efree_Ini structure. - - :param path: The path to save the ini to - :type path: unicode - :return: Whether save succeeded - :rtype: bool - - """ - return bool(efreet_ini_save(self.ini, _cfruni(path))) - - #TODO: property data: - - property section: - """ - - :param section: The section of the ini file we want to get values from - :return: Returns 1 if the section exists, otherwise 0 - Sets the current working section of the ini file to @a section - - """ - #TODO: def __get__(self): - - def __set__(self, section): - ret = efreet_ini_section_set(self.ini, _cfruni(section)) - if ret is 0: - raise RuntimeError("Setting Ini section failed") - - def section_add(self, section): - """section_add(unicode section) - - Adds a new working section of the ini file to section - - :param section: The section of the ini file we want to add - - """ - efreet_ini_section_add(self.ini, _cfruni(section)) - - def string_get(self, key): - """string_get(unicode key) -> unicode - - Retrieves the value for the given key or NULL if none found. - - :param key: The key to lookup - :return: Returns the string associated with the given key or NULL if not - found. - - """ - return _ctouni(efreet_ini_string_get(self.ini, _cfruni(key))) - - def string_set(self, key, value): - """string_set(unicode key, unicode value) - - Sets the value for the given key - - :param key: The key to use - :param value: The value to set - - """ - efreet_ini_string_set(self.ini, _cfruni(key), _cfruni(value)) - - def localestring_get(self, key): - """localestring_get(unicode key) -> unicode - - Retrieves the utf8 encoded string associated with key in the current locale or None if none found - - :param key: The key to search for - :return: Returns the utf8 encoded string associated with key, or None - if none found - - """ - _ctouni(efreet_ini_localestring_get(self.ini, _cfruni(key))) - - def localestring_set(self, key, value): - """localestring_set(unicode key, unicode value) - - Sets the value for the given key - - :param key: The key to use - :param value: The value to set - - """ - efreet_ini_localestring_set(self.ini, _cfruni(key), _cfruni(value)) - - def boolean_get(self, key): - """boolean_get(unicode key) -> bool - - Retrieves the boolean value at key @a key from the ini @a ini - - :param key: The key to search for - :return: Returns 1 if the boolean is true, 0 otherwise - - """ - return bool(efreet_ini_boolean_get(self.ini, _cfruni(key))) - - def boolean_set(self, key, int value): - """boolean_set(unicode key, bool value) - - Sets the value for the given key - - :param key: The key to use - :param value: The value to set - - """ - efreet_ini_boolean_set(self.ini, _cfruni(key), value) - - def int_get(self, key): - """int_get(unicode key) -> int - - Retrieves the value for the given key or -1 if none found. - - :param key: The key to lookup - :return: Returns the integer associated with the given key or -1 if not - found. - - """ - return efreet_ini_int_get(self.ini, _cfruni(key)) - - def int_set(self, key, int value): - """int_set(unicode key, int value) - - Sets the value for the given key - - :param key: The key to use - :param value: The value to set - - """ - efreet_ini_int_set(self.ini, _cfruni(key), value) - - def double_get(self, key): - """double_get(unicode key) -> double - - Retrieves the value for the given key or -1 if none found. - - :param key: The key to lookup - :return: Returns the double associated with the given key or -1 if not - found. - - """ - return efreet_ini_double_get(self.ini, _cfruni(key)) - - def double_set(self, key, double value): - """double_set(unicode key, double value) - - Sets the value for the given key - - :param key: The key to use - :param value: The value to set - - """ - efreet_ini_double_set(self.ini, _cfruni(key), value) - - def key_unset(self, key): - """key_unset(unicode key) - - Remove the given key from the ini struct - - :param key: The key to remove - - """ - efreet_ini_key_unset(self.ini, _cfruni(key)) diff --git a/efl/efreet/menu.pxi b/efl/efreet/menu.pxi deleted file mode 100644 index bf86c17..0000000 --- a/efl/efreet/menu.pxi +++ /dev/null @@ -1,106 +0,0 @@ -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 deleted file mode 100644 index 7cc0c4c..0000000 --- a/efl/efreet/trash.pxd +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index c37fa15..0000000 --- a/efl/efreet/trash.pyx +++ /dev/null @@ -1,83 +0,0 @@ -""" - -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 deleted file mode 100644 index 1fc46f4..0000000 --- a/efl/efreet/uri.pxi +++ /dev/null @@ -1,91 +0,0 @@ -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 = 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 8731198..bfe54ca 100755 --- a/setup.py +++ b/setup.py @@ -86,19 +86,6 @@ else: extra_link_args = evas_libs + eina_libs) modules.append(evas_ext) - # Efreet - efreet_cflags, efreet_libs = pkg_config('Efreet', 'efreet', "1.7.99") - 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") efile_cflags, efile_libs = pkg_config('EcoreFile', 'ecore-file', "1.7.99") diff --git a/tests/efreet/test_trash.py b/tests/efreet/test_trash.py deleted file mode 100644 index 1f1c395..0000000 --- a/tests/efreet/test_trash.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/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 deleted file mode 100644 index 81831de..0000000 --- a/tests/efreet/test_uri.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/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()