We have been working on a widget that will aid a lot on the
implementation of preferences/configuration windows and UI elements in
Elementary-based applications, and we do think that the code is mature
enough to be presented to the community now.

Prefs is a widget that populates its view with widgets
bound to data types (following the instructions of a ".epb" file that
describes a set of items) and handles the storage/restoration of such
data on a configuration file automatically.

The ".epb" file is similar to a ".edj" file and is created by a tool
named "elm_prefs_cc" (based on edje_cc) that receives a ".epc" file as
input (similar to a ".edc" file).

Here's a excerpt from an epc file:

collection
{
   page
   {
      name: "main";
      version: 1;
      title: "Preferences Widget";
      subtitle: "Prefs";
      widget: "elm/vertical_frame";

      items {
         item {
            name: "universe";
            type: INT;
            label: "Ultimate Answer of Life, the Universe and
            Everything";
            editable: 1;

            int {
               default: 42;
               min: 0;
               max: 150;
            }
         }

         item {
            name: "label";
            type: LABEL;
            label: "Just a label...";
         }

         item {
            name: "text";
            type: TEXT;
            editable: 1;

            text {
               placeholder: "This is a text field (:";
               default: "default str.";
               deny: "^[0-9]*$";
            }
         }

         item {
            name: "date";
            type: DATE;
            label: "First EFL Developer Day";

            date {
               default: 2012 11 05;
               min: 1980 11 1;
               max: 2200 12 2;
            }
         }

         /* ... */
      }
   }
}

As you see, items (think of edc parts) are grouped in pages (think of
edc groups).

With subpage support, we can already create lots of functional config.
screens. In the future we could surely extend it to make toolbars,
lists, etc.

For your convenience, the prefs widget also searches for an
appropriated “.epb” file in some predefined places and tries to load
the “main” page if a specific page isn’t provided. The same is valid
for the file that holds the user configuration.

To help with the understanding of the mechanics of this preferences
infrastructure, we have done three documented examples and an initial
reference for the ".epc" file can be found in the docs as well.

We hope that you enjoy this work and provide us your feedback.

Regards,

Gustavo Lima Chaves,
Murilo Belluzzo,
Ricardo Almeida.

--
Gustavo Lima Chaves
Senior Developer @ ProFUSION Embedded Systems

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to