wiki:HowtoEFL

http://main.elivecd.org/images/misc/maton.png

Development with EFL and tips & tricks

Introduction to EFL

The first thing that you need to know is what is EFL (or Enlightenment Foundation Libraries)

Learning EFL

The best way to learn the EFL API is  downloading the full SVN repository of EFL and e17 (and other things), so that there you can have a lot of examples of codes, like the directory TEST that has some  examples of ecore, you can also search for test or example files/directories in the SVN

In Elive you can install the package efl-doc that includes updated (to the same version as the package efl-all that you have installed) documentation about the EFL libs, you can view the contents of the installed package using dpkg -L packagename, it includes also a lot of very nice manual pages

You can use the apishow tool (apt-get install apishow) like a FAST reference, it searches keywords in the headers of EFL

To learn basics of EFL you can read the previous link of introduction to EFL

E17 Modules

E17 modules could be considered like gadgets for E17, but basically they can do anything

They are more exactly C applications managed and controled by E17, using E17 features and also any thing that you would like that they can do, a bad point of this is that if your E17 module segfaults, the entire E17 segfaults too, so please write stable code on it

In the E17 SVN you can found a module called skel, it is not really a module to use but more exactly a BASE of e17 module, so just copy it and start modifying the source code, you have then the basics for build your own module

But if you want something more complete you can try  the package emodule-creator (apt-get install emodule-creator), it contain a kind of templates of e17 modules, so select your example number and you have a ready-to-compile-and-use e17 module that you can hack at what you want to make. The idea of to create in a fast way e17 modules with a pre-made code, and also to demonstrate the capabilities of e17 modules (with examples of different's things possible with e17 modules)

This is a nice youtube video demo of how to make an e17 module in 10 minutes:  http://www.youtube.com/watch?v=abNsVyYTSkU

Some Tips & Tricks

From here, we suppose that you are using emodule-creator, so:

  • [Basic]: You should do everything from user, of course. To compile and install a module that you have selected with emodule-creator, just enter in the directory and run sh autogen.sh && make && make install
  • If you modify the code and you want to recompile/install it, run just make && make install && echo -e "\nCompilation Successfully", after that, just restart E17 (Ctrl + Alt + END) to reload it
  • Remember that if your module crashes, all your E17 crashes, to not have this risk, use a different user and a new E17 instance in YOUR actual running E17, following these steps:
    • Create a new user from elpanel
    • Open a terminal with your user and give permissions in your graphical system for everybody can access to it, so run xhost +
    • On this terminal, change to your new user, if your new user is called user2 do: su user2 and go to his home directory running cd
    • You can now do everything from this user, run from it emodule-creator and start working with it
    • Now you will want to try this module from this user, in the directory e/trunk/e/ of your downloaded SVN you will found a file called xnest.sh (xnest) and x-ui.sh (xephyr), copy it to the directory /usr/bin and if you run it without parameters you can see a lot of options for debugging code, just run xnest.sh -e for now, this will open a new E17 session from this user, where you can try your modules and also crash this e17 without risk for your real E17 desktop
      • Note: It is recommended to use Xephyr, looks more stable and better working, do apt-get install xserver-xephyr to have it, also edit the x-ui.sh file and modify it a bit (remove the profile part, so that you will use the simple profile... so, just keep enlightenment_start without anything more than this), also change your resolution/colors to something like 800x600 (no colors parameter needed)
  • When you install a module, they are located in .e/e/modules directory of the home of the user, but if you want to remove it its recommended to just do make uninstall in the source code of the module
  • Since you disable and unload a module in your e17 dir, you should have not any risk from this module if can segfault
  • If your E17 system be totally unusable because a module that made him segfaulting just starting, you may be remove entirely your .e directory of the user's home, but in elive is recommended to run instead the command elive-skel upgrade .e from that user
  • If you have any thing that doesn't change from your modifications, try to run make clean before to recompile it
  • When you use the template 05 of emodule-creator, there's something in the source code that mades the middle-click of the mouse to restart e17, using this feature, when you run the command for recompile and install, before to try it you need to exit from E17 and enter again, a faster solution is just to restart it, and a good way to do this in a fast way is just clicking in the module (middle-click) that you are working on :)

Misc

  •  Autotools: A very nice howto about how to create your Makefiles (& co) architecture files in the better way and without the help of external bloated editors that creates them by yourself
  • EDJE: If you want to do an  Edje interface, after to learn how (with the previous listed links) you can use a  fast reference card or  a more complete reference (with explanations of elements)

Notes

In Elive you have a good environment ready to use to develop with EFL:

  • It is strongly recommended to use the last version of Elive and/or the last available version of EFL packages (the next command should upgrade it: apt-get update && apt-get install efl-all ), you will also require to install some dependencies that you maybe can't have installed yet, in any case to be sure you can just install the package emodule-creator because it installs also the required dependencies to build (at least) e17 modules
  • Vim: If you like to edit with Vim, you can like the configurations included by default in Elive for vim and EFL, apart to have a nice configuration by deafult, it includes syntax hilighting for EDC files, it also has by default the best (IMHO) colour theme for any language, specially C and Bash, this should be the better colors theme for a fast reading of the code and to found parts in the code fast,  there's an Screenshot