From 4a5ee4c108b2c84e0a8ef73ae9088164b6d5ff63 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Fri, 29 Mar 2013 20:36:25 +0900 Subject: [PATCH] ecore clean up. Removed unnecessary files. How this files are committed? --- .cvsignore | 31 - COPYING-PLAIN | 33 - Doxyfile | 139 -- README.in | 49 - configure.in | 964 ------------- debian/.cvsignore | 12 - debian/changelog.in | 5 - debian/libecore-con0.install | 1 - debian/libecore-config0.install | 1 - debian/libecore-evas0.install | 1 - debian/libecore-fb0.install | 1 - debian/libecore-file0.install | 1 - debian/libecore-imf-evas0.install | 1 - debian/libecore-imf0.install | 1 - debian/libecore-ipc0.install | 1 - debian/libecore-job0.install | 1 - debian/libecore-txt0.install | 1 - debian/libecore-x0.install | 1 - debian/libecore0.install | 1 - doc/.cvsignore | 3 - doc/ecore.css | 178 --- ecore-dbus.pc.in | 11 - ecore-desktop.pc.in | 11 - ecore-job.pc.in | 11 - ecore-txt.pc.in | 11 - ecore.c.in | 378 ----- gendoc | 10 - src/.cvsignore | 2 - src/bin/.cvsignore | 10 - src/lib/.cvsignore | 2 - src/lib/ecore_desktop/.cvsignore | 6 - src/lib/ecore_desktop/Ecore_Desktop.h | 281 ---- src/lib/ecore_desktop/Makefile.am | 46 - src/lib/ecore_desktop/ecore_desktop.c | 1195 ---------------- src/lib/ecore_desktop/ecore_desktop_icon.c | 714 ---------- src/lib/ecore_desktop/ecore_desktop_menu.c | 1844 ------------------------- src/lib/ecore_desktop/ecore_desktop_paths.c | 1041 -------------- src/lib/ecore_desktop/ecore_desktop_private.h | 40 - src/lib/ecore_desktop/ecore_desktop_tree.c | 362 ----- src/lib/ecore_desktop/ecore_desktop_xmlame.c | 132 -- src/lib/ecore_job/.cvsignore | 6 - src/lib/ecore_job/Ecore_Job.h | 56 - src/lib/ecore_job/Makefile.am | 32 - src/lib/ecore_job/ecore_job.c | 115 -- src/lib/ecore_job/ecore_job_private.h | 16 - src/lib/ecore_txt/.cvsignore | 6 - src/lib/ecore_txt/Ecore_Txt.h | 49 - src/lib/ecore_txt/Makefile.am | 31 - src/lib/ecore_txt/ecore_txt.c | 85 -- src/lib/ecore_txt/ecore_txt_private.h | 4 - 50 files changed, 7933 deletions(-) delete mode 100644 .cvsignore delete mode 100644 COPYING-PLAIN delete mode 100644 Doxyfile delete mode 100644 README.in delete mode 100644 configure.in delete mode 100644 debian/.cvsignore delete mode 100644 debian/changelog.in delete mode 100644 debian/libecore-con0.install delete mode 100644 debian/libecore-config0.install delete mode 100644 debian/libecore-evas0.install delete mode 100644 debian/libecore-fb0.install delete mode 100644 debian/libecore-file0.install delete mode 100644 debian/libecore-imf-evas0.install delete mode 100644 debian/libecore-imf0.install delete mode 100644 debian/libecore-ipc0.install delete mode 100644 debian/libecore-job0.install delete mode 100644 debian/libecore-txt0.install delete mode 100644 debian/libecore-x0.install delete mode 100644 debian/libecore0.install delete mode 100644 doc/.cvsignore delete mode 100644 doc/ecore.css delete mode 100644 ecore-dbus.pc.in delete mode 100644 ecore-desktop.pc.in delete mode 100644 ecore-job.pc.in delete mode 100644 ecore-txt.pc.in delete mode 100644 ecore.c.in delete mode 100755 gendoc delete mode 100644 src/.cvsignore delete mode 100644 src/bin/.cvsignore delete mode 100644 src/lib/.cvsignore delete mode 100644 src/lib/ecore_desktop/.cvsignore delete mode 100644 src/lib/ecore_desktop/Ecore_Desktop.h delete mode 100644 src/lib/ecore_desktop/Makefile.am delete mode 100644 src/lib/ecore_desktop/ecore_desktop.c delete mode 100644 src/lib/ecore_desktop/ecore_desktop_icon.c delete mode 100644 src/lib/ecore_desktop/ecore_desktop_menu.c delete mode 100644 src/lib/ecore_desktop/ecore_desktop_paths.c delete mode 100644 src/lib/ecore_desktop/ecore_desktop_private.h delete mode 100644 src/lib/ecore_desktop/ecore_desktop_tree.c delete mode 100644 src/lib/ecore_desktop/ecore_desktop_xmlame.c delete mode 100644 src/lib/ecore_job/.cvsignore delete mode 100644 src/lib/ecore_job/Ecore_Job.h delete mode 100644 src/lib/ecore_job/Makefile.am delete mode 100644 src/lib/ecore_job/ecore_job.c delete mode 100644 src/lib/ecore_job/ecore_job_private.h delete mode 100644 src/lib/ecore_txt/.cvsignore delete mode 100644 src/lib/ecore_txt/Ecore_Txt.h delete mode 100644 src/lib/ecore_txt/Makefile.am delete mode 100644 src/lib/ecore_txt/ecore_txt.c delete mode 100644 src/lib/ecore_txt/ecore_txt_private.h diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 1c7016b..0000000 --- a/.cvsignore +++ /dev/null @@ -1,31 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -build-stamp -compile -config.guess -config.h -config.h.in -config.log -config.status -config.sub -configure -configure-stamp -depcomp -ecore-config -install-sh -libtool -ltmain.sh -missing -mkinstalldirs -stamp-h -stamp-h.in -autom4te.cache -stamp-h1 -doc -*.tar.gz -README -*.oe -*.bb -*.spec -*.pc diff --git a/COPYING-PLAIN b/COPYING-PLAIN deleted file mode 100644 index 376875e..0000000 --- a/COPYING-PLAIN +++ /dev/null @@ -1,33 +0,0 @@ -Plain English Copyright Notice - -This file is not intended to be the actual License. The reason this file -exists is that we here are programmers and engineers. We aren't lawyers. We -provide licenses that we THINK say the right things, but we have our own -intentions at heart. This is a plain-english explanation of what those -intentions are, and if you follow them you will be within the "spirit" of -the license. - -The intent is for us to enjoy writing software that is useful to us (the -AUTHORS) and allow others to use it freely and also benefit from the work we -put into making it. We don't want to restrict others using it. They should -not *HAVE* to make the source code of the applications they write that -simply link to these libraries (be that statically or dynamically), or for -them to be limited as to what license they choose to use (be it open, closed -or anything else). But we would like to know you are using these libraries. -We simply would like to know that it has been useful to someone. This is why -we ask for acknowledgement of some sort. - -You can do what you want with the source of this software - it doesn't -matter. We still have it here for ourselves and it is open and free to use -and download and play with. It can't be taken away. We don't really mind what -you do with the source to your software. We would simply like to know that -you are using it - especially if it makes it to a commerical product. If you -simply e-mail all the AUTHORS (see COPYING and AUTHORS files) telling us, and -then make sure you include a paragraph or page in the manual for the product -with the copyright notice and state that you used this software, we will be -very happy. If you want to contribute back modifications and fixes you may have -made we will welcome those too with open arms (generally). If you want help -with changes needed, ports needed or features to be added, arrangements can -be easily made with some dialogue. - -Carsten Haitzler diff --git a/Doxyfile b/Doxyfile deleted file mode 100644 index d764190..0000000 --- a/Doxyfile +++ /dev/null @@ -1,139 +0,0 @@ -PROJECT_NAME = Ecore -PROJECT_NUMBER = -OUTPUT_DIRECTORY = doc -INPUT = ecore.c.in ./src/lib -IMAGE_PATH = doc/img -OUTPUT_LANGUAGE = English -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = doc/head.html -HTML_FOOTER = doc/foot.html -HTML_STYLESHEET = doc/e.css -HTML_ALIGN_MEMBERS = YES -ENUM_VALUES_PER_LINE = 1 -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = YES -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = NO -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES -HIDE_FRIEND_COMPOUNDS = YES -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = NO -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = NO -SHOW_INCLUDE_FILES = NO -JAVADOC_AUTOBRIEF = YES -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 2 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ALIASES = -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -SHOW_USED_FILES = NO -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -FILE_PATTERNS = -RECURSIVE = YES -EXCLUDE = ./src/lib/ecore_desktop -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = ./examples/ -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 2 -IGNORE_PREFIX = -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -GENERATE_LATEX = YES -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -GENERATE_MAN = YES -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = YES -GENERATE_XML = NO -XML_SCHEMA = -XML_DTD = -GENERATE_AUTOGEN_DEF = NO -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = NO -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -CLASS_DIAGRAMS = NO -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -CLASS_GRAPH = NO -COLLABORATION_GRAPH = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = NO -INCLUDED_BY_GRAPH = NO -GRAPHICAL_HIERARCHY = NO -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 512 -MAX_DOT_GRAPH_HEIGHT = 512 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -SEARCHENGINE = NO diff --git a/README.in b/README.in deleted file mode 100644 index 2567738..0000000 --- a/README.in +++ /dev/null @@ -1,49 +0,0 @@ -Ecore @VERSION@ - -Requirements: -------------- - -Must: - libc libm - -Recommended: - libX11 libXext libXcursor libXprint libXinerama libXrandr libXss libXrender - libXcomposite libXfixes libXdamage libXdpms libXtest OpenSSL CURL - -Optional: - XCB SDL DirectFB - -Ecore is the event/X abstraction layer that makes doing selections, -Xdnd, general X stuff, event loops, timeouts and idle handlers fast, -optimized, and convenient. It's a separate library so anyone can make -use of the work put into Ecore to make this job easy for applications. - ------------------------------------------------------------------------------- -COMPILING AND INSTALLING: - - ./configure - make -(as root unless youa re installing in your users directories): - make install - ------------------------------------------------------------------------------- -BUILDING PACKAGES: - -RPM: To build rpm packages: - - sudo rpm -ta @PACKAGE@-@VERSION@.tar.gz - -You will find rpm packages in your system /usr/src/redhat/* dirs (note you may -not need to use sudo or root if you have your own ~/.rpmrc. see rpm documents -for more details) - -DEB: To build deb packages: - - tar zvf @PACKAGE@-@VERSION@.tar.gz - cd @PACKAGE@-@VERSION@ - dpkg-buildpackage -us -uc -rfakeroot - cd .. - rm -rf @PACKAGE@-@VERSION@ - -You will find all the debian source, binary etc. packages put in the directory -where you first untarred the source tarball. diff --git a/configure.in b/configure.in deleted file mode 100644 index d494ef6..0000000 --- a/configure.in +++ /dev/null @@ -1,964 +0,0 @@ -# get rid of that stupid cache mechanism -rm -f config.cache - -AC_INIT(ecore, 0.9.9.043, enlightenment-devel@lists.sourceforge.net) -AC_PREREQ(2.52) -AC_CONFIG_SRCDIR(configure.in) -AC_CANONICAL_BUILD -AC_CANONICAL_HOST -AC_ISC_POSIX - -AM_INIT_AUTOMAKE(1.6 dist-bzip2) -AM_CONFIG_HEADER(config.h) - -AC_PROG_CXX -AC_C_BIGENDIAN -AC_PROG_CC -AM_PROG_CC_STDC -AC_HEADER_STDC -AC_C_CONST -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_C___ATTRIBUTE__ -AC_HEADER_SYS_WAIT - -AC_LIBTOOL_WIN32_DLL -define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl -AC_PROG_LIBTOOL -AC_DEFINE_UNQUOTED(SHARED_LIB_SUFFIX, "$shrext_cmds", [Suffix for shared objects]) - -VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'` -VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'` -VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'` -SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'` -version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN" -AC_SUBST(version_info) - -# define pkg-config requirements for all our submodules. -# only the trivial requirements go here. -requirements_ecore_con="" -requirements_ecore_config="" -requirements_ecore_desktop="" -requirements_ecore_directfb="" -requirements_ecore_evas="evas" -requirements_ecore_fb="" -requirements_ecore_file="" -requirements_ecore_ipc="" -requirements_ecore_job="" -requirements_ecore_txt="" -requirements_ecore_x="" -requirements_ecore_win32="" -requirements_ecore_wince="" -requirements_ecore_sdl="" - -dnl The first call to PKG_CHECK_MODULES is done conditionally, -dnl so we should include this here: -PKG_PROG_PKG_CONFIG - -dnl add windows requirements -WIN32_CFLAGS="" -WIN32_LIBS="" -lt_no_undefined="" -lt_enable_auto_import="" -case "$host_os" in - mingw*|cegcc) - PKG_CHECK_MODULES([EVIL], [evil]) - AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed.]) - dnl needed for correct definition of EAPI - AC_DEFINE(EFL_ECORE_BUILD, 1, [Define to mention that ecore is built.]) - AC_DEFINE(EFL_ECORE_EVAS_BUILD, 1, [Define to mention that ecore evas is built.]) - AC_DEFINE(EFL_ECORE_FILE_BUILD, 1, [Define to mention that ecore file is built.]) - AC_DEFINE(EFL_ECORE_IMF_BUILD, 1, [Define to mention that ecore imf is built.]) - AC_DEFINE(EFL_ECORE_JOB_BUILD, 1, [Define to mention that ecore job is built.]) - AC_DEFINE(EFL_ECORE_SDL_BUILD, 1, [Define to mention that ecore SDL is built.]) - AC_DEFINE(EFL_ECORE_TXT_BUILD, 1, [Define to mention that ecore txt is built.]) - AC_DEFINE(EFL_ECORE_WIN32_BUILD, 1, [Define to mention that ecore Win32 is built.]) - AC_DEFINE(HAVE_DLFCN_H, 1, [Define to 1 if you have the header file.]) - AC_DEFINE(HAVE_SYS_MMAN_H, 1, [Define to 1 if you have the header file.]) - AC_DEFINE(HAVE_SYS_TIME_H, 1, [Define to 1 if you have the header file.]) - if test "$host_os" = "cegcc" ; then - AC_DEFINE(EFL_ECORE_WINCE_BUILD, 1, [Define to mention that ecore WinCE is built.]) - WIN32_CFLAGS="-mwin32" - WIN32_LIBS="-lws2 -laygshell" - lt_enable_auto_import="-Wl,--enable-auto-import" - else - WIN32_LIBS="-lws2_32" - fi - lt_no_undefined="-no-undefined" - ;; - *) - AC_CHECK_HEADERS([dlfcn.h features.h langinfo.h locale.h netdb.h netinet/in.h sys/time.h sys/mman.h]) - AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl) - AC_SUBST(dlopen_libs) - ;; -esac -AC_SUBST(WIN32_CFLAGS) -AC_SUBST(WIN32_LIBS) -AC_SUBST(lt_no_undefined) -AC_SUBST(lt_enable_auto_import) - -dnl check common functions and headers -AC_CHECK_FUNCS(gettimeofday) -AC_CHECK_FUNCS(strlcpy) - -dnl openssl -want_openssl="yes" -have_openssl="no" -AC_ARG_ENABLE(openssl, - AC_HELP_STRING( - [--disable-openssl], - [disable openssl support] - ), - [ want_openssl=$enableval ] -) - -if test "x$want_openssl" = "xyes"; then - PKG_CHECK_MODULES([SSL], [openssl], [ - AC_DEFINE(USE_OPENSSL, 1, [Use OpenSSL]) - requirements_ecore_con="$requirements_ecore_con openssl" - # no need to add it to req_ecore_ipc, since they - # depends on ecore_con anyway. - have_openssl="yes" - ], [ - have_openssl="no" - ]) -fi - -dnl curl -want_curl="yes" -have_curl="no" -AC_ARG_ENABLE(curl, - AC_HELP_STRING( - [--disable-curl], - [disable curl support] - ), - [ want_curl=$enableval ] -) - -if test "x$want_curl" = "xyes"; then - PKG_CHECK_MODULES(CURL, libcurl, - [ - AC_DEFINE(HAVE_CURL, 1, [ Downloading with CURL ]) - requirements_ecore_con="$requirements_ecore_con libcurl" - have_curl="yes" - ], - [ have_curl="no" ] - ) -fi - -dnl abstract sockets -want_abstract_sockets="yes" -AC_ARG_ENABLE(abstract-sockets, - AC_HELP_STRING( - [--disable-abstract-sockets], - [disable abstract sockets.] - ), - [ want_abstract_sockets=$enableval ] -) -if test "x$want_abstract_sockets" = "xyes"; then - AC_DEFINE(HAVE_ABSTRACT_SOCKETS, 1, [Have abstract sockets namespace]) -fi - -dnl ecore_job -ECORE_CHECK_MODULE([Job], [yes]) - -dnl ecore_con -ECORE_CHECK_MODULE([Con], [yes]) - -dnl ecore_ipc -ECORE_CHECK_MODULE([Ipc], [yes], [$have_ecore_con]) - -dnl ecore_config -PKG_CHECK_MODULES(EET, [eet >= 1.0.0], - [ have_eet="yes" ], - [ have_eet="no" ] -) -ecore_config_deps="no" -if test "x$have_eet" = "xyes" -a "x$have_ecore_ipc" = "xyes" ; then - ecore_config_deps="yes" -fi -ECORE_CHECK_MODULE([Config], [yes], [$ecore_config_deps], - [requirements_ecore_config="$requirements_ecore_config ecore-ipc eet"]) - -dnl ecore_txt -iconv_cflags="" -iconv_libs="" -have_iconv="no" -AC_ARG_WITH(iconv-link, - AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]), - [ - iconv_libs=$withval - have_iconv="yes" - ] -) - -if test "x$have_iconv" = "xno" ; then - AC_CHECK_LIB(c, iconv, - [ have_iconv="yes" ] - ) - - if test "x$have_iconv" != "xyes"; then - AC_CHECK_LIB(iconv, iconv, - [ - iconv_libs="-liconv" - have_iconv="yes" - ] - ) - fi -fi -AC_MSG_CHECKING(for explicit iconv link options) -AC_MSG_RESULT($iconv_libs) - -AC_SUBST(iconv_cflags) -AC_SUBST(iconv_libs) - -ECORE_CHECK_MODULE([Txt], [yes], [$have_iconv], - [ecore_txt_libs="$ecore_txt_libs $iconv_libs"]) - -dnl ecore_evas -PKG_CHECK_MODULES(EVAS, [evas >= 0.9.9], - [ have_evas="yes" ], - [ have_evas="no" ] -) - -ECORE_CHECK_MODULE([Evas], [yes], [$have_evas]) - -####################################### -## Simple X11 build/link - -AC_ARG_ENABLE(simple-x11, - AC_HELP_STRING([--enable-simple-x11], [enable simple x11 linking]), - [ want_evas_simple_x11=$enableval ] -) - -have_x="no" -have_ecore_x="no" -have_ecore_x_xlib="no" -have_ecore_x_xcb="no" - -x_dir=""; -x_includes=""; -x_cflags=""; -x_libs=""; - -dnl ecore_x{cb} - -AC_ARG_ENABLE(ecore-x-xcb, - AC_HELP_STRING( - [--enable-ecore-x-xcb], - [enable the ecore_x module with XCB backend. [[default=disabled]]]), - [ want_ecore_x_xcb=$enableval ], - [ want_ecore_x_xcb="no" ]) - -AC_MSG_CHECKING(whether ecore_x with XCB backend is to be built) -AC_MSG_RESULT($want_ecore_x_xcb) - -if test "x$want_ecore_x_xcb" = "xyes" ; then - PKG_CHECK_MODULES(XCB, xcb xcb-icccm xcb-image xcb-keysyms, - [ have_ecore_x_xcb="yes" ], - [ have_ecore_x_xcb="no" ]) - - if test "x$have_ecore_x_xcb" = "xyes" ; then - PKG_CHECK_MODULES(XCB_COMPOSITE, xcb-composite, - [ have_ecore_x_xcb_composite="yes" - AC_DEFINE(ECORE_XCB_COMPOSITE, 1, [Build support for XCB composite]) ], - [ have_ecore_x_xcb_composite="no" ]) - - PKG_CHECK_MODULES(XCB_DAMAGE, xcb-damage, - [ have_ecore_x_xcb_damage="yes" - AC_DEFINE(ECORE_XCB_DAMAGE, 1, [Build support for XCB damage]) ], - [ have_ecore_x_xcb_damage="no" ]) - - PKG_CHECK_MODULES(XCB_DPMS, xcb-dpms, - [ have_ecore_x_xcb_dpms="yes" - AC_DEFINE(ECORE_XCB_DPMS, 1, [Build support for XCB dpms]) ], - [ have_ecore_x_xcb_dpms="no" ]) - - PKG_CHECK_MODULES(XCB_RANDR, xcb-randr, - [ have_ecore_x_xcb_randr="yes" - AC_DEFINE(ECORE_XCB_RANDR, 1, [Build support for XCB randr]) ], - [ have_ecore_x_xcb_randr="no" ]) - - PKG_CHECK_MODULES(XCB_RENDER, xcb-render, - [ have_ecore_x_xcb_render="yes" - AC_DEFINE(ECORE_XCB_RENDER, 1, [Build support for XCB render]) ], - [ have_ecore_x_xcb_render="no" ]) - - PKG_CHECK_MODULES(XCB_SCREENSAVER, xcb-screensaver, - [ have_ecore_x_xcb_screensaver="yes" - AC_DEFINE(ECORE_XCB_SCREENSAVER, 1, [Build support for XCB screensaver]) ], - [ have_ecore_x_xcb_screensaver="no" ]) - - PKG_CHECK_MODULES(XCB_SHAPE, xcb-shape, - [ have_ecore_x_xcb_shape="yes" - AC_DEFINE(ECORE_XCB_SHAPE, 1, [Build support for XCB shape]) ], - [ have_ecore_x_xcb_shape="no" ]) - - PKG_CHECK_MODULES(XCB_SYNC, xcb-sync, - [ have_ecore_x_xcb_sync="yes" - AC_DEFINE(ECORE_XCB_SYNC, 1, [Build support for XCB sync]) ], - [ have_ecore_x_xcb_sync="no" ]) - - PKG_CHECK_MODULES(XCB_XFIXES, xcb-xfixes, - [ have_ecore_x_xcb_xfixes="yes" - AC_DEFINE(ECORE_XCB_FIXES, 1, [Build support for XCB xfixes]) ], - [ have_ecore_x_xcb_xfixes="no" ]) - - PKG_CHECK_MODULES(XCB_XINERAMA, xcb-xinerama, - [ have_ecore_x_xcb_xinerama="yes" - AC_DEFINE(ECORE_XCB_XINERAMA, 1, [Build support for XCB xinerama]) ], - [ have_ecore_x_xcb_xinerama="no" ]) - - PKG_CHECK_MODULES(XCB_XPRINT, xcb-xprint, - [ have_ecore_x_xcb_xprint="yes" - AC_DEFINE(ECORE_XCB_XPRINT, 1, [Build support for XCB xprint]) ], - [ have_ecore_x_xcb_xprint="no" ]) - - PKG_CHECK_MODULES(XCB_XTEST, xcb-xtest, - [ have_ecore_x_xcb_xtest="yes" - AC_DEFINE(ECORE_XCB_XTEST, 1, [Build support for XCB xtest]) ], - [ have_ecore_x_xcb_xtest="no" ]) - - AC_DEFINE(HAVE_ECORE_X_XCB, 1, [Defined to 1 if XCB is enabled.]) - - x_cflags=$XCB_CFLAGS - x_libs=$XCB_LIBS - have_x="yes" - - have_ecore_x_xcb_define="-DHAVE_ECORE_X_XCB" - AC_SUBST(have_ecore_x_xcb_define) - fi -fi - -if ! test "x$have_ecore_x_xcb" = "xyes" ; then - AC_PATH_XTRA - AC_CHECK_HEADER(X11/X.h, - [ - if test "x$want_evas_simple_x11" = "xyes"; then - x_libs="${x_libs} -lX11 -lXext" - else - x_dir=${x_dir:-/usr/X11R6} - x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}} - x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext" - fi - have_ecore_x_xlib="yes" - ] - ) - - if test "x$have_ecore_x_xlib" = "xyes"; then - Xcursor_libs="" - Xcursor_cflags="" - use_Xcursor="no" - PCFLAGS=$CFLAGS - CFLAGS="$x_cflags $x_includes" - AC_CHECK_HEADER(X11/Xcursor/Xcursor.h, - [ - AC_CHECK_LIB(Xcursor, XcursorImageLoadCursor, - [ - AC_DEFINE(ECORE_XCURSOR, 1, [Build support for Xcursor]) - Xcursor_cflags="" - Xcursor_libs="-lXcursor" - use_Xcursor="yes" - ], [ - Xcursor_cflags="" - Xcursor_libs="" - use_Xcursor="no" - ], [ - $x_libs -lXrender - ] - ) - ], [ - Xcursor_cflags="" - Xcursor_libs="" - use_Xcursor="no" - ], [ - #include - ] - ) - CFLAGS=$PCFLAGS - - AC_SUBST(Xcursor_cflags) - AC_SUBST(Xcursor_libs) - - ECORE_CHECK_X_EXTENSION([Xcomposite], [Xcomposite.h], [Xcomposite], [XCompositeQueryExtension]) - ECORE_CHECK_X_EXTENSION([Xdamage], [Xdamage.h], [Xdamage], [XDamageSubtract]) - ECORE_CHECK_X_EXTENSION([Xdpms], [dpms.h], [Xdpms], [DPMSQueryExtension]) - if test "x$use_xdpms" = "xno" ; then - ECORE_CHECK_X_EXTENSION([Xdpms], [dpms.h], [Xext], [DPMSQueryExtension]) - fi - ECORE_CHECK_X_EXTENSION([Xfixes], [Xfixes.h], [Xfixes], [XFixesExpandRegion]) - ECORE_CHECK_X_EXTENSION([Xinerama], [Xinerama.h], [Xinerama], [XineramaQueryScreens]) - ECORE_CHECK_X_EXTENSION([Xprint], [Print.h], [Xp], [XpQueryScreens]) - ECORE_CHECK_X_EXTENSION([Xrandr], [Xrandr.h], [Xrandr], [XRRSizes]) - ECORE_CHECK_X_EXTENSION([Xrender], [Xrender.h], [Xrender], [XRenderFindVisualFormat]) - ECORE_CHECK_X_EXTENSION([Xtest], [XTest.h], [Xtst], [XTestFakeKeyEvent]) - ECORE_CHECK_X_EXTENSION([Xss], [scrnsaver.h], [Xss], [XScreenSaverSelectInput]) - - AC_DEFINE(HAVE_ECORE_X_XLIB, 1, [Defined to 1 if Xlib is enabled.]) - have_x="yes" - - have_ecore_x_xlib="yes" - fi -fi - -AC_SUBST(x_cflags) -AC_SUBST(x_includes) -AC_SUBST(x_libs) - -ECORE_CHECK_MODULE([X], [yes], [$have_x], - [ecore_x_libs="$ecore_x_libs $x_libs"]) - -dnl ecore_evas_x11 -have_ecore_evas_software_x11="no" -have_ecore_evas_xrender_x11="no"; -have_ecore_evas_opengl_x11="no"; -have_ecore_evas_software_xcb="no" -have_ecore_evas_xrender_xcb="no"; -have_ecore_evas_software_16_x11="no"; -if test "x$have_ecore_x" = "xyes" -a "x$have_ecore_evas" = "xyes"; then - - dnl ecore_evas_x Xlib - if test "x$have_ecore_x_xlib" = "xyes"; then - want_ecore_evas_software_x11="yes" - dnl disabling this will make things go haywire - #AC_ARG_ENABLE(ecore-evas-x11, - # AC_HELP_STRING( - # [--enable-ecore-evas-x11], - # [enable X11 support in the ecore_evas module.] - # ), - # [ want_ecore_evas_x11=$enableval ] - #) - AC_MSG_CHECKING(whether ecore_evas Software Xlib support is to be built) - AC_MSG_RESULT($want_ecore_evas_software_x11) - - if test "x$want_ecore_evas_software_x11" = "xyes"; then - PKG_CHECK_MODULES(EVAS_SOFTWARE_X11, evas-software-x11, [ - AC_DEFINE(BUILD_ECORE_EVAS_SOFTWARE_X11, 1, [Support for Software Xlib Engine in Ecore_Evas]) - have_ecore_evas_software_x11="yes"; - ], [ - have_ecore_evas_software_x11="no"; - ]) - fi - - dnl ecore_evas_opengl_x11 - want_ecore_evas_opengl_x11=yes - AC_ARG_ENABLE(ecore-evas-opengl-x11, - AC_HELP_STRING( - [--enable-ecore-evas-opengl-x11], - [enable OpenGL Xlib support in the ecore_evas module.] - ), - [ want_ecore_evas_opengl_x11=$enableval ] - ) - AC_MSG_CHECKING(whether ecore_evas OpenGL Xlib support is to be built) - AC_MSG_RESULT($want_ecore_evas_opengl_x11) - - if test "x$want_ecore_evas_opengl_x11" = "xyes"; then - PKG_CHECK_MODULES(EVAS_OPENGL_X11, evas-opengl-x11, [ - AC_DEFINE(BUILD_ECORE_EVAS_OPENGL_X11, 1, [Support for OpenGL Xlib Engine in Ecore_Evas]) - have_ecore_evas_opengl_x11="yes"; - ], [ - have_ecore_evas_opengl_x11="no" - ]) - fi - - dnl ecore_evas_xrender_x11 - want_ecore_evas_xrender_x11="yes" - AC_ARG_ENABLE(ecore-evas-xrender-x11, - AC_HELP_STRING( - [--disable-ecore-evas-xrender-x11], - [disable XRender Xlib support in the ecore_evas module. [[default=enabled]]] - ), - [ want_ecore_evas_xrender_x11=$enableval ] - ) - - AC_MSG_CHECKING(whether ecore_evas XRender Xlib support is to be built) - AC_MSG_RESULT($want_ecore_evas_xrender_x11) - - if test "x$want_ecore_evas_xrender_x11" = "xyes"; then - PKG_CHECK_MODULES(EVAS_XRENDER_X11, evas-xrender-x11, [ - AC_DEFINE(BUILD_ECORE_EVAS_XRENDER_X11, 1, [Support for XRender Xlib Engine in Ecore_Evas]) - have_ecore_evas_xrender_x11="yes" - ], [ - have_ecore_evas_xrender_x11="no" - ]) - fi - - dnl ecore_evas_software_16_x11 - want_ecore_evas_software_16_x11=no - AC_ARG_ENABLE(ecore-evas-software-16-x11, - AC_HELP_STRING( - [--enable-ecore-evas-software-16-x11], - [enable 16bpp optimized mode support in the ecore_evas module. [[default=disabled]]] - ), - [ want_ecore_evas_software_16_x11=$enableval ] - ) - - AC_MSG_CHECKING(whether ecore_evas x11-16 support is to be built) - AC_MSG_RESULT($want_ecore_evas_software_16_x11) - - if test "x$want_ecore_evas_software_16_x11" = "xyes"; then - PKG_CHECK_MODULES(EVAS_SOFTWARE_16_X11, evas-software-16-x11, - [ - AC_DEFINE(BUILD_ECORE_EVAS_SOFTWARE_16_X11, 1, [Support for X11 16bpp Engine in Ecore_Evas]) - have_ecore_evas_software_16_x11="yes"; - ] - ) - fi - else - want_ecore_evas_software_xcb="yes" - ECORE_EVAS_CHECK_MODULE([software-xcb], - [$want_ecore_evas_software_xcb], - [Software XCB], - $have_ecore_x_xcb) - - want_ecore_evas_xrender_xcb="auto" - ECORE_EVAS_CHECK_MODULE([xrender-xcb], - [$want_ecore_evas_xrender_xcb], - [XRender XCB], - $have_ecore_x_xcb) - fi - - if test "x$have_ecore_evas_software_x11" = "xyes" -o \ - "x$have_ecore_evas_opengl_x11" = "yes" -o \ - "x$have_ecore_evas_xrender_x11" = "yes" -o \ - "x$have_ecore_evas_software_16_x11" = "yes" -o \ - "x$have_ecore_evas_software_xcb" = "xyes" -o \ - "x$have_ecore_evas_xrender_xcb" = "yes"; then - AC_DEFINE(BUILD_ECORE_EVAS_X11, 1, [Support for X Window Engines in Ecore_Evas]) - requirements_ecore_evas="$requirements_ecore_evas ecore-x" - fi - -fi - -dnl ecore_win32 - -ECORE_CHECK_MODULE([Win32], [no], [yes], - [ecore_win32_libs="-lgdi32"]) -AC_SUBST(ecore_win32_libs) - -want_ecore_evas_software_ddraw="yes" -ECORE_EVAS_CHECK_MODULE([software-ddraw], - [$want_ecore_evas_software_ddraw], - [Software DirectDraw], - $have_ecore_win32) - -want_ecore_evas_direct3d="yes" -ECORE_EVAS_CHECK_MODULE([direct3d], - [$want_ecore_evas_direct3d], - [Direct3d], - $have_ecore_win32) - -want_ecore_evas_opengl_glew="yes" -ECORE_EVAS_CHECK_MODULE([opengl-glew], - [$want_ecore_evas_opengl_glew], - [Glew OpenGL], - $have_ecore_win32) - -want_ecore_evas_software_16_ddraw="yes" -ECORE_EVAS_CHECK_MODULE([software-16-ddraw], - [$want_ecore_evas_software_16_ddraw], - [16 bpp Software DirectDraw], - $have_ecore_win32) - -if test "x$have_ecore_evas_software_ddraw" = "xyes" -o \ - "x$have_ecore_evas_direct3d" = "yes" -o \ - "x$have_ecore_evas_opengl_glew" = "yes" -o \ - "x$have_ecore_evas_software_16_ddraw" = "yes"; then - AC_DEFINE(BUILD_ECORE_EVAS_WIN32, 1, [Support for Win32 Engine in Ecore_Evas]) - requirements_ecore_evas="$requirements_ecore_evas ecore-win32" -fi - -dnl ecore_wince - -ECORE_CHECK_MODULE([WinCE], [no]) - -want_ecore_evas_software_16_wince="yes" -ECORE_EVAS_CHECK_MODULE([software-16-wince], - [$want_ecore_evas_software_16_wince], - [16 bpp Software Windows CE], - $have_ecore_wince) - -if test "x$have_ecore_evas_software_16_wince" = "xyes"; then - requirements_ecore_evas="$requirements_ecore_evas ecore-wince" -fi - -dnl ecore_dfb -PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16, - [ have_directfb="yes" ], - [ have_directfb="no" ] -) - -ECORE_CHECK_MODULE([DirectFB], [no], [$have_directfb], - [requirements_ecore_directfb="directfb"]) - -dnl ecore_evas_dfb -have_ecore_evas_dfb="no" -if test "x$have_ecore_directfb" = "xyes" -a "x$have_ecore_evas" = "xyes"; then - want_ecore_evas_dfb="yes" - AC_MSG_CHECKING(whether ecore_evas DirectFB support is to be built) - AC_ARG_ENABLE(ecore-evas-dfb, - AC_HELP_STRING([--disable-ecore-evas-dfb], [disable DirectFB in the ecore_evas module]), - [ want_ecore_evas_dfb=$enableval ] - ) - AC_MSG_RESULT($want_ecore_evas_dfb) - - if test "x$want_ecore_evas_dfb" = "xyes" -a "x$have_ecore_directfb" = "xyes" ; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $DIRECTFB_CFLAGS" - PKG_CHECK_MODULES(EVAS_DIRECTFB, evas-directfb, - [ - AC_DEFINE(BUILD_ECORE_EVAS_DIRECTFB, 1, [Support for DirectFB in Ecore_Evas]) - have_ecore_evas_dfb="yes" - requirements_ecore_evas="$requirements_ecore_evas ecore-directfb" - ] - ) - CFLAGS="$save_CFLAGS" - fi -fi - -dnl ecore_fb -have_fb="no" -AC_CHECK_HEADER(linux/fb.h, - [ AC_CHECK_HEADER(linux/input.h, [ have_fb="yes" ]) ] -) -ECORE_CHECK_MODULE([FB], [no], [$have_fb]) - -tslib_libs="" -if test "x$have_ecore_fb" = "xyes" ; then -AC_CHECK_HEADER(tslib.h, - [ - AC_CHECK_LIB(ts, ts_open, tslib_libs="-lts", tslib_libs="-ltslib") - AC_DEFINE(HAVE_TSLIB, 1, [Build Ecore_FB Touchscreen Code]) - ] -) -fi -AC_SUBST(tslib_libs) - -dnl ecore_evas_fb -have_ecore_evas_fb="no"; -if test "x$have_ecore_fb" = "xyes" -a "x$have_ecore_evas" = "xyes"; then - want_ecore_evas_fb="yes"; - AC_MSG_CHECKING(whether ecore_evas fb support is to be built) - AC_ARG_ENABLE(ecore-evas-fb, - AC_HELP_STRING([--disable-ecore-evas-fb], [disable fb in the ecore_evas module]), - [ want_ecore_evas_fb=$enableval ] - ) - AC_MSG_RESULT($want_ecore_evas_fb) - - if test "x$want_ecore_evas_fb" = "xyes"; then - PKG_CHECK_MODULES(EVAS_FB, evas-fb, - [ - AC_DEFINE(BUILD_ECORE_EVAS_FB, 1, [Support for Linux FB in Ecore_Evas]) - have_ecore_evas_fb="yes" - requirements_ecore_evas="$requirements_ecore_evas ecore-fb" - ] - ) - fi -fi - -dnl ecore_sdl -AC_ARG_WITH(sdl-config, AC_HELP_STRING([--with-sdl-config=PATH], [use sdl-config specified]), [ - SDL_CONFIG=$withval; - echo "using "$SDL_CONFIG" for sdl-config"; -], [ - if test -z "$SDL_CONFIG"; then - AC_PATH_PROG(SDL_CONFIG, "sdl-config", "", $PATH) - fi -]) -if test -z "$SDL_CONFIG" ; then SDL_CONFIG="sdl-config"; fi - -sdl_cflags=""; -sdl_libs=""; -have_sdl="no" -AC_CHECK_HEADER(SDL/SDL.h, [ have_sdl="yes" ], [ have_sdl="no" ]) - -ECORE_CHECK_MODULE([SDL], [no], [$have_sdl]) - -dnl ecore_evas_sdl -have_ecore_evas_sdl="no"; -if test "x$have_ecore_sdl" = "xyes" -a "x$have_ecore_evas" = "xyes"; then - want_ecore_evas_sdl="yes"; - AC_MSG_CHECKING([whether ecore_evas SDL support is to be built]) - AC_ARG_ENABLE(ecore-evas-sdl, - AC_HELP_STRING([--disable-ecore-evas-sdl], [disable SDL in the ecore_evas module]), - [ want_ecore_evas_sdl=$enableval ] - ) - AC_MSG_RESULT($want_ecore_evas_sdl) - - if test "x$want_ecore_evas_sdl" = "xyes"; then - save_CFLAGS=$CFLAGS - SDL_CFLAGS=`$SDL_CONFIG --cflags` - SDL_LIBS=`$SDL_CONFIG --libs` - CFLAGS="$CFLAGS $SDL_CFLAGS" - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - - PKG_CHECK_MODULES(EVAS_SOFTWARE_SDL, evas-software-sdl, [ - AC_DEFINE(BUILD_ECORE_EVAS_SDL, 1, [Support for SDL in Ecore_Evas]) - have_ecore_evas_sdl="yes" - requirements_ecore_evas="$requirements_ecore_evas ecore-sdl" - PKG_CHECK_MODULES(SDL, sdl >= 1.3.0, [ - AC_DEFINE(BUILD_ECORE_EVAS_SDL_130, 1, [Support for SVN SDL]) - ], [ - dummy="no" - ]) - ], [ - have_ecore_evas_sdl="no" - ]) - CFLAGS=$save_CFLAGS - fi -fi - -dnl ecore_evas_buffer -want_ecore_evas_buffer="yes"; -have_ecore_evas_buffer="no"; -AC_MSG_CHECKING(whether ecore_evas buffer support is to be built) -AC_ARG_ENABLE(ecore-evas-buffer, - AC_HELP_STRING([--disable-ecore-evas-buffer], [disable buffer in the ecore_evas module]), - [ want_ecore_evas_buffer=$enableval ] -) -AC_MSG_RESULT($want_ecore_evas_buffer) - -if test "x$want_ecore_evas_buffer" = "xyes" -a "x$have_ecore_evas" = "xyes"; then - PKG_CHECK_MODULES(EVAS_SOFTWARE_BUFFER, evas-software-buffer, - [ - AC_DEFINE(BUILD_ECORE_EVAS_BUFFER, 1, [Support for Buffers in Ecore_Evas]) - have_ecore_evas_buffer="yes" - ], [ - have_ecore_evas_buffer="no" - ]) -fi - -dnl ecore_file -ECORE_CHECK_MODULE([File], [yes]) -have_inotify="no" -have_poll="no" -if test "x$have_ecore_file" = "xyes"; then - - dnl We need to check if the right inotify version is accessible - want_inotify="yes" - AC_MSG_CHECKING(whether inotify is to be used for filemonitoring) - AC_ARG_ENABLE(inotify, - AC_HELP_STRING([--disable-inotify], [disable inotify in the ecore_file module]), - [ want_inotify=$enableval ] - ) - AC_MSG_RESULT($want_inotify) - - dnl It's hard to find a good test on how to check the correct - dnl inotify version. They changed the headers a lot. - dnl in kernel 2.6.13 __NR_inotify_init was added to the defined syscalls - dnl in asm/unistd.h and IN_MOVE_SELF was added to linux/inotify.h - dnl so with this check you need a very new kernel and kernel-headers! - if test "x$want_inotify" = "xyes"; then - AC_CHECK_LIB(c, inotify_init, [ - AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ]) - AC_DEFINE(HAVE_SYS_INOTIFY, 1, [ File monitoring with Inotify - sys/inotify.h ]) - have_inotify="yes" - ], - [ - AC_TRY_COMPILE( - [ - #include - #include - ], - [ int a = __NR_inotify_init; int b = IN_MOVE_SELF; ], - [ - AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ]) - have_inotify="yes" - ], [ - have_inotify="no" - ] - ) - ] - ) - fi - - want_poll="yes" - AC_MSG_CHECKING(whether polling is to be used for filemonitoring) - AC_ARG_ENABLE(poll, - AC_HELP_STRING([--disable-poll], [disable poll in the ecore_file module]), - [ want_poll=$enableval ] - ) - AC_MSG_RESULT($want_poll) - - if test "x$want_poll" = "xyes"; then - AC_DEFINE(HAVE_POLL, 1, [ File monitoring with polling ]) - have_poll="yes" - fi - requirements_ecore_file="$requirements_ecore_file $requirements_ecore_con" -fi - -dnl ecore_desktop -ECORE_CHECK_MODULE([Desktop], [no], [$have_ecore_file], - [requirements_ecore_desktop="ecore-file"]) - -dnl ecore_imf -ECORE_CHECK_MODULE([IMF], [yes]) - -try_ecore_imf_evas=no -if test "x$have_ecore_imf" = "xyes" -a "x$have_evas" = "xyes"; then - try_ecore_imf_evas=yes -fi - -ECORE_CHECK_MODULE([IMF_EVAS], [yes], [$try_ecore_imf_evas]) - -dnl requirements -AC_SUBST(requirements_ecore_con) -AC_SUBST(requirements_ecore_config) -AC_SUBST(requirements_ecore_desktop) -AC_SUBST(requirements_ecore_directfb) -AC_SUBST(requirements_ecore_evas) -AC_SUBST(requirements_ecore_fb) -AC_SUBST(requirements_ecore_file) -AC_SUBST(requirements_ecore_ipc) -AC_SUBST(requirements_ecore_job) -AC_SUBST(requirements_ecore_txt) -AC_SUBST(requirements_ecore_x) -AC_SUBST(requirements_ecore_sdl) - -# set up conditionals -AM_CONDITIONAL(BUILD_ECORE_X, test $have_ecore_x = yes) -AM_CONDITIONAL(BUILD_ECORE_X_XLIB, test $have_ecore_x_xlib = yes) -AM_CONDITIONAL(BUILD_ECORE_X_XCB, test $have_ecore_x_xcb = yes) - -AC_OUTPUT([ -Makefile -ecore-con.pc -ecore-config.pc -ecore-desktop.pc -ecore-directfb.pc -ecore-evas.pc -ecore-fb.pc -ecore-file.pc -ecore-imf.pc -ecore-imf-evas.pc -ecore-ipc.pc -ecore-job.pc -ecore-txt.pc -ecore-x.pc -ecore-win32.pc -ecore-sdl.pc -ecore-wince.pc -ecore.pc -src/Makefile -src/bin/Makefile -src/lib/Makefile -src/lib/ecore/Makefile -src/lib/ecore_job/Makefile -src/lib/ecore_x/Makefile -src/lib/ecore_x/xlib/Makefile -src/lib/ecore_x/xcb/Makefile -src/lib/ecore_fb/Makefile -src/lib/ecore_sdl/Makefile -src/lib/ecore_evas/Makefile -src/lib/ecore_con/Makefile -src/lib/ecore_imf/Makefile -src/lib/ecore_imf_evas/Makefile -src/lib/ecore_ipc/Makefile -src/lib/ecore_txt/Makefile -src/lib/ecore_config/Makefile -src/lib/ecore_file/Makefile -src/lib/ecore_desktop/Makefile -src/lib/ecore_directfb/Makefile -src/lib/ecore_win32/Makefile -src/lib/ecore_wince/Makefile -README -ecore.spec -]) - -echo -echo "$PACKAGE $VERSION" -echo -echo "Optional Modules:" -echo -echo " Core:" -echo -echo " Ecore_Job....................: $have_ecore_job" -echo " Ecore_Txt....................: $have_ecore_txt" -echo " Ecore_File...................: $have_ecore_file" -if test "x$have_ecore_file" = "xyes" ; then - echo " Inotify....................: $have_inotify" - echo " Poll.......................: $have_poll" - echo " CURL.......................: $have_curl" -fi -echo " Ecore_Desktop................: $have_ecore_desktop" -echo " Ecore_Con....................: $have_ecore_con" -if test "x$have_ecore_con" = "xyes" ; then - echo " OpenSSL....................: $have_openssl" - echo " CURL.......................: $have_curl" -fi -echo " Ecore_Ipc....................: $have_ecore_ipc" -if test "x$have_ecore_con" = "xyes" ; then - echo " OpenSSL....................: $have_openssl" -fi -echo " Ecore_Config.................: $have_ecore_config" -echo " Ecore_IMF....................: $have_ecore_imf" -echo " Ecore_IMF_Evas...............: $have_ecore_imf_evas" - -echo -echo " Graphic systems:" -echo - -if test "x$have_ecore_x" = "xyes" ; then - if test "x$have_ecore_x_xcb" = "xyes" ; then - echo " Ecore_X (XCB backend)........: $have_ecore_x_xcb" - echo " Xprint.....................: $have_ecore_x_xcb_xprint" - echo " Xinerama...................: $have_ecore_x_xcb_xinerama" - echo " Xrandr.....................: $have_ecore_x_xcb_randr" - echo " Xscreensaver...............: $have_ecore_x_xcb_screensaver" - echo " Xshape.....................: $have_ecore_x_xcb_shape" - echo " Xsync......................: $have_ecore_x_xcb_sync" - echo " Xrender....................: $have_ecore_x_xcb_render" - echo " Xcomposite.................: $have_ecore_x_xcb_composite" - echo " Xfixes.....................: $have_ecore_x_xcb_xfixes" - echo " Xdamage....................: $have_ecore_x_xcb_damage" - echo " Xdpms......................: $have_ecore_x_xcb_dpms" - echo " Xtest......................: $have_ecore_x_xcb_xtest" - else - echo " Ecore_X (Xlib backend).......: $have_ecore_x" - echo " Xcursor....................: $use_Xcursor" - echo " Xprint.....................: $use_xprint" - echo " Xinerama...................: $use_xinerama" - echo " Xrandr.....................: $use_xrandr" - echo " Xscreensaver...............: $use_xss" - echo " Xrender....................: $use_xrender" - echo " Xcomposite.................: $use_xcomposite" - echo " Xfixes.....................: $use_xfixes" - echo " Xdamage....................: $use_xdamage" - echo " Xdpms......................: $use_xdpms" - echo " Xtest......................: $use_xtest" - fi -else - echo " Ecore_X......................: $have_ecore_x" -fi -echo " Ecore_Win32..................: $have_ecore_win32" -echo " Ecore_SDL....................: $have_ecore_sdl" -echo " Ecore_FB.....................: $have_ecore_fb" -echo " Ecore_DFB....................: $have_ecore_directfb" -echo " Ecore_WinCE..................: $have_ecore_wince" - -echo -echo " Ecore Evas:" -echo - -echo " Ecore_Evas...................: $have_ecore_evas" -if test "x$have_ecore_evas" = "xyes" ; then - echo " Software Memory Buffer.....: $have_ecore_evas_buffer" - echo " Software X11...............: $have_ecore_evas_software_x11" - echo " XRender X11................: $have_ecore_evas_xrender_x11" - echo " OpenGL X11.................: $have_ecore_evas_opengl_x11" - echo " Software XCB...............: $have_ecore_evas_software_xcb" - echo " XRender XCB................: $have_ecore_evas_xrender_xcb" - echo " Software DirectDraw........: $have_ecore_evas_software_ddraw" - echo " Direct3D...................: $have_ecore_evas_direct3d" - echo " OpenGL Glew................: $have_ecore_evas_opengl_glew" - echo " Software SDL...............: $have_ecore_evas_sdl" - echo " DirectFB...................: $have_ecore_evas_dfb" - echo " Software Framebuffer.......: $have_ecore_evas_fb" - echo " Software 16bit X11.........: $have_ecore_evas_software_16_x11" - echo " Software 16bit DirectDraw..: $have_ecore_evas_software_16_ddraw" - echo " Software 16bit WinCE.......: $have_ecore_evas_software_16_wince" -fi -echo -echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE." -echo diff --git a/debian/.cvsignore b/debian/.cvsignore deleted file mode 100644 index 2acb329..0000000 --- a/debian/.cvsignore +++ /dev/null @@ -1,12 +0,0 @@ -Makefile -Makefile.in -ecore1-test -ecore1-test.substvars -files -libecore1 -libecore1-dev -libecore1.postinst.debhelper -libecore1.postrm.debhelper -libecore1.substvars -tmp -changelog diff --git a/debian/changelog.in b/debian/changelog.in deleted file mode 100644 index e5dd1a6..0000000 --- a/debian/changelog.in +++ /dev/null @@ -1,5 +0,0 @@ -ecore (@VERSION@-1) unstable; urgency=low - - * a CVS snapshot release. - - -- Falko Schmidt Fri, 4 Apr 2008 15:13:56 +0000 diff --git a/debian/libecore-con0.install b/debian/libecore-con0.install deleted file mode 100644 index 1c47c56..0000000 --- a/debian/libecore-con0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_con.so.* diff --git a/debian/libecore-config0.install b/debian/libecore-config0.install deleted file mode 100644 index 32c5d31..0000000 --- a/debian/libecore-config0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_config.so.* diff --git a/debian/libecore-evas0.install b/debian/libecore-evas0.install deleted file mode 100644 index d13df80..0000000 --- a/debian/libecore-evas0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_evas.so.* diff --git a/debian/libecore-fb0.install b/debian/libecore-fb0.install deleted file mode 100644 index 0bdee71..0000000 --- a/debian/libecore-fb0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_fb.so.* diff --git a/debian/libecore-file0.install b/debian/libecore-file0.install deleted file mode 100644 index b436295..0000000 --- a/debian/libecore-file0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_file.so.* diff --git a/debian/libecore-imf-evas0.install b/debian/libecore-imf-evas0.install deleted file mode 100644 index 8476e83..0000000 --- a/debian/libecore-imf-evas0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_imf_evas.so.* diff --git a/debian/libecore-imf0.install b/debian/libecore-imf0.install deleted file mode 100644 index a4a971d..0000000 --- a/debian/libecore-imf0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_imf.so.* diff --git a/debian/libecore-ipc0.install b/debian/libecore-ipc0.install deleted file mode 100644 index 6b15c13..0000000 --- a/debian/libecore-ipc0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_ipc.so.* diff --git a/debian/libecore-job0.install b/debian/libecore-job0.install deleted file mode 100644 index 80758d5..0000000 --- a/debian/libecore-job0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_job.so.* diff --git a/debian/libecore-txt0.install b/debian/libecore-txt0.install deleted file mode 100644 index 6c774ce..0000000 --- a/debian/libecore-txt0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_txt.so.* diff --git a/debian/libecore-x0.install b/debian/libecore-x0.install deleted file mode 100644 index 1556912..0000000 --- a/debian/libecore-x0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore_x.so.* diff --git a/debian/libecore0.install b/debian/libecore0.install deleted file mode 100644 index 7eef82a..0000000 --- a/debian/libecore0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libecore.so.* diff --git a/doc/.cvsignore b/doc/.cvsignore deleted file mode 100644 index cc370ed..0000000 --- a/doc/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -html -latex -man diff --git a/doc/ecore.css b/doc/ecore.css deleted file mode 100644 index 6117b39..0000000 --- a/doc/ecore.css +++ /dev/null @@ -1,178 +0,0 @@ -td.md { - background-color: #ffffff; - font-family: monospace; - text-align: left; - vertical-align: center; - font-size: 10; - padding-right : 1px; - padding-top : 1px; - padding-left : 1px; - padding-bottom : 1px; - margin-left : 1px; - margin-right : 1px; - margin-top : 1px; - margin-bottom : 1px -} -td.mdname { - font-family: monospace; - text-align: left; - vertical-align: center; - font-size: 10; - padding-right : 1px; - padding-top : 1px; - padding-left : 1px; - padding-bottom : 1px; - margin-left : 1px; - margin-right : 1px; - margin-top : 1px; - margin-bottom : 1px -} -h1 -{ - text-align: center; - color: #333333 -} -h2 -{ - text-align: left; - color: #333333 -} -h3 -{ - text-align: left; - color: #333333 -} -a:link -{ - text-decoration: none; - color: #444444; - font-weight: bold; -} -a:visited -{ - text-decoration: none; - color: #666666; - font-weight: bold; -} -a:hover -{ - text-decoration: none; - color: #000000; - font-weight: bold; -} -a.nav:link -{ - text-decoration: none; - color: #444444; - font-weight: normal; -} -a.nav:visited -{ - text-decoration: none; - color: #666666; - font-weight: normal; -} -a.nav:hover -{ - text-decoration: none; - color: #000000; - font-weight: normal; -} -a.qindex:link -{ - text-decoration: none; - color: #444444; - font-weight: normal; -} -a.qindex:visited -{ - text-decoration: none; - color: #666666; - font-weight: normal; -} -a.qindex:hover -{ - text-decoration: none; - color: #000000; - font-weight: normal; -} -p -{ - color: #000000; - font-family: sans-serif; - font-size: 10; -} -body { - background-image: url("hilite.png"); - background-repeat: no-repeat; - background-position: left top; - background-color: #dddddd; - color: #000000; - font-family: sans-serif; - padding: 8px; - margin: 0; -} -div.fragment -{ - background-image: url("hilite.png"); - background-repeat: no-repeat; - background-position: left top; - border: thin solid #888888; - background-color: #eeeeee; - padding: 4px; - text-align: left; - vertical-align: center; - font-size: 12; -} -hr -{ - border: 0; - background-color: #000000; - width: 80%; - height: 1; -} -dl -{ - background-image: url("hilite.png"); - background-repeat: no-repeat; - background-position: left top; - border: thin solid #aaaaaa; - background-color: #eeeeee; - padding: 4px; - text-align: left; - vertical-align: center; - font-size: 12; -} -em -{ - color: #334466; - font-family: courier; - font-size: 10; - font-style: normal; -} - -div.nav -{ - border: thin solid #000000; - background-color: #ffffff; - padding: 1px; - text-align: center; - vertical-align: center; - font-size: 12; -} -div.body -{ - border: thin solid #000000; - background-color: #ffffff; - padding: 4px; - text-align: left; - font-size: 10; -} -div.diag -{ - border: thin solid #888888; - background-color: #eeeeee; - padding: 4px; - text-align: center; - font-size: 8; -} diff --git a/ecore-dbus.pc.in b/ecore-dbus.pc.in deleted file mode 100644 index d6c5c29..0000000 --- a/ecore-dbus.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ecore-dbus -Description: E core library, DBus module -Requires: ecore-con @requirements_ecore_dbus@ -Version: @VERSION@ -Libs: -L${libdir} -lecore_dbus -Cflags: -I${includedir} diff --git a/ecore-desktop.pc.in b/ecore-desktop.pc.in deleted file mode 100644 index 48b7bf9..0000000 --- a/ecore-desktop.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ecore-desktop -Description: E core library, Desktop module -Requires: ecore @requirements_ecore_desktop@ -Version: @VERSION@ -Libs: -L${libdir} -lecore_desktop -Cflags: -I${includedir} diff --git a/ecore-job.pc.in b/ecore-job.pc.in deleted file mode 100644 index fc914a0..0000000 --- a/ecore-job.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ecore-job -Description: E core library, Job module -Requires: ecore @requirements_ecore_job@ -Version: @VERSION@ -Libs: -L${libdir} -lecore_job -Cflags: -I${includedir} diff --git a/ecore-txt.pc.in b/ecore-txt.pc.in deleted file mode 100644 index 1cedb76..0000000 --- a/ecore-txt.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ecore-txt -Description: E core library, Text module -Requires: ecore @requirements_ecore_txt@ -Version: @VERSION@ -Libs: -L${libdir} @ecore_txt_libs@ -Cflags: -I${includedir} diff --git a/ecore.c.in b/ecore.c.in deleted file mode 100644 index 3780e28..0000000 --- a/ecore.c.in +++ /dev/null @@ -1,378 +0,0 @@ -/** -@brief Ecore Library Public API Calls - -These routines are used for Ecore Library interaction -*/ - -/** - -@mainpage Ecore - -@image latex ecore_big.eps width=5cm -@image html ecore.png - -@version 1.0.0 -@author Carsten Haitzler -@author Tom Gilbert -@author Burra -@author Chris Ross -@author Term -@author Tilman Sauerbeck -@author Nathan Ingersoll -@date 2000-2004 - -@section intro Introduction - -Ecore is a library of convenience functions. - -The Ecore library provides the following modules: -@li @link Ecore.h Ecore - Main Loop Functions. @endlink -@li @link Ecore_Con.h Ecore_Con - Connection functions. @endlink -@li @link Ecore_Config.h Ecore_Config - Configuration functions. @endlink -@li @link Ecore_Evas.h Ecore_Evas - Evas convenience functions. @endlink -@li @link Ecore_Fb.h Ecore_FB - Frame buffer convenience functions. @endlink -@li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink -@li @link Ecore_Job.h Ecore_Job - Job functions, to be used in the Ecore main loop. @endlink -@li @link Ecore_Txt.h Ecore_Txt - Text encoding conversion. @endlink -@li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink - -@section compiling How to compile using Ecore? - -This section has to be documented. Below is just a quick line to handle all -Ecore modules at once. - -@verbatim -gcc *.c \ --I/usr/local/include -I/usr/X11R6/include \ --L/usr/local/lib -L/usr/X11R6/lib \ --lecore -lecore_evas -lecore_x -lecore_fb -lecore_job \ -`evas-config --cflags --libs` -@endverbatim - -@section install How is it installed? - -Suggested configure options for evas for a Linux desktop X display: - -@verbatim -./configure \ ---enable-ecore-x \ ---enable-ecore-fb \ ---enable-ecore-evas \ ---enable-ecore-evas-gl \ ---enable-ecore-job \ ---enable-ecore-con \ ---enable-ecore-ipc \ ---enable-ecore-txt -make CFLAGS="-O9 -mpentiumpro -march=pentiumpro -mcpu=pentiumpro" -@endverbatim - -@todo (1.0) Document API - -*/ - -/* -@page Ecore_Main_Loop_Page The Ecore Main Loop - -@section intro What is Ecore? - -Ecore is a clean and tiny event loop library with many modules to do lots of -convenient things for a programmer, to save time and effort. - -It's small and lean, designed to work on embedded systems all the way to -large and powerful multi-cpu workstations. It serialises all system signals, -events etc. into a single event queue, that is easily processed without -needing to worry about concurrency. A properly written, event-driven program -using this kind of programming doesn't need threads, nor has to worry about -concurrency. It turns a program into a state machine, and makes it very -robust and easy to follow. - -Ecore gives you other handy primitives, such as timers to tick over for you -and call specified functions at particular times so the programmer can use -this to do things, like animate, or time out on connections or tasks that take -too long etc. - -Idle handlers are provided too, as well as calls on entering an idle state -(often a very good time to update the state of the program). All events that -enter the system are passed to specific callback functions that the program -sets up to handle those events. Handling them is simple and other Ecore -modules produce more events on the queue, coming from other sources such as -file descriptors etc. - -Ecore also lets you have functions called when file descriptors become active -for reading or writing, allowing for streamlined, non-blocking IO. - -Here is an exmaple of a simple program and its basic event loop flow: - -@image html prog_flow.png - - - -@section work How does Ecore work? - -Ecore is very easy to learn and use. All the function calls are designed to -be easy to remember, explicit in describing what they do, and heavily -name-spaced. Ecore programs can start and be very simple. - -For example: - -@code -#include - -int main(int argc, const char **argv) -{ - ecore_init(); - ecore_app_args_set(argc, argv); - ecore_main_loop_begin(); - ecore_shutdown(); - return 0; -} -@endcode - -This program is very simple and does't check for errors, but it does start up -and begin a main loop waiting for events or timers to tick off. This program -doesn't set up any, but now we can expand on this simple program a little -more by adding some event handlers and timers. - -@code -#include - -Ecore_Timer *timer1 = NULL; -Ecore_Event_Handler *handler1 = NULL; -double start_time = 0.0; - -int timer_func(void *data) -{ - printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time); - return 1; -} - -int exit_func(void *data, int ev_type, void *ev) -{ - Ecore_Event_Signal_Exit *e; - - e = (Ecore_Event_Signal_Exit *)ev; - if (e->interrupt) printf("Exit: interrupt\n"); - else if (e->quit) printf("Exit: quit\n"); - else if (e->terminate) printf("Exit: terminate\n"); - ecore_main_loop_quit(); - return 1; -} - -int main(int argc, const char **argv) -{ - ecore_init(); - ecore_app_args_set(argc, argv); - start_time = ecore_time_get(); - handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); - timer1 = ecore_timer_add(0.5, timer_func, NULL); - ecore_main_loop_begin(); - ecore_shutdown(); - return 0; -} -@endcode - -In the previous example, we initialize our application and get the time at -which our program has started so we can calculate an offset. We set -up a timer to tick off in 0.5 seconds, and since it returns 1, will -keep ticking off every 0.5 seconds until it returns 0, or is deleted -by hand. An event handler is set up to call a function - exit_func(), -whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C -on the command line will cause such an event to happen). If this event -occurs it tells you what kind of exit signal was received, and asks -the main loop to quit when it is finished by calling -ecore_main_loop_quit(). - -The handles returned by ecore_timer_add() and ecore_event_handler_add() are -only stored here as an example. If you don't need to address the timer or -event handler again you don't need to store the result, so just call the -function, and don't assign the result to any variable. - -This program looks slightly more complex than needed to do these simple -things, but in principle, programs don't get any more complex. You add more -event handlers, for more events, will have more timers and such, BUT it all -follows the same principles as shown in this example. - -*/ - -/** -@page Ecore_Config_Page The Enlightened Property Library - -The Enlightened Property Library (Ecore_Config) is an adbstraction -from the complexities of writing your own configuration. It provides -many features using the Enlightenment 17 development libraries. - -To use the library, you: -@li Set the default values of your properties. -@li Load the configuration from a file. You must set the default values - first, so that the library knows the correct type of each argument. - -The following examples show how to use the Enlightened Property Library: -@li @link config_basic_example.c config_basic_example.c @endlink -@li @link config_listener_example.c config_listener_example.c @endlink - -*/ - -/** -@page Ecore_ADT_Page Ecore Abstract Data Types - -This page briefly describes the different abstract data types -that are provided by the Ecore library for general usage. You need to -include the @link Ecore_Data.h Ecore_Data.h @endlink to use them. - -@section Ecore_ADT_List List - -A list is a simple data type where one each piece of data points to -another piece of data. - -Associated modules that describe the List ADT include: -@li @ref Ecore_Data_List_Creation_Group -@li @ref Ecore_Data_List_Add_Item_Group -@li @ref Ecore_Data_List_Remove_Item_Group -@li @ref Ecore_Data_List_Traverse_Group -@li @ref Ecore_Data_List_Node_Group - -Examples involving lists include: -@li @link list_example.c list_example.c @endlink - -@section Ecore_ADT_DList Doubly Linked List - -A doubly linked list is like a linked list, only each piece of data -can also point to the piece before it. In other words, you can traverse -a doubly linked list in both directions. - -Associated modules that describe the DList ADT include: -@li @ref Ecore_Data_DList_Creation_Group -@li @ref Ecore_Data_DList_Add_Item_Group -@li @ref Ecore_Data_DList_Remove_Item_Group - -@section Ecore_ADT_Hash Hash - -A hash is an abstract data type where one value is associated with another -value. Instead of each element of the group being accessible using a -number, each element is accessed using another object. - -Associated modules that describe the Hash ADT include: -@li @ref Ecore_Data_Hash_ADT_Creation_Group -@li @ref Ecore_Data_Hash_ADT_Destruction_Group -@li @ref Ecore_Data_Hash_ADT_Data_Group - -@todo Finish this. -*/ - -/** -@page X_Window_System_Page X Window System - -The Ecore library includes a wrapper for handling the X window system. -This page briefly explains what the X window system is and various terms -that are used. -*/ - -// GROUP DEFINITIONS - -/** -@defgroup Ecore_Timer_Group Ecore Timer - -The timer allows callbacks to be called at specific intervals. - */ - -/** -@defgroup Ecore_Job_Group Ecore Jobs - -You can queue jobs that are to be done by the main loop when the current -event is dealt with. -*/ - -/** -@defgroup Idle_Group Idle Handlers - -Callbacks that are called when the program enters or exits an idle state. - -The ecore main loop enters an idle state when it is waiting for timers -to time out, data to come in on a file descriptor or any other event -to occur. You can set callbacks to be called when the main loop -enters an idle state, during an idle state or just after the program -wakes up. - -Enterer callbacks are good for updating your program's state, if it -has a state engine. Once all of the enterer handlers are called, the -program will enter a "sleeping" state. - -Idler callbacks are called when the main loop has called all enterer -handlers. They are useful for interfaces that require polling and -timers would be too slow to use. - -If no idler callbacks are specified, then the process literally goes -to sleep. Otherwise, the idler callbacks are called continuously -while the loop is "idle", using as much CPU as is available to the -process. - -Exiter callbacks are called when the main loop wakes up from an idle -state. - -*/ - -/** -@defgroup Ecore_Config_Create_Group Ecore Config Create Functions - -Convenience functions that set default values, bounds, option values and -descriptions in one call. -*/ - -/** -@defgroup Ecore_Config_File_Group Ecore Config File Functions - -Functions that are used to load and save properties from and to files. -*/ - -// EXAMPLES - -/** -@example args_example.c -Shows how to set and retrieve the program arguments. -*/ - -/** -@example con_server_example.c -Shows how to write a simple server using the Ecore_Con library. -*/ - -/** -@example con_client_example.c -Shows how to write a simple client, that connects to the example server. -*/ - -/** -@example event_handler_example.c -Shows how to use event handlers. -*/ - -/** -@example timer_example.c -Demonstrates use of the ecore_timer. -*/ - -/** -@example config_basic_example.c -Provides an example of how to use the basic configuration functions. -See the file Ecore_Config.h for the full list of available functions. -*/ - -/** -@example config_listener_example.c -Shows how to set up a listener to listen for configuration changes. -*/ - -/** -@example list_example.c -Provides a basic example of how to append to and traverse a list. -*/ - -/** -@example list_destroy_example.c -Shows how to set and use a destructor for an Ecore_List. -*/ - -/** -@example x_window_example.c -Shows the basics of using the X Windows system through Ecore functions. -*/ diff --git a/gendoc b/gendoc deleted file mode 100755 index e3293c1..0000000 --- a/gendoc +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -rm -rf ./doc/html ./doc/latex ./doc/man -mkdir -p ./doc/html ./doc/latex ./doc/man 2>/dev/null -doxygen -cp doc/img/*.png doc/html/ -cp doc/img/*.gif doc/html/ -rm -f ecore_docs.tar ecore_docs.tar.gz -tar -cvf ecore_docs.tar doc/html doc/man doc/latex -gzip -9 ecore_docs.tar -exit 0 diff --git a/src/.cvsignore b/src/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/bin/.cvsignore b/src/bin/.cvsignore deleted file mode 100644 index 79fccac..0000000 --- a/src/bin/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -ecore_config -ecore_evas_test -ecore_test -ecore_dbus_test -ecore_dbus_hal_test -ecore_dbus_receiver_test diff --git a/src/lib/.cvsignore b/src/lib/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/src/lib/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/lib/ecore_desktop/.cvsignore b/src/lib/ecore_desktop/.cvsignore deleted file mode 100644 index 09980ae..0000000 --- a/src/lib/ecore_desktop/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/src/lib/ecore_desktop/Ecore_Desktop.h b/src/lib/ecore_desktop/Ecore_Desktop.h deleted file mode 100644 index 825e4e9..0000000 --- a/src/lib/ecore_desktop/Ecore_Desktop.h +++ /dev/null @@ -1,281 +0,0 @@ -#ifndef _ECORE_DESKTOP_H -# define _ECORE_DESKTOP_H - -#include -#include - -/** - * @file Ecore_Desktop.h - * @brief The file that provides the freedesktop.org desktop, icon, and menu - * functions. - * - * This header provides the Ecore_Desktop freedesktop.org desktop, icon, - * and menu handling functions, as well as ancillary functions for searching - * freedesktop.org specific paths. Other freedesktop.org specifications - * make use of similar files, paths, and icons, implementors can use / extend - * this code to suit. - * - * Ecore_Desktop is not for every freedesktop.org specification, just those that - * are associated with .desktop files. - * - * For path searching details, see @ref Ecore_Desktop_Paths_Group. - * - * For desktop file details, see @ref Ecore_Desktop_Main_Group. - * - * For icon theme details, see @ref Ecore_Desktop_Icon_Group. - * - * For menu file details, see @ref Ecore_Desktop_Menu_Group. - */ - -struct _Ecore_Desktop -{ - /* FIXME: Do the ECORE_MAGIC thing here. - * While this might help with segfaults and such, I think it's a waste of - * space and cycles that just covers up bugs. On the other hand, it makes - * for a more robust library, and it's used everywhere else in ecore. - */ - Ecore_Hash *data, *group, *Categories, *OnlyShowIn, *NotShowIn, *MimeTypes, *Actions; - char *original_path; - char *original_lang; - char *eap_name; - char *name; - char *generic; - char *comment; - char *type; - char *categories; - char *exec; - char *exec_params; - char *icon_class; - char *icon_theme; - char *icon; - char *icon_path; - time_t icon_time; /* For checking if the icon cache is valid. */ - char *path; - char *URL; - char *file; - char *deletiondate; - char *window_class; /* window class */ - char *window_name; /* window name */ - char *window_title; /* window title */ - char *window_role; /* window role */ - unsigned char wait_exit:1; /* wait for app to exit before execing next */ - unsigned char startup:1; - unsigned char hidden:1; - unsigned char no_display:1; - unsigned char allocated:1; - unsigned char ondisk:1; - unsigned char hard_icon:1; - /* Actually calling this st_mtime causes compile issues, must be some strange macros at work. */ - time_t mtime; /* For checking if the cache is valid. */ -}; -typedef struct _Ecore_Desktop Ecore_Desktop; - -struct _Ecore_Desktop_Icon_Theme -{ - Ecore_Hash *data, *group; - Ecore_List *Inherits; - Ecore_List *Directories; - char *path; - char *name; - char *comment; - char *example; - char *example_path; - char *inherits; - char *directories; - int hidden; - unsigned char hicolor:1; - /* Actually calling this st_mtime causes compile issues, must be some strange macros at work. */ - time_t mtime; /* For checking if the cache is valid. */ - double last_checked; -}; -typedef struct _Ecore_Desktop_Icon_Theme Ecore_Desktop_Icon_Theme; - -struct _Ecore_Desktop_Icon_Theme_Directory -{ - Ecore_Hash *icons; - char *path; - char *full_path; - char *type; - int size, minimum, maximum, threshold; -}; -typedef struct _Ecore_Desktop_Icon_Theme_Directory - Ecore_Desktop_Icon_Theme_Directory; - -enum _Ecore_Desktop_Paths_Type -{ - ECORE_DESKTOP_PATHS_CONFIG = 0, - ECORE_DESKTOP_PATHS_MENUS = 1, - ECORE_DESKTOP_PATHS_DIRECTORIES = 2, - ECORE_DESKTOP_PATHS_DESKTOPS = 3, - ECORE_DESKTOP_PATHS_ICONS = 4, - ECORE_DESKTOP_PATHS_KDE_LEGACY = 5, - ECORE_DESKTOP_PATHS_XSESSIONS = 6, - ECORE_DESKTOP_PATHS_MAX = 7 -}; -typedef enum _Ecore_Desktop_Paths_Type Ecore_Desktop_Paths_Type; - -enum _Ecore_Desktop_Tree_Element_Type -{ - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL = 0, - ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING = 1, - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE = 2, - ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH = 3 -}; -typedef enum _Ecore_Desktop_Tree_Element_Type Ecore_Desktop_Tree_Element_Type; - -struct _Ecore_Desktop_Tree_Element -{ - void *element; /* A pointer to the element. */ - Ecore_Desktop_Tree_Element_Type type; /* The type of the element. */ -}; -typedef struct _Ecore_Desktop_Tree_Element Ecore_Desktop_Tree_Element; - -typedef struct _Ecore_Desktop_Tree Ecore_Desktop_Tree; -struct _Ecore_Desktop_Tree -{ - Ecore_Desktop_Tree_Element *elements; /* An array of elements. */ - int size; /* The size of the array. */ - char **buffers; /* An array of pointers to the bits of data. */ - int buffers_size; /* The size of the array. */ - Ecore_Desktop_Tree *parent; /* Parent if this is a child. */ -}; - -struct _Ecore_Desktop_Instrumentation -{ - double desktops_time; - double desktops_in_cache_time; - double desktops_not_found_time; - double icons_time; - double icons_in_cache_time; - double icons_not_found_time; - int desktops; - int desktops_in_cache; - int desktops_not_found; - int icons; - int icons_in_cache; - int icons_not_found; -}; - - -# ifdef __cplusplus -extern "C" -{ -# endif - - /* Function Prototypes */ - EAPI int ecore_desktop_paths_init(void); - EAPI void ecore_desktop_paths_extras_clear(void); - EAPI void ecore_desktop_paths_prepend_user(Ecore_Desktop_Paths_Type - type, const char *paths); - EAPI void - ecore_desktop_paths_prepend_system(Ecore_Desktop_Paths_Type type, - const char *paths); - EAPI void ecore_desktop_paths_append_user(Ecore_Desktop_Paths_Type - type, const char *paths); - EAPI void - ecore_desktop_paths_append_system(Ecore_Desktop_Paths_Type type, - const char *paths); - EAPI void ecore_desktop_paths_regen(void); - char *ecore_desktop_paths_file_find(Ecore_List * paths, - const char *file, int sub, - int (*func) (void - *data, - const char - *path), - void *data); - EAPI int ecore_desktop_paths_for_each(Ecore_Desktop_Paths_Type - type, - Ecore_For_Each function, - void *user_data); - char *ecore_desktop_paths_recursive_search(const char *path, - const char *file, - int sub, - int (*dir_func) - (void *data, - const char *path), - int (*func) (void - *data, - const - char - *path), - void *data); - EAPI int ecore_desktop_paths_shutdown(void); - - Ecore_Hash *ecore_desktop_paths_to_hash(const char *paths); - Ecore_List *ecore_desktop_paths_to_list(const char *paths); - - EAPI int ecore_desktop_init(void); - EAPI int ecore_desktop_shutdown(void); - Ecore_Hash *ecore_desktop_ini_get(const char *file); - Ecore_Desktop *ecore_desktop_get(const char *file, const char *lang); - void ecore_desktop_save(Ecore_Desktop * desktop); - EAPI Ecore_List *ecore_desktop_get_command(Ecore_Desktop * desktop, - Ecore_List * files, int fill); - EAPI char *ecore_desktop_merge_command(char *exec, char *params); - void ecore_desktop_destroy(Ecore_Desktop * desktop); - - EAPI int ecore_desktop_icon_init(void); - EAPI int ecore_desktop_icon_shutdown(void); - EAPI char *ecore_desktop_icon_find(const char *icon, - const char *icon_size, - const char *icon_theme); - - Ecore_Hash *ecore_desktop_icon_theme_list(void); - Ecore_Desktop_Icon_Theme *ecore_desktop_icon_theme_get(const char *file, - const char *lang); - void ecore_desktop_icon_theme_destroy(Ecore_Desktop_Icon_Theme - * icon_theme); - - EAPI void - ecore_desktop_menu_for_each(void (*func) - (const char *name, const char *path, const char *directory, Ecore_Hash * apps)); - Ecore_Desktop_Tree *ecore_desktop_menu_get(char *file); - - Ecore_Desktop_Tree *ecore_desktop_tree_new(char *buffer); - Ecore_Desktop_Tree *ecore_desktop_tree_add(Ecore_Desktop_Tree * tree, - const char *element); - void ecore_desktop_tree_track(Ecore_Desktop_Tree * tree, - void *element); - Ecore_Desktop_Tree *ecore_desktop_tree_extend(Ecore_Desktop_Tree * tree, - const char *element); - Ecore_Desktop_Tree *ecore_desktop_tree_insert(Ecore_Desktop_Tree * tree, - int before, void *element, - Ecore_Desktop_Tree_Element_Type - type); - Ecore_Desktop_Tree *ecore_desktop_tree_merge(Ecore_Desktop_Tree * tree, - int before, - Ecore_Desktop_Tree * element); - Ecore_Desktop_Tree *ecore_desktop_tree_add_child(Ecore_Desktop_Tree * tree, - Ecore_Desktop_Tree * - element); - Ecore_Desktop_Tree *ecore_desktop_tree_add_hash(Ecore_Desktop_Tree * tree, - Ecore_Hash * element); - void ecore_desktop_tree_remove(Ecore_Desktop_Tree * tree, - int element); - int ecore_desktop_tree_exist(Ecore_Desktop_Tree * tree, - char *element); - int ecore_desktop_tree_foreach(Ecore_Desktop_Tree * tree, - int level, - int (*func) (const void *data, - Ecore_Desktop_Tree - * tree, - int element, - int level), - const void *data); - void ecore_desktop_tree_dump(Ecore_Desktop_Tree * tree, - int level); - void ecore_desktop_tree_del(Ecore_Desktop_Tree * tree); - - Ecore_Desktop_Tree *ecore_desktop_xmlame_new(char *buffer); - Ecore_Desktop_Tree *ecore_desktop_xmlame_get(char *file); - - char *ecore_desktop_home_get(void); - - EAPI void ecore_desktop_instrumentation_reset(void); - EAPI void ecore_desktop_instrumentation_print(void); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/src/lib/ecore_desktop/Makefile.am b/src/lib/ecore_desktop/Makefile.am deleted file mode 100644 index 99ae460..0000000 --- a/src/lib/ecore_desktop/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = \ --I$(top_srcdir)/src/lib/ecore \ --I$(top_builddir)/src/lib/ecore_file \ --I$(top_builddir)/src/lib/ecore_desktop \ --I$(top_builddir)/src/lib/ecore \ --I$(top_srcdir)/src/lib/ecore_file \ --I$(top_srcdir)/src/lib/ecore_desktop - -if BUILD_ECORE_DESKTOP - -lib_LTLIBRARIES = libecore_desktop.la -include_HEADERS = \ -Ecore_Desktop.h - -libecore_desktop_la_SOURCES = \ -ecore_desktop.c \ -ecore_desktop_tree.c \ -ecore_desktop_icon.c \ -ecore_desktop_menu.c \ -ecore_desktop_paths.c \ -ecore_desktop_xmlame.c \ -ecore_desktop_private.h - -libecore_desktop_la_LIBADD = \ -$(top_builddir)/src/lib/ecore/libecore.la \ -$(top_builddir)/src/lib/ecore_file/libecore_file.la - -libecore_desktop_la_LDFLAGS = -version-info @version_info@ - -libecore_desktop_la_DEPENDENCIES = \ -$(top_builddir)/src/lib/ecore/libecore.la \ -$(top_builddir)/src/lib/ecore_file/libecore_file.la - -endif - -EXTRA_DIST = \ -Ecore_Desktop.h \ -ecore_desktop.c \ -ecore_desktop_tree.c \ -ecore_desktop_icon.c \ -ecore_desktop_menu.c \ -ecore_desktop_paths.c \ -ecore_desktop_xmlame.c \ -ecore_desktop_private.h diff --git a/src/lib/ecore_desktop/ecore_desktop.c b/src/lib/ecore_desktop/ecore_desktop.c deleted file mode 100644 index 33a52c7..0000000 --- a/src/lib/ecore_desktop/ecore_desktop.c +++ /dev/null @@ -1,1195 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ - -#include "Ecore_Desktop.h" -#include "ecore_desktop_private.h" - -#include -#include - -struct _Ecore_Desktop_Instrumentation instrumentation; - -extern int reject_count, not_over_count; - -static int init_count = 0; - -static Ecore_Hash *desktop_cache; - -Ecore_Desktop *_ecore_desktop_get(const char *file, const char *lang); -void _ecore_desktop_destroy(Ecore_Desktop * desktop); - -#define IFGETDUP(src, key, dst) src = (char *)ecore_hash_get(result->group, key); if (src) dst = strdup(src); else dst = NULL; -#define IFFREE(src) if (src) free(src); src = NULL; - -/** - * @defgroup Ecore_Desktop_Main_Group .desktop file Functions - * - * Functions that deal with freedesktop.org desktop files. - * - * This conforms with the freedesktop.org XDG Desktop Entry Specification version 0.9.4 - */ - -/** - * Get the contents of a .ini style file. - * - * The Ecore_Hash returned is a two level hash, the first level - * is the groups in the file, one per group, keyed by the name - * of that group. The value of each of those first level hashes - * is the second level Ecore_Hash, the contents of each group. - * - * @param file Full path to the .ini style file. - * @return An Ecore_Hash of the files contents. - * @ingroup Ecore_Desktop_Main_Group - */ -Ecore_Hash * -ecore_desktop_ini_get(const char *file) -{ - Ecore_Hash *result; - FILE *f; - char buffer[PATH_MAX]; - Ecore_Hash *current = NULL; - - result = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (!result) return NULL; - - f = fopen(file, "r"); - if (!f) - { - fprintf(stderr, "ERROR: Cannot Open File %s\n", file); - ecore_hash_destroy(result); - return NULL; - } - ecore_hash_free_key_cb_set(result, free); - ecore_hash_free_value_cb_set(result, (Ecore_Free_Cb) ecore_hash_destroy); - *buffer = '\0'; -#ifdef DEBUG - fprintf(stdout, "PARSING INI %s\n", file); -#endif - while (fgets(buffer, sizeof(buffer), f) != NULL) - { - char *c; - char *key; - char *value; - - c = buffer; - /* Strip preceeding blanks. Note that \n is treated differently from the other white space. */ - while ((*c == ' ') || (*c == '\t')) - c++; - /* Skip blank lines and comments */ - if ((*c == '\0') || (*c == '\n') || (*c == '#')) continue; - if (*c == '[') /* New group. */ - { - key = c + 1; - while ((*c != ']') && (*c != '\n') && (*c != '\0')) - c++; - *c++ = '\0'; - current = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (current) - { - ecore_hash_free_key_cb_set(current, free); - ecore_hash_free_value_cb_set(current, free); - ecore_hash_set(result, strdup(key), current); -#ifdef DEBUG - fprintf(stdout, " GROUP [%s]\n", key); -#endif - } - } - else if (current) /* key=value pair of current group. */ - { - char *tv; - - key = c; - /* Find trailing blanks or =. */ - while ((*c != '=') && (*c != ' ') && (*c != '\t') && (*c != '\n') && (*c != '\0')) - c++; - if (*c != '=') /* Find equals. */ - { - *c++ = '\0'; - while ((*c != '=') && (*c != '\n') && (*c != '\0')) - c++; - } - if (*c == '=') /* Equals found. */ - { - *c++ = '\0'; - /* Strip preceeding blanks. Note that \n is treated differently from the other white space. */ - while ((*c == ' ') || (*c == '\t')) - c++; - value = c; - /* Find end. */ - while ((*c != '\n') && (*c != '\0')) - c++; - *c++ = '\0'; - /* FIXME: should strip space at end, then unescape value. */ - tv = ecore_hash_remove(current, key); - if (tv) free(tv); - if (value[0] != '\0') - ecore_hash_set(current, strdup(key), strdup(value)); -#ifdef DEBUG - fprintf(stdout, " %s=%s\n", key, value); -#endif - } - } - - } - - fclose(f); - return result; -} - -/** - * Get the contents of a .desktop file. - * - * Use ecore_desktop_destroy() to free this structure. - * - * @param file Full path to the .desktop file. - * @param lang Language to use, or NULL for default. - * @return An Ecore_Desktop containing the files contents. - * @ingroup Ecore_Desktop_Main_Group - */ -Ecore_Desktop * -ecore_desktop_get(const char *file, const char *lang) -{ - Ecore_Desktop *result; - - result = _ecore_desktop_get(file, lang); - if (result) - { - /* Kill the hash, it takes up way too much memory. */ - if (result->data) - { - ecore_hash_destroy(result->data); - result->data = NULL; - } - result->group = NULL; - } - - return result; -} - -Ecore_Desktop * -_ecore_desktop_get(const char *file, const char *lang) -{ - Ecore_Desktop *result; - struct stat st; - char *value; - int stated = 0; - int in_cache = 0; - double begin; - - begin = ecore_time_get(); - result = (Ecore_Desktop *) ecore_hash_get(desktop_cache, (char *)file); - /* Check if the cache is still valid. */ - if (result) - { - in_cache = 1; - if (stat(result->original_path, &st) >= 0) - { - if (st.st_mtime > result->mtime) - { - ecore_hash_remove(desktop_cache, result->original_path); - result = NULL; - } - stated = 1; - } - } - /* Not in cache, get it the slow way. */ - if (!result) - { - result = calloc(1, sizeof(Ecore_Desktop)); - if (!result) goto error; - result->ondisk = 1; - result->original_path = strdup(file); - if (lang) - result->original_lang = strdup(lang); - result->data = ecore_desktop_ini_get(result->original_path); - if (!result->data) - { - IFFREE(result->original_path); - IFFREE(result->original_lang); - free(result); - result = NULL; - goto error; - } - /* Timestamp the cache, and no need to stat the file twice if the cache was stale. */ - if ((stated) || (stat(result->original_path, &st) >= 0)) - result->mtime = st.st_mtime; - result->group = ecore_hash_get(result->data, "Desktop Entry"); - if (!result->group) - result->group = ecore_hash_get(result->data, "KDE Desktop Entry"); - /* This is a "Desktop" file, probably an application. */ - if (result->group) - { - int size = 0; - - value = (char *) ecore_file_file_get(result->original_path); - /* Figure out the eap_name. */ - if (value) - { - char *temp; - - temp = strrchr(value, '.'); - - if (temp) *temp = '\0'; - result->eap_name = malloc(strlen(value) + 5); - if (result->eap_name) - sprintf(result->eap_name, "%s.edj", value); - if (temp) *temp = '.'; - } - - IFGETDUP(value, "Name", result->name); - IFGETDUP(value, "GenericName", result->generic); - IFGETDUP(value, "Comment", result->comment); - IFGETDUP(value, "Type", result->type); - - IFGETDUP(value, "Path", result->path); - IFGETDUP(value, "URL", result->URL); - IFGETDUP(value, "File", result->file); - - IFGETDUP(value, "Exec", result->exec); - /* Seperate out the params. */ - if (result->exec) - { - char *exe = NULL; - - exe = strchr(result->exec, ' '); - if (exe) - { - *exe = '\0'; - exe++; - /* trim the parameter string */ - for(; isspace(*exe) && ((exe - result->exec) < PATH_MAX) && (*exe != '\0'); exe++); - if(*exe != '\0') - result->exec_params = strdup(exe); - } - } - - IFGETDUP(value, "StartupWMClass", result->window_class); - /* Guess a window class - exe name with first letter capitalized. */ - if ((!value) && (result->exec)) - { - char *tmp; - - tmp = strdup(result->exec); - if (tmp) - { - char *p; - - value = (char *)ecore_file_file_get(tmp); /* In case the exe included a path. */ - p = value; - while ((*p != '\0') && (*p != ' ')) - { - *p = tolower(*p); - p++; - } - *p = '\0'; - *value = toupper(*value); - result->window_class = strdup(value); - free(tmp); - } - } - IFGETDUP(value, "X-Enlightenment-WindowName", result->window_name); - IFGETDUP(value, "X-Enlightenment-WindowTitle", result->window_title); - IFGETDUP(value, "X-Enlightenment-WindowRole", result->window_role); - - IFGETDUP(value, "Categories", result->categories); - if (result->categories) - result->Categories = - ecore_desktop_paths_to_hash(result->categories); - IFGETDUP(value, "Icon", result->icon); - IFGETDUP(value, "X-Enlightenment-IconTheme", result->icon_theme); - IFGETDUP(value, "X-Enlightenment-IconClass", result->icon_class); - IFGETDUP(value, "X-Enlightenment-IconPath", result->icon_path); - - /* If the icon is a path put the full path into the icon_path member.*/ - if ((result->icon != NULL) && (result->icon_path == NULL) && - (strchr(result->icon, '/') != NULL)) - { - if (result->icon[0] == '/') - { - result->icon_path = strdup(result->icon); - } - else /* It's a relative path. */ - { - char *temp; - - size = - strlen(result->original_path) + - strlen(result->icon) + 2; - temp = malloc(size); - if (temp) - { - char *dir; - - dir = - ecore_file_dir_get(result->original_path); - if (dir) - { - sprintf(temp, "%s/%s", dir, result->icon); - result->icon_path = - ecore_file_realpath(temp); - free(dir); - } - free(temp); - } - } - result->hard_icon = 1; - } - - if ((result->icon_theme == NULL) && (result->icon_path != NULL)) - result->hard_icon = 1; - - /* icon/class is a list of standard icons from the theme that can override the icon created above. - * Use (from .desktop) name.edj,exec,categories. It's case sensitive, the reccomendation is to lowercase it. - * It should be most specific to most generic. firefox,browser,internet for instance - * If the icon in the file is not a full path, just put it first in the class, greatly simplifies things later - * when it's time to do the search. - */ - if (!result->icon_class) - { - size = 0; - if ((result->icon) && (strchr(result->icon, '/') == NULL)) - size += strlen(result->icon) + 1; - if (result->eap_name) - size += strlen(result->eap_name) + 1; - if (result->exec) - size += strlen(result->exec) + 1; - if (result->categories) - size += strlen(result->categories) + 1; - result->icon_class = malloc(size + 1); - if (result->icon_class) - { - char *p; - int done = 0; - - result->icon_class[0] = '\0'; - if ((result->icon) && (strchr(result->icon, '/') == NULL) && - (result->icon[0] != '\0')) - { - strcat(result->icon_class, result->icon); - done = 1; - } - /* We do this here coz we don't want to lower case the result->icon part later. */ - p = result->icon_class; - p += strlen(result->icon_class); - if ((result->eap_name) && (result->eap_name[0] != '\0')) - { - if (done) - strcat(result->icon_class, ","); - strcat(result->icon_class, result->eap_name); - done = 1; - } - if ((result->exec) && (result->exec[0] != '\0')) - { - char *tmp; - - tmp = strdup(ecore_file_file_get(result->exec)); - if (tmp) - { - char *p2; - - p2 = tmp; - while (*p2 != '\0') - { - if (*p2 == ' ') - { - *p2 = '\0'; - break; - } - p2++; - } - if (done) - strcat(result->icon_class, ","); - strcat(result->icon_class, tmp); - done = 1; - free(tmp); - } - } - if ((result->categories) && (result->categories[0] != '\0')) - { - if (done) - strcat(result->icon_class, ","); - strcat(result->icon_class, result->categories); - done = 1; - } - while (*p != '\0') - { - if (*p == ';') - *p = ','; - else - *p = tolower(*p); - p++; - } - if (result->icon_class[0] == '\0') - { - free(result->icon_class); - result->icon_class = NULL; - } - } - } - - value = ecore_hash_get(result->group, "MimeType"); - if (value) - result->MimeTypes = - ecore_desktop_paths_to_hash(value); - value = ecore_hash_get(result->group, "Actions"); - if (value) - result->Actions = - ecore_desktop_paths_to_hash(value); - value = ecore_hash_get(result->group, "OnlyShowIn"); - if (value) - result->OnlyShowIn = - ecore_desktop_paths_to_hash(value); - value = ecore_hash_get(result->group, "NotShowIn"); - if (value) - result->NotShowIn = - ecore_desktop_paths_to_hash(value); - value = ecore_hash_get(result->group, "X-KDE-StartupNotify"); - if (value) - result->startup = (strcmp(value, "true") == 0); - value = ecore_hash_get(result->group, "StartupNotify"); - if (value) - result->startup = (strcmp(value, "true") == 0); - value = ecore_hash_get(result->group, "X-Enlightenment-WaitExit"); - if (value) - result->wait_exit = (strcmp(value, "true") == 0); - value = ecore_hash_get(result->group, "NoDisplay"); - if (value) - result->no_display = (strcmp(value, "true") == 0); - value = ecore_hash_get(result->group, "Hidden"); - if (value) - result->hidden = (strcmp(value, "true") == 0); - } - else - { - /*Maybe it's a 'trash' file - which also follows the Desktop FDO spec */ - result->group = ecore_hash_get(result->data, "Trash Info"); - if (result->group) - { - IFGETDUP(value, "Path", result->path); - IFGETDUP(value, "DeletionDate", - result->deletiondate); - } - } - - /* Final sanity check. */ - if ((result->data) && (!result->group)) - { - _ecore_desktop_destroy(result); - result = NULL; - } - else - ecore_hash_set(desktop_cache, strdup(result->original_path), result); - } - -error: - if (result) - { - if (in_cache) - { - instrumentation.desktops_in_cache_time += ecore_time_get() - begin; - instrumentation.desktops_in_cache++; - } - else - { - instrumentation.desktops_time += ecore_time_get() - begin; - instrumentation.desktops++; - } - } - else - { - instrumentation.desktops_not_found_time += ecore_time_get() - begin; - instrumentation.desktops_not_found++; - } - return result; -} - -void -ecore_desktop_save(Ecore_Desktop * desktop) -{ - Ecore_List *commands; - char *temp; - int trash = 0; - - if (!desktop->group) - { - if ((desktop->ondisk) && (desktop->original_path)) - { - desktop->data = ecore_desktop_ini_get(desktop->original_path); - desktop->group = - (Ecore_Hash *) ecore_hash_get(desktop->data, "Desktop Entry"); - if (!desktop->group) - desktop->group = - (Ecore_Hash *) ecore_hash_get(desktop->data, - "KDE Desktop Entry"); - if (!desktop->group) - { - trash = 1; - desktop->group = - (Ecore_Hash *) ecore_hash_get(desktop->data, "Trash Info"); - } - } - else - { - desktop->group = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (desktop->group) - { - ecore_hash_free_key_cb_set(desktop->group, free); - ecore_hash_free_value_cb_set(desktop->group, free); - } - } - } - - if (desktop->group) - { - if (desktop->original_path) - { - struct stat st; - - if (stat(desktop->original_path, &st) >= 0) - { - char *real; - - real = ecore_file_readlink(desktop->original_path); - if (real) - ecore_hash_set(desktop->group, - strdup("X-Enlightenment-OriginalPath"), - real); - } - } - - /* We are not passing a list of files, so we only expect one command. */ - commands = ecore_desktop_get_command(desktop, NULL, 0); - if (commands) - { - temp = ecore_list_first(commands); - if (temp) - ecore_hash_set(desktop->group, strdup("Exec"), strdup(temp)); - ecore_list_destroy(commands); - } - - if (desktop->name) - ecore_hash_set(desktop->group, strdup("Name"), - strdup(desktop->name)); - if (desktop->generic) - ecore_hash_set(desktop->group, strdup("GenericName"), - strdup(desktop->generic)); - if (desktop->comment) - ecore_hash_set(desktop->group, strdup("Comment"), - strdup(desktop->comment)); - if (desktop->type) - ecore_hash_set(desktop->group, strdup("Type"), - strdup(desktop->type)); - if (desktop->URL) - ecore_hash_set(desktop->group, strdup("URL"), strdup(desktop->URL)); - if (desktop->file) - ecore_hash_set(desktop->group, strdup("File"), - strdup(desktop->file)); - if (desktop->icon) - ecore_hash_set(desktop->group, strdup("Icon"), - strdup(desktop->icon)); - if (desktop->icon_theme) - ecore_hash_set(desktop->group, strdup("X-Enlightenment-IconTheme"), - strdup(desktop->icon_theme)); - else - ecore_hash_remove(desktop->group, "X-Enlightenment-IconTheme"); - if (desktop->icon_class) - ecore_hash_set(desktop->group, strdup("X-Enlightenment-IconClass"), - strdup(desktop->icon_class)); - else - ecore_hash_remove(desktop->group, "X-Enlightenment-IconClass"); - if (desktop->icon_path) - ecore_hash_set(desktop->group, strdup("X-Enlightenment-IconPath"), - strdup(desktop->icon_path)); - else - ecore_hash_remove(desktop->group, "X-Enlightenment-IconPath"); - if (desktop->window_class) - ecore_hash_set(desktop->group, strdup("StartupWMClass"), - strdup(desktop->window_class)); - if (desktop->categories) - ecore_hash_set(desktop->group, strdup("Categories"), - strdup(desktop->categories)); - if (desktop->window_name) - ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowName"), - strdup(desktop->window_name)); - else - ecore_hash_remove(desktop->group, "X-Enlightenment-WindowName"); - if (desktop->window_title) - ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowTitle"), - strdup(desktop->window_title)); - else - ecore_hash_remove(desktop->group, "X-Enlightenment-WindowTitle"); - if (desktop->window_role) - ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowRole"), - strdup(desktop->window_role)); - else - ecore_hash_remove(desktop->group, "X-Enlightenment-WindowRole"); - ecore_hash_remove(desktop->group, "X-KDE-StartupNotify"); - if (desktop->wait_exit) - ecore_hash_set(desktop->group, strdup("X-Enlightenment-WaitExit"), - strdup("true")); - else - ecore_hash_remove(desktop->group, "X-Enlightenment-WaitExit"); - if (desktop->startup) - ecore_hash_set(desktop->group, strdup("StartupNotify"), - strdup("true")); - else - ecore_hash_remove(desktop->group, "StartupNotify"); - if (desktop->no_display) - ecore_hash_set(desktop->group, strdup("NoDisplay"), strdup("true")); - else - ecore_hash_remove(desktop->group, "NoDisplay"); - if (desktop->hidden) - ecore_hash_set(desktop->group, strdup("Hidden"), strdup("true")); - else - ecore_hash_remove(desktop->group, "Hidden"); - - /* FIXME: deal with the ShowIn's and mime stuff. */ - - if (desktop->path) - ecore_hash_set(desktop->group, strdup("Path"), - strdup(desktop->path)); - if (desktop->deletiondate) - ecore_hash_set(desktop->group, strdup("DeletionDate"), - strdup(desktop->deletiondate)); - - if (desktop->original_path) - { - FILE *f; - Ecore_List *list; - char *key; - - ecore_file_unlink(desktop->original_path); - f = fopen(desktop->original_path, "wb"); - list = ecore_hash_keys(desktop->group); - if ((!f) || (!list)) - return; - - if (trash) - fprintf(f, "[Trash Info]\n"); - else - fprintf(f, "[Desktop Entry]\n"); - ecore_list_first_goto(list); - while ((key = (char *)ecore_list_next(list))) - { - char *value; - - value = (char *)ecore_hash_get(desktop->group, key); - if ((value) && (value[0] != '\0')) - fprintf(f, "%s=%s\n", key, value); - } - fclose(f); - } - - if (desktop->data) - { - ecore_hash_destroy(desktop->data); - desktop->data = NULL; - } - else - ecore_hash_destroy(desktop->group); - desktop->group = NULL; - } -} - -/** - * Setup what ever needs to be setup to support Ecore_Desktop. - * - * There are internal structures that are needed for Ecore_Desktop - * functions to operate, this sets them up. - * - * @ingroup Ecore_Desktop_Main_Group - */ -EAPI int -ecore_desktop_init() -{ - if (++init_count != 1) - return init_count; - - if (!ecore_desktop_paths_init()) - return --init_count; - - if (!desktop_cache) - { - desktop_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (desktop_cache) - { - ecore_hash_free_key_cb_set(desktop_cache, free); - ecore_hash_free_value_cb_set(desktop_cache, - (Ecore_Free_Cb) _ecore_desktop_destroy); - } - } - - if (!ecore_desktop_icon_init()) - return --init_count; - - return init_count; -} - -/** - * Tear down what ever needs to be torn down to support Ecore_Desktop. - * - * There are internal structures that are needed for Ecore_Desktop - * functions to operate, this tears them down. - * - * @ingroup Ecore_Desktop_Main_Group - */ -EAPI int -ecore_desktop_shutdown() -{ - if (--init_count != 0) - return init_count; - - ecore_desktop_icon_shutdown(); - - if (desktop_cache) - { - ecore_hash_destroy(desktop_cache); - desktop_cache = NULL; - } - - ecore_desktop_paths_shutdown(); - - return init_count; -} - -/** - * Free whatever resources are used by an Ecore_Desktop. - * - * There are internal resources used by each Ecore_Desktop - * This releases those resources. - * - * @param desktop An Ecore_Desktop that was previously returned by ecore_desktop_get(). - * @ingroup Ecore_Desktop_Main_Group - */ -void -ecore_desktop_destroy(Ecore_Desktop * desktop) -{ - /* This is just a dummy, because these structures are cached. */ - /* Later versions of the cache may reference count, then this will be useful. */ - desktop = NULL; -} - -void -_ecore_desktop_destroy(Ecore_Desktop * desktop) -{ - IFFREE(desktop->original_path); - IFFREE(desktop->original_lang); - IFFREE(desktop->eap_name); - IFFREE(desktop->name); - IFFREE(desktop->generic); - IFFREE(desktop->comment); - IFFREE(desktop->type); - IFFREE(desktop->exec); - IFFREE(desktop->exec_params); - IFFREE(desktop->categories); - IFFREE(desktop->icon); - IFFREE(desktop->icon_theme); - IFFREE(desktop->icon_class); - IFFREE(desktop->icon_path); - IFFREE(desktop->path); - IFFREE(desktop->URL); - IFFREE(desktop->file); - IFFREE(desktop->deletiondate); - IFFREE(desktop->window_class); - IFFREE(desktop->window_name); - IFFREE(desktop->window_title); - IFFREE(desktop->window_role); - if (desktop->NotShowIn) ecore_hash_destroy(desktop->NotShowIn); - if (desktop->OnlyShowIn) ecore_hash_destroy(desktop->OnlyShowIn); - if (desktop->Categories) ecore_hash_destroy(desktop->Categories); - if (desktop->MimeTypes) ecore_hash_destroy(desktop->MimeTypes); - if (desktop->Actions) ecore_hash_destroy(desktop->Actions); - if (desktop->data) - { - ecore_hash_destroy(desktop->data); - desktop->data = NULL; - } - desktop->group = NULL; - free(desktop); -} - -/** - * Get and massage the users home directory. - * - * This is an internal function that may be useful elsewhere. - * - * @return The users howe directory. - * @ingroup Ecore_Desktop_Main_Group - */ -char * -ecore_desktop_home_get() -{ - char home[PATH_MAX]; - int len; - - /* Get Home Dir, check for trailing '/', strip it */ - if (getenv("HOME")) - strncpy(home, getenv("HOME"), PATH_MAX); - else - strcpy(home, "/"); - len = strlen(home) - 1; - while ((len >= 0) && (home[len] == '/')) - { - home[len] = '\0'; - len--; - } - - return strdup(home); -} - -EAPI Ecore_List * -ecore_desktop_get_command(Ecore_Desktop * desktop, Ecore_List * files, int fill) -{ - Ecore_List *result; - char *sub_result = NULL, *params = NULL; - int is_single = 0, do_file = 0; - - result = ecore_list_new(); - if (!result) return NULL; - ecore_list_free_cb_set(result, free); - - if (desktop->exec_params) - params = strdup(desktop->exec_params); - -#ifdef DEBUG -if (files) - { - char *file; - - ecore_list_first_goto(files); - while((file = ecore_list_next(files)) != NULL) - printf("FILE FOR COMMAND IS - %s\n", file); - } -#endif - - if (files) - ecore_list_first_goto(files); - - /* FIXME: The string handling could be better, but it's good enough for now. */ - do - { - if (fill) - { - Ecore_DList *command; - char *p, buf[PATH_MAX + 10], *big_buf = NULL; - const char *t; - int len = 0; - - command = ecore_dlist_new(); - if (!command) goto error; - - ecore_dlist_free_cb_set(command, free); - /* Grab a fresh copy of the params. The default is %F as per rasters request. */ - if (params) free(params); - if (desktop->exec_params) - params = strdup(desktop->exec_params); - else - params = strdup("%F"); - if (!params) goto error; - /* Split it up. */ - t = params; - for (p = params; *p; p++) - { - if (*p == '%') - { - *p = '\0'; - ecore_dlist_append(command, strdup(t)); - len += strlen(t) + 1; - *p = '%'; - t = p; - } - } - if (t < p) - { - ecore_dlist_append(command, strdup(t)); - len += strlen(t) + 1; - } - free(params); - params = NULL; - t = NULL; - p = NULL; - /* Check the bits for replacables. */ - if (!ecore_dlist_empty_is(command)) - { - ecore_dlist_first_goto(command); - while ((p = ecore_dlist_next(command)) != NULL) - { - int is_URL = 0, is_directory = 0, is_file = 0; - - t = NULL; - do_file = 0; - is_single = 0; - if (p[0] == '%') - switch (p[1]) - { - case 'f': /* Single file name, multiple invokations if multiple files. If the file is on the net, download first and point to temp file. */ - do_file = 1; - is_single = 1; - break; - - case 'u': /* Single URL, multiple invokations if multiple URLs. */ - do_file = 1; - is_single = 1; - is_URL = 1; - break; - - case 'c': /* Translated Name field from .desktop file. */ - t = desktop->name; - break; - - case 'k': /* Location of the .desktop file, may be a URL, or empty. */ - t = desktop->original_path; - break; - - case 'F': /* Multiple file names. If the files are on the net, download first and point to temp files. */ - do_file = 1; - break; - - case 'U': /* Multiple URLs. */ - do_file = 1; - is_URL = 1; - break; - - case 'd': /* Directory of the file in %f. */ - do_file = 1; - is_single = 1; - is_directory = 1; - break; - - case 'D': /* Directories of the files in %F. */ - do_file = 1; - is_directory = 1; - break; - - case 'n': /* Single filename without path. */ - do_file = 1; - is_single = 1; - is_file = 1; - break; - - case 'N': /* Multiple filenames without paths. */ - do_file = 1; - is_file = 1; - break; - - case 'i': /* "--icon Icon" field from .desktop file, or empty. */ - if (desktop->icon) - { - snprintf(buf, sizeof(buf), "--icon %s", desktop->icon); - t = buf; - } - break; - - case 'm': /* Deprecated mini icon, the spec says we can just drop it. */ - break; - - case 'v': /* Device field from .desktop file. */ - break; - - case '%': /* A '%' character. */ - t = "%"; - break; - - default: - break; - } - /* Take care of any file expansions. */ - if (do_file && (files)) - { - char *file; - size_t big_len; - - /* Pre load the big_buf so that the reallocs are quick. WEemight eventually need more than PATH_MAX. */ - big_buf = malloc(PATH_MAX); - big_buf[0] = '\0'; - big_len = 0; - while((file = ecore_list_next(files)) != NULL) - { - char *text = NULL, *escaped = NULL; - - if (is_URL) - { - /* FIXME: The spec is unclear about what they mean by URL, - * GIMP uses %U, but doesn't understand file://foo - * GIMP is also happy if you pass it a raw file name. - * For now, just make this the same as is_file. - */ - text = strdup(file); - } - else if (is_directory) - { - /* FIXME: for onefang - * if filename does not start with ./ or ../ or / then assume it - * is a path relative to cwd i.e. "file.png" or "blah/file.png" and - * thus %d/%D would be ./ implicitly (but may need to be explicit - * in the command line) - */ - text = ecore_file_dir_get(file); - } - else if (is_file) - text = strdup(ecore_file_file_get(file)); - else - { - /* FIXME: If the file is on the net, download - * first and point to temp file. - * - * This I think is the clue to how the whole - * file/url thing is supposed to work. This is - * purely speculation though, and you can get - * into lots of trouble with specs that require - * geussing like this. - * - * %u%U - pass filenames or URLS. - * %f%F - pass filenames, download URLS and pass path to temp file. - * - * WE are not currently getting URLs passed to us anyway. - */ - text = strdup(file); - } - if (text) - { - escaped = ecore_file_escape_name(text); - free(text); - text = NULL; - } - /* Add it to the big buf. */ - if (escaped) - { - big_len += strlen(escaped) + 2; - big_buf = realloc(big_buf, big_len); - strcat(big_buf, " "); - strcat(big_buf, escaped); - t = big_buf; - free(escaped); - escaped = NULL; - } - if (is_single) - break; - } - } - /* Insert this bit into the command. */ - if (t) - { - ecore_dlist_previous(command); - ecore_dlist_insert(command, strdup(t)); - len += strlen(t) + 1; - ecore_dlist_next(command); - ecore_dlist_next(command); - } - if (big_buf) - { - free(big_buf); - big_buf = NULL; - } - } - - /* Put it all together. */ - params = malloc(len + 1); - if (params) - { - params[0] = '\0'; - ecore_dlist_first_goto(command); - while ((p = ecore_dlist_next(command)) != NULL) - { - if (p[0] == '%') - strcat(params, &p[2]); - else - strcat(params, p); - } - } - } - ecore_list_destroy(command); - } - - /* Add the command to the list of commands. */ - /* NOTE: params might be just desktop->exec_params, or it might have been built from bits. */ - sub_result = ecore_desktop_merge_command(desktop->exec, params); - if (sub_result) - { -#ifdef DEBUG - printf("FULL COMMAND IS - %s\n", sub_result); -#endif - ecore_list_append(result, sub_result); - } - /* If there is any "single file" things to fill in, and we have more files, - * go back and do it all again for the next file. - */ - } - while((do_file) && (is_single) && (fill) && (files) && (ecore_list_current(files))); - -error: - if (params) free(params); - return result; -} - -EAPI char * -ecore_desktop_merge_command(char *exec, char *params) -{ - int size; - char *end, *result = NULL; - - if ((exec) && (params)) - { - size = strlen(exec); - end = exec + size; - /* Two possibilities, it was just split at the space, or it was setup seperatly. */ - if (params == (end + 1)) - { - *end = ' '; - result = strdup(exec); - *end = '\0'; - } - else - { - size += strlen(params) + 2; - result = malloc(size); - if (result) - sprintf(result, "%s %s", exec, params); - } - } - else if (exec) - result = strdup(exec); - - return result; -} - -EAPI void -ecore_desktop_instrumentation_reset(void) -{ - instrumentation.desktops = 0; - instrumentation.desktops_in_cache = 0; - instrumentation.desktops_not_found = 0; - instrumentation.icons = 0; - instrumentation.icons_in_cache = 0; - instrumentation.icons_not_found = 0; - instrumentation.desktops_time = 0.0; - instrumentation.desktops_in_cache_time = 0.0; - instrumentation.desktops_not_found_time = 0.0; - instrumentation.icons_time = 0.0; - instrumentation.icons_in_cache_time = 0.0; - instrumentation.icons_not_found_time = 0.0; -#ifdef DEBUG - printf("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n"); - printf("Desktop instrumentation reset.\n"); - printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); -#endif -} - -EAPI void -ecore_desktop_instrumentation_print(void) -{ -#ifdef DEBUG - if ((instrumentation.desktops + instrumentation.desktops_in_cache + instrumentation.desktops_not_found + instrumentation.icons + instrumentation.icons_in_cache + instrumentation.icons_not_found) > 0) - { - printf("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n"); - printf(" Found %5d desktops %2.5f (%2.6f/desktop)\n", instrumentation.desktops, instrumentation.desktops_time, instrumentation.desktops_time / instrumentation.desktops); - printf(" Found %5d desktops in cache %2.5f (%2.6f/desktop)\n", instrumentation.desktops_in_cache, instrumentation.desktops_in_cache_time, instrumentation.desktops_in_cache_time / instrumentation.desktops_in_cache); - printf("Not found %5d desktops %2.5f (%2.6f/desktop)\n", instrumentation.desktops_not_found, instrumentation.desktops_not_found_time, instrumentation.desktops_not_found_time / instrumentation.desktops_not_found); - printf(" Found %5d icons %2.5f (%2.6f/icon)\n", instrumentation.icons, instrumentation.icons_time, instrumentation.icons_time / instrumentation.icons); - printf(" Found %5d icons in cache %2.5f (%2.6f/icon)\n", instrumentation.icons_in_cache, instrumentation.icons_in_cache_time, instrumentation.icons_in_cache_time / instrumentation.icons_in_cache); - printf("Not found %5d icons %2.5f (%2.6f/icon)\n", instrumentation.icons_not_found, instrumentation.icons_not_found_time, instrumentation.icons_not_found_time / instrumentation.icons_not_found); - printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); - } -#endif -} diff --git a/src/lib/ecore_desktop/ecore_desktop_icon.c b/src/lib/ecore_desktop/ecore_desktop_icon.c deleted file mode 100644 index 618e3c8..0000000 --- a/src/lib/ecore_desktop/ecore_desktop_icon.c +++ /dev/null @@ -1,714 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ -#include -#include - -#include "Ecore_Desktop.h" -#include "ecore_desktop_private.h" -#include "ecore_private.h" - -//#define DEBUG 1 - -static char *_ecore_desktop_icon_find0(const char *icon, - const char *icon_size, - const char *icon_theme, - int *in_cache); - -static int _ecore_desktop_icon_theme_list_add(void *data, - const char *path); -static void _ecore_desktop_icon_theme_destroy(Ecore_Desktop_Icon_Theme * - icon_theme); -static void -_ecore_desktop_icon_theme_directory_destroy(Ecore_Desktop_Icon_Theme_Directory * - icon_theme_directory); -static inline void -_ecore_desktop_icon_theme_cache_check(Ecore_Desktop_Icon_Theme *icon_theme); - -/* FIXME: We need a way for the client to disable searching for any of these that they don't support. */ -static const char *ext[] = - { "", ".edj", ".png", ".svgz", ".svg", ".xpm", NULL }; /* "" is in case the icon already has an extension, search for that first. */ -static int init_count = 0; -static Ecore_Hash *icon_theme_cache = NULL; - -/** - * @defgroup Ecore_Desktop_Icon_Group icon theme Functions - * - * Functions that deal with freedesktop.org icon themes. - * - * This conforms with the freedesktop.org XDG Icon Theme Specification version 0.11 - */ - -/** - * Find the path to an icon. - * - * Using the search algorithm specified by freedesktop.org, - * search for an icon in the currently installed set of icon themes. - * - * The returned string needs to be freed eventually. - * - * @param icon The name of the required icon. - * @param icon_size The size of the required icon. - * @param icon_theme The theme of the required icon. - * @return The full path to an icon file, or NULL. - * @ingroup Ecore_Desktop_Icon_Group - */ - -EAPI char * -ecore_desktop_icon_find(const char *icon, const char *icon_size, - const char *icon_theme) -{ - char *result = NULL, *icn; - Ecore_List *icons; - int in_cache = 0; - double begin; - - begin = ecore_time_get(); - if (icon) - { - /* Easy check first, was a full path supplied? */ - if ((icon[0] == '/') && (ecore_file_exists(icon))) - result = strdup(icon); - else - { - icons = ecore_desktop_paths_to_list(icon); - if (icons) - { - - if (icon_size == NULL) - icon_size = "48x48"; - if (icon_theme == NULL) - icon_theme = "hicolor"; - ecore_list_first_goto(icons); - while ((icn = ecore_list_next(icons))) - { - char *ext; -#ifdef DEBUG - fprintf(stderr, "\tTrying To Find Icon %s\n", icn); -#endif - ext = strrchr(icn, '.'); - /* Check for unsupported extension */ - if ((ext) && (!strcmp(ext, ".ico"))) - continue; - - result = _ecore_desktop_icon_find0(icn, icon_size, icon_theme, &in_cache); - if (result) - break; - } - ecore_list_destroy(icons); - - } /* if (icons) */ - } /* if ((icon[0] == '/') && (ecore_file_exists(icon))) ; else */ - } /* if (icon) */ - - if (result) - { - if (in_cache) - { - instrumentation.icons_in_cache_time += ecore_time_get() - begin; - instrumentation.icons_in_cache++; - } - else - { - instrumentation.icons_time += ecore_time_get() - begin; - instrumentation.icons++; - } - } - else - { - instrumentation.icons_not_found_time += ecore_time_get() - begin; - instrumentation.icons_not_found++; - } - - return result; -} - -/** Search for an icon the fdo way. - * - * This complies with the freedesktop.org Icon Theme Specification version 0.7 - * - * @param icon The icon to search for. - * @param icon_size The icon size to search for. - * @param icon_theme The icon theme to search in. - * @return The full path to the found icon. - */ -static char * -_ecore_desktop_icon_find0(const char *icon, const char *icon_size, - const char *icon_theme, int *in_cache) -{ - Ecore_Desktop_Icon_Theme *theme; - char path[PATH_MAX]; - char *found = NULL; - int wanted_size; - int minimal_size = INT_MAX; - int has_ext = 0; - int has_icon_ext = 0; - int i; - char *closest = NULL; - Ecore_Desktop_Icon_Theme_Directory *directory; - - if ((icon == NULL) || (icon[0] == '\0')) - return NULL; - - /* Check the file extension, if any. */ - found = strrchr(icon, '.'); - if (found != NULL) - { - has_ext = 1; - for (i = 0; ext[i] != NULL; i++) - { - if (strcmp(found, ext[i]) == 0) - { - has_icon_ext = 1; - break; - } - } - found = NULL; - } - -#ifdef DEBUG - fprintf(stderr, "\tTrying To Find Icon %s (%s) in theme %s\n", icon, - icon_size, icon_theme); -#endif - - /* Get the theme description file. */ - theme = ecore_desktop_icon_theme_get(icon_theme, NULL); -#ifdef DEBUG - printf("SEARCHING FOR %s\n", icon_theme); -#endif - - if (!theme) return NULL; - if (!theme->Directories) goto done; - - wanted_size = atoi(icon_size); - - /* Loop through the themes directories. */ - ecore_list_first_goto(theme->Directories); - while ((directory = ecore_list_next(theme->Directories)) != NULL) - { - if (directory->size) - { - int match = 0; - int result_size = 0; - - /* Does this theme directory match the required icon size? */ - switch (directory->type[0]) - { - case 'F': /* Fixed. */ - match = (wanted_size == directory->size); - result_size = abs(directory->size - wanted_size); - break; - case 'S': /* Scaled. */ - match = ((directory->minimum <= wanted_size) && - (wanted_size <= directory->maximum)); - if (wanted_size < directory->minimum) - result_size = directory->minimum - wanted_size; - if (wanted_size > directory->maximum) - result_size = wanted_size - directory->maximum; - break; - default: /* Threshold. */ - match = (((directory->size - directory->threshold) <= wanted_size) && - (wanted_size <= (directory->size + directory->threshold))); - if (wanted_size < (directory->size - directory->threshold)) - result_size = directory->minimum - wanted_size; - if (wanted_size > (directory->size + directory->threshold)) - result_size = wanted_size - directory->maximum; - break; - } - - /* Do we need to check this directory? */ - if ((match) || (result_size < minimal_size)) - { - /* Look for icon with all extensions. */ - for (i = 0; ext[i] != NULL; i++) - { - /* Check if there will be an extension to check. */ - if ((ext[i][0] == '\0') && (!has_ext)) - continue; - if ((ext[i][0] != '\0') && (has_icon_ext)) - continue; - if (directory->icons) - { - snprintf(path, PATH_MAX, "%s%s", icon, ext[i]); -#ifdef DEBUG - printf("FDO icon = %s\n", path); -#endif - found = ecore_hash_get(directory->icons, path); - if (found) - { - found = strdup(found); - if (match) - *in_cache = 1; - } - } - else - { - snprintf(path, PATH_MAX, "%s/%s%s", directory->full_path, icon, ext[i]); -#ifdef DEBUG - printf("FDO icon = %s\n", path); -#endif - if (ecore_file_exists(path)) - found = strdup(path); - } - if (found) - { - if (ecore_file_is_dir(found)) - { - free(found); - found = NULL; - } - else if (match) /* If there is a match in sizes, return the icon. */ - goto done; - else if (result_size < minimal_size) /* While we are here, figure out our next fallback strategy. */ - { - minimal_size = result_size; - if (closest) free(closest); - closest = found; - found = NULL; - } - else - { - free(found); - found = NULL; - } - } - } /* for (i = 0; ext[i] != NULL; i++) */ - } /* if ((match) || (result_size < minimal_size)) */ - } /* if (directory->size) */ - } /* while ((directory = ecore_list_next(directory_paths)) != NULL) */ - - if (!found) - { - /* Fall back strategy #1, look for closest size in this theme. */ - found = closest; - if (found) - { - closest = NULL; - goto done; - } - - /* Fall back strategy #2, Try again with the parent themes. */ - if (!theme->hicolor) - { - if (theme->Inherits) - { - char *inherits; - - ecore_list_first_goto(theme->Inherits); - while ((inherits = ecore_list_next(theme->Inherits)) != NULL) - { - found = _ecore_desktop_icon_find0(icon, icon_size, inherits, in_cache); - if (found) goto done; - } - } - else /* Fall back strategy #3, Try the default hicolor theme. */ - { - found = _ecore_desktop_icon_find0(icon, icon_size, "hicolor", in_cache); - if (found) goto done; - } - } - - /* Fall back strategy #4, Just search in the base of the icon directories. */ - for (i = 0; ext[i] != NULL; i++) - { - /* Check if there will be an extension to check. */ - if ((ext[i][0] == '\0') && (!has_ext)) - continue; - if ((ext[i][0] != '\0') && (has_icon_ext)) - continue; - snprintf(path, PATH_MAX, "%s%s", icon, ext[i]); -#ifdef DEBUG - printf("FDO icon = %s\n", path); -#endif - found = ecore_desktop_paths_file_find(ecore_desktop_paths_icons, path, 0, NULL, NULL); - if (found) - { - if (ecore_file_is_dir(found)) - { - free(found); - found = NULL; - } - else - goto done; - } - } - } - -done: - if (closest) free(closest); - ecore_desktop_icon_theme_destroy(theme); - - return found; -} - -Ecore_Hash * -ecore_desktop_icon_theme_list(void) -{ - static int loaded = 0; - if (!loaded) - { - char *tmp; - tmp = ecore_desktop_paths_file_find(ecore_desktop_paths_icons, "index.theme", 2, - _ecore_desktop_icon_theme_list_add, NULL); - loaded = 1; - free(tmp); - } - return icon_theme_cache; -} - -static int -_ecore_desktop_icon_theme_list_add(void *data __UNUSED__, const char *path) -{ - char icn[PATH_MAX]; - - snprintf(icn, PATH_MAX, "%sindex.theme", path); - if (ecore_desktop_icon_theme_get(icn, NULL)) - return 1; /* Should stop it from recursing this directory, but let it continue searching the next. */ - return 0; -} - -/** - * Setup what ever needs to be setup to support ecore_desktop_icon. - * - * There are internal structures that are needed for ecore_desktop_icon - * functions to operate, this sets them up. - * - * @ingroup Ecore_Desktop_Icon_Group - */ -EAPI int -ecore_desktop_icon_init() -{ - if (++init_count != 1) - return init_count; - - if (!icon_theme_cache) - { - icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (icon_theme_cache) - { - ecore_hash_free_key_cb_set(icon_theme_cache, free); - ecore_hash_free_value_cb_set(icon_theme_cache, - ECORE_FREE_CB(_ecore_desktop_icon_theme_destroy)); - } - } - - return init_count; -} - -/** - * Tear down what ever needs to be torn down to support ecore_desktop_ycon. - * - * There are internal structures that are needed for ecore_desktop_icon - * functions to operate, this tears them down. - * - * @ingroup Ecore_Desktop_Icon_Group - */ -EAPI int -ecore_desktop_icon_shutdown() -{ - if (--init_count != 0) - return init_count; - - if (icon_theme_cache) - { - ecore_hash_destroy(icon_theme_cache); - icon_theme_cache = NULL; - } - - return init_count; -} - -/** - * Get the contents of an index.theme file. - * - * Everything that is in the index.theme file is returned in the - * data member of the Ecore_Desktop_Icon_Theme structure, it's an Ecore_Hash - * as returned by ecore_desktop_ini_get(). Some of the data in the - * index.theme file is decoded into specific members of the returned - * structure. - * - * Use ecore_desktop_icon_theme_destroy() to free this structure. - * - * @param icon_theme Name of the icon theme, or full path to the index.theme file. - * @param lang Language to use, or NULL for default. - * @return An Ecore_Desktop_Icon_Theme containing the files contents. - * @ingroup Ecore_Desktop_Icon_Group - */ -Ecore_Desktop_Icon_Theme * -ecore_desktop_icon_theme_get(const char *icon_theme, const char *lang __UNUSED__) -{ - Ecore_Desktop_Icon_Theme *result = NULL; - char *theme_path = NULL, *theme_dir = NULL; - const char *value; - Ecore_List *Directories; - char *directory; - - if (icon_theme[0] == '/') - { - theme_path = strdup(icon_theme); - theme_dir = ecore_file_dir_get(theme_path); - if (theme_dir) - icon_theme = ecore_file_file_get(theme_dir); -#ifdef DEBUG - printf("LOADING THEME %s - %s\n", icon_theme, theme_path); -#endif - } - - result = ecore_hash_get(icon_theme_cache, icon_theme); - if (result) goto done; - if (!theme_dir) - { - char icn[PATH_MAX]; - - snprintf(icn, PATH_MAX, "%s/index.theme", icon_theme); -#ifdef DEBUG - printf("SEARCHING FOR %s\n", icn); -#endif - theme_path = ecore_desktop_paths_file_find(ecore_desktop_paths_icons, icn, - 2, NULL, NULL); - if (!theme_path) goto error; - theme_dir = ecore_file_dir_get(theme_path); - } - if (!theme_path) goto error; - result = calloc(1, sizeof(Ecore_Desktop_Icon_Theme)); - if (!result) goto error; - result->data = ecore_desktop_ini_get(theme_path); - if (!result->data) goto error; - result->group = ecore_hash_get(result->data, "Icon Theme"); - if (!result->group) goto error; - - - if ((strcmp(icon_theme, "hicolor") == 0)) - result->hicolor = 1; - - /* According to the spec, name and comment are required, but we can fake those easily enough. */ - value = ecore_hash_get(result->group, "Name"); - if (!value) value = icon_theme; - result->name = strdup(value); - value = ecore_hash_get(result->group, "Comment"); - if (!value) value = "No comment provided."; - result->comment = strdup(value); - value = ecore_hash_get(result->group, "Inherits"); - if (value) - { - result->inherits = strdup(value); - if (result->inherits) - result->Inherits = ecore_desktop_paths_to_list(result->inherits); - } - value = ecore_hash_get(result->group, "Example"); - if (!value) value = "exec"; - result->example = strdup(value); - value = ecore_hash_get(result->group, "Directories"); - /* FIXME: Directories is also required, don't feel like faking it for now. */ - if (!value) goto error; - result->directories = strdup(value); - Directories = ecore_desktop_paths_to_list(result->directories); - if (!Directories) goto error; - result->Directories = ecore_list_new(); - if (!result->Directories) goto error; - ecore_list_free_cb_set(result->Directories, - ECORE_FREE_CB(_ecore_desktop_icon_theme_directory_destroy)); - ecore_list_first_goto(Directories); - while ((directory = ecore_list_next(Directories)) != NULL) - { - Ecore_Hash *sub_group; - Ecore_Desktop_Icon_Theme_Directory *dir; - - /* Get the details for this theme directory. */ - sub_group = ecore_hash_get(result->data, directory); - dir = calloc(1, sizeof (Ecore_Desktop_Icon_Theme_Directory)); - if ((dir) && (sub_group)) - { - const char *size, *minsize, *maxsize, *threshold; - char full_path[PATH_MAX]; - - dir->path = strdup(directory); - snprintf(full_path, PATH_MAX, "%s/%s", theme_dir, directory); - dir->full_path = strdup(full_path); - value = ecore_hash_get(sub_group, "Type"); - if (!value) - value = "Threshold"; - dir->type = strdup(value); - size = ecore_hash_get(sub_group, "Size"); - minsize = ecore_hash_get(sub_group, "MinSize"); - maxsize = ecore_hash_get(sub_group, "MaxSize"); - threshold = ecore_hash_get(sub_group, "Threshold"); - if (size) - { - if (!minsize) - minsize = size; - if (!maxsize) - maxsize = size; - if (!threshold) - threshold = "2"; - dir->minimum = atoi(minsize); - dir->maximum = atoi(maxsize); - dir->threshold = atoi(threshold); - - dir->size = atoi(size); - ecore_list_append(result->Directories, dir); - } - else - _ecore_desktop_icon_theme_directory_destroy(dir); - } - else if (dir) - _ecore_desktop_icon_theme_directory_destroy(dir); - } - ecore_list_destroy(Directories); - - /* This passes the basic validation tests, mark it as real and cache it. */ - result->path = strdup(theme_path); - ecore_hash_set(icon_theme_cache, strdup(icon_theme), result); - ecore_hash_destroy(result->data); - result->data = NULL; - result->group = NULL; - -done: - if (theme_dir) free(theme_dir); - if (theme_path) free(theme_path); - - /* Cache the directories. */ - _ecore_desktop_icon_theme_cache_check(result); - return result; - -error: - if (theme_dir) free(theme_dir); - if (theme_path) free(theme_path); - if (result) - { - if (result->data) ecore_hash_destroy(result->data); - _ecore_desktop_icon_theme_destroy(result); - } - return NULL; -} - -/** - * Free whatever resources are used by an Ecore_Desktop_Icon_Theme. - * - * There are internal resources used by each Ecore_Desktop_Icon_Theme - * This releases those resources. - * - * @param icon_theme An Ecore_Desktop_Icon_Theme. - * @ingroup Ecore_Desktop_Icon_Group - */ -void -ecore_desktop_icon_theme_destroy(Ecore_Desktop_Icon_Theme * icon_theme) -{ - /* This is just a dummy, because these structures are cached. */ - /* Later versions of the cache may reference count, then this will be useful. */ - - icon_theme = NULL; -} - -static void -_ecore_desktop_icon_theme_destroy(Ecore_Desktop_Icon_Theme * icon_theme) -{ - if (icon_theme->path) - free(icon_theme->path); - if (icon_theme->name) - free(icon_theme->name); - if (icon_theme->comment) - free(icon_theme->comment); - if (icon_theme->example) - free(icon_theme->example); - if (icon_theme->inherits) - free(icon_theme->inherits); - if (icon_theme->directories) - free(icon_theme->directories); - if (icon_theme->Directories) - ecore_list_destroy(icon_theme->Directories); - if (icon_theme->Inherits) - ecore_list_destroy(icon_theme->Inherits); - free(icon_theme); -} - -static void -_ecore_desktop_icon_theme_directory_destroy(Ecore_Desktop_Icon_Theme_Directory * - icon_theme_directory) -{ - if (icon_theme_directory->path) - free(icon_theme_directory->path); - if (icon_theme_directory->full_path) - free(icon_theme_directory->full_path); - if (icon_theme_directory->type) - free(icon_theme_directory->type); - if (icon_theme_directory->icons) - ecore_hash_destroy(icon_theme_directory->icons); - free(icon_theme_directory); -} - -static inline void -_ecore_desktop_icon_theme_cache_check(Ecore_Desktop_Icon_Theme *icon_theme) -{ - /* The spec has this to say - - * - * "The algorithm as described in this document works by always looking up - * filenames in directories (a stat in unix terminology). A good - * implementation is expected to read the directories once, and do all - * lookups in memory using that information. - * - * "This caching can make it impossible for users to add icons without having - * to restart applications. In order to handle this, any implementation that - * does caching is required to look at the mtime of the toplevel icon - * directories when doing a cache lookup, unless it already did so less than - * 5 seconds ago. This means that any icon editor or theme installation - * program need only to change the mtime of the the toplevel directory where - * it changed the theme to make sure that the new icons will eventually get - * used." - * - * The phrase "toplevel icon directories" is ambigous, but I guess they mean - * the directory where the index.theme file lives. - */ - - struct stat st; - int clear = 0; - - if (ecore_time_get() > (icon_theme->last_checked + 5.0)) - { - if (stat(icon_theme->path, &st) >= 0) - { - icon_theme->last_checked = ecore_time_get(); - if (st.st_mtime > icon_theme->mtime) - { - clear = 1; - icon_theme->mtime = st.st_mtime; - } - } - } - - if (clear) - { - Ecore_Desktop_Icon_Theme_Directory *dir; - char full_path[PATH_MAX]; - - ecore_list_first_goto(icon_theme->Directories); - while ((dir = ecore_list_next(icon_theme->Directories)) != NULL) - { - if (dir->icons) - { - ecore_hash_destroy(dir->icons); - dir->icons = NULL; - } - dir->icons = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (dir->icons) - { - Ecore_List *files; - - ecore_hash_free_key_cb_set(dir->icons, free); - ecore_hash_free_value_cb_set(dir->icons, free); - files = ecore_file_ls(dir->full_path); - if (files) - { - const char *file; - - while ((file = ecore_list_next(files))) - { - snprintf(full_path, PATH_MAX, "%s/%s", dir->full_path, file); - ecore_hash_set(dir->icons, strdup(file), strdup(full_path)); - } - ecore_list_destroy(files); - } - } - } - } -} diff --git a/src/lib/ecore_desktop/ecore_desktop_menu.c b/src/lib/ecore_desktop/ecore_desktop_menu.c deleted file mode 100644 index 3afc397..0000000 --- a/src/lib/ecore_desktop/ecore_desktop_menu.c +++ /dev/null @@ -1,1844 +0,0 @@ -/* - * This conforms with the freedesktop.org Desktop Menu Specification version 0.92 - * - * This is gonna be repetative and slow. The idea is to first get it to correctly - * follow the spec in a way that is easy to check. Only then can we start to - * optomize into "ugly but fast". - * - * There are notes at the very end about all those nasty steps we need to do to - * follow the spec. - */ - -#include - -#include "Ecore_Desktop.h" -#include "ecore_desktop_private.h" -#include "ecore_private.h" - -#include -#include -#include - -//#define DEBUG 1 - -struct _ecore_desktop_menu_expand_apps_data -{ - char *path; - Ecore_Hash *pool; - int length; -}; - -struct _ecore_desktop_menu_unxml_data -{ - char *file; - char *base; - char *path; - Ecore_Desktop_Tree *stack, *merge_stack; - int unallocated, level; -}; - -struct _ecore_desktop_menu_generate_data -{ - char *name, *path; - Ecore_Desktop_Tree *rules; - Ecore_Hash *pool, *apps; - int unallocated; - - Ecore_Desktop_Tree *rule; - int include; -}; - -struct _ecore_desktop_menu_legacy_data -{ - Ecore_Desktop_Tree *merge; - Ecore_Desktop_Tree *current; - char *menu; - char *prefix; - char *path; - int length, menu_length, level; -}; - -static int _ecore_desktop_menu_make_apps(const void *data, - Ecore_Desktop_Tree * tree, - int element, int level); -static Ecore_Desktop_Tree *_ecore_desktop_menu_get0(char *file, - Ecore_Desktop_Tree * - merge_stack, int level); -static Ecore_Desktop_Tree *_ecore_desktop_menu_create_menu(void); -static int _ecore_desktop_menu_unxml(const void *data, - Ecore_Desktop_Tree * tree, - int element, int level); -static int _ecore_desktop_menu_check_directory(void *data, - const char *path); -static int _ecore_desktop_menu_check_menu(void *data, - const char *path); -static int _ecore_desktop_menu_legacy_menu_dir(void *data, - const char *path); -static int _ecore_desktop_menu_legacy_menu(void *data, - const char *path); -static void _ecore_desktop_menu_unxml_rules(Ecore_Desktop_Tree * rules, - Ecore_Desktop_Tree * tree, - char type, char sub_type); -static void _ecore_desktop_menu_unxml_moves(Ecore_Desktop_Tree * menu, - Ecore_Desktop_Tree * tree); -static void _ecore_desktop_menu_add_dirs(Ecore_Desktop_Tree * tree, - Ecore_List * paths, const char *pre, - const char *post, char *extra, - int element); -static int _ecore_desktop_menu_expand_apps(struct - _ecore_desktop_menu_unxml_data - *unxml_data, char *app_dir, - Ecore_Hash * pool); -static int _ecore_desktop_menu_check_app(void *data, const char *path); - -static int _ecore_desktop_menu_merge(const void *data, - Ecore_Desktop_Tree * tree, - int element, int level); -static int _ecore_desktop_menu_expand_default_dirs(const void *data, - Ecore_Desktop_Tree - * tree, - int element, - int level); - -static int _ecore_desktop_menu_generate(const void *data, - Ecore_Desktop_Tree * tree, - int element, int level); -static int _ecore_desktop_menu_is_include(const void *data, Ecore_Desktop_Tree * tree, int element, int level __UNUSED__); -static void _ecore_desktop_menu_inherit_apps(void *value, - void *user_data); -static void _ecore_desktop_menu_select_app(void *value, - void *user_data); -static int _ecore_desktop_menu_apply_rules(struct - _ecore_desktop_menu_generate_data - *generate_data, - Ecore_Desktop_Tree * rule, - char *key, - Ecore_Desktop * desktop); - -/** - * @defgroup Ecore_Desktop_Menu_Group menu Functions - * - * Functions that deal with freedesktop.org menus. - */ - -EAPI void -ecore_desktop_menu_for_each(void (*func) - (const char *name, const char *path, const char *directory, Ecore_Hash * apps)) -{ - char *menu_file; - - /* Find the main menu file. */ - menu_file = ecore_desktop_paths_file_find(ecore_desktop_paths_menus, - "applications.menu", -1, NULL, - NULL); - if (!menu_file) - { - /* Try various quirks of various systems and other wms. */ - menu_file = ecore_desktop_paths_file_find(ecore_desktop_paths_menus, - "kde-applications.menu", -1, NULL, - NULL); - if (!menu_file) - { - menu_file = ecore_desktop_paths_file_find(ecore_desktop_paths_menus, - "debian-menu.menu", -1, NULL, - NULL); - /* FIXME: If all else fails, run debians funky menu generator shit. */ - } - } - - if (menu_file) - { - Ecore_Desktop_Tree *menus; - - /* convert the xml into menus */ - menus = ecore_desktop_menu_get(menu_file); - if (menus) - { - /* create the .desktop and order files from the menu */ - ecore_desktop_tree_foreach(menus, 0, _ecore_desktop_menu_make_apps, - func); -// FIXME: Can't free this just yet, causes major memory corruption. -// this leaks a LOT (428,200 bytes in one valgrind run...) -// ecore_desktop_tree_del(menus); - } - free(menu_file); - } -} - -static int -_ecore_desktop_menu_make_apps(const void *data, Ecore_Desktop_Tree * tree, - int element, int level __UNUSED__) -{ - if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - if (strncmp((char *)tree->elements[element].element, "elements[element].element; - directory = name; - directory += 8; - path = strchr(directory, '<'); - path++; - directory = strchr(path, '<'); - directory++; - len = strlen(directory); - if (len > 2) - { - path = strdup(directory); - if (path) - { - path[len - 1] = '\0'; - /* FIXME: Figure out what to do if it's just ".directory". */ - directory = ecore_desktop_paths_file_find(ecore_desktop_paths_directories, path, 0, NULL, NULL); - free(path); - } - else - directory = NULL; - } - else - directory = NULL; - path = (char *)tree->elements[element + 1].element; -// pool = (Ecore_Hash *) tree->elements[element + 2].element; - apps = (Ecore_Hash *) tree->elements[element + 4].element; - path = &path[11]; -#ifdef DEBUG - printf("OUTPUTTING MENU - %s \t\t%s \t\t%s\n", path, name, directory); -#endif - if (func) - func(name, path, directory, apps); - free(directory); - } - } - return 0; -} - -/** - * Decode a freedesktop.org menu XML jungle. - * - * Using the algorithm specified by freedesktop.org, fully decode - * a menu based on an initial menu file. - * - * @param file The base file for the menu. - * @return The resulting menu tree. - * @ingroup Ecore_Desktop_Menu_Group - */ - -Ecore_Desktop_Tree * -ecore_desktop_menu_get(char *file) -{ - return _ecore_desktop_menu_get0(file, NULL, 0); -} - -static Ecore_Desktop_Tree * -_ecore_desktop_menu_get0(char *file, Ecore_Desktop_Tree * merge_stack, - int level) -{ - Ecore_Desktop_Tree *menu_xml; - struct _ecore_desktop_menu_unxml_data data; - int oops = 0; - - /* Preperation. */ - data.stack = ecore_desktop_tree_new(NULL); - /* FIXME data.base and data.path leak */ - data.base = ecore_file_strip_ext(ecore_file_file_get(file)); - data.path = ecore_file_dir_get(file); - if ((level == 0) && (merge_stack == NULL)) - merge_stack = ecore_desktop_tree_new(NULL); -#ifdef DEBUG -printf("MENU FILE %d - %s\n", level, file); -#endif - menu_xml = ecore_desktop_xmlame_get(file); - if ((data.stack) && (data.base) && (data.path) && (merge_stack) - && (menu_xml)) - { - int i; - - data.file = file; - data.level = level; - data.merge_stack = merge_stack; - - /* Setup the merge stack. */ - if (merge_stack->size <= level) - { - /* XXX storing a pointer to a static string probably isn't a good idea. this is most likely the cause of the valgrind error mentioned below. (once this function has exited that memory will no longer be valid) */ - while (merge_stack->size < level) - ecore_desktop_tree_add(merge_stack, ""); - ecore_desktop_tree_add(merge_stack, file); - } - else - merge_stack->elements[level].element = file; - - /* Find out if we are looping. */ - for (i = 0; i < level; i++) - { - char *text; - - /* I can safely assume that they are all strings. */ - text = (char *)merge_stack->elements[i].element; -/* printf("--- %s --- %s\n", text, file); - if (text) - if (file) */ - if (strcmp(text, file) == 0) - { -/* FIXME: valgrind says - -==5761== Conditional jump or move depends on uninitialised value(s) -==5761== at 0x1B90565C: strcmp (in /usr/lib/valgrind/vgpreload_memcheck.so) -==5761== by 0x1BA3E984: _ecore_desktop_menu_get0 (ecore_desktop_menu.c:176) -==5761== by 0x1BA3FE3F: _ecore_desktop_menu_merge (ecore_desktop_menu.c:1146) -==5761== by 0x1BA3D5A2: ecore_desktop_tree_foreach (ecore_desktop_tree.c:267) - * which is the strcmp just above. But it doesn't complain about the first two if's, - * or the printf, which I inserted to try and track this down. - * No idea what it actually is complaining about, so I'll comment it for future study. - * - * This is probably caused by the fact that a static string was passed into the - * tree. See the comment above where this occurs. - */ - fprintf(stderr, - "\n### Oops, infinite menu merging loop detected at %s\n", - file); - oops++; - } - } - - if (oops == 0) - { - /* Get on with it. */ - ecore_desktop_tree_foreach(menu_xml, 0, _ecore_desktop_menu_unxml, - &data); - ecore_desktop_tree_foreach(menu_xml, 0, _ecore_desktop_menu_merge, - &data); - - /* The rest of this is only done after ALL the menus have been merged. */ - if (level == 0) - { - ecore_desktop_tree_foreach(menu_xml, 0, - _ecore_desktop_menu_expand_default_dirs, - &data); - -#ifdef DEBUG - ecore_desktop_tree_dump(menu_xml, 0); - printf("\n\n"); -#endif - - data.unallocated = FALSE; - ecore_desktop_tree_foreach(menu_xml, 0, - _ecore_desktop_menu_generate, - &data); - - data.unallocated = TRUE; - ecore_desktop_tree_foreach(menu_xml, 0, - _ecore_desktop_menu_generate, - &data); - -#ifdef DEBUG -// ecore_desktop_tree_dump(menu_xml, 0); -// printf("\n\n"); -#endif - } - } - } - else - oops++; - - if (oops) - { - E_FN_DEL(ecore_desktop_tree_del, (menu_xml)); - if (level == 0) - { - E_FN_DEL(ecore_desktop_tree_del, (merge_stack)); - } - E_FREE(data.path); - E_FREE(data.base); - E_FN_DEL(ecore_desktop_tree_del, (data.stack)); - } - - - return menu_xml; -} - -static int -_ecore_desktop_menu_unxml(const void *data, Ecore_Desktop_Tree * tree, - int element, int level) -{ - struct _ecore_desktop_menu_unxml_data *unxml_data; - - unxml_data = (struct _ecore_desktop_menu_unxml_data *)data; - if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - if (strncmp((char *)tree->elements[element].element, "elements[element].type = - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[element].element = NULL; - } - else if (strcmp((char *)tree->elements[element].element, "elements[0].element; - flags += 7; - tree->elements[element].element = menu; - tree->elements[element].type = - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE; - for (i = element + 1; i < tree->size; i++) - { - int result = 0; - - if (tree->elements[i].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - if (strncmp - ((char *)tree->elements[i].element, "elements[i].type = - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[i].element = NULL; - } - else - if (strcmp - ((char *)tree->elements[i].element, - "elements[i].element, - "elements[i].element, - "elements[i].element, - "elements[i].element, - " - elements[i].element); - result = 1; - } - } - else if (tree->elements[i].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - Ecore_Desktop_Tree *sub; - - sub = - (Ecore_Desktop_Tree *) tree->elements[i].element; - if ((sub) && (sub->size)) - { - if (sub->elements[0].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - if (strcmp - ((char *)sub->elements[0].element, - "elements[1]. - element); - sprintf(temp, - " <%s> <%s>", - flags, name, directory); - menu->elements[0].element = - strdup(temp); - ecore_desktop_tree_track(menu, name); - ecore_desktop_tree_track(menu, - menu-> - elements[0]. - element); - flags = - (char *)menu->elements[0].element; - flags += 7; - /* The rest of this is probably not needed, except to ease debugging. */ - if (unxml_data->stack->size <= level) - { - while (unxml_data->stack->size < - level) - ecore_desktop_tree_add - (unxml_data->stack, ""); - ecore_desktop_tree_add - (unxml_data->stack, name); - } - else - unxml_data->stack-> - elements[level].element = name; - temp[0] = '\0'; - for (i = 0; i <= level; i++) - { - char *text; - - /* I can safely assume that they are all strings. */ - text = - (char *)unxml_data->stack-> - elements[i].element; - if (text[0] != '\0') - { - sprintf(&temp[length], - "%s%s", - ((length) ? "/" : - ""), text); - length += - strlen(text) + - ((length) ? 1 : 0); - } - } - menu_path = strdup(temp); - sprintf(temp, "elements[1].element = - strdup(temp); - ecore_desktop_tree_track(menu, - menu_path); - ecore_desktop_tree_track(menu, - menu-> - elements[1]. - element); - result = 1; - } - /* FIXME: Move this to later in the sequence. */ - else - if (strcmp - ((char *)sub->elements[0].element, - "elements[1]. - element); - sprintf(temp, - " <%s> <%s>", - flags, name, directory); - menu->elements[0].element = - strdup(temp); - ecore_desktop_tree_track(menu, - directory); - ecore_desktop_tree_track(menu, - menu-> - elements[0]. - element); - flags = - (char *)menu->elements[0].element; - flags += 7; - result = 1; - } - else - if (strcmp - ((char *)sub->elements[0].element, - " - elements - [0]. - element); - /* FIXME: Dunno if this causes a memory leak, but for now we play it safe. */ - tree->elements[i].type = - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[i].element = NULL; -// result = 1; - } - else - if (strcmp - ((char *)sub->elements[0].element, - "size == 3) - && (sub->elements[1].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - && (((char *)sub->elements[1].element)[0] != '<')) - { - char temp[PATH_MAX]; - - snprintf(temp, PATH_MAX, "%s %s", - (char *)sub->elements[0].element, - (char *)sub->elements[1].element); - ecore_desktop_tree_extend(menu, temp); - result = 1; - } - else - { - ecore_desktop_tree_add_child - (menu, sub); - tree->elements[i].type = - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[i].element = - NULL; - } - } - } - } - } - if (result) - { - if (tree->elements[i].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - ecore_desktop_tree_del((Ecore_Desktop_Tree *) - tree->elements[i]. - element); - tree->elements[i].type = - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[i].element = NULL; - } - } - - /* Add it if it has not been deleted. */ - if (flags[1] != 'D') - { - tree->elements[element].element = menu; - tree->elements[element].type = - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE; - } - } - } - } - return 0; -} - -static Ecore_Desktop_Tree * -_ecore_desktop_menu_create_menu() -{ - Ecore_Desktop_Tree *menu, *rules; - Ecore_Hash *pool, *apps; - - menu = ecore_desktop_tree_new(NULL); - rules = ecore_desktop_tree_new(NULL); - pool = ecore_hash_new(ecore_str_hash, ecore_str_compare); - apps = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if ((menu) && (rules) && (pool) && (apps)) - { - ecore_hash_free_key_cb_set(pool, free); - ecore_hash_free_value_cb_set(pool, free); - ecore_hash_free_key_cb_set(apps, free); - ecore_hash_free_value_cb_set(apps, free); - ecore_desktop_tree_extend(menu, " <> <>"); - ecore_desktop_tree_extend(menu, "length; path[i] != '\0'; i++) - { - if (path[i] == '/') - count++; - } - if (count == 1) - { - legacy_data->current = legacy_data->merge; - legacy_data->level = 0; - } - else if (count <= legacy_data->level) - { - if ((legacy_data->current) && (legacy_data->current->parent)) - { - legacy_data->current = legacy_data->current->parent; - legacy_data->level--; - } - } - - start = legacy_data->length; - count = 0; - temp_path = strdup(path); - if (temp_path) - { - for (i = legacy_data->length; temp_path[i] != '\0'; i++) - { - if (temp_path[i] == '/') - { - if (count >= legacy_data->level) - { - temp_path[i] = '\0'; - menu = _ecore_desktop_menu_create_menu(); - if (menu) - { - char temp[PATH_MAX]; - - sprintf(temp, " <%s> <>", - &temp_path[start]); - menu->elements[0].element = strdup(temp); - ecore_desktop_tree_track(menu, - menu->elements[0].element); - sprintf(temp, "menu, - &temp_path[legacy_data->length]); - menu->elements[1].element = strdup(temp); - ecore_desktop_tree_track(menu, - menu->elements[1].element); - - ecore_desktop_tree_add_child(legacy_data->current, - menu); - /* This is not needed, but if it was, this is where it would go. - * sprintf(temp, "current = menu; - legacy_data->level++; - } - temp_path[i] = '/'; - } - start = i + 1; - count++; - } - } - free(temp_path); - } - - legacy_data->level = count; - - return 0; -} - -static int -_ecore_desktop_menu_legacy_menu(void *data, const char *path) -{ - struct _ecore_desktop_menu_legacy_data *legacy_data; - char *menu_path; - char *file; - char temp[PATH_MAX]; - int i, count = 0, menu_count = 0; - - legacy_data = (struct _ecore_desktop_menu_legacy_data *)data; - if ((legacy_data->current) && (legacy_data->current->size > 0) && - (legacy_data->current->elements[1].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING)) - { - menu_path = (char *)legacy_data->current->elements[1].element; - menu_path += 12 + legacy_data->menu_length; - } - else - { - menu_path = ""; - printf(" PROBLEM IN LEGACYDIR FILE - %s - %s %s\n", - legacy_data->prefix, legacy_data->path, - &path[legacy_data->length]); - } - - for (i = legacy_data->length; path[i] != '\0'; i++) - { - if (path[i] == '/') - count++; - } - for (i = 0; menu_path[i] != '\0'; i++) - { - if (menu_path[i] == '/') - menu_count++; - } - /* FIXME: The (legacy_data->current) test is just to patch a seggie, find out why. */ - while ((menu_count >= count) && (legacy_data->current)) - { - legacy_data->current = legacy_data->current->parent; - menu_count--; - } - if ((legacy_data->current) && (legacy_data->current->size > 0) && - (legacy_data->current->elements[1].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING)) - { - menu_path = (char *)legacy_data->current->elements[1].element; - menu_path += 12 + legacy_data->menu_length; - } - else - { - /* FIXME: Bugger, a corner case. - * If this is .directory, then maybe ignore it? - * If this is a desktop, we need to put it into the pool of the menu that legacy_data->merge will get merged into. - */ - menu_path = ""; - printf(" LEGACYDIR FILE - %s - %s %s\n", legacy_data->prefix, - legacy_data->path, &path[legacy_data->length]); - return 0; - } - - menu_count = strlen(menu_path); - if (menu_count) - menu_count++; - file = (char *)&path[legacy_data->length + menu_count]; - count = strlen(file); - - if (strcmp(".directory", file) == 0) - { - menu_path = (char *)legacy_data->current->elements[0].element; - menu_count = strlen(menu_path); - menu_path[menu_count - 3] = '\0'; - sprintf(temp, "%s <.directory>", menu_path); - legacy_data->current->elements[0].element = strdup(temp); - ecore_desktop_tree_track(legacy_data->current, - legacy_data->current->elements[0].element); - } - else if (strcmp(".desktop", &file[count - 8]) == 0) - { - Ecore_Hash *pool; - Ecore_Desktop_Tree *rules; - - pool = (Ecore_Hash *) legacy_data->current->elements[2].element; - rules = - (Ecore_Desktop_Tree *) legacy_data->current->elements[3].element; - if (rules->size == 0) - { - Ecore_Desktop_Tree *new_rules; - - new_rules = ecore_desktop_tree_new(NULL); - if (new_rules) - ecore_desktop_tree_add_child(rules, new_rules); - } - sprintf(temp, "%s%s", legacy_data->prefix, file); - ecore_hash_set(pool, strdup(temp), strdup(path)); -#ifdef DEBUG -// printf -// ("POOLING - _ecore_desktop_menu_legacy_menu(void *data, %s) - %s - %s\n", -// path, file, temp); -#endif - if (rules->size > 0) - { - rules = (Ecore_Desktop_Tree *) rules->elements[0].element; - sprintf(temp, "IOF %s%s", legacy_data->prefix, file); - ecore_desktop_tree_extend(rules, temp); - } - } -#ifdef DEBUG - else - printf("PROBLEM - _ecore_desktop_menu_legacy_menu(void *data, %s) - %s\n", - path, file); -#endif - - return 0; -} - -static void -_ecore_desktop_menu_unxml_rules(Ecore_Desktop_Tree * rules, - Ecore_Desktop_Tree * tree, char type, - char sub_type) -{ - int i; - char temp[PATH_MAX]; - - for (i = 0; i < tree->size; i++) - { - if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - /* FIXME or would be valid input (which this won't catch) */ - if (strcmp((char *)tree->elements[i].element, "elements[i].element, "elements[i + 1].element); - ecore_desktop_tree_extend(rules, temp); - } - else if (strcmp((char *)tree->elements[i].element, "elements[i + 1].element); - ecore_desktop_tree_extend(rules, temp); - } - else if (strcmp((char *)tree->elements[i].element, " - elements[i + 1].element, - type, sub_type); - } - else if ((strcmp((char *)tree->elements[i].element, "elements[i].element, "elements[i].element)[1]; - sub = ecore_desktop_tree_new(NULL); - if (sub) - { - ecore_desktop_tree_add_child(rules, sub); - for (i++; i < tree->size; i++) - { - if (tree->elements[i].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - _ecore_desktop_menu_unxml_rules(sub, - (Ecore_Desktop_Tree - *) tree-> - elements[i]. - element, type, - this_type); - } - } - } - } - else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - _ecore_desktop_menu_unxml_rules(rules, - (Ecore_Desktop_Tree *) tree-> - elements[i].element, type, - sub_type); - } - } -} - -static void -_ecore_desktop_menu_unxml_moves(Ecore_Desktop_Tree * menu, - Ecore_Desktop_Tree * tree) -{ - int i; - char *old = NULL; - char *new = NULL; - - for (i = 0; i < tree->size; i++) - { - if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - Ecore_Desktop_Tree *sub; - - sub = (Ecore_Desktop_Tree *) tree->elements[i].element; - if ((sub) && (sub->size)) - { - if (sub->elements[0].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - if (strcmp((char *)sub->elements[0].element, "elements[1].element); - if (strcmp((char *)sub->elements[0].element, "elements[1].element); - } - } - } - if ((old) && (new)) - { - char temp[PATH_MAX * 2]; - - sprintf(temp, " <%s>", old, new); - ecore_desktop_tree_extend(menu, temp); - } - - if (old) free(old); - old = NULL; - if (new) free(new); - new = NULL; - } -} - -static void -_ecore_desktop_menu_add_dirs(Ecore_Desktop_Tree * tree, Ecore_List * paths, - const char *pre, const char *post __UNUSED__, char *extra, int element __UNUSED__) -{ - char t[PATH_MAX], *this_path; - - /* reverse the order of the dirs. */ - ecore_list_first_goto(paths); - while ((this_path = ecore_list_next(paths)) != NULL) - { - if (extra) - sprintf(t, "%s %s%s-merged/", pre, this_path, extra); - else - sprintf(t, "%s %s", pre, this_path); - if (tree) - ecore_desktop_tree_extend(tree, t); - } -} - -static int -_ecore_desktop_menu_expand_apps(struct _ecore_desktop_menu_unxml_data - *unxml_data, char *app_dir, Ecore_Hash * pool) -{ - if (pool) - { - struct _ecore_desktop_menu_expand_apps_data our_data; - char dir[PATH_MAX]; - - our_data.pool = pool; - sprintf(dir, "%s", app_dir); - if (dir[0] != '/') - sprintf(dir, "%s/%s", unxml_data->path, app_dir); - our_data.path = dir; - our_data.length = strlen(dir); -#ifdef DEBUG - printf - ("EXPANDING - _ecore_desktop_menu_expand_apps(unxml_data, %s) - %s\n", - app_dir, dir); -#endif - ecore_desktop_paths_recursive_search(dir, NULL, -1, NULL, - _ecore_desktop_menu_check_app, - &our_data); - } - return 0; -} - -static int -_ecore_desktop_menu_check_app(void *data, const char *path) -{ - char *p; - struct _ecore_desktop_menu_expand_apps_data *our_data; - - our_data = (struct _ecore_desktop_menu_expand_apps_data *)data; - p = strrchr(path, '.'); - if (p) - { - if (strcmp(p, ".desktop") == 0) - { - int i; - char *file; - - file = strdup(path + our_data->length); - if ((file) && (path)) - { - for (i = 0; file[i] != '\0'; i++) - if (file[i] == '/') - file[i] = '-'; - ecore_hash_set(our_data->pool, file, strdup(path)); -#ifdef DEBUG -// printf -// ("POOLING - _ecore_desktop_menu_check_app(void *data, %s) - %s\n", -// path, file); -#endif - } - } -#ifdef DEBUG - else - printf("PROBLEM - _ecore_desktop_menu_check_app(void *data, %s)\n", - path); -#endif - } - - return 0; -} - -static int -_ecore_desktop_menu_merge(const void *data, Ecore_Desktop_Tree * tree, - int element, int level) -{ - struct _ecore_desktop_menu_unxml_data *unxml_data; - Ecore_Desktop_Tree *merge; - int result = 0; - - unxml_data = (struct _ecore_desktop_menu_unxml_data *)data; - merge = ecore_desktop_tree_new(NULL); - if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - char *string; - - string = (char *)tree->elements[element].element; - if (strcmp(string, "base) - _ecore_desktop_menu_add_dirs(merge, ecore_desktop_paths_menus, - "base, element); - result = 1; - } - else if (strcmp(string, "path, &string[10]); - ecore_desktop_paths_recursive_search(merge_path, NULL, -1, NULL, - _ecore_desktop_menu_check_menu, - merge); - result = 1; - } - else if (strncmp(string, "elements[0].element; - legacy_data.menu += 14; - legacy_data.menu_length = - strchr(legacy_data.menu, '>') - legacy_data.menu; - legacy_data.menu[legacy_data.menu_length] = '\0'; - if (strncmp(string, "prefix=\"", 8) == 0) - { - string += 8; - legacy_data.prefix = string; - while ((*string != '"') && (*string != '\0')) - string++; - if (*string != '\0') - *string++ = '\0'; - while ((*string == ' ') && (*string != '\0')) - string++; - } - if (string[0] == '/') - sprintf(merge_path, "%s", string); - else - sprintf(merge_path, "%s%s", unxml_data->path, string); - legacy_data.path = merge_path; - legacy_data.length = strlen(merge_path); -#ifdef DEBUG - printf(" - %s - %s\n", legacy_data.prefix, merge_path); -#endif - ecore_desktop_paths_recursive_search(merge_path, NULL, -1, - _ecore_desktop_menu_legacy_menu_dir, - _ecore_desktop_menu_legacy_menu, - &legacy_data); - legacy_data.menu[legacy_data.menu_length] = '>'; - result = 1; - } - else if (strncmp(string, "path, string); - } - else /* This is a parent type MergeFile. */ - { - char *xdg_path; - int found = -1; - - /* The spec is a little unclear, and the examples may look like they - * contradict the description, but it all makes sense if you cross - * reference it with the XDG Base Directory Specification (version 0.6). - * To make things harder, parent type MergeFiles never appear on my box. - * - * What you do is this. - * - * Just plain ignore the specified path in the MergeFile element, it's for - * legacy apps that don't understand parent types. - * - * Take the XDG_CONFIG_DIRS stuff as a whole ($XDG_CONFIG_HOME, then - * $XDG_CONFIG_DIRS), in this code that will be ecore_desktop_paths_config. - * - * If this menu file is from one of the directories in ecore_desktop_paths_config, - * scan the rest of ecore_desktop_paths_config looking for the new menu. In other - * words start searching in the next ecore_desktop_paths_config entry after the one - * that this menu is in. - * - * The file to look for is the path to this menu with the portion from - * ecore_desktop_paths_config stripped off the beginning. For instance, the top level - * menu file is typically /etc/xdg/menus/applications.menu, and /etc/xdg is - * typically in ecore_desktop_paths_config, so search for menus/applications.menu. - * - * If this menu file is NOT from one of the directories in ecore_desktop_paths_menus, - * insert nothing. - * - * The first one found wins, if none are found, don't merge anything. - */ - - merge_path[0] = '\0'; - ecore_list_first_goto(ecore_desktop_paths_config); - while ((xdg_path = ecore_list_next(ecore_desktop_paths_config)) != NULL) - { - if (found < 0) - { - int length = strlen(xdg_path); - - if (strncmp(xdg_path, unxml_data->file, length) == 0) - found = length; - } - else - { - snprintf(merge_path, PATH_MAX, "%s%s", xdg_path, &(unxml_data->file)[found]); - if (ecore_file_exists(merge_path)) - break; - merge_path[0] = '\0'; - } - } - - } - if (merge_path[0] != '\0') - { - Ecore_Desktop_Tree *new_menu; - - new_menu = - _ecore_desktop_menu_get0(merge_path, - unxml_data->merge_stack, - level + 1); - if (new_menu) - { - if (new_menu->size > 1) - { - if (new_menu->elements[1].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - new_menu = - (Ecore_Desktop_Tree *) new_menu-> - elements[1].element; - if (new_menu->size > 0) - { - if (new_menu->elements[0].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - merge = - (Ecore_Desktop_Tree *) new_menu-> - elements[0].element; - ecore_desktop_tree_remove(merge, 0); - ecore_desktop_tree_remove(merge, 1); - ecore_desktop_tree_remove(merge, 2); - ecore_desktop_tree_remove(merge, 3); - ecore_desktop_tree_remove(merge, 4); - /* FIXME: The MENU_PATHs need to be prefixed. */ - } - else - printf - ("FUCK an error in _ecore_desktop_menu_merge(%s)\n", - merge_path); - } - else - printf - ("FUCK another error in _ecore_desktop_menu_merge(%s)\n", - merge_path); - } - else - printf - ("FUCK ME! An error in _ecore_desktop_menu_merge(%s)\n", - merge_path); - } - } - } - result = 1; - } - } - - if (result) - { - if ((merge) && (merge->size)) - ecore_desktop_tree_merge(tree, element + 1, merge); - - tree->elements[element].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[element].element = NULL; - } - - return 0; -} - -static int -_ecore_desktop_menu_expand_default_dirs(const void *data, - Ecore_Desktop_Tree * tree, int element, - int level __UNUSED__) -{ - struct _ecore_desktop_menu_unxml_data *unxml_data; - Ecore_Desktop_Tree *merge; - int result = 0; - - unxml_data = (struct _ecore_desktop_menu_unxml_data *)data; - merge = ecore_desktop_tree_new(NULL); - if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - char *string; - - string = (char *)tree->elements[element].element; - if (strcmp(string, "size)) - ecore_desktop_tree_merge(tree, element + 1, merge); - - tree->elements[element].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[element].element = NULL; - } - - return 0; -} - -static int -_ecore_desktop_menu_generate(const void *data, Ecore_Desktop_Tree * tree, - int element, int level) -{ - struct _ecore_desktop_menu_unxml_data *unxml_data; - - unxml_data = (struct _ecore_desktop_menu_unxml_data *)data; - if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - if (strncmp((char *)tree->elements[element].element, "unallocated; - generate_data.name = (char *)tree->elements[element].element; - generate_data.path = (char *)tree->elements[element + 1].element; - generate_data.pool = (Ecore_Hash *) tree->elements[element + 2].element; - generate_data.rules = (Ecore_Desktop_Tree *) tree->elements[element + 3].element; - generate_data.apps = (Ecore_Hash *) tree->elements[element + 4].element; - - /* generate and inherit the pools on the first pass, and preparse the include/exclude logic. */ - if (!generate_data.unallocated) - { - int i; - - for (i = element + 5; i < tree->size; i++) - { - int result = 0; - char *string; - - if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - string = (char *)tree->elements[i].element; - if (strncmp(string, "path, &string[14]); - merge = ecore_desktop_tree_new(NULL); - if (merge) - { - ecore_desktop_paths_recursive_search(merge_path, NULL, -1, NULL, _ecore_desktop_menu_check_directory, merge); - ecore_desktop_tree_merge(tree, i + 1, merge); - } - result = 1; - } - } - else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - Ecore_Desktop_Tree *sub; - - sub = (Ecore_Desktop_Tree *) tree->elements[i].element; - if ((sub) && (sub->size)) - { - if (sub->elements[0].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - string = (char *)sub->elements[0].element; - if ((strcmp(string, "elements[i].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[i].element = NULL; - } - } - - if (unxml_data->stack->size <= level) - { - while (unxml_data->stack->size < level) - ecore_desktop_tree_add_hash(unxml_data->stack, generate_data.pool); - ecore_desktop_tree_add_hash(unxml_data->stack, generate_data.pool); - } - else - { - unxml_data->stack->elements[level].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH; - unxml_data->stack->elements[level].element = generate_data.pool; - } - for (i = level - 1; i >= 0; i--) - { - if (unxml_data->stack->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH) - { - Ecore_Hash *ancestor; - - ancestor = (Ecore_Hash *) unxml_data->stack->elements[i].element; - ecore_hash_for_each_node(ancestor, _ecore_desktop_menu_inherit_apps, generate_data.pool); - } - } - } - - /* Process the rules. */ - if (generate_data.name[9] == (generate_data.unallocated ? 'O' : ' ')) - { -#ifdef DEBUG - printf("MAKING MENU - %s \t\t%s\n", generate_data.path, generate_data.name); - ecore_desktop_tree_dump(generate_data.rules, 0); - printf("\n\n"); -#endif - for (i = 0; i < generate_data.rules->size; i++) - { - if (generate_data.rules->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - generate_data.rule = (Ecore_Desktop_Tree *) generate_data.rules->elements[i].element; - if (generate_data.rule->size > 0) - { - char type = 'I'; - - /* Find out if this is an include or an exclude. This info may be way down in the tree. */ - if (generate_data.rule->elements[0].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - ecore_desktop_tree_foreach(generate_data.rule, 0, _ecore_desktop_menu_is_include, &type); - if (type == 'I') - { - generate_data.include = TRUE; - ecore_hash_for_each_node(generate_data.pool, _ecore_desktop_menu_select_app, &generate_data); - } - else - { - generate_data.include = FALSE; - ecore_hash_for_each_node(generate_data.apps, _ecore_desktop_menu_select_app, &generate_data); - } - } - } - else - printf("Fuck, a bug in _ecore_desktop_menus.\n"); - } - } - } - } - return 0; -} - -static int -_ecore_desktop_menu_is_include(const void *data, Ecore_Desktop_Tree * tree, int element, int level __UNUSED__) -{ - char *result; - - result = (char *)data; - if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - { - *result = ((char *)tree->elements[element].element)[0]; - return 1; - } - - return 0; -} - -static void -_ecore_desktop_menu_inherit_apps(void *value, void *user_data) -{ - Ecore_Hash_Node *node; - Ecore_Hash *pool; - char *key, *app; - - pool = (Ecore_Hash *) user_data; - node = (Ecore_Hash_Node *) value; - key = (char *)node->key; - app = (char *)node->value; -#ifdef DEBUG -// printf("CHECKING %s - %s\n", app, key); -#endif - if (!ecore_hash_get(pool, key)) - ecore_hash_set(pool, strdup(key), strdup(app)); -} - -static void -_ecore_desktop_menu_select_app(void *value, void *user_data) -{ - Ecore_Hash_Node *node; - Ecore_Desktop *desktop; - struct _ecore_desktop_menu_generate_data *generate_data; - char *key, *app; - - node = (Ecore_Hash_Node *) value; - generate_data = (struct _ecore_desktop_menu_generate_data *)user_data; - key = (char *)node->key; - app = (char *)node->value; - - /* FIXME: pass an actuall language parameter. */ - desktop = ecore_desktop_get(app, NULL); - - if (desktop) - { - if ((generate_data->unallocated) && (desktop->allocated)) - return; - - if (_ecore_desktop_menu_apply_rules(generate_data, generate_data->rule, key, desktop)) - { - desktop->allocated = TRUE; - if (generate_data->include) - { - ecore_hash_set(generate_data->apps, key, strdup(app)); -#ifdef DEBUG - printf("INCLUDING %s%s - %s\n", ((generate_data->unallocated) ? "UNALLOCATED " : ""), app, key); -#endif - } - else - { - ecore_hash_remove(generate_data->apps, key); -#ifdef DEBUG - printf("EXCLUDING %s%s - %s\n", ((generate_data->unallocated) ? "UNALLOCATED " : ""), app, key); -#endif - } - } - } -} - -static int -_ecore_desktop_menu_apply_rules(struct _ecore_desktop_menu_generate_data *generate_data, Ecore_Desktop_Tree * rule, char *key, Ecore_Desktop * desktop) -{ - char type = 'O'; - int result = FALSE; - int i; - - for (i = 0; i < rule->size; i++) - { - if (rule->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - result = _ecore_desktop_menu_apply_rules(generate_data, (Ecore_Desktop_Tree *) rule->elements[i].element, key, desktop); - } - else - { - char *rul; - char match; - int sub_result = FALSE; - - rul = (char *)rule->elements[i].element; - type = rul[1]; - match = rul[2]; - switch (match) - { - case 'A': - { - sub_result = TRUE; - break; - } - - case 'F': - { - if (strcmp(key, &rul[4]) == 0) - sub_result = TRUE; - break; - } - - case 'C': - { - /* Try to match a category. */ - if ((desktop->Categories) && (ecore_hash_get(desktop->Categories, &rul[4]) != NULL)) - sub_result = TRUE; - break; - } - } - switch (type) - { - case 'A': result = TRUE; if (!sub_result) return FALSE; break; - case 'N': result = TRUE; if (sub_result) return FALSE; break; - default: if (sub_result) return TRUE; break; - } - } - } - - return result; -} - -/* - -'s to . -*12000000 expand 's -*12100000 for each dir (recursive) -*12110000 create recursively nested <> element -*12120000 // dirpath -*12130000 dirpath -*12140000 if exist .directory -*12141000 add <.directory> to name -*12150000 -*12160000 for each *.desktop - 12161000 if no categories in bar.desktop -*12161100 prefix-bar.desktop - 12162000 add "Legacy" to categories -*12163000 add any prefix to the desktop ID. -*12164000 add it to the pool -*12170000 -*13000000 for each and element -*13100000 get the root elements from that elements file/s. -*13200000 remove the element from those root elements. -*13300000 replace that element with the child elements of those root elements. -*13400000? expand the to 's $XDG_CONFIG_DIRS/menus/foo-merged/ for the menu file foo.menu -FIXME: The above should probably move to before 13000000 -*14000000 loop until all and elements are done, -*14000000 careful to avoid infinite loops in files that reference each other. -*15000000 for each recursively - 15100000 consolidate duplicate child s. -*15200000 expand s and s to s and s. - 15300000 consolidate duplicate child s, s, and s. - 16000000 for each recursively (but from the deepest level out) - 16100000 for each - 16110000 do the move. - 16120000 mark any that has been affected. - 17000000 for each marked recursively - 17100000 consolidate duplicate child s. -*18000000 for each recursively -*18100000 if there are elements that are not ovreridden by a element -*18110000 remove this element and all it's children. - -*20000000 generate menus -*21000000 for each that is (which is the default) -*21100000 for each -*21110000 for each .desktop -*21111000 if it exists in the pool, replace it. -*21112000 else add it to the pool. -*21200000 for each parent -*21210000 for each .desktop in the pool -*21211000 if it doesn't exist in the child pool -*21211100 add it to the pool. -*21300000 for each and -*21310000 if rule is an -*21311000 for each .desktop in pool -*21311100 for each rule -*21311110 if rule matches .desktop in pool -*21311111 add .desktop to menu. -*21311112 mark it as allocated -*21320000 if rule is an -*21321000 for each .desktop in menu -*21321100 for each rule -*21321110 if rule matches .desktop in menu -*21321111 remove .desktop from menu. -*21321112 leave it as allocated. - -*30000000 generate unallocated menus -*31000000 Same as for generate menus, but only the ones. -*32000000 Only the unallocated .desktop entries can be used. - - 40000000 generate menu layout - This part of the spec is a whole other rabbit hole, and optional. B-) -*/ - - -/* THINGS TAHT CAN BE DUPLICATED - -AppDir last dup is used -.desktop last dup is used -DirectoryDir last dup is used -.directory last dup is used -Directory last dup is used, unless it points to a non existant entry, then work your way backwards -LegacyDir last dup is used -MergeDir last dup is used -MergeFile last dup is used - -DefaultMergeDirs dirs that are earlier in the path go later in the menu, so they have priority -KDELegacyDirs dirs that are earlier in the path go later in the menu, so they have priority - -OnlyUnallocated & NotOnlyUnallocated last one wins, default is NotOnlyUnallocated -Deleted & NotDeleted last one wins - -Include & Exclude done in order -*/ diff --git a/src/lib/ecore_desktop/ecore_desktop_paths.c b/src/lib/ecore_desktop/ecore_desktop_paths.c deleted file mode 100644 index ec3975e..0000000 --- a/src/lib/ecore_desktop/ecore_desktop_paths.c +++ /dev/null @@ -1,1041 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ -/* - * This conforms with the freedesktop.org XDG Base Directory Specification version 0.6 - * - * The policy here is to add extra directories to the possible search paths to - * cater for quirks of different OS's. It doesn't take long to eliminate an - * excess directory from the paths. - */ - -#include - -#include "Ecore_Desktop.h" -#include "ecore_desktop_private.h" - -#include -#include -#include -#include - -/* This really slows things down and no doubt drags in some KDE bloat at start up. - * To work around this, I add a few extra things to try in the _ecore_desktop_paths_get() - * calls below. - * -#define KDE_SUPPORT 1 - */ - -/* This is nowhere near as bloated and slow as the KDE stuff, but worthwhile - * making it optional anyway. - * -#define GNOME_SUPPORT 1 - */ - -/* FIXME: remove those two defines, preload a cache with the guesses, whenever - * we have a few seconds of idle time, run the gnome and kde config proggies - * and correct those guesses. - */ - -Ecore_List *ecore_desktop_paths_config = NULL; -Ecore_List *ecore_desktop_paths_menus = NULL; -Ecore_List *ecore_desktop_paths_directories = NULL; -Ecore_List *ecore_desktop_paths_desktops = NULL; -Ecore_List *ecore_desktop_paths_icons = NULL; -Ecore_List *ecore_desktop_paths_kde_legacy = NULL; -Ecore_List *ecore_desktop_paths_xsessions = NULL; - - -static Ecore_List *_ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type, - const char *before, const char *env_home, - const char *env, const char *env_home_default, - const char *env_default, const char *type, - const char *gnome_extra, const char *kde); -static void _ecore_desktop_paths_massage_path(char *path, char *home, - char *first, - char *second); -static void _ecore_desktop_paths_check_and_add(Ecore_List * paths, - const char *path); -static void _ecore_desktop_paths_create(void); -static void _ecore_desktop_paths_destroy(void); - -static Ecore_List *gnome_data = NULL; -static Ecore_List *prepend_user_paths[ECORE_DESKTOP_PATHS_MAX]; -static Ecore_List *prepend_system_paths[ECORE_DESKTOP_PATHS_MAX]; -static Ecore_List *append_user_paths[ECORE_DESKTOP_PATHS_MAX]; -static Ecore_List *append_system_paths[ECORE_DESKTOP_PATHS_MAX]; -static char *home; -static int init_count = 0; - -#if defined GNOME_SUPPORT || defined KDE_SUPPORT -struct _config_exe_data -{ - char *home; - Ecore_List *paths, *types; - int done; -}; - -static void _ecore_desktop_paths_exec_config(Ecore_List * paths, - char *home, - Ecore_List * extras, - char *cmd); - -static int _ecore_desktop_paths_cb_exe_exit(void *data, int type, - void *event); - -static Ecore_Event_Handler *exit_handler = NULL; -#endif - -EAPI int -ecore_desktop_paths_init(void) -{ - if (++init_count != 1) - return init_count; - -#if defined GNOME_SUPPORT || defined KDE_SUPPORT - exit_handler = - ecore_event_handler_add(ECORE_EXE_EVENT_DEL, - _ecore_desktop_paths_cb_exe_exit, NULL); -#endif - - ecore_desktop_paths_extras_clear(); - gnome_data = ecore_list_new(); - home = ecore_desktop_home_get(); - - if (gnome_data) - { -#ifdef GNOME_SUPPORT - if (exit_handler) - { - ecore_list_free_cb_set(gnome_data, free); - _ecore_desktop_paths_exec_config(gnome_data, home, NULL, - "gnome-config --datadir"); - } -#else - Ecore_List *config_list; - - config_list = ecore_desktop_paths_to_list("/opt/gnome/share"); - if (config_list) - { - char *this_config; - char path[PATH_MAX]; - - ecore_list_first_goto(config_list); - while ((this_config = ecore_list_next(config_list)) != NULL) - { - - _ecore_desktop_paths_massage_path(path, home, - this_config, NULL); - _ecore_desktop_paths_check_and_add(gnome_data, path); - } - E_FN_DEL(ecore_list_destroy, config_list); - } -#endif - } - - _ecore_desktop_paths_create(); - return init_count; -} - -EAPI int -ecore_desktop_paths_shutdown(void) -{ - int i; - - if (--init_count != 0) - return init_count; - - for (i = 0; i < ECORE_DESKTOP_PATHS_MAX; i++) - { - E_FN_DEL(ecore_list_destroy, prepend_user_paths[i]); - E_FN_DEL(ecore_list_destroy, prepend_system_paths[i]); - E_FN_DEL(ecore_list_destroy, append_user_paths[i]); - E_FN_DEL(ecore_list_destroy, append_system_paths[i]); - } - - _ecore_desktop_paths_destroy(); - E_FN_DEL(ecore_list_destroy, gnome_data); - -#if defined GNOME_SUPPORT || defined KDE_SUPPORT - if (exit_handler) - ecore_event_handler_del(exit_handler); -#endif - free(home); - return init_count; -} - -EAPI void -ecore_desktop_paths_regen(void) -{ - _ecore_desktop_paths_destroy(); - _ecore_desktop_paths_create(); -} - -static void -_ecore_desktop_paths_create(void) -{ - if (!ecore_desktop_paths_desktops) - { - ecore_desktop_paths_desktops = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DESKTOPS, NULL, - "XDG_DATA_HOME", "XDG_DATA_DIRS", - "~/.local/share:~/.kde/share", - "/usr/local/share:/usr/share", -// "applications:applnk:applications/kde", - "applications:applnk", - "dist/desktop-files:dist/short-menu:gnome/apps", - "xdgdata-apps:apps"); - _ecore_desktop_paths_check_and_add(ecore_desktop_paths_desktops, - "/usr/local/share/update-desktop-files/templates"); - _ecore_desktop_paths_check_and_add(ecore_desktop_paths_desktops, - "/usr/share/update-desktop-files/templates"); - } - if (!ecore_desktop_paths_kde_legacy) - { -#ifdef KDE_SUPPORT - ecore_desktop_paths_kde_legacy = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, "apps"); -#else - ecore_desktop_paths_kde_legacy = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL, - "XDG_DATA_HOME", "XDG_DATA_DIRS", - "~/.local/share:~/.kde/share", - "/usr/local/share:/usr/share", "applnk", - NULL, "apps"); -#endif - if (ecore_desktop_paths_kde_legacy) - { - char temp[PATH_MAX], *path; - Ecore_List *temp_list; - - /* Copy it, cause Ecore_List walks can not be nested. */ - temp_list = ecore_list_new(); - if (temp_list) - { - ecore_list_first_goto(ecore_desktop_paths_kde_legacy); - while ((path = - ecore_list_next(ecore_desktop_paths_kde_legacy)) != - NULL) - ecore_list_append(temp_list, path); - - ecore_list_first_goto(temp_list); - while ((path = ecore_list_next(temp_list)) != NULL) - { - char *t1, *t2; - - t1 = rindex(path, '/'); - *t1 = '\0'; - t2 = rindex(path, '/'); - *t2 = '\0'; - sprintf(temp, "%s/apps/kappfinder/apps/", path); - *t2 = '/'; - *t1 = '/'; - _ecore_desktop_paths_check_and_add - (ecore_desktop_paths_kde_legacy, temp); - } - } - ecore_list_destroy(temp_list); - } - } - if (!ecore_desktop_paths_icons) - { - char *gnome; - - ecore_desktop_paths_icons = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_ICONS, "~/.icons", - "XDG_DATA_HOME", "XDG_DATA_DIRS", - "~/.local/share:~/.kde/share", - "/usr/local/share:/usr/share:/usr/X11R6/share", - "icons:pixmaps", "dist/icons", - "icon:pixmap"); - _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons, - "/usr/local/share/pixmaps/"); - _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons, - "/usr/share/pixmaps/"); - _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons, - "/usr/share/update-desktop-files/kappfinder-icons/"); - gnome = getenv("GNOME_ICON_PATH"); - if (gnome) - _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons, gnome); - } - if (!ecore_desktop_paths_menus) - ecore_desktop_paths_menus = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_MENUS, NULL, - "XDG_CONFIG_HOME", "XDG_CONFIG_DIRS", - "~/.config", "/etc/xdg:/var/lib/menu-xdg", - "menus", NULL, "xdgconf-menu"); - if (!ecore_desktop_paths_directories) - ecore_desktop_paths_directories = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DIRECTORIES, NULL, - "XDG_DATA_HOME", "XDG_DATA_DIRS", - "~/.local/share:~/.kde/share", - "/usr/local/share:/usr/share", - "desktop-directories", "gnome/vfolders", - "xdgdata-dirs"); - if (!ecore_desktop_paths_config) - ecore_desktop_paths_config = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_CONFIG, NULL, - "XDG_CONFIG_HOME", "XDG_CONFIG_DIRS", - "~/.config", "/etc/xdg", NULL, NULL, NULL); - if (!ecore_desktop_paths_xsessions) - ecore_desktop_paths_xsessions = - _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_XSESSIONS, NULL, - "XDG_DATA_HOME", "XDG_DATA_DIRS", - "~/.local/share:~/.kde/share", - "/usr/local/share:/usr/share", "xsessions", - NULL, NULL); -} - -static void -_ecore_desktop_paths_destroy(void) -{ - E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_xsessions); - E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_config); - E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_directories); - E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_menus); - E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_icons); - E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_kde_legacy); - E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_desktops); -} - -EAPI void -ecore_desktop_paths_extras_clear(void) -{ - int i; - - for (i = 0; i < ECORE_DESKTOP_PATHS_MAX; i++) - { - E_FN_DEL(ecore_list_destroy, prepend_user_paths[i]); - E_FN_DEL(ecore_list_destroy, prepend_system_paths[i]); - E_FN_DEL(ecore_list_destroy, append_user_paths[i]); - E_FN_DEL(ecore_list_destroy, append_system_paths[i]); - prepend_user_paths[i] = ecore_list_new(); - if (prepend_user_paths[i]) - ecore_list_free_cb_set(prepend_user_paths[i], free); - prepend_system_paths[i] = ecore_list_new(); - if (prepend_system_paths[i]) - ecore_list_free_cb_set(prepend_system_paths[i], free); - append_user_paths[i] = ecore_list_new(); - if (append_user_paths[i]) - ecore_list_free_cb_set(append_user_paths[i], free); - append_system_paths[i] = ecore_list_new(); - if (append_system_paths[i]) - ecore_list_free_cb_set(append_system_paths[i], free); - } -} - -EAPI void -ecore_desktop_paths_prepend_user(Ecore_Desktop_Paths_Type type, const char *paths) -{ - if (prepend_user_paths[type]) - ecore_list_append(prepend_user_paths[type], strdup(paths)); -} - -EAPI void -ecore_desktop_paths_prepend_system(Ecore_Desktop_Paths_Type type, const char *paths) -{ - if (prepend_system_paths[type]) - ecore_list_append(prepend_system_paths[type], strdup(paths)); -} - -EAPI void -ecore_desktop_paths_append_user(Ecore_Desktop_Paths_Type type, const char *paths) -{ - if (append_user_paths[type]) - ecore_list_append(append_user_paths[type], strdup(paths)); -} - -EAPI void -ecore_desktop_paths_append_system(Ecore_Desktop_Paths_Type type, const char *paths) -{ - if (append_system_paths[type]) - ecore_list_append(append_system_paths[type], strdup(paths)); -} - -/** Search for a file in fdo compatible locations. - * - * This will search through all the diretories of a particular type, looking - * for the file. It will recurse into subdirectories. If func is NULL, then - * only the first file found will be returned. If func is defined, then each - * file found will be passed to func, until func returns 1. - * - * The returned string will have to be freed eventually. - * - * @param type The type of directories to search. - * @param file The file to search for. - * @param sub Levels of sub directories to search, -1 = all, 0 = none. - * @param func A function to call for each file found. - * @param data A pointer to pass on to func. - */ -char * -ecore_desktop_paths_file_find(Ecore_List * paths, const char *file, int sub, - int (*func) (void *data, const char *path), - void *data) -{ - char *path = NULL, *this_path; - char temp[PATH_MAX]; - struct stat path_stat; - - if (!paths) return NULL; - ecore_list_first_goto(paths); - while ((this_path = ecore_list_next(paths)) != NULL) - { - if (path) - { - free(path); - path = NULL; - } - snprintf(temp, PATH_MAX, "%s%s", this_path, file); - if (stat(temp, &path_stat) == 0) - { - path = strdup(temp); - if ((func) && (func(data, temp))) - break; - } - else if (sub != 0) - path = - ecore_desktop_paths_recursive_search(this_path, file, sub, - NULL, func, data); - if (path && (!func)) - break; - } - - return path; -} - -/* We need - -config file full of paths -menus=pathlist -desktops=pathlist -directories=pathlist -icons=pathlist -*/ - -static Ecore_List * -_ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type, - const char *before, const char *env_home, const char *env, - const char *env_home_default, const char *env_default, const char *type, - const char *gnome_extra, const char *kde) -{ - Ecore_List *paths = NULL; - Ecore_List *types = NULL; - Ecore_List *gnome_extras = NULL; - char path[PATH_MAX]; - Ecore_List *env_list; - - -#ifdef KDE_SUPPORT - Ecore_List *kdes = NULL; -#endif - - paths = ecore_list_new(); - if (!paths) return NULL; - ecore_list_free_cb_set(paths, free); - /* Don't sort them, as they are in preferred order from each source. */ - /* Merge the results, there are probably some duplicates. */ - - if (type) - types = ecore_desktop_paths_to_list(type); - if (gnome_extra) - gnome_extras = ecore_desktop_paths_to_list(gnome_extra); -#ifdef KDE_SUPPORT - if (kde) - kdes = ecore_desktop_paths_to_list(kde); -#else - kde = NULL; -#endif - - if (before) - { - Ecore_List *befores; - - befores = ecore_desktop_paths_to_list(before); - if (befores) - { - char *this_before; - - ecore_list_first_goto(befores); - while ((this_before = ecore_list_next(befores)) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, - this_before, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - E_FN_DEL(ecore_list_destroy, befores); - } - } - - if (prepend_user_paths[path_type]) - { - char *this_path; - - ecore_list_first_goto(prepend_user_paths[path_type]); - while ((this_path = ecore_list_next(prepend_user_paths[path_type])) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, this_path, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - - if (env_home) - { - const char *value; - - value = getenv(env_home); - if ((value == NULL) || (value[0] == '\0')) - value = env_home_default; - env_list = ecore_desktop_paths_to_list(value); - if (env_list) - { - char *this_env; - - ecore_list_first_goto(env_list); - while ((this_env = ecore_list_next(env_list)) != NULL) - { - if (types) - { - char *this_type; - - ecore_list_first_goto(types); - while ((this_type = ecore_list_next(types)) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, - this_env, this_type); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - else - { - _ecore_desktop_paths_massage_path(path, home, this_env, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - E_FN_DEL(ecore_list_destroy, env_list); - } - } - - if (append_user_paths[path_type]) - { - char *this_path; - - ecore_list_first_goto(append_user_paths[path_type]); - while ((this_path = ecore_list_next(append_user_paths[path_type])) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, this_path, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - - if (prepend_system_paths[path_type]) - { - char *this_path; - - ecore_list_first_goto(prepend_system_paths[path_type]); - while ((this_path = ecore_list_next(prepend_system_paths[path_type])) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, this_path, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - - if (env) - { - const char *value; - - value = getenv(env); - if ((value == NULL) || (value[0] == '\0')) - value = env_default; - env_list = ecore_desktop_paths_to_list(value); - if (env_list) - { - char *this_env; - - ecore_list_first_goto(env_list); - while ((this_env = ecore_list_next(env_list)) != NULL) - { - if (types) - { - char *this_type; - - ecore_list_first_goto(types); - while ((this_type = ecore_list_next(types)) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, - this_env, this_type); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - else - { - _ecore_desktop_paths_massage_path(path, home, this_env, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - E_FN_DEL(ecore_list_destroy, env_list); - } - } - - if (append_system_paths[path_type]) - { - char *this_path; - - ecore_list_first_goto(append_system_paths[path_type]); - while ((this_path = ecore_list_next(append_system_paths[path_type])) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, this_path, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - - /* - * Get the pathlist from the config file - type=pathlist - * for each path in config - * if it is already in paths, skip it - * if it exists, add it to end of paths - */ - - if (gnome_data) - { - char *this_gnome; - - ecore_list_first_goto(gnome_data); - while ((this_gnome = ecore_list_next(gnome_data)) != NULL) - { - if (types) - { - char *this_type; - - ecore_list_first_goto(types); - while ((this_type = ecore_list_next(types)) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, - this_gnome, this_type); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - else - { - _ecore_desktop_paths_massage_path(path, home, this_gnome, NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - } - if (gnome_data && gnome_extras) - { - char *this_gnome, *this_type; - - ecore_list_first_goto(gnome_data); - while ((this_gnome = ecore_list_next(gnome_data)) != NULL) - { - ecore_list_first_goto(gnome_extras); - while ((this_type = ecore_list_next(gnome_extras)) != NULL) - { - _ecore_desktop_paths_massage_path(path, home, - this_gnome, this_type); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - } - -#ifdef KDE_SUPPORT - if ((exit_handler != NULL) && (kdes != NULL)) - { - char *this_kde; - - ecore_list_first_goto(kdes); - while ((this_kde = ecore_list_next(kdes)) != NULL) - { - char cmd[128]; - - sprintf(cmd, "kde-config --path %s", this_kde); - _ecore_desktop_paths_exec_config(paths, home, NULL, cmd); - } - } -#endif - -#ifdef KDE_SUPPORT - E_FN_DEL(ecore_list_destroy, kdes); -#endif - E_FN_DEL(ecore_list_destroy, gnome_extras); - E_FN_DEL(ecore_list_destroy, types); - - return paths; -} - -static void -_ecore_desktop_paths_massage_path(char *path, char *home, char *first, - char *second) -{ - int last; - - /* Strip traling slash of first. */ - last = strlen(first) - 1; - while ((last >= 0) && (first[last] == '/')) - { - first[last] = '\0'; - last--; - } - - if (second) - { - /* Strip traling slash of second. */ - last = strlen(second) - 1; - while ((last >= 0) && (second[last] == '/')) - { - second[last] = '\0'; - last--; - } - } - - if ((second) && (second[0] != '\0')) - { - if (first[0] == '~') - sprintf(path, "%s%s/%s/", home, &first[1], - &second[(second[0] == '/') ? 1 : 0]); - else - sprintf(path, "%s/%s/", first, &second[(second[0] == '/') ? 1 : 0]); - } - else - { - if (first[0] == '~') - sprintf(path, "%s%s/", home, &first[1]); - else - sprintf(path, "%s/", first); - } -} - -static void -_ecore_desktop_paths_check_and_add(Ecore_List * paths, const char *path) -{ - struct stat path_stat; - char *this_path; - - if (!paths) return; - - /* Check if we have it already. */ - ecore_list_first_goto(paths); - while ((this_path = ecore_list_next(paths)) != NULL) - { - if (strcmp(path, this_path) == 0) - return; - } - - /* Check if the path exists. */ - if ((stat(path, &path_stat) == 0) && (S_ISDIR(path_stat.st_mode))) - ecore_list_append(paths, strdup(path)); -} - -char * -ecore_desktop_paths_recursive_search(const char *path, const char *file, - int sub, int (*dir_func) (void *data, - const char - *path), - int (*func) (void *data, const char *path), - void *data) -{ - char *fpath = NULL; - DIR *dir = NULL; - struct dirent *script; - - if ((sub != 0) && (sub != -1)) - sub -= 1; - - dir = opendir(path); - if (!dir) return NULL; - - while ((script = readdir(dir)) != NULL) - { - struct stat script_stat; - char info_text[PATH_MAX]; - - sprintf(info_text, "%s%s", path, script->d_name); - if ((stat(info_text, &script_stat) == 0)) - { - if (S_ISDIR(script_stat.st_mode)) - { - if ((strcmp(basename(info_text), ".") != 0) && - (strcmp(basename(info_text), "..") != 0)) - { - snprintf(info_text, PATH_MAX, "%s%s/", path, script->d_name); - if ((dir_func) && (dir_func(data, info_text))) - break; - if (sub != 0) - { - if (fpath) free(fpath); - fpath = - ecore_desktop_paths_recursive_search(info_text, file, sub, - dir_func, func, data); - } - } - } - else - { - if (file) - { - if (strcmp(basename(info_text), file) == 0) - { - if (fpath) - free(fpath); - fpath = strdup(info_text); - if ((func) && (func(data, path))) - break; - } - } - else - { - if ((func) && (func(data, info_text))) - break; - } - } - if (fpath && (!func)) - break; - } - } - closedir(dir); - - return fpath; -} - -#if defined GNOME_SUPPORT || defined KDE_SUPPORT -static void -_ecore_desktop_paths_exec_config(Ecore_List * paths, char *home, - Ecore_List * extras, char *cmd) -{ - Ecore_Exe *exe; - struct _config_exe_data ced; - - ced.home = home; - ced.paths = paths; - ced.types = extras; - ced.done = 0; - exe = - ecore_exe_pipe_run(cmd, - ECORE_EXE_PIPE_AUTO | ECORE_EXE_PIPE_READ | - ECORE_EXE_PIPE_READ_LINE_BUFFERED, &ced); - if (exe) - { - ecore_exe_tag_set(exe, "genmenu/fdo"); - while (ced.done == 0) - { - /* FIXME: raster is paranoid. If too much time passes, give up. - * Or find a way to let the usual event loop shit do this without - * spinning our wheels. On the other hand, these are quick - * commands, and we NEED this data before we can continue. On - * the gripping hand, some tweaking of the stuff searched for not - * only gets rid of the need for this, but also speeds things up - * drastically. - */ - ecore_main_loop_iterate(); - usleep(10); - } - } -} - -static int -_ecore_desktop_paths_cb_exe_exit(void *data, int type, void *event) -{ - Ecore_Exe_Event_Del *ev; - Ecore_List *paths; - Ecore_List *config_list; - Ecore_Exe_Event_Data *read; - struct _config_exe_data *ced; - char *value; - char path[PATH_MAX]; - - ev = event; - if (!ev->exe) - return 1; - value = ecore_exe_tag_get(ev->exe); - if ((!value) || (strcmp(value, "genmenu/fdo")) != 0) - return 1; - ced = ecore_exe_data_get(ev->exe); - if (!ced) - return 1; - paths = ced->paths; - if (!paths) - return 1; - - read = ecore_exe_event_data_get(ev->exe, ECORE_EXE_PIPE_READ); - if ((read) && (read->lines[0].line)) - { - value = read->lines[0].line; - config_list = ecore_desktop_paths_to_list(value); - if (config_list) - { - char *this_config, *this_type; - - ecore_list_first_goto(config_list); - while ((this_config = ecore_list_next(config_list)) != NULL) - { - if (ced->types) - { - ecore_list_first_goto(ced->types); - while ((this_type = - ecore_list_next(ced->types)) != NULL) - { - _ecore_desktop_paths_massage_path(path, - ced->home, - this_config, - this_type); - _ecore_desktop_paths_check_and_add(paths, - path); - } - } - else - { - _ecore_desktop_paths_massage_path(path, ced->home, - this_config, - NULL); - _ecore_desktop_paths_check_and_add(paths, path); - } - } - E_FN_DEL(ecore_list_destroy, config_list); - } - } - ced->done = 1; - return 1; -} -#endif - -/** Split a list of paths into an Ecore_Hash. - * - * The list of paths can use any one of ;:, to seperate the paths. - * You can also escape the :;, with \. - * - * @param paths A list of paths. - */ -Ecore_Hash * -ecore_desktop_paths_to_hash(const char *paths) -{ - Ecore_Hash *result; - char *path; - char buf[PATH_MAX], *p, *pp; - - if (!paths) return NULL; - result = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (!result) return NULL; - ecore_hash_free_key_cb_set(result, free); - ecore_hash_free_value_cb_set(result, free); - - path = strdup(paths); - if (path) - { - p = path; - while (p) - { - pp = buf; - while (*p) - { - /* Check for escape */ - if (*p == '\\') - { - /* If separator, skip escape */ - if ((*(p + 1) == ';') || (*(p + 1) == ':') || (*(p + 1) == ',')) - p++; - } - /* Check for separator */ - else if ((*p == ';') || (*p == ':') || (*p == ',')) - break; - *pp = *p; - pp++; - p++; - } - *pp = '\0'; - if (*buf) ecore_hash_set(result, strdup(buf), strdup(buf)); - if (*p) p++; - else p = NULL; - } - free(path); - } - return result; -} - -/** Split a list of paths into an Ecore_Hash. - * - * The list of paths can use any one of ;:, to seperate the paths. - * You can also escape the :;, with \. - * - * @param paths A list of paths. - */ -Ecore_List * -ecore_desktop_paths_to_list(const char *paths) -{ - Ecore_List *result; - char *path; - char buf[PATH_MAX], *p, *pp; - - if (!paths) return NULL; - result = ecore_list_new(); - if (!result) return NULL; - ecore_list_free_cb_set(result, free); - - path = strdup(paths); - if (path) - { - p = path; - while (p) - { - pp = buf; - while (*p) - { - /* Check for escape */ - if (*p == '\\') - { - /* If separator, skip escape */ - if ((*(p + 1) == ';') || (*(p + 1) == ':') || (*(p + 1) == ',')) - p++; - } - /* Check for separator */ - else if ((*p == ';') || (*p == ':') || (*p == ',')) - break; - *pp = *p; - pp++; - p++; - } - *pp = '\0'; - if (*buf) ecore_list_append(result, strdup(buf)); - if (*p) p++; - else p = NULL; - } - free(path); - } - return result; -} - -EAPI int -ecore_desktop_paths_for_each(Ecore_Desktop_Paths_Type type, - Ecore_For_Each function, void *user_data) -{ - Ecore_List *list = NULL; - - switch (type) - { - case ECORE_DESKTOP_PATHS_CONFIG: - list = ecore_desktop_paths_config; - break; - case ECORE_DESKTOP_PATHS_MENUS: - list = ecore_desktop_paths_menus; - break; - case ECORE_DESKTOP_PATHS_DIRECTORIES: - list = ecore_desktop_paths_directories; - break; - case ECORE_DESKTOP_PATHS_DESKTOPS: - list = ecore_desktop_paths_desktops; - break; - case ECORE_DESKTOP_PATHS_ICONS: - list = ecore_desktop_paths_icons; - break; - case ECORE_DESKTOP_PATHS_KDE_LEGACY: - list = ecore_desktop_paths_kde_legacy; - break; - case ECORE_DESKTOP_PATHS_XSESSIONS: - list = ecore_desktop_paths_xsessions; - break; - case ECORE_DESKTOP_PATHS_MAX: - break; - } - if (list) - return ecore_list_for_each(list, function, user_data); - return 0; -} diff --git a/src/lib/ecore_desktop/ecore_desktop_private.h b/src/lib/ecore_desktop/ecore_desktop_private.h deleted file mode 100644 index 4d8c176..0000000 --- a/src/lib/ecore_desktop/ecore_desktop_private.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ -#ifndef _ECORE_DESKTOP_PRIVATE_H -# define _ECORE_DESKTOP_PRIVATE_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; } -#define E_REALLOC(p, s, n) p = (s *)realloc(p, sizeof(s) * n) -#define E_NEW(s, n) (s *)calloc(n, sizeof(s)) -#define E_NEW_BIG(s, n) (s *)malloc(n * sizeof(s)) -#define E_FREE(p) { if (p) {free(p); p = NULL;} } - -extern Ecore_List *ecore_desktop_paths_config; -extern Ecore_List *ecore_desktop_paths_menus; -extern Ecore_List *ecore_desktop_paths_directories; -extern Ecore_List *ecore_desktop_paths_desktops; -extern Ecore_List *ecore_desktop_paths_icons; -extern Ecore_List *ecore_desktop_paths_kde_legacy; -extern Ecore_List *ecore_desktop_paths_xsessions; -extern struct _Ecore_Desktop_Instrumentation instrumentation; - - -# ifdef __cplusplus -extern "C" -{ -# endif -# ifdef __cplusplus -} -# endif - -#endif diff --git a/src/lib/ecore_desktop/ecore_desktop_tree.c b/src/lib/ecore_desktop/ecore_desktop_tree.c deleted file mode 100644 index e8bf09e..0000000 --- a/src/lib/ecore_desktop/ecore_desktop_tree.c +++ /dev/null @@ -1,362 +0,0 @@ -#include - -#include "Ecore_Desktop.h" -#include "ecore_desktop_private.h" - -static void ecore_desktop_tree_dump_each_hash_node(void *value, - void *user_data); - -/* Just a quick and dirty tree implemtation that will likely get replaced by - * something much saner at a later date. I wrote most of this while falling - * asleep. It will probably scare me when I wake up. B-) - * - * Devilhorns said to make it portable, so we can't rely on any external tree - * implementation. So this tree is designed specifically for this task. Then - * we finally found a place for the genmenu code, and Ecore was back on the - * menu. However, speed could be an issue later, so it might be worth it to - * stick with a custom tree implementation, so that we can optimize it for this - * task. - * - * The trees will be tiny. - * They only store strings. - * There is no insertion or deletion, only append. - * Append order must be maintained. - * The trees will only ever be accessed sequentially, from begining to end. - * The tree data will come in two ways, all in one big string, or a bunch of - * seperate strings, one per element. Any particular tree might have both. - * - * No duplicates in the tree, - * This is the nasty part of this tree implementation. - * Insertions involve a linear search for dupes, most of the - * time there won't be any dupes, so the tree is searched in - * it's entirety. These trees will be really small, and only created at - * the begining, so no big drama there. - * The tree may allow duplicates. - */ - -Ecore_Desktop_Tree * -ecore_desktop_tree_new(char *buffer) -{ - Ecore_Desktop_Tree *tree; - - tree = E_NEW(Ecore_Desktop_Tree, 1); - if ((tree) && (buffer)) - { - tree->buffers = - (char **)realloc(tree->buffers, - (tree->buffers_size + 1) * sizeof(char *)); - tree->buffers[tree->buffers_size++] = strdup(buffer); - } - return tree; -} - -Ecore_Desktop_Tree * -ecore_desktop_tree_add(Ecore_Desktop_Tree * tree, const char *element) -{ - tree->elements = - (Ecore_Desktop_Tree_Element *) realloc(tree->elements, - (tree->size + - 1) * - sizeof - (Ecore_Desktop_Tree_Element)); - tree->elements[tree->size].element = (char*)element; - tree->elements[tree->size++].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING; - return tree; -} - -Ecore_Desktop_Tree * -ecore_desktop_tree_extend(Ecore_Desktop_Tree * tree, const char *element) -{ - tree->buffers = - (char **)realloc(tree->buffers, - (tree->buffers_size + 1) * sizeof(char *)); - tree->buffers[tree->buffers_size++] = strdup(element); - tree = ecore_desktop_tree_add(tree, tree->buffers[tree->buffers_size - 1]); - - return tree; -} - -void -ecore_desktop_tree_track(Ecore_Desktop_Tree * tree, void *element) -{ - tree->buffers = - (char **)realloc(tree->buffers, - (tree->buffers_size + 1) * sizeof(char *)); - tree->buffers[tree->buffers_size++] = element; -} - -/* OK, so we need an insert after all, and it falls into the dumb category. */ -Ecore_Desktop_Tree * -ecore_desktop_tree_insert(Ecore_Desktop_Tree * tree, int before, void *element, - Ecore_Desktop_Tree_Element_Type type) -{ - int i; - - tree->elements = - (Ecore_Desktop_Tree_Element *) realloc(tree->elements, - (tree->size + - 1) * - sizeof - (Ecore_Desktop_Tree_Element)); - tree->size++; - for (i = tree->size - 1; i > before; i--) - { - tree->elements[i].element = tree->elements[i - 1].element; - tree->elements[i].type = tree->elements[i - 1].type; - } - tree->elements[before].element = element; - tree->elements[before].type = type; - return tree; -} - -/* OK, so we need a tree merge after all, and it falls into the dumb category. */ -Ecore_Desktop_Tree * -ecore_desktop_tree_merge(Ecore_Desktop_Tree * tree, int before, - Ecore_Desktop_Tree * element) -{ - int i, size; - - size = element->size; - if (size) - { - tree->elements = - (Ecore_Desktop_Tree_Element *) realloc(tree->elements, - (tree->size + - size) * - sizeof - (Ecore_Desktop_Tree_Element)); - tree->size += size; - for (i = tree->size - 1; (i > before) && ((i - size) > 0); i--) - { - tree->elements[i].element = tree->elements[i - size].element; - tree->elements[i].type = tree->elements[i - size].type; - } - for (i = 0; i < size; i++) - { - tree->elements[before + i].element = element->elements[i].element; - tree->elements[before + i].type = element->elements[i].type; - } - } - - /* Careful, this might screw up the freeing order if that is important. */ - size = element->buffers_size; - if (size) - { -/* - tree->buffers = (char **) realloc(tree->buffers, (tree->buffers_size + size) * sizeof(char *)); - tree->buffers_size += size; - for (i = 0; i < size; i++) - { - tree->buffers[tree->buffers_size + i] = element->buffers[i]; - element->buffers[i] = NULL; - } -*/ - } - return tree; -} - -Ecore_Desktop_Tree * -ecore_desktop_tree_add_child(Ecore_Desktop_Tree * tree, - Ecore_Desktop_Tree * element) -{ - tree->elements = - (Ecore_Desktop_Tree_Element *) realloc(tree->elements, - (tree->size + - 1) * - sizeof - (Ecore_Desktop_Tree_Element)); - tree->elements[tree->size].element = element; - tree->elements[tree->size++].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE; - element->parent = tree; - return tree; -} - -Ecore_Desktop_Tree * -ecore_desktop_tree_add_hash(Ecore_Desktop_Tree * tree, Ecore_Hash * element) -{ - tree->elements = - (Ecore_Desktop_Tree_Element *) realloc(tree->elements, - (tree->size + - 1) * - sizeof - (Ecore_Desktop_Tree_Element)); - tree->elements[tree->size].element = element; - tree->elements[tree->size++].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH; - return tree; -} - -void -ecore_desktop_tree_remove(Ecore_Desktop_Tree * tree, int element) -{ - if (tree->size > element) - { - tree->elements[element].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[element].element = NULL; - } -} - -int -ecore_desktop_tree_exist(Ecore_Desktop_Tree * tree, char *element) -{ - int exist = 0; - int i; - - /* This is the dumb part of the tree, a linear search. */ - for (i = 0; i < tree->size; i++) - { - if ((tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) - && (strcmp((char *)tree->elements[i].element, element) == 0)) - { - exist = 1; - break; - } - } - return exist; -} - -int -ecore_desktop_tree_foreach(Ecore_Desktop_Tree * tree, int level, - int (*func) (const void *data, - Ecore_Desktop_Tree * tree, int element, - int level), const void *data) -{ - int result = 0; - int i; - - for (i = 0; i < tree->size; i++) - { - if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - { - if (ecore_desktop_tree_foreach - ((Ecore_Desktop_Tree *) tree->elements[i].element, level + 1, - func, data)) - result = 1; - } - else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL) - { - /* This falls into the dumb category. */ - int j = i; - int k = i; - int moved = 0; - - /* Find the next non NULL element. */ - while ((j < tree->size) - && (tree->elements[j].type == - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL)) - j++; - /* Move the next batch of non NULL up. */ - while ((j < tree->size) - && (tree->elements[j].type != - ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL)) - { - moved = 1; - tree->elements[k].type = tree->elements[j].type; - tree->elements[k].element = tree->elements[j].element; - tree->elements[j].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL; - tree->elements[j].element = NULL; - j++; - k++; - } - if (moved) - i--; - else - tree->size = i; - } - else - { - if (func(data, tree, i, level)) - result = 1; - } - } - return result; -} - -void -ecore_desktop_tree_dump(Ecore_Desktop_Tree * tree, int level) -{ - int i; - - for (i = 0; i < tree->size; i++) - { - int j; - - for (j = 0; j < level; j++) - printf("."); - switch (tree->elements[i].type) - { - case ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL: - { - printf("NULL\n"); - } - break; - - case ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING: - { - printf("%s\n", (char *)tree->elements[i].element); - } - break; - - case ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE: - { - printf("TREE ELEMENT TYPE\n"); - ecore_desktop_tree_dump((Ecore_Desktop_Tree *) tree-> - elements[i].element, level + 1); - } - break; - - case ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH: - { - int lev; - - lev = level + 1; - printf("HASH ELEMENT TYPE\n"); - ecore_hash_for_each_node((Ecore_Hash *) tree->elements[i]. - element, - ecore_desktop_tree_dump_each_hash_node, - &lev); - } - break; - - default: - { - printf("UNKNOWN ELEMENT TYPE!\n"); - } - break; - } - } -} - -static void -ecore_desktop_tree_dump_each_hash_node(void *value, void *user_data) -{ - Ecore_Hash_Node *node; - int level; - int j; - - node = (Ecore_Hash_Node *) value; - level = *((int *)user_data); - for (j = 0; j < level; j++) - printf("."); - printf("%s = %s\n", (char *)node->key, (char *)node->value); -} - -void -ecore_desktop_tree_del(Ecore_Desktop_Tree * tree) -{ - int i; - - for (i = tree->size - 1; i >= 0; i--) - { - if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE) - ecore_desktop_tree_del((Ecore_Desktop_Tree *) tree->elements[i]. - element); - else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH) - ecore_hash_destroy((Ecore_Hash *) tree->elements[i].element); - } - - E_FREE(tree->elements); - - for (i = tree->buffers_size - 1; i >= 0; i--) - E_FREE(tree->buffers[i]); - E_FREE(tree); -} diff --git a/src/lib/ecore_desktop/ecore_desktop_xmlame.c b/src/lib/ecore_desktop/ecore_desktop_xmlame.c deleted file mode 100644 index 6adcaf0..0000000 --- a/src/lib/ecore_desktop/ecore_desktop_xmlame.c +++ /dev/null @@ -1,132 +0,0 @@ -#include "Ecore_Desktop.h" -#include "ecore_desktop_private.h" - -#include -#include -#include - -/** xmlame.c Extensively Mocked Language Approximately Mangled for Enlightenment. - * - * This is NOT a real XML parser. There were a few ways we could go when it came - * to parsing the freedesktop.org (fdo) XML menu files. Whatever way we went, we - * needed some sort of XML parser if we wanted to fully support fdo menu files. - * Nothing we can do about that, fdo set the standard and they choose XML to do it. - * - * After a discussion with raster, three things led to the decision to do it this - * way. It is likely that this will get included as a core part of the E17 window - * manager (E17) coz E17 needs this functionality. E17 is in a dependency freeze - * and there is no XML parser in it's current dependencies. The fdo XML menu files - * look to be simple enough to parse that this sort of fake, brain dead, XML parser - * may get away with it. Much testing on lots of systems is highly recommended. - * - * The final '>' of a tag is replaced with a '\0', but it's existance can be implied. - */ - -static char *_ecore_desktop_xmlame_parse(Ecore_Desktop_Tree * tree, - char *buffer); - -Ecore_Desktop_Tree * -ecore_desktop_xmlame_new(char *buffer) -{ - Ecore_Desktop_Tree *tree; - - tree = ecore_desktop_tree_new(buffer); - return tree; -} - -Ecore_Desktop_Tree * -ecore_desktop_xmlame_get(char *file) -{ - int size; - char *buffer; - Ecore_Desktop_Tree *tree = NULL; - - size = ecore_file_size(file); - buffer = (char *)malloc(size + 1); - if (buffer) - { - int fd; - - buffer[0] = '\0'; - fd = open(file, O_RDONLY); - if (fd != -1) - { - if (read(fd, buffer, size) == size) - buffer[size] = '\0'; - } - tree = ecore_desktop_xmlame_new(buffer); - if (tree) - { - /* Have the file name as the first item on the tree, for later reference. */ - ecore_desktop_tree_extend(tree, file); - _ecore_desktop_xmlame_parse(tree, buffer); - } - } - return tree; -} - -static char * -_ecore_desktop_xmlame_parse(Ecore_Desktop_Tree * tree, char *buffer) -{ - while (*buffer != '\0') - { - char *text; - - /* Skip any white space at the beginning. */ - while ((*buffer != '\0') && (isspace(*buffer))) - buffer++; - text = buffer; - /* Find the beginning of a tag. */ - while ((*buffer != '<') && (*buffer != '\0')) - buffer++; - /* Check for data between tags. */ - if (buffer != text) - { - char t; - - t = *buffer; - *buffer = '\0'; - ecore_desktop_tree_extend(tree, text); - *buffer = t; - } - if (*buffer != '\0') - { - char *begin; - - begin = buffer++; - /* Find the end of the tag. */ - while ((*buffer != '>') && (*buffer != '\0')) - buffer++; - /* We have our tag, do something with it. */ - if (*buffer != '\0') - { - *buffer++ = '\0'; - if (begin[1] == '/') - { /* The end of an element. */ - ecore_desktop_tree_add(tree, begin); - break; - } - else if ((begin[1] == '!') || (begin[1] == '-') - || (*(buffer - 2) == '/')) - { /* This is a script, a comment, or a stand alone tag. */ - ecore_desktop_tree_add(tree, begin); - } - else - { /* The beginning of an element. */ - Ecore_Desktop_Tree *new_tree; - - new_tree = ecore_desktop_xmlame_new(NULL); - if (new_tree) - { - ecore_desktop_tree_add_child(tree, new_tree); - ecore_desktop_tree_add(new_tree, begin); - buffer = - _ecore_desktop_xmlame_parse(new_tree, buffer); - } - } - } - } - } - - return buffer; -} diff --git a/src/lib/ecore_job/.cvsignore b/src/lib/ecore_job/.cvsignore deleted file mode 100644 index 0aac4af..0000000 --- a/src/lib/ecore_job/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -ecore_job.lo -libecore_job.la diff --git a/src/lib/ecore_job/Ecore_Job.h b/src/lib/ecore_job/Ecore_Job.h deleted file mode 100644 index 9276cfc..0000000 --- a/src/lib/ecore_job/Ecore_Job.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ - -#ifndef _ECORE_JOB_H -#define _ECORE_JOB_H - -#ifdef EAPI -# undef EAPI -#endif - -#ifdef _WIN32 -# ifdef EFL_ECORE_JOB_BUILD -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) -# else -# define EAPI -# endif /* ! DLL_EXPORT */ -# else -# define EAPI __declspec(dllimport) -# endif /* ! EFL_ECORE_JOB_BUILD */ -#else -# ifdef __GNUC__ -# if __GNUC__ >= 4 -# define EAPI __attribute__ ((visibility("default"))) -# else -# define EAPI -# endif -# else -# define EAPI -# endif -#endif /* ! _WIN32 */ - -/** - * @file - * @brief Functions for dealing with Ecore jobs. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _ECORE_JOB_PRIVATE_H -typedef void Ecore_Job; /**< A job handle */ -#endif - -EAPI int ecore_job_init(void); -EAPI int ecore_job_shutdown(void); -EAPI Ecore_Job *ecore_job_add(void (*func) (void *data), const void *data); -EAPI void *ecore_job_del(Ecore_Job *job); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/ecore_job/Makefile.am b/src/lib/ecore_job/Makefile.am deleted file mode 100644 index 31c21b4..0000000 --- a/src/lib/ecore_job/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = \ --I$(top_srcdir)/src/lib/ecore \ --I$(top_builddir)/src/lib/ecore - -AM_CFLAGS = @WIN32_CFLAGS@ - -if BUILD_ECORE_JOB - -lib_LTLIBRARIES = libecore_job.la -include_HEADERS = \ -Ecore_Job.h - -libecore_job_la_SOURCES = \ -ecore_job.c \ -ecore_job_private.h - -libecore_job_la_LIBADD = \ -$(top_builddir)/src/lib/ecore/libecore.la - -libecore_job_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -version-info @version_info@ - -libecore_job_la_DEPENDENCIES = \ -$(top_builddir)/src/lib/ecore/libecore.la - -endif - -EXTRA_DIST = \ -Ecore_Job.h \ -ecore_job.c \ -ecore_job_private.h diff --git a/src/lib/ecore_job/ecore_job.c b/src/lib/ecore_job/ecore_job.c deleted file mode 100644 index 44ac1e0..0000000 --- a/src/lib/ecore_job/ecore_job.c +++ /dev/null @@ -1,115 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "Ecore.h" -#include "ecore_private.h" -#include "ecore_job_private.h" -#include "Ecore_Job.h" - -static int _ecore_job_event_handler(void *data, int type, void *ev); -static void _ecore_job_event_free(void *data, void *ev); - -static int ecore_event_job_type = 0; -static int _ecore_init_job_count = 0; -static Ecore_Event_Handler* _ecore_job_handler = NULL; - -EAPI int -ecore_job_init(void) -{ - if (++_ecore_init_job_count == 1) - { - ecore_init(); - ecore_event_job_type = ecore_event_type_new(); - _ecore_job_handler = ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL); - } - - return _ecore_init_job_count; -} - -EAPI int -ecore_job_shutdown(void) -{ - if (--_ecore_init_job_count) - return _ecore_init_job_count; - - ecore_event_handler_del(_ecore_job_handler); - _ecore_job_handler = NULL; - ecore_shutdown(); - - return _ecore_init_job_count; -} - -/** - * Add a job to the event queue. - * @param func The function to call when the job gets handled. - * @param data Data pointer to be passed to the job function when the job is - * handled. - * @return The handle of the job. @c NULL is returned if the job could not be - * added to the queue. - * @ingroup Ecore_Job_Group - * @note Once the job has been executed, the job handle is invalid. - */ -EAPI Ecore_Job * -ecore_job_add(void (*func) (void *data), const void *data) -{ - Ecore_Job *job; - - if (!func) return NULL; - - job = calloc(1, sizeof(Ecore_Job)); - if (!job) return NULL; - ECORE_MAGIC_SET(job, ECORE_MAGIC_JOB); - job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, NULL); - if (!job->event) - { - free(job); - return NULL; - } - job->func = func; - job->data = (void *)data; - return job; -} - -/** - * Delete a queued job that has not yet been executed. - * @param job Handle of the job to delete. - * @return The data pointer that was to be passed to the job. - * @ingroup Ecore_Job_Group - */ -EAPI void * -ecore_job_del(Ecore_Job *job) -{ - void *data; - - if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_JOB)) - { - ECORE_MAGIC_FAIL(job, ECORE_MAGIC_JOB, - "ecore_job_del"); - return NULL; - } - data = job->data; - ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE); - ecore_event_del(job->event); - return data; -} - -static int -_ecore_job_event_handler(void *data __UNUSED__, int type __UNUSED__, void *ev) -{ - Ecore_Job *job; - - job = ev; - job->func(job->data); - return 0; -} - -static void -_ecore_job_event_free(void *data __UNUSED__, void *ev) -{ - Ecore_Job *job; - - job = ev; - free(ev); -} diff --git a/src/lib/ecore_job/ecore_job_private.h b/src/lib/ecore_job/ecore_job_private.h deleted file mode 100644 index d5795f2..0000000 --- a/src/lib/ecore_job/ecore_job_private.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _ECORE_JOB_PRIVATE_H -#define _ECORE_JOB_PRIVATE_H - -#define ECORE_MAGIC_JOB 0x76543210 - -typedef struct _Ecore_Job Ecore_Job; - -struct _Ecore_Job -{ - ECORE_MAGIC; - Ecore_Event *event; - void (*func) (void *data); - void *data; -}; - -#endif diff --git a/src/lib/ecore_txt/.cvsignore b/src/lib/ecore_txt/.cvsignore deleted file mode 100644 index e599172..0000000 --- a/src/lib/ecore_txt/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -ecore_txt.lo -libecore_txt.la diff --git a/src/lib/ecore_txt/Ecore_Txt.h b/src/lib/ecore_txt/Ecore_Txt.h deleted file mode 100644 index 734fa8a..0000000 --- a/src/lib/ecore_txt/Ecore_Txt.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ - -#ifndef _ECORE_TXT_H -#define _ECORE_TXT_H - -#ifdef EAPI -# undef EAPI -#endif - -#ifdef _WIN32 -# ifdef EFL_ECORE_TXT_BUILD -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) -# else -# define EAPI -# endif /* ! DLL_EXPORT */ -# else -# define EAPI __declspec(dllimport) -# endif /* ! EFL_ECORE_TXT_BUILD */ -#else -# ifdef __GNUC__ -# if __GNUC__ >= 4 -# define EAPI __attribute__ ((visibility("default"))) -# else -# define EAPI -# endif -# else -# define EAPI -# endif -#endif /* ! _WIN32 */ - -/** - * @file Ecore_Txt.h - * @brief Provides a text encoding conversion function. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -EAPI char *ecore_txt_convert(const char *enc_from, const char *enc_to, const char *text); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/ecore_txt/Makefile.am b/src/lib/ecore_txt/Makefile.am deleted file mode 100644 index 6b3a6e6..0000000 --- a/src/lib/ecore_txt/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = \ --I$(top_srcdir)/src/lib/ecore \ --I$(top_builddir)/src/lib/ecore \ -@iconv_cflags@ - -if BUILD_ECORE_TXT - -lib_LTLIBRARIES = libecore_txt.la - -include_HEADERS = \ -Ecore_Txt.h - -libecore_txt_la_SOURCES = \ -ecore_txt.c \ -ecore_txt_private.h - -libecore_txt_la_LIBADD = @iconv_libs@ - -libecore_txt_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -version-info @version_info@ - -libecore_txt_la_DEPENDENCIES = - - -endif - -EXTRA_DIST = \ -Ecore_Txt.h \ -ecore_txt.c \ -ecore_txt_private.h diff --git a/src/lib/ecore_txt/ecore_txt.c b/src/lib/ecore_txt/ecore_txt.c deleted file mode 100644 index 8f605ab..0000000 --- a/src/lib/ecore_txt/ecore_txt.c +++ /dev/null @@ -1,85 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "Ecore_Txt.h" -#include "ecore_txt_private.h" - - -/** - * To be documented. - * - * FIXME: Finish this. - */ -EAPI char * -ecore_txt_convert(const char *enc_from, const char *enc_to, const char *text) -{ - iconv_t ic; - char *new_txt, *inp, *outp; - size_t inb, outb, outlen, tob, outalloc; - - if (!text) return NULL; - ic = iconv_open(enc_to, enc_from); - if (ic == (iconv_t)(-1)) return NULL; - new_txt = malloc(64); - inb = strlen(text); - outb = 64; - inp = (char*)text; - outp = new_txt; - outalloc = 64; - outlen = 0; - tob = 0; - - for (;;) - { - size_t count; - - tob = outb; - count = iconv(ic, &inp, &inb, &outp, &outb); - outlen += tob - outb; - if (count == (size_t)(-1)) - { - if (errno == E2BIG) - { - new_txt = realloc(new_txt, outalloc + 64); - outp = new_txt + outlen; - outalloc += 64; - outb += 64; - } - else if (errno == EILSEQ) - { - if (new_txt) free(new_txt); - new_txt = NULL; - break; - } - else if (errno == EINVAL) - { - if (new_txt) free(new_txt); - new_txt = NULL; - break; - } - else - { - if (new_txt) free(new_txt); - new_txt = NULL; - break; - } - } - if (inb == 0) - { - if (outalloc == outlen) new_txt = realloc(new_txt, outalloc + 1); - new_txt[outlen] = 0; - break; - } - } - iconv_close(ic); - return new_txt; -} diff --git a/src/lib/ecore_txt/ecore_txt_private.h b/src/lib/ecore_txt/ecore_txt_private.h deleted file mode 100644 index b3e975a..0000000 --- a/src/lib/ecore_txt/ecore_txt_private.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _ECORE_TXT_PRIVATE_H -#define _ECORE_TXT_PRIVATE_H - -#endif -- 2.7.4