[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] new gadcon algo. please test :)



Hi all,

Please find a diff patch attached. I did not want to commit yet, but I'd
like all of you test it. Any comments or bug reports are apriciated.

This patch does the following things:

- Initial gadcons positioning - works.
- Dragging of gadcons in the shelf in "non-shrinked" mode - works.
- Dragging of gadcons in the shelf in "shrinked" mode - works but still
has some troubles.
- Sizing of gadcons in "non-shrinked" shelf mode - works
- Sizing of gadcons in "shrinked" shelf mode - is not allowed untill u
decrease its size. Not work well.

Still todo:

- item sizing in "shrinked" mode.
- item auto-resizing if all the items takes more space than gadcon can
give.
- shelf position in the corners of the screen.
- item positions have to remain the same when "autoscroll" is set/unset
on one item.
- problem with the "below everything"+"invisible style" shelf mode. At least I have it
with a shelf in the Right-Bottom corner, it goes out of screen. It seams
that swallowed part of the shelf theme is not positioned correctly.

btw. the patch will require to nuke an existing config, since I did not
update config version. 


Raster need your help. This is all about gadcon's smart data. If I have
a shelf, that that takes all the width of the zone, then sd->x = 18. If
I set a shrinked mode of the shelf, then, sd->x = -230(my screen res is
1280x800). Why ? you can find this strange behaviour by putting some
printfs in the begining of _e_gadcon_smart_reconfigure function and
explore sd pointer. 

Second the size of the gadcon is not always set before
starting positioning gadcon items. Is it ok ?

Most of the "still todo" will be autofixed if sd->x/y will always be
positive and would have a correct position wrt shelf position.

sndev

-- 

Aleksej Struk
Master Degree Student
Free University of Bozen-Bolzano
Faculty of Computer Science
phone: +39-0471-061749
cell phone: +39-3204627049 +370-61278908
astruk@gmail.com alstruk@unibz.it - http://astruk.googlepages.com/home
? src/bin/e_gadcon.old.c
Index: src/bin/e_config.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_config.c,v
retrieving revision 1.195
diff -u -r1.195 e_config.c
--- src/bin/e_config.c	21 Aug 2006 02:30:10 -0000	1.195
+++ src/bin/e_config.c	21 Aug 2006 17:58:01 -0000
@@ -90,6 +90,8 @@
    E_CONFIG_VAL(D, T, geom.pos, INT);
    E_CONFIG_VAL(D, T, geom.size, INT);
    E_CONFIG_VAL(D, T, geom.res, INT);
+   E_CONFIG_VAL(D, T, state_info.seq, INT);
+   E_CONFIG_VAL(D, T, state_info.flags, INT);
    E_CONFIG_VAL(D, T, style, STR);
    E_CONFIG_VAL(D, T, autoscroll, UCHAR);
    E_CONFIG_VAL(D, T, resizable, UCHAR);
@@ -1115,13 +1117,15 @@
    cf_gc->name = evas_stringshare_add(_name); \
    cf_gc->id = evas_stringshare_add(_id); \
    e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc)
-#define CFG_GADCON_CLIENT(_name, _id, _res, _size, _pos, _style, _autoscr, _resizable) \
+#define CFG_GADCON_CLIENT(_name, _id, _res, _size, _pos, _seq, _style, _autoscr, _resizable) \
    cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); \
    cf_gcc->name = evas_stringshare_add(_name); \
    cf_gcc->id = evas_stringshare_add(_id); \
    cf_gcc->geom.res = _res; \
    cf_gcc->geom.size = _size; \
    cf_gcc->geom.pos = _pos; \
+   cf_gcc->state_info.seq = _seq; \
+   cf_gcc->state_info.flags = 0; \
    if (_style) cf_gcc->style = evas_stringshare_add(_style); \
    else cf_gcc->style = NULL; \
    cf_gcc->autoscroll = _autoscr; \
@@ -1131,39 +1135,39 @@
 	/* the default shelf on the default head/zone */
 	CFG_GADCON("shelf", "0");
 	CFG_GADCON_CLIENT("start", "default", 800, 32,
-			  0, NULL, 0, 0);
+			  0, 0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("pager", "default", 800, 120,
-			  32, NULL, 0, 0);
+			  32, 1, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibar", "default", 800, 200,
-			  400 - (16 / 2), NULL, 1, 0);
+			  400 - (16 / 2), 2, NULL, 1, 0);
 	CFG_GADCON_CLIENT("temperature", "default", 800, 32,
-			  800 - (5 * 32), NULL, 0, 0);
+			  800 - (5 * 32), 3, NULL, 0, 0);
 	CFG_GADCON_CLIENT("cpufreq", "default", 800, 32,
-			  800 - (4 * 32), NULL, 0, 0);
+			  800 - (4 * 32), 4, NULL, 0, 0);
 	CFG_GADCON_CLIENT("battery", "default", 800, 32,
-			  800 - (3 * 32), NULL, 0, 0);
+			  800 - (3 * 32), 5, NULL, 0, 0);
 	CFG_GADCON_CLIENT("clock", "default", 800, 32,
-			  800 - (2 * 32), NULL, 0, 0);
+			  800 - (2 * 32), 6, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibox", "default", 800, 200,
-			  400 - (1 * 32), NULL, 1, 0);
+			  400 - (1 * 32), 7, NULL, 1, 0);
 	/* additional shelves for up to 3 more heads by default */
 	CFG_GADCON("shelf", "1");
 	CFG_GADCON_CLIENT("pager", "default2", 800, 120,
-			  0, NULL, 0, 0);
+			  0, 0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibox", "default", 800, 200,
-			  400 - (1 * 32), NULL, 1, 0);
+			  400 - (1 * 32), 1, NULL, 1, 0);
 	
 	CFG_GADCON("shelf", "2");
 	CFG_GADCON_CLIENT("pager", "default3", 800, 120,
-			  0, NULL, 0, 0);
+			  0, 0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibox", "default", 800, 200,
-			  400 - (1 * 32), NULL, 1, 0);
+			  400 - (1 * 32), 1, NULL, 1, 0);
 	
 	CFG_GADCON("shelf", "3");
 	CFG_GADCON_CLIENT("pager", "default4", 800, 120,
-			  0, NULL, 0, 0);
+			  0, 0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibox", "default", 800, 200,
-			  400 - (1 * 32), NULL, 1, 0);
+			  400 - (1 * 32), 1, NULL, 1, 0);
      }
    IFCFGEND;
    
Index: src/bin/e_config.h
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_config.h,v
retrieving revision 1.111
diff -u -r1.111 e_config.h
--- src/bin/e_config.h	21 Aug 2006 15:33:20 -0000	1.111
+++ src/bin/e_config.h	21 Aug 2006 17:58:01 -0000
@@ -333,6 +333,9 @@
    struct {
       int pos, size, res;
    } geom;
+   struct {
+      int seq, flags;
+   } state_info; // used by positioning algo. Has not to be set manually.
    const char    *style;
    unsigned char  autoscroll;
    unsigned char  resizable;
Index: src/bin/e_gadcon.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.c,v
retrieving revision 1.37
diff -u -r1.37 e_gadcon.c
--- src/bin/e_gadcon.c	9 Aug 2006 11:07:44 -0000	1.37
+++ src/bin/e_gadcon.c	21 Aug 2006 17:58:01 -0000
@@ -31,6 +31,7 @@
 static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_gadcon_layout_smart_sync_clients(E_Gadcon *gc);
 
 static Evas_Object *e_gadcon_layout_add(Evas *evas);
 static void e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal);
@@ -41,8 +42,8 @@
 static void e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
 static int e_gadcon_layout_pack(Evas_Object *obj, Evas_Object *child);
 static void e_gadcon_layout_pack_size_set(Evas_Object *obj, int size);
-static void e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size);
-static void e_gadcon_layout_pack_options_set(Evas_Object *obj, int pos, int size, int res);
+static void e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size, int seq, int flags);
+static void e_gadcon_layout_pack_options_set(Evas_Object *obj, int pos, int size, int res, int seq, int flags);
 static void e_gadcon_layout_pack_min_size_set(Evas_Object *obj, int w, int h);
 static void e_gadcon_layout_pack_aspect_set(Evas_Object *obj, int w, int h);
 static void e_gadcon_layout_pack_aspect_pad_set(Evas_Object *obj, int w, int h);
@@ -52,6 +53,97 @@
 static Evas_List *providers_list = NULL;
 static Evas_List *gadcons = NULL;
 
+/* a smart object JUST for gadcon */
+typedef struct _E_Gadcon_Layout_Item E_Gadcon_Layout_Item;
+typedef struct _E_Smart_Data E_Smart_Data;
+typedef struct _E_Gadcon_Layout_Item_Container E_Gadcon_Layout_Item_Container;
+
+
+struct _E_Smart_Data
+{ 
+   Evas_Coord       x, y, w, h;
+   Evas_Object     *obj;
+   Evas_Object     *clip;
+   unsigned char    horizontal : 1;
+   unsigned char    doing_config : 1;
+   unsigned char    redo_config : 1;
+   Evas_List       *items;
+   int              frozen;
+   Evas_Coord       minw, minh, req;
+}; 
+
+#define E_LAYOUT_ITEM_RESIST_LEVEL  10 //FIXME: has to be implemented as an config option
+
+typedef enum _E_Gadcon_Layout_Item_State 
+{ 
+   E_LAYOUT_ITEM_STATE_NONE, 
+   E_LAYOUT_ITEM_STATE_POS_INC, 
+   E_LAYOUT_ITEM_STATE_POS_DEC,
+   E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC, 
+   E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC, 
+   E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC, 
+   E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC,
+} E_Gadcon_Layout_Item_State;
+
+typedef enum _E_Gadcon_Layout_Item_Lock
+{
+   E_GADCON_LAYOUT_ITEM_LOCK_NONE     = 0x00000000,
+   E_GADCON_LAYOUT_ITEM_LOCK_POSITION = 0x00000001,
+   E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE = 0x00000002
+} E_Gadcon_Layout_Item_Lock;
+
+struct _E_Gadcon_Layout_Item
+{
+   E_Smart_Data    *sd;
+   struct {
+      int           pos, size, size2, res;
+      int	    prev_pos, prev_size;
+   } ask;
+   int              hookp;
+   struct {
+      int           w, h;
+   } min, aspect, aspect_pad;
+
+
+   struct {
+      int seq; // sequence number
+      int resist; // internal
+      E_Gadcon_Layout_Item_Lock	 lock_flags;
+      E_Gadcon_Layout_Item_State state;
+   } state_info;
+
+   Evas_Coord       x, y, w, h;
+   Evas_Object     *obj;
+};
+
+typedef enum _E_Layout_Item_Container_State 
+{ 
+   E_LAYOUT_ITEM_CONTAINER_STATE_NONE, 
+   E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC, 
+   E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC, 
+   E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC, 
+   E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC, 
+   E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC, 
+   E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC, 
+   E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED
+} E_Layout_Item_Container_State;
+
+struct _E_Gadcon_Layout_Item_Container
+{
+   int pos, size, prev_pos, prev_size;
+
+   struct {
+      int min_seq, max_seq;
+   } state_info;
+
+   E_Smart_Data *sd;
+   Evas_List *items; // the list of E_Gadcon_Layout_Item's;
+
+   // the state that inherited from E_Gadcon_Layout_Item of from their composition.
+   E_Layout_Item_Container_State state;
+};
+/*************************/
+
 /* externally accessible functions */
 EAPI int
 e_gadcon_init(void)
@@ -243,16 +335,22 @@
 		       gcc->config.pos = cf_gcc->geom.pos;
 		       gcc->config.size = cf_gcc->geom.size;
 		       gcc->config.res = cf_gcc->geom.res;
+		       gcc->config.state_info.seq = cf_gcc->state_info.seq;
+		       gcc->config.state_info.flags = cf_gcc->state_info.flags;
 		       if (gcc->o_frame)
 			 e_gadcon_layout_pack_options_set(gcc->o_frame,
 							  gcc->config.pos, 
 							  gcc->config.size,
-							  gcc->config.res);
+							  gcc->config.res,
+							  gcc->config.state_info.seq,
+							  gcc->config.state_info.flags);
 		       else
 			 e_gadcon_layout_pack_options_set(gcc->o_base,
 							  gcc->config.pos, 
 							  gcc->config.size,
-							  gcc->config.res);
+							  gcc->config.res,
+							  gcc->config.state_info.seq,
+							  gcc->config.state_info.flags);
 		       e_gadcon_client_autoscroll_set(gcc, cf_gcc->autoscroll);
 		       e_gadcon_client_resizable_set(gcc, cf_gcc->resizable);
 		       if (gcc->client_class->func.orient)
@@ -337,16 +435,22 @@
 		       gcc->config.pos = cf_gcc->geom.pos;
 		       gcc->config.size = cf_gcc->geom.size;
 		       gcc->config.res = cf_gcc->geom.res;
+		       gcc->config.state_info.seq = cf_gcc->state_info.seq;
+		       gcc->config.state_info.flags = cf_gcc->state_info.flags;
 		       if (gcc->o_frame)
 			 e_gadcon_layout_pack_options_set(gcc->o_frame,
 							  gcc->config.pos, 
 							  gcc->config.size,
-							  gcc->config.res);
+							  gcc->config.res,
+							  gcc->config.state_info.seq,
+							  gcc->config.state_info.flags);
 		       else
 			 e_gadcon_layout_pack_options_set(gcc->o_base,
 							  gcc->config.pos, 
 							  gcc->config.size,
-							  gcc->config.res);
+							  gcc->config.res,
+							  gcc->config.state_info.seq,
+							  gcc->config.state_info.flags);
 		       if (gcc->client_class->func.orient)
 			 gcc->client_class->func.orient(gcc);
 		    }
@@ -874,7 +978,8 @@
    gc = gcc->gadcon;
    if (gcc->style) evas_stringshare_del(gcc->style);
    gcc->style = evas_stringshare_add(E_GADCON_CLIENT_STYLE_PLAIN);
-   _e_gadcon_client_save(gcc);
+   _e_gadcon_layout_smart_sync_clients(gc);
+   //_e_gadcon_client_save(gcc);
    e_gadcon_unpopulate(gc);
    e_gadcon_populate(gc);
 }
@@ -889,7 +994,8 @@
    gc = gcc->gadcon;
    if (gcc->style) evas_stringshare_del(gcc->style);
    gcc->style = evas_stringshare_add(E_GADCON_CLIENT_STYLE_INSET);
-   _e_gadcon_client_save(gcc);
+   _e_gadcon_layout_smart_sync_clients(gc);
+   //_e_gadcon_client_save(gcc);
    e_gadcon_unpopulate(gc);
    e_gadcon_populate(gc);
 }
@@ -904,7 +1010,8 @@
    gc = gcc->gadcon;
    if (gcc->autoscroll) gcc->autoscroll = 0;
    else gcc->autoscroll = 1;
-   _e_gadcon_client_save(gcc);
+   _e_gadcon_layout_smart_sync_clients(gc);
+   //_e_gadcon_client_save(gcc);
    e_gadcon_unpopulate(gc);
    e_gadcon_populate(gc);
 }
@@ -919,7 +1026,8 @@
    gc = gcc->gadcon;
    if (gcc->resizable) gcc->resizable = 0;
    else gcc->resizable = 1;
-   _e_gadcon_client_save(gcc);
+   _e_gadcon_layout_smart_sync_clients(gc);
+   //_e_gadcon_client_save(gcc);
    e_gadcon_unpopulate(gc);
    e_gadcon_populate(gc);
 }
@@ -972,6 +1080,7 @@
 		       cf_gc->clients = evas_list_remove_list(cf_gc->clients, l);
 		       e_gadcon_unpopulate(gc);
 		       e_gadcon_populate(gc);
+		       _e_gadcon_layout_smart_sync_clients(gc);
 		       e_config_save_queue();
 		       return;
 		    }
@@ -1270,6 +1379,7 @@
    _e_gadcon_movereisze_handle(gcc);
 }
     
+//here
 static void
 _e_gadcon_client_save(E_Gadcon_Client *gcc)
 {
@@ -1300,6 +1410,8 @@
 		       cf_gcc->geom.pos = gcc->config.pos;
 		       cf_gcc->geom.size = gcc->config.size;
 		       cf_gcc->geom.res = gcc->config.res;
+		       cf_gcc->state_info.seq = gcc->config.state_info.seq;
+		       cf_gcc->state_info.flags = gcc->config.state_info.flags;
 		       cf_gcc->autoscroll = gcc->autoscroll;
 		       if (cf_gcc->style) evas_stringshare_del(cf_gcc->style);
 		       cf_gcc->style = NULL;
@@ -1329,6 +1441,8 @@
 	cf_gcc->geom.pos = gcc->config.pos;
 	cf_gcc->geom.size = gcc->config.size;
 	cf_gcc->geom.res = gcc->config.res;
+	cf_gcc->state_info.seq = gcc->config.state_info.seq;
+	cf_gcc->state_info.flags = gcc->config.state_info.flags;
 	cf_gcc->autoscroll = gcc->autoscroll;
 	if (cf_gcc->style) evas_stringshare_del(cf_gcc->style);
 	cf_gcc->style = NULL;
@@ -1469,11 +1583,29 @@
    if (gcc->o_event) evas_object_resize(gcc->o_event, w, h);
 }
 
+/********* helper fn *********/
+static void
+_e_gadcon_smart_layout_reset_item_states(E_Smart_Data *sd, E_Gadcon_Layout_Item *except)
+{
+   Evas_List *l;
+   E_Gadcon_Layout_Item *bi;
+
+   for (l = sd->items; l; l = l->next)
+     {
+	bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
+	if ((!bi) || (bi == except)) continue;
+
+	bi->state_info.state = bi->state_info.state = E_LAYOUT_ITEM_STATE_NONE;
+	bi->state_info.resist = 0;
+     }
+}
+
 static void
 _e_gadcon_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
    E_Gadcon_Client *gcc;
    Evas_Coord x, y;
+   E_Gadcon_Layout_Item *bi;
    
    gcc = data;
    evas_object_raise(gcc->o_event);
@@ -1485,63 +1617,216 @@
      evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, NULL, NULL);
    else
      evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, NULL, NULL);
+
+
+   gcc->config.state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION |
+				  E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+   bi = evas_object_data_get(gcc->o_frame ? gcc->o_frame : gcc->o_base, "e_gadcon_layout_data");
+   //gcc->config.state_info.seq = bi->state_info.seq;
+
+   //bi->state_info.lock_flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION | E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+   bi->state_info.resist = 0;
+
+   _e_gadcon_smart_layout_reset_item_states(bi->sd, bi);
+
    gcc->sx -= x;
    gcc->sy -= y;
 }
 
 static void
+_e_gadcon_layout_smart_sync_clients(E_Gadcon *gc)
+{
+   E_Gadcon_Client	*gcc;
+   E_Gadcon_Layout_Item *bi;
+   Evas_List *l;
+   Evas_Object *obj;
+
+   for (l = gc->clients; l; l = l->next)
+     {
+	gcc = l->data;
+
+	obj = gcc->o_frame ? gcc->o_frame : gcc->o_base;
+	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
+
+	gcc->config.pos = bi->ask.pos;
+	gcc->config.state_info.seq = bi->state_info.seq;
+	gcc->config.state_info.flags = bi->state_info.lock_flags;
+	bi->state_info.state = E_LAYOUT_ITEM_STATE_NONE; 
+	
+	_e_gadcon_client_save(gcc);
+     }
+}
+
+static void
 _e_gadcon_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
    E_Gadcon_Client *gcc;
+   Evas_List *l;
    
    gcc = data;
    gcc->moving = 0;
+
+   _e_gadcon_layout_smart_sync_clients(gcc->gadcon);
    _e_gadcon_client_save(gcc);
 }
 
+static int gadcon_mouse_warp_mutex = 0;
+static int gadcon_mouse_wanted_x = 0;
+static int gadcon_mouse_wanted_y = 0;
+
 static void
 _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
    E_Gadcon_Client *gcc;
+   E_Gadcon_Layout_Item *bi;
    Evas_Coord x, y, w, h;
+   Evas_List *l;
+   Evas_Object *o; 
    
    gcc = data;
    if (!gcc->moving) return;
+
+   if (gadcon_mouse_warp_mutex)
+     {
+	ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &x, &y);
+	if ((x == gadcon_mouse_wanted_x) && (y == gadcon_mouse_wanted_y))
+	  gadcon_mouse_warp_mutex = 0;
+	/*else
+	  return;*/
+     }
+
    evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y);
+
    x = x - gcc->dx;
    y = y - gcc->dy;
+
+   o = gcc->o_frame ? gcc->o_frame : gcc->o_base;
+   bi = evas_object_data_get(o, "e_gadcon_layout_data");
+
+   if (bi->sd->horizontal) 
+     gcc->config.pos = bi->x;
+   else 
+     gcc->config.pos = bi->y;
+
+   if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
+     {
+	if (x < 0)
+	  {
+	     if (bi->state_info.state != E_LAYOUT_ITEM_STATE_POS_DEC)
+	       bi->state_info.resist = 0;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_POS_DEC;
+	     x = -1;
+	  }
+	else if (x > 0)
+	  {
+	     if (bi->state_info.state != E_LAYOUT_ITEM_STATE_POS_INC)
+	       bi->state_info.resist = 0;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_POS_INC;
+	     x = 1;
+	  }
+     }
+   else
+     {
+	if (y < 0)
+	  { 
+	     if (bi->state_info.state != E_LAYOUT_ITEM_STATE_POS_DEC)
+	       bi->state_info.resist = 0;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_POS_DEC;
+	     y = -1;
+	  }
+	else if (y > 0)
+	  {
+	     if (bi->state_info.state != E_LAYOUT_ITEM_STATE_POS_INC)
+	       bi->state_info.resist = 0;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_POS_INC;
+	     y = 1;
+	  }
+     }
+
    if (gcc->o_frame)
      evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h);
    else
      evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
+
    if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
      {
 	if (gcc->o_frame)
-	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx + x, w);
+	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + x, w,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
 	else
-	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, w);
-	gcc->config.pos = gcc->sx + x;
-	gcc->config.size = w;
+	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + x, w,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
+
+	if (gcc->config.pos + x != bi->x && 0/*switch off mouse warping for a while*/)
+	  {
+	     int mpx, mpy;
+
+	     ecore_x_pointer_last_xy_get(&mpx, &mpy);
+
+	     gadcon_mouse_warp_mutex = 1;
+
+	     //FIXME: sndev, warp mouse to a center of gcc
+	     /*gadcon_mouse_wanted_x = 
+		gcc->dx = ((bi->x + bi->w) / 2) + 
+			   (mpx - ((gcc->config.pos + gcc->config.size) / 2));*/
+	     gcc->dx = gadcon_mouse_wanted_x = bi->x + mpx - gcc->config.pos;
+	     gadcon_mouse_wanted_y = mpy;
+
+	     ecore_x_pointer_warp(gcc->gadcon->zone->container->win, gadcon_mouse_wanted_x, mpy);
+	     ecore_x_sync();
+
+	     x = y = 0;
+	  }
+	gcc->config.pos = bi->ask.pos;
+	gcc->config.size = bi->w;
+	gcc->config.state_info.seq = bi->state_info.seq;
+	gcc->config.state_info.flags = bi->state_info.lock_flags;
 	evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
 	gcc->config.res = w;
      }
    else
      {
 	if (gcc->o_frame)
-	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy + y, h);
+	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + y, h,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
 	else
-	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, h);
-	gcc->config.pos = gcc->sy + y;
-	gcc->config.size = h;
+	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + y, h,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
+	
+	if (gcc->config.pos + y != bi->y && 0/*switch off mouse warping for a while*/)
+	  {
+	     int mpx, mpy;
+
+	     ecore_x_pointer_last_xy_get(&mpx, &mpy);
+
+	     gadcon_mouse_warp_mutex = 1;
+
+	     //FIXME: sndev, warp mouse to a center of gcc
+	     gadcon_mouse_wanted_x = mpx;
+	     gcc->dy = gadcon_mouse_wanted_y = bi->y + mpy - gcc->config.pos;
+
+	     ecore_x_pointer_warp(gcc->gadcon->zone->container->win, mpx, gadcon_mouse_wanted_y);
+	     ecore_x_sync();
+
+	     x = y = 0;
+	  }
+	gcc->config.pos = bi->ask.pos;
+	gcc->config.size = bi->h;
+	gcc->config.state_info.seq = bi->state_info.seq;
+	gcc->config.state_info.flags = bi->state_info.lock_flags;
 	evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
 	gcc->config.res = h;
      }
+
+   gcc->dx += x;
+   gcc->dy += y;
 }
 
 static void
 _e_gadcon_client_resize_start(E_Gadcon_Client *gcc)
 {
    Evas_Coord x, y;
+   E_Gadcon_Layout_Item *bi;
    
    evas_object_raise(gcc->o_event);
    evas_object_stack_below(gcc->o_control, gcc->o_event);
@@ -1552,6 +1837,12 @@
      evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh);
    else
      evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh);
+
+   gcc->config.state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION | 
+				  E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+   bi = evas_object_data_get(gcc->o_frame ? gcc->o_frame : gcc->o_base, "e_gadcon_layout_data");
+   _e_gadcon_smart_layout_reset_item_states(bi->sd, bi);
+
    gcc->sx -= x;
    gcc->sy -= y;
 }
@@ -1560,6 +1851,8 @@
 _e_gadconclient_resize_stop(E_Gadcon_Client *gcc)
 {
    gcc->resizing = 0;
+
+   _e_gadcon_layout_smart_sync_clients(gcc->gadcon);
    _e_gadcon_client_save(gcc);
 }
 
@@ -1580,38 +1873,113 @@
 {
    E_Gadcon_Client *gcc;
    Evas_Coord x, y, w, h;
+   E_Gadcon_Layout_Item *bi;
    
    gcc = data;
    if (!gcc->resizing) return;
    evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y);
    x = x - gcc->dx;
    y = y - gcc->dy;
+
    if (gcc->o_frame)
-     evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h);
+     { 
+	evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h);
+	bi = evas_object_data_get(gcc->o_frame, "e_gadcon_layout_data");
+     }
    else
-     evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
+     { 
+	evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
+	bi = evas_object_data_get(gcc->o_base, "e_gadcon_layout_data");
+     }
+
+
+   if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) 
+     gcc->config.pos = bi->x;
+   else
+     gcc->config.pos = bi->y;
+
+   if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
+     {
+	if ((w - x) < bi->min.w) 
+	  return;
+
+	if (x < 0)
+	  { 
+	     //FIXME: need to play around shinked mode. if necessary 
+	     if (gcc->config.pos == 0) return; 
+	     
+	     //FIXME: do not size if the gadcon is already full of gccs. Need play around 
+	     //shrinked mode also.
+	     
+	     x = -1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC;
+	  }
+	else if (x > 0)
+	  {
+	     x = 1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC;
+	  }
+     }
+   else
+     {
+	if ((h - y) < bi->min.h) return;
+
+	if (y < 0)
+	  {
+	     //FIXME: need to play around shinked mode. if necessary 
+	     if (gcc->config.pos == 0) return; 
+	     
+	     //FIXME: do not size if the gadcon is already full of gccs. Need play around 
+	     //shrinked mode also.
+	     
+	     y = -1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC;
+	  }
+	else if (y > 0)
+	  {
+	     y = 1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC;
+	  }
+     }
+
+   //deny sizing for a while if all gccs fills gc
+   if ((((bi->sd->horizontal) && (bi->sd->w <= bi->sd->req)) ||
+       ((!bi->sd->horizontal) && (bi->sd->h <= bi->sd->req))) &&
+       (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC))
+     return;
+
    if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
      {
 	if (gcc->o_frame)
-	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx + x, gcc->sw - x);
+	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + x, w - x,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
 	else
-	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, gcc->sw - x);
-	gcc->config.pos = gcc->sx + x;
-	gcc->config.size = gcc->sw - x;
+	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + x, w - x,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
+
+	gcc->config.pos = bi->ask.pos;
+	gcc->config.size = bi->w;
 	evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
 	gcc->config.res = w;
      }
    else
      {
 	if (gcc->o_frame)
-	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy + y, gcc->sh - y);
+	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + y, h - y,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
 	else
-	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, gcc->sh - y);
-	gcc->config.pos = gcc->sy + y;
-	gcc->config.size = gcc->sh - y;
+	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + y, h - y,
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
+	gcc->config.pos = bi->ask.pos;
+	gcc->config.size = bi->h;
+	gcc->config.state_info.seq = bi->state_info.seq;
+	gcc->config.state_info.flags = bi->state_info.lock_flags;
 	evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
 	gcc->config.res = h;
      }
+
+   gcc->dx += x;
+   gcc->dy += y;
 }
 
 static void
@@ -1631,76 +1999,110 @@
 {
    E_Gadcon_Client *gcc;
    Evas_Coord x, y, w, h;
+   E_Gadcon_Layout_Item *bi;
    
    gcc = data;
    if (!gcc->resizing) return;
    evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y);
    x = x - gcc->dx;
    y = y - gcc->dy;
+
    if (gcc->o_frame)
-     evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h);
+     { 
+	evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h);
+	bi = evas_object_data_get(gcc->o_frame, "e_gadcon_layout_data");
+     }
    else
-     evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
+     { 
+	evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
+	bi = evas_object_data_get(gcc->o_base, "e_gadcon_layout_data");
+     }
+
+   //deny sizing for a while if gccs fills all the gc
+   if (((bi->sd->horizontal) && (bi->sd->w <= bi->sd->req)) ||
+       ((!bi->sd->horizontal) && (bi->sd->h <= bi->sd->req)))
+     return;
+
+   if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) 
+     gcc->config.pos = bi->x;
+   else
+     gcc->config.pos = bi->y;
+
+   if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
+     {
+	if (x < 0)
+	  { 
+	     x = -1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC;
+	  }
+	else if (x > 0)
+	  { 
+	     //FIXME: need to play around shrinked mode if necesary 
+	     //FIXME: need to use something one. or use gcc->config. or bi 
+	     
+	     if ((gcc->config.pos + bi->w) == bi->sd->w) 
+	       return; 
+
+	     //FIXME: do not size if all the gadcons already fills up all the space
+	     x = 1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC;
+	  }
+     }
+   else
+     {
+	if (y < 0) 
+	  {
+	     y = -1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC;
+	  }
+	else if (y > 0)
+	  {
+	     //FIXME: need to play around shrinked mode if necesary 
+	     //FIXME: need to use something one. or use gcc->config. or bi 
+	     
+	     if ((gcc->config.pos + bi->w) == bi->sd->w) 
+	       return; 
+
+	     //FIXME: do not size if all the gadcons already fills up all the space
+	     y = 1;
+	     bi->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC;
+	  }
+     }
+
+
    if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
      {
 	if (gcc->o_frame)
-	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx, gcc->sw + x);
+	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos, w + x, 
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
 	else
-	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx, gcc->sw + x);
-	gcc->config.pos = gcc->sx;
-	gcc->config.size = gcc->sw + x;
+	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, w + x, 
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
+	gcc->config.pos = bi->x;
+	gcc->config.size = bi->w;
 	evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
 	gcc->config.res = w;
      }
    else
      {
 	if (gcc->o_frame)
-	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy, gcc->sh + y);
+	  e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos, h + y, 
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
 	else
-	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy, gcc->sh + y);
-	gcc->config.pos = gcc->sy;
-	gcc->config.size = gcc->sh + y;
+	  e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, h + y, 
+					  gcc->config.state_info.seq, gcc->config.state_info.flags);
+	gcc->config.pos = bi->y;
+	gcc->config.size = bi->h;
+	gcc->config.state_info.seq = bi->state_info.seq;
+	gcc->config.state_info.flags = bi->state_info.lock_flags;
 	evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
 	gcc->config.res = h;
      }
-}
-
-
-
-
 
-/* a smart object JUST for gadcon */
-
-typedef struct _E_Smart_Data E_Smart_Data;
-typedef struct _E_Gadcon_Layout_Item  E_Gadcon_Layout_Item;
-
-struct _E_Smart_Data
-{ 
-   Evas_Coord       x, y, w, h;
-   Evas_Object     *obj;
-   Evas_Object     *clip;
-   unsigned char    horizontal : 1;
-   unsigned char    doing_config : 1;
-   unsigned char    redo_config : 1;
-   Evas_List       *items;
-   int              frozen;
-   Evas_Coord       minw, minh, req;
-}; 
+   gcc->dx += x;
+   gcc->dy += y;
+}
 
-struct _E_Gadcon_Layout_Item
-{
-   E_Smart_Data    *sd;
-   struct {
-      int           pos, size, size2, res;
-   } ask;
-   int              hookp;
-   struct {
-      int           w, h;
-   } min, aspect, aspect_pad;
-   Evas_Coord       x, y, w, h;
-   Evas_Object     *obj;
-   unsigned char    can_move : 1;
-};
 
 /* local subsystem functions */
 static E_Gadcon_Layout_Item *_e_gadcon_layout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj);
@@ -1926,7 +2328,7 @@
 
 /* called when a users moves/resizes the gadcon client explicitly */
 static void
-e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size)
+e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size, int seq, int flags)
 {
    E_Gadcon_Layout_Item *bi;
 
@@ -1942,12 +2344,14 @@
    if ((bi->ask.res - pos) < size) pos = bi->ask.res - size;
    bi->ask.size = size;
    bi->ask.pos = pos;
+   bi->state_info.seq = seq;
+   bi->state_info.lock_flags = flags;
    _e_gadcon_layout_smart_reconfigure(bi->sd);
 }
 
 /* called when restoring config from saved config */
 static void
-e_gadcon_layout_pack_options_set(Evas_Object *obj, int pos, int size, int res)
+e_gadcon_layout_pack_options_set(Evas_Object *obj, int pos, int size, int res, int seq, int flags)
 {
    E_Gadcon_Layout_Item *bi;
 
@@ -1958,6 +2362,8 @@
    bi->ask.res = res;
    bi->ask.size = size;
    bi->ask.pos = pos;
+   bi->state_info.seq = seq;
+   bi->state_info.lock_flags = flags;
    _e_gadcon_layout_smart_reconfigure(bi->sd);
 }
 
@@ -2031,6 +2437,9 @@
    if (!bi) return NULL;
    bi->sd = sd;
    bi->obj = obj;
+   bi->state_info.resist = 0;
+   bi->ask.prev_pos = -1;
+   bi->ask.prev_size = 0;
    /* defaults */
    evas_object_clip_set(obj, sd->clip);
    evas_object_smart_member_add(obj, bi->sd->obj);
@@ -2075,92 +2484,114 @@
 }
 
 static int
-_e_gadcon_sort_cb(void *d1, void *d2)
+_e_gadcon_layout_smart_sort_by_pos_cb(void *d1, void *d2)
 {
-   E_Gadcon_Layout_Item *bi1, *bi2;
+   E_Gadcon_Layout_Item *bi, *bi2;
    int v1, v2;
-   
-   bi1 = evas_object_data_get(d1, "e_gadcon_layout_data");
+
+   bi = evas_object_data_get(d1, "e_gadcon_layout_data");
    bi2 = evas_object_data_get(d2, "e_gadcon_layout_data");
-   v1 = (bi1->ask.pos + (bi1->ask.size / 2)) - bi1->hookp;
-   if (v1 < 0) v1 = -v1;
-   v2 = (bi2->ask.pos + (bi2->ask.size / 2)) - bi2->hookp;
-   if (v2 < 0) v2 = -v2;
-   return v1 - v2;
-}    
+
+   if (bi->sd->horizontal)
+     {
+	v1 = bi->x;
+	v2 = bi2->x;
+     }
+   else
+     {
+	v1 = bi->y;
+	v2 = bi2->y;
+     }
+
+   return (v1 - v2);
+}
 
 static int
-_e_gadcon_sort_all_cb(void *d1, void *d2)
+_e_gadcon_layout_smart_sort_by_seq_cb2(void *d1, void *d2)
 {
-   E_Gadcon_Layout_Item *bi1, *bi2;
-   int v1, v2;
-   
-   bi1 = evas_object_data_get(d1, "e_gadcon_layout_data");
+   E_Gadcon_Layout_Item *bi, *bi2;
+
+   bi = evas_object_data_get(d1, "e_gadcon_layout_data");
    bi2 = evas_object_data_get(d2, "e_gadcon_layout_data");
-   v1 = (bi1->ask.pos + (bi1->ask.size / 2));
-   if (v1 < 0) v1 = -v1;
-   v2 = (bi2->ask.pos + (bi2->ask.size / 2));
-   if (v2 < 0) v2 = -v2;
-   return v1 - v2;
-}    
 
-static void
-_e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
+   return (bi->state_info.seq - bi2->state_info.seq);
+}
+
+static int
+_e_gadcon_layout_smart_sort_by_seq_cb(void *d1, void *d2)
 {
-   Evas_Coord x, y, w, h, xx, yy;
-   Evas_List *l, *l2;
-   int min, mino, cur;
-   Evas_List *list_s = NULL, *list_m = NULL, *list_e = NULL, *list = NULL;
+   E_Gadcon_Layout_Item *bi, *bi2;
+
+   bi = d1;
+   bi2 = d2;
+
+   return (bi->state_info.seq - bi2->state_info.seq);
+}
+
+static int
+_e_gadcon_layout_smart_containers_sort_cb(void *d1, void *d2)
+{
+   E_Gadcon_Layout_Item_Container *lc, *lc2;
+
+   lc = d1;
+   lc2 = d2;
+
+   if (lc->pos < lc2->pos) return -1;
+   else if (lc->pos > lc2->pos) return 1;
+
+   return 0;
+}
+
+/*
+ * @min - the minimum width required by all the gadcons
+ * @cur - the current width required by all the gadcons
+ * @mino - the smalest width/height among all the objects
+ */
+static void 
+_e_gadcon_layout_smart_gadcon_size_get(E_Smart_Data *sd, int *min, int *cur, unsigned int *mino)
+{
+   Evas_Coord x, y, w, h;
+   E_Gadcon_Layout_Item	*bi;
+   Evas_List *l;
 
-   if (sd->frozen) return;
-   if (sd->doing_config)
-     {
-	sd->redo_config = 1;
-	return;
-     }
-   
    x = sd->x; y = sd->y; w = sd->w; h = sd->h;
-   min = mino = cur = 0;
 
+   // how much space all the gadgets takes in the shelf
    for (l = sd->items; l; l = l->next)
      {
-	E_Gadcon_Layout_Item *bi;
-	Evas_Object *obj;
-	
-	obj = l->data;
-	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-	if (!bi) continue;
+	bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
 	bi->ask.size2 = bi->ask.size;
+
 	if ((bi->aspect.w > 0) && (bi->aspect.h > 0))
 	  {
 	     if (sd->horizontal)
 	       {
-		  bi->ask.size2 = (((h - bi->aspect_pad.h) * bi->aspect.w) / 
-				   bi->aspect.h) + bi->aspect_pad.w;
+		  bi->ask.size2 = (((h - bi->aspect_pad.h) * bi->aspect.w) / bi->aspect.h)
+				   + bi->aspect_pad.w;
 		  if (bi->ask.size2 > bi->min.w)
 		    {
-		       min += bi->ask.size2;
-		       cur += bi->ask.size2;
+		       *min += bi->ask.size2;
+		       *cur += bi->ask.size2;
 		    }
 		  else
 		    {
-		       cur += bi->min.w;
-		       min += bi->min.w;
+		       *min += bi->min.w;
+		       *cur += bi->min.w;
 		    }
 	       }
-	     else 
+	     else
 	       {
-		  bi->ask.size2 = (((w - bi->aspect_pad.w) * bi->aspect.h) / 
-				   bi->aspect.w) + bi->aspect_pad.h;
+		  bi->ask.size2 = (((w - bi->aspect_pad.w) * bi->aspect.h) / bi->aspect.w)
+				   + bi->aspect_pad.h;
 		  if (bi->ask.size2 > bi->min.h)
 		    {
-		       min += bi->ask.size2;
-		       cur += bi->ask.size2;
+		       *min += bi->ask.size2;
+		       *cur += bi->ask.size2;
 		    }
 		  else
 		    {
-		       cur += bi->min.h;
-		       min += bi->min.h;
+		       *cur += bi->min.h;
+		       *min += bi->min.h;
 		    }
 	       }
 	  }
@@ -2168,46 +2599,47 @@
 	  {
 	     if (sd->horizontal)
 	       {
-		  min += bi->min.w;
-		  if (bi->min.h > mino) mino = bi->min.h;
+		  *min += bi->min.w;
+		  if (bi->min.h > *mino) *mino = bi->min.h;
+		  //if (bi->min.w > *mino) *mino = bi->min.w;
 		  if (bi->ask.size < bi->min.w)
-		    cur += bi->min.w;
+		    *cur += bi->min.w;
 		  else
-		    cur += bi->ask.size;
+		    *cur += bi->ask.size;
 	       }
 	     else
 	       {
-		  min += bi->min.h;
-		  if (bi->min.w > mino) mino = bi->min.w;
+		  *min += bi->min.h;
+		  //if (bi->min.h > *mino) *mino = bi->min.h;
+		  if (bi->min.w > *mino) *mino = bi->min.w;
 		  if (bi->ask.size < bi->min.h)
-		    cur += bi->min.h;
+		    *cur += bi->min.h;
 		  else
-		    cur += bi->ask.size;
+		    *cur += bi->ask.size;
 	       }
 	  }
      }
-   
+}
+static void
+_e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur)
+{
+   Evas_List *l;
+   E_Gadcon_Layout_Item *bi;
+   int x, y, w, h;
+
+   x = sd->x; y = sd->y; w = sd->w; h = sd->h;
    if (sd->horizontal)
      {
-	if (cur <= w)
-	  {
-	     /* all is fine - it should all fit */
-	  }
-	else
+	if (cur > w)
 	  {
 	     int sub, give, num, given, i;
-	     
+
 	     sub = cur - w; /* we need to find "sub" extra pixels */
 	     if (min <= w)
 	       {
 		  for (l = sd->items; l; l = l->next)
 		    {
-		       E_Gadcon_Layout_Item *bi;
-		       Evas_Object *obj;
-		       
-		       obj = l->data;
-		       bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-		       if (!bi) continue;
+		       bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
 		       give = bi->ask.size - bi->min.w; // how much give does this have?
 		       if (give < sub) give = sub;
 		       bi->ask.size2 = bi->ask.size - give;
@@ -2216,24 +2648,17 @@
 		    }
 	       }
 	     else
-	       { /* EEK - all items just cant fit at their minimum! what do we do? */
-		  num = 0;
+	       {
+		  /* EEK - all items just cant fit at their minimum! what do we do? */
 		  num = evas_list_count(sd->items);
 		  give = min - w; // how much give total below minw we need
 		  given = 0;
 		  for (l = sd->items; l; l = l->next)
 		    {
-		       E_Gadcon_Layout_Item *bi;
-		       Evas_Object *obj;
-		       
-		       obj = l->data;
-		       bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-		       if (!bi) continue;
+		       bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
 		       bi->ask.size2 = bi->min.w;
 		       if (!l->next)
-			 {
-			    bi->ask.size2 -= (give - given);
-			 }
+			 bi->ask.size2 -= (give - given);
 		       else
 			 {
 			    i = (give + (num / 2)) / num;
@@ -2246,25 +2671,16 @@
      }
    else
      {
-	if (cur <= h)
-	  {
-	     /* all is fine - it should all fit */
-	  }
-	else
+	if (cur > h)
 	  {
 	     int sub, give, num, given, i;
-	     
+
 	     sub = cur - h; /* we need to find "sub" extra pixels */
 	     if (min <= h)
 	       {
 		  for (l = sd->items; l; l = l->next)
 		    {
-		       E_Gadcon_Layout_Item *bi;
-		       Evas_Object *obj;
-		       
-		       obj = l->data;
-		       bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-		       if (!bi) continue;
+		       bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
 		       give = bi->ask.size - bi->min.h; // how much give does this have?
 		       if (give < sub) give = sub;
 		       bi->ask.size2 = bi->ask.size - give;
@@ -2273,24 +2689,17 @@
 		    }
 	       }
 	     else
-	       { /* EEK - all items just cant fit at their minimum! what do we do? */
-		  num = 0;
+	       {
+		  /* EEK - all items just cant fit at their minimum! what do we do? */
 		  num = evas_list_count(sd->items);
 		  give = min - h; // how much give total below minw we need
 		  given = 0;
 		  for (l = sd->items; l; l = l->next)
 		    {
-		       E_Gadcon_Layout_Item *bi;
-		       Evas_Object *obj;
-		       
-		       obj = l->data;
-		       bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-		       if (!bi) continue;
+		       bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
 		       bi->ask.size2 = bi->min.h;
 		       if (!l->next)
-			 {
-			    bi->ask.size2 -= (give - given);
-			 }
+			 bi->ask.size2 -= (give - given);
 		       else
 			 {
 			    i = (give + (num / 2)) / num;
@@ -2301,398 +2710,1403 @@
 	       }
 	  }
      }
-   
-   for (l = sd->items; l; l = l->next)
+}
+
+#define LC_OVERLAP(__lc, __lc2) \
+   ( __lc2->pos >= __lc->pos && (__lc2->pos < (__lc->pos + __lc->size)) || \
+     __lc->pos >= __lc2->pos && (__lc->pos < (__lc2->pos + __lc2->size)))
+
+#define E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(__lc, __bi, __increase) \
+	     if (__lc->sd->horizontal) \
+	       { \
+		  if (__increase) \
+		    __lc->size += __bi->w; \
+		  else \
+		    __lc->size -= __bi->w; \
+	       } \
+	     else \
+	       { \
+		  if (__increase) \
+		    __lc->size += __bi->h; \
+		  else \
+		    __lc->size -= __bi->h; \
+	       }
+
+#define LC_FREE(__lc) \
+   if (__lc->items) \
+     evas_list_free(__lc->items); \
+   E_FREE(__lc)
+
+#define E_LAYOUT_ITEM_CONTAINER_STATE_SET(__con_state, __bi_state) \
+   if (__bi_state == E_LAYOUT_ITEM_STATE_NONE) \
+      __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; \
+   else if (__bi_state == E_LAYOUT_ITEM_STATE_POS_INC) \
+      __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC; \
+   else if (__bi_state == E_LAYOUT_ITEM_STATE_POS_DEC) \
+      __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC; \
+   else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) \
+      __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC; \
+   else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) \
+      __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC; \
+   else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) \
+      __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC; \
+   else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC) \
+      __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC
+
+static void
+_e_gadcon_layout_smart_position_gadcons_inside_container(E_Gadcon_Layout_Item_Container *lc)
+{
+   int shift = 0;
+   Evas_List *l;
+   E_Gadcon_Layout_Item *bi;
+
+   if (!lc->items) return;
+
+   bi = lc->items->data;
+   if (lc->sd->horizontal) 
+     shift = lc->pos - bi->x;
+   else
+     shift = lc->pos - bi->y;
+   if (!shift) return;
+
+   for (l = lc->items; l; l = l->next)
      {
-	E_Gadcon_Layout_Item *bi;
-	Evas_Object *obj;
-	
-	obj = l->data;
-	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-	if (!bi) continue;
-	list = evas_list_append(list, obj);
-	if (sd->horizontal)
+	bi = l->data;
+	if (lc->sd->horizontal) 
+	  bi->x += shift;
+	else
+	  bi->y += shift;
+
+	if ((bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) ||
+	    (bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC))
 	  {
-	     xx = bi->ask.pos + (bi->ask.size / 2);
-	     if (xx < (bi->ask.res / 3))
-	       { /* hooked to start */
-		  bi->x = bi->ask.pos;
-		  bi->w = bi->ask.size2;
-		  list_s = evas_list_append(list_s, obj);
-		  bi->hookp = 0;
-	       }
-	     else if (xx > ((2 * bi->ask.res) / 3))
-	       { /* hooked to end */
-		  bi->x = (bi->ask.pos - bi->ask.res) + w;
-		  bi->w = bi->ask.size2;
-		  list_e = evas_list_append(list_e, obj);
-		  bi->hookp = bi->ask.res;
+	     if (lc->sd->horizontal) 
+	       bi->ask.pos = bi->x;
+	     else
+	       bi->ask.pos = bi->y;
+	  }
+     }
+}
+
+/*
+ * The function takes lc and lc2 as an input.
+ * The output is in lc;
+ */
+static void
+_e_gadcon_layout_smart_helper_item_container_merge(E_Gadcon_Layout_Item_Container *lc, E_Gadcon_Layout_Item_Container *lc2)
+{
+   int start = 0, size = 0, next = 0, min_seq = 0, max_seq = 0;
+   Evas_List *l, *nl = NULL;
+   E_Gadcon_Layout_Item *bi;
+
+   for (l = lc->items; l; l = l->next)
+     nl = evas_list_append(nl, l->data);
+
+   for (l = lc2->items; l; l = l->next)
+     nl = evas_list_append(nl, l->data);
+
+   nl = evas_list_sort(nl, evas_list_count(nl), _e_gadcon_layout_smart_sort_by_seq_cb);
+
+   for (l = nl; l; l = l->next)
+     {
+	bi = l->data;
+	if (l == nl)
+	  { 
+	     min_seq = bi->state_info.seq;
+	     if (lc->sd->horizontal)
+	       {
+		  start = bi->x;
+		  size = bi->w;
+		  next = bi->x + bi->w;
 	       }
 	     else
-	       { /* hooked to middle */
-		  if ((bi->ask.pos <= (bi->ask.res / 2)) &&
-		      ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2)))
-		    { /* straddles middle */
-		       if (bi->ask.res > 2)
-			 bi->x = (w / 2) + 
-			 (((bi->ask.pos + (bi->ask.size2 / 2) - 
-			    (bi->ask.res / 2)) * 
-			   (bi->ask.res / 2)) /
-			  (bi->ask.res / 2)) - (bi->ask.size2 / 2);
-		       else
-			 bi->x = w / 2;
-		       bi->w = bi->ask.size2;
-		    }
-		  else
-		    { /* either side of middle */
-		       bi->x = (bi->ask.pos - (bi->ask.res / 2)) + (w / 2);
-		       bi->w = bi->ask.size2;
-		    }
-		  list_m = evas_list_append(list_m, obj);
-		  bi->hookp = bi->ask.res / 2;
+	       {
+		  start = bi->y;
+		  size = bi->h;
+		  next = bi->y + bi->h;
 	       }
-	     if (bi->x < 0) bi->x = 0;
-	     else if ((bi->x + bi->w) > w) bi->x = w - bi->w;
+	     continue;
+	  }
+
+	max_seq = bi->state_info.seq;
+	if (lc->sd->horizontal)
+	  {
+	     bi->x = next;
+	     size += bi->w;
+	     next = bi->x + bi->w;
 	  }
 	else
 	  {
-	     yy = bi->ask.pos + (bi->ask.size2 / 2);
-	     if (yy < (bi->ask.res / 3))
-	       { /* hooked to start */
-		  bi->y = bi->ask.pos;
-		  bi->h = bi->ask.size2;
-		  list_s = evas_list_append(list_s, obj);
-		  bi->hookp = 0;
-	       }
-	     else if (yy > ((2 * bi->ask.res) / 3))
-	       { /* hooked to end */
-		  bi->y = (bi->ask.pos - bi->ask.res) + h;
-		  bi->h = bi->ask.size2;
-		  list_e = evas_list_append(list_e, obj);
-		  bi->hookp = bi->ask.res;
+	     bi->y = next;
+	     size += bi->h;
+	     next = bi->y + bi->h;
+	  }
+     }
+
+   lc->items = evas_list_free(lc->items);
+   lc2->items = evas_list_free(lc2->items);
+   lc->items = nl;
+   lc->pos = start;
+   lc->size = size;
+   lc->state_info.min_seq = min_seq;
+   lc->state_info.max_seq = max_seq;
+   lc2->pos = lc->pos + lc->size;
+   lc2->size = 0;
+}
+
+/* The function assumes that lc and lc2 overlaps and lc->pos < lc2->pos.
+ * It does not test for those conditions 
+ */
+static E_Gadcon_Layout_Item_Container *
+_e_gadcon_layout_smart_position_containers(E_Gadcon_Layout_Item_Container *lc, E_Gadcon_Layout_Item_Container *lc2)
+{
+   int create_new = 0;
+   Evas_List *l, *l2;
+   E_Gadcon_Layout_Item *bi, *bi2;
+   E_Layout_Item_Container_State new_state;
+   E_Gadcon_Layout_Item_Container *lc3 = NULL;
+
+   if ((lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) &&
+       (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE))
+     {
+	if (lc->state_info.max_seq <= lc2->state_info.min_seq)
+	  { 
+	     lc2->pos = lc->pos + lc->size;
+	     _e_gadcon_layout_smart_position_gadcons_inside_container(lc2);
+
+	     create_new = 1;
+	     new_state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE;
+	  }
+	else if (lc->state_info.min_seq > lc2->state_info.max_seq)
+	  {
+	     lc->pos = lc2->pos + lc2->size;
+	     _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+
+	     create_new = 1;
+	     new_state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE;
+	  }
+	else if (((lc->state_info.min_seq > lc2->state_info.min_seq) &&
+		  (lc->state_info.min_seq < lc2->state_info.max_seq)) ||
+	         ((lc2->state_info.min_seq > lc->state_info.min_seq) &&
+		  (lc2->state_info.min_seq < lc->state_info.max_seq)))
+	  {
+	     _e_gadcon_layout_smart_helper_item_container_merge(lc, lc2);
+
+	     create_new = 1;
+	     new_state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE;
+	  }
+	else
+	  {
+	  }
+     }
+   else if ((lc->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE) &&
+	    (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE))
+     {
+	if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC)
+	  { 
+	     int t;
+
+	     bi = lc->items->data;
+	     bi2 = lc2->items->data;
+
+	     if (lc->sd->horizontal)
+	       { 
+		  bi->ask.pos = bi->x = bi2->x + bi2->w - bi->w; 
+		  bi2->x = bi->x - bi2->w;
 	       }
 	     else
-	       { /* hooked to middle */
-		  if ((bi->ask.pos <= (bi->ask.res / 2)) &&
-		      ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2)))
-		    { /* straddles middle */
-		       if (bi->ask.res > 2)
-			 bi->y = (h / 2) + 
-			 (((bi->ask.pos + (bi->ask.size2 / 2) - 
-			    (bi->ask.res / 2)) * 
-			   (bi->ask.res / 2)) /
-			  (bi->ask.res / 2)) - (bi->ask.size2 / 2);
-		       else
-			 bi->y = h / 2;
-		       bi->h = bi->ask.size2;
-		    }
-		  else
-		    { /* either side of middle */
-		       bi->y = (bi->ask.pos - (bi->ask.res / 2)) + (h / 2);
-		       bi->h = bi->ask.size2;
-		    }
-		  list_s = evas_list_append(list_s, obj);
-		  bi->hookp = bi->ask.res / 2;
+	       {
+		  bi->ask.pos = bi->y = bi2->y + bi2->h - bi->h;
+		  bi2->y = bi->y - bi2->h;
 	       }
-	     if (bi->y < 0) bi->y = 0;
-	     else if ((bi->y + bi->h) > h) bi->y = h - bi->h;
+	     bi2->state_info.lock_flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+
+	     t = bi->state_info.seq;
+	     bi->state_info.seq = bi2->state_info.seq;
+	     bi2->state_info.seq = t;
+
+	     _e_gadcon_layout_smart_helper_item_container_merge(lc, lc2);
+
+	     create_new = 1;
+	     new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
 	  }
-     }
-   list_s = evas_list_sort(list_s, evas_list_count(list_s), _e_gadcon_sort_cb);
-   list_m = evas_list_sort(list_m, evas_list_count(list_m), _e_gadcon_sort_cb);
-   list_e = evas_list_sort(list_e, evas_list_count(list_e), _e_gadcon_sort_cb);
-   list = evas_list_sort(list, evas_list_count(list), _e_gadcon_sort_all_cb);
-   for (l = list_s; l; l = l->next)
-     {
-	E_Gadcon_Layout_Item *bi;
-	Evas_Object *obj;
-	
-	obj = l->data;
-	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-	if (!bi) continue;
-	again1:
-	for (l2 = l->prev; l2; l2 = l2->prev)
+	else if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED)
 	  {
-	     E_Gadcon_Layout_Item *bi2;
-	     
-	     obj = l2->data;
-	     bi2 = evas_object_data_get(obj, "e_gadcon_layout_data");
-	     if (!bi2) continue;
-	     if (sd->horizontal)
+	     if (lc->state_info.max_seq < lc2->state_info.min_seq)
+	       { 
+		  lc2->pos = lc->pos + lc->size;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc2); 
+		  
+		  create_new = 1; 
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	       }
+	     else if (lc->state_info.min_seq > lc2->state_info.max_seq)
 	       {
-		  if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w))
+		  lc2->pos = lc->pos - lc2->size;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc2);
+
+		  create_new = 1; 
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	       }
+	     else if (((lc->state_info.min_seq > lc2->state_info.min_seq) &&
+		       (lc->state_info.min_seq < lc2->state_info.max_seq)) ||
+		      ((lc2->state_info.min_seq > lc->state_info.min_seq) &&
+		       (lc2->state_info.min_seq < lc->state_info.max_seq)))
+	       {
+		  int shift = 0;
+		  _e_gadcon_layout_smart_helper_item_container_merge(lc, lc2);
+
+		  for (l = lc->items; l; l = l->next)
 		    {
-		       bi->x = bi2->x + bi2->w;
-		       goto again1;
+		       bi = l->data;
+		       if (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION)
+			 {
+			    if (lc->sd->horizontal)
+			      shift = bi->ask.pos - bi->x;
+			    else
+			      shift = bi->ask.pos - bi->y;
+			 }
+
+		       if (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)
+			 break;
+		    }
+
+		  for (l = lc->items; l && shift; l = l->next)
+		    {
+		       bi = l->data;
+
+		       if (lc->sd->horizontal)
+			 bi->x += shift;
+		       else
+			 bi->y += shift;
+
+		       if (l == lc->items)
+			 {
+			    if (lc->sd->horizontal)
+			      lc->pos = bi->x;
+			    else
+			      lc->pos = bi->y;
+
+			 }
 		    }
+
+		  create_new = 1;
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
 	       }
 	     else
 	       {
-		  if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h))
-		    {
-		       bi->y = bi2->y + bi2->h;
-		       goto again1;
-		    }
 	       }
 	  }
      }
-   for (l = list_m; l; l = l->next)
+   else if ((lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) &&
+	    (lc2->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE))
      {
-	E_Gadcon_Layout_Item *bi;
-	Evas_Object *obj;
-	
-	obj = l->data;
-	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-	if (!bi) continue;
-	again2:
-	for (l2 = l->prev; l2; l2 = l2->prev)
+	if (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED)
 	  {
-	     E_Gadcon_Layout_Item *bi2;
-	     
-	     obj = l2->data;
-	     bi2 = evas_object_data_get(obj, "e_gadcon_layout_data");
-	     if (!bi2) continue;
-             if (sd->horizontal)
+	     if (lc->state_info.max_seq < lc2->state_info.min_seq)
+	       { 
+		  lc->pos = lc2->pos - lc->size;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+
+		  create_new = 1;
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	       }
+	     else if (lc->state_info.min_seq > lc2->state_info.max_seq)
 	       {
-		  if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w))
+		  lc->pos = lc2->pos + lc2->size;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+
+		  create_new = 1;
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	       }
+	     else if (((lc->state_info.min_seq > lc2->state_info.min_seq) &&
+		       (lc->state_info.min_seq < lc2->state_info.max_seq)) ||
+		      ((lc2->state_info.min_seq > lc->state_info.min_seq) &&
+		       (lc2->state_info.min_seq < lc->state_info.max_seq)))
+	       {
+		  int shift = 0;
+
+		  _e_gadcon_layout_smart_helper_item_container_merge(lc, lc2);
+
+		  for (l = lc->items; l; l = l->next)
+		    {
+		       bi = l->data;
+		       if (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION)
+			 { 
+			    if (lc->sd->horizontal) 
+			      shift = bi->ask.pos - bi->x;
+			    else
+			      shift = bi->ask.pos - bi->y;
+			 }
+
+		       if (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)
+			 break;
+		    }
+
+		  for (l = lc->items; l && shift; l = l->next)
 		    {
-		       if ((bi2->x + (bi2->w / 2)) < (w / 2))
-			 bi->x = bi2->x - bi->w;
+		       bi = l->data;
+
+		       if (lc->sd->horizontal) 
+			 bi->x += shift;
 		       else
-			 bi->x = bi2->x + bi2->w;
-		       goto again2;
+			 bi->y += shift;
+
+		       if (l == lc->items)
+			 { 
+			    if (lc->sd->horizontal) 
+			      lc->pos = bi->x;
+			    else
+			      lc->pos = bi->y;
+			 }
 		    }
+
+		  create_new = 1;
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
 	       }
 	     else
 	       {
-		  if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h))
-		    {
-		       if ((bi2->y + (bi2->h / 2)) < (h / 2))
-			 bi->y = bi2->y - bi->h;
-		       else
-			 bi->y = bi2->y + bi2->h;
-		       goto again2;
-		    }
 	       }
 	  }
+	else if (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC)
+	  {
+	     int t;
+
+	     bi = (evas_list_last(lc->items))->data;
+	     bi2 = lc2->items->data;
+
+	     if (lc->sd->horizontal)
+	       { 
+		  bi2->ask.pos = bi2->x = bi->x; 
+		  bi->x = bi2->x + bi2->w; 
+	       }
+	     else
+	       {
+		  bi2->ask.pos = bi2->y = bi->y;
+		  bi->y = bi2->y + bi2->h;
+	       } 
+	     bi->state_info.lock_flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+
+	     t = bi->state_info.seq;
+	     bi->state_info.seq = bi2->state_info.seq;
+	     bi2->state_info.seq = t;
+
+	     lc->items = evas_list_remove_list(lc->items, evas_list_last(lc->items));
+	     lc->items = evas_list_append(lc->items, bi2);
+	     lc->items = evas_list_append(lc->items, bi);
+	     lc2->items = evas_list_free(lc2->items);
+	     E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc, bi2, 1);
+	     lc2->pos = lc->pos + lc->size;
+	     lc2->size = 0;
+
+	     create_new = 1;
+	     new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	  }
      }
-   for (l = list_e; l; l = l->next)
+   else if ((lc->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE) &&
+	    (lc2->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE))
      {
-	E_Gadcon_Layout_Item *bi;
-	Evas_Object *obj;
-	
-	obj = l->data;
-	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-	if (!bi) continue;
-	again3:
-	for (l2 = l->prev; l2; l2 = l2->prev)
+	if ((lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED) &&
+	    (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED))
 	  {
-	     E_Gadcon_Layout_Item *bi2;
-	     
-	     obj = l2->data;
-	     bi2 = evas_object_data_get(obj, "e_gadcon_layout_data");
-	     if (!bi2) continue;
-             if (sd->horizontal)
+	     if (lc->state_info.max_seq < lc2->state_info.min_seq)
 	       {
-		  if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w))
+		  int move_lc2 = 1;
+		  for (l = lc2->items; l; l = l->next)
+		    {
+		       bi = l->data;
+		       if (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)
+			 {
+			    move_lc2 = 0;
+			    break;
+			 }
+		    }
+
+		  if (move_lc2)
 		    {
-		       bi->x = bi2->x - bi->w;
-		       goto again3;
+		       lc2->pos = lc->pos + lc->size;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc2);
 		    }
-	       }
-	     else
-	       {
-		  if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h))
+		  else
 		    {
-		       bi->y = bi2->y - bi->h;
-		       goto again3;
+		       lc->pos = lc2->pos - lc->size;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
 		    }
+		  create_new = 1;
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	       }
+	     else if (lc->state_info.min_seq > lc2->state_info.max_seq)
+	       {
+		  int move_lc = 1;
+
+		  for (l = lc->items; l; l = l->next)
+		    {
+		       bi = l->data;
+		       if (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)
+			 {
+			    move_lc = 0;
+			    break;
+			 }
+		    }
+
+		  if (move_lc)
+		    {
+		       lc->pos = lc2->pos + lc2->size;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+		    }
+		  else
+		    {
+		       lc2->pos = lc->pos - lc2->size;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc2);
+		    }
+
+		  create_new = 1;
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	       }
+	     else if (((lc->state_info.min_seq > lc2->state_info.min_seq) &&
+		       (lc->state_info.min_seq < lc2->state_info.max_seq)) ||
+		      ((lc2->state_info.min_seq > lc->state_info.min_seq) &&
+		       (lc2->state_info.min_seq < lc->state_info.max_seq)))
+	       {
+		  int shift = 0;
+		  _e_gadcon_layout_smart_helper_item_container_merge(lc, lc2);
+
+		  for (l = lc->items; l; l = l->next)
+		    {
+		       bi = l->data;
+		       if ((bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) &&
+			   (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE))
+			 {
+			    if (lc->sd->horizontal) 
+			      shift = bi->ask.pos - bi->x;
+			    else
+			      shift = bi->ask.pos - bi->y;
+			    break;
+			 }
+		    }
+
+		  for (l = lc->items; l && shift; l = l->next)
+		    {
+		       bi = l->data;
+		       
+		       if (lc->sd->horizontal)
+			 bi->x += shift;
+		       else
+			 bi->y += shift;
+
+		       if (l == lc->items)
+			 {
+			    if (lc->sd->horizontal)
+			      lc->pos = bi->x;
+			    else
+			      lc->pos = bi->y;
+			 }
+		    }
+		  
+		  create_new = 1;
+		  new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+	       }
+	     else
+	       {
 	       }
 	  }
      }
-   for (l = list; l; l = l->next)
+
+   /*******************/
+   if (create_new)
      {
-	E_Gadcon_Layout_Item *bi;
-	Evas_Object *obj;
+	lc3 = E_NEW(E_Gadcon_Layout_Item_Container, 1);
+	lc3->sd = lc->sd;
+	if (lc->pos < lc2->pos)
+	  {
+	     lc3->pos = lc->pos;
+	     for (l = lc->items; l; l = l->next)
+	       lc3->items = evas_list_append(lc3->items, l->data);
+
+	     for (l = lc2->items; l; l = l->next)
+	       lc3->items = evas_list_append(lc3->items, l->data);
+
+	     lc3->state_info.min_seq = lc->state_info.min_seq;
+	     if (lc2->items) 
+	       lc3->state_info.max_seq = lc2->state_info.max_seq;
+	     else
+	       lc3->state_info.max_seq = lc->state_info.max_seq;
+	  }
+	else
+	  {
+	     lc3->pos = lc2->pos;
+	     for (l = lc2->items; l; l = l->next)
+	       lc3->items = evas_list_append(lc3->items, l->data);
+
+	     for (l = lc->items; l; l = l->next)
+	       lc3->items = evas_list_append(lc3->items, l->data);
+
+	     lc3->state_info.min_seq = lc2->state_info.min_seq;
+	     if (lc->items) 
+	       lc3->state_info.max_seq = lc->state_info.max_seq;
+	     else
+	       lc3->state_info.max_seq = lc2->state_info.max_seq;
+	  }
+	lc3->size = lc->size + lc2->size;
+	lc3->state = new_state;
+     }
+
+   return lc3;
+}
+
+static void
+_e_gadcon_layout_smart_position_gadcons_static(Evas_List **list)
+{
+   int ok;
+   Evas_List *l;
+   E_Gadcon_Layout_Item_Container *lc, *lc2, *lc3;
+
+   *list = evas_list_sort(*list, evas_list_count(*list), _e_gadcon_layout_smart_containers_sort_cb);
+
+   __reposition_again: 
+   for (l = *list; l; l = l->next) 
+     { 
+	if (!l->next) continue; 
+
+	lc = l->data; 
+	lc2 = l->next->data; 
 	
-	obj = l->data;
-	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-	if (!bi) continue;
-	bi->can_move = 1;
-	if (sd->horizontal)
+	if (LC_OVERLAP(lc, lc2)) 
+	  { 
+	     lc3 = _e_gadcon_layout_smart_position_containers(lc, lc2); 
+	     if (lc3) 
+	       { 
+		  l->data = lc3; 
+		  *list = evas_list_remove_list(*list, l->next); 
+		  LC_FREE(lc); 
+		  LC_FREE(lc2); 
+		  goto __reposition_again; 
+	       } 
+	  } 
+     }
+
+   ok = 1; 
+   for (l = *list; l; l = l->next) 
+     { 
+	lc = l->data; 
+	if (lc->pos < 0) 
+	  { 
+	     ok = 0;
+	     lc->pos = 0; 
+	     _e_gadcon_layout_smart_position_gadcons_inside_container(lc); 
+	     continue; 
+	  } 
+	
+	if (lc->sd->horizontal) 
+	  { 
+	     if (((lc->pos + lc->size) > lc->sd->w) && (evas_list_count(*list) > 1)) 
+	       { 
+		  ok = 0;
+		  lc->pos = lc->sd->w - lc->size; 
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc); 
+	       } 
+	  } 
+	else 
+	  { 
+	     if (((lc->pos + lc->size) > lc->sd->h) && (evas_list_count(*list) > 1)) 
+	       { 
+		  ok = 0;
+		  lc->pos = lc->sd->h - lc->size;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+	       }
+	  }
+     }
+   if (!ok)
+     _e_gadcon_layout_smart_position_gadcons_static(list);
+}
+
+static void
+_e_gadcon_layout_smart_position_gadcons(E_Smart_Data *sd, Evas_List **list)
+{
+   int ok;
+   Evas_List *l, *l2, *l3;
+   E_Gadcon_Layout_Item *bi, *bi2;
+   E_Gadcon_Layout_Item_Container *lc, *lc2, *lc3, *lc_moving = NULL, *lc_back = NULL;
+
+   if (!list || !*list) return;
+
+   for (l = *list; l; l = l->next)
+     {
+	lc_moving = l->data;
+	if ((lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) ||
+	    (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC) ||
+	    (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC) ||
+	    (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC) ||
+	    (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC) ||
+	    (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC))
+	  {
+	     lc_back = E_NEW(E_Gadcon_Layout_Item_Container, 1);
+	     lc_back->pos = lc_moving->pos;
+	     lc_back->prev_pos = lc_moving->prev_pos;
+	     lc_back->prev_size = lc_moving->prev_size;
+	     lc_back->size = lc_moving->size;
+	     lc_back->state_info.min_seq = lc_moving->state_info.min_seq;
+	     lc_back->state_info.max_seq = lc_moving->state_info.max_seq;
+	     lc_back->sd = lc_moving->sd;
+	     for (l2 = lc_moving->items; l2; l2 = l2->next) 
+	       lc_back->items = evas_list_append(lc_back->items, l2->data);
+	     lc_back->state = lc_moving->state;
+	     break;
+	  }
+	lc_moving = NULL;
+     }
+
+   if (!lc_moving)
+     {
+	_e_gadcon_layout_smart_position_gadcons_static(list);
+	goto __finish;
+     }
+
+   lc_moving->pos = lc_moving->prev_pos;
+   if ((lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC) ||
+       (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC) ||
+       (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC) ||
+       (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC))
+     {
+	lc_moving->size = lc_moving->prev_size;
+     }
+   _e_gadcon_layout_smart_position_gadcons_inside_container(lc_moving);
+   lc_moving->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+   _e_gadcon_layout_smart_position_gadcons_static(list);
+
+   //k. now we have to find moving lc
+
+   lc2 = NULL;
+   lc3 = NULL;
+   ok = 0;
+   for (l = *list; l; l = l->next)
+     {
+	lc = l->data;
+	if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) continue;
+
+	if (evas_list_count(lc->items) == 1)
 	  {
-	     if (!l->prev)
+	     bi = lc->items->data;
+	     if ((bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC) ||
+	         (bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) ||
+		 (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) ||
+		 (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) ||
+		 (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) ||
+		 (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC))
 	       {
-		  if (bi->x <= 0)
+		  LC_FREE(lc);
+		  l->data = lc_moving = lc_back;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc_back);
+	       }
+	  }
+	else
+	  {
+	     for (l2 = lc->items; l2; l2 = l2->next)
+	       {
+		  bi = l2->data; 
+
+		  if ((bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC) || 
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) ||
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) ||
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) ||
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) ||
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC))
 		    {
-		       bi->x = 0;
-		       bi->can_move = 0;
+		       ok = 1;
+		       if (l2 != lc->items)
+			 {
+			    lc2 = E_NEW(E_Gadcon_Layout_Item_Container, 1);
+			    lc2->sd = sd;
+			    lc2->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE;
+			    for (l3 = lc->items; l3 != l2; l3 = l3->next)
+			      {
+				 bi2 = l3->data;
+				 lc2->items = evas_list_append(lc2->items, bi2);
+				 if (l3 == lc->items)
+				   {
+				      lc2->state_info.min_seq = bi2->state_info.seq;
+				      if (sd->horizontal) 
+					lc2->pos = lc2->prev_pos = bi2->x;
+				      else
+					lc2->pos = lc2->prev_pos = bi2->y;
+				   }
+				 lc2->state_info.max_seq = bi2->state_info.seq;
+				 E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc2, bi2, 1);
+			      }
+			 }
+
+		       if (l2->next)
+			 {
+			    lc3 = E_NEW(E_Gadcon_Layout_Item_Container, 1);
+			    lc3->sd = sd;
+			    lc3->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE;
+			    for (l3 = l2->next; l3; l3 = l3->next)
+			      {
+				 bi2 = l3->data;
+				 lc3->items = evas_list_append(lc3->items, bi2);
+				 if (l3 == l2->next)
+				   {
+				      lc3->state_info.min_seq = bi2->state_info.seq;
+				      if (sd->horizontal)
+					lc3->pos = lc3->prev_pos = bi2->x;
+				      else
+					lc3->pos = lc3->prev_pos = bi2->y;
+				   }
+				 lc3->state_info.max_seq = bi2->state_info.seq;
+				 E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc3, bi2, 1);
+			      }
+			 }
+
+		       lc_moving = lc_back;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc_moving);
+
+		       break;
 		    }
 	       }
-	     if (!l->next)
+
+	     if (ok)
 	       {
-		  if ((bi->x + bi->w) >= w)
+		  LC_FREE(lc);
+		  if (lc2)
 		    {
-		       bi->x = w - bi->w;
-		       bi->can_move = 0;
+		       l->data = lc2;
+		       *list = evas_list_append(*list, lc_moving);
+		       if (lc3) 
+			 *list = evas_list_append(*list, lc3); 
+		       *list = evas_list_sort(*list, evas_list_count(*list),
+					     _e_gadcon_layout_smart_containers_sort_cb);
 		    }
+		  else
+		    {
+		       l->data = lc_moving;
+		       if (lc3)
+			 { 
+			    *list = evas_list_append(*list, lc3); 
+			    *list = evas_list_sort(*list, evas_list_count(*list), 
+						  _e_gadcon_layout_smart_containers_sort_cb);
+			 }
+		    }
+
+		  break;
 	       }
 	  }
-	else
+     }
+   for (l = *list; l; l = l->next)
+     {
+	lc = l->data;
+	if (lc == lc_moving) continue;
+	lc->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE;
+     }
+
+   if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC)
+     {
+	for (l = *list; (l) && (l->data != lc_moving); l = l->next);
+
+	ok = 0;
+	if (l && l->prev)
 	  {
-	     if (!l->prev)
+	     lc = l->prev->data;
+	     if (LC_OVERLAP(lc, lc_moving))
+	       { 
+		  bi = lc_moving->items->data;
+		  if (bi->state_info.resist <= E_LAYOUT_ITEM_RESIST_LEVEL)
+		    {
+		       ok = 1;
+		       bi->state_info.resist ++;
+		       lc_moving->pos = lc_moving->prev_pos;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc_moving);
+		    }
+		  else
+		    { 
+		       bi->state_info.resist = 0;
+		       lc3 = _e_gadcon_layout_smart_position_containers(lc, lc_moving); 
+		       if (lc3) 
+			 { 
+			    ok = 1; 
+			    l->data = lc3;
+			    *list = evas_list_remove_list(*list, l->prev); 
+			    LC_FREE(lc_moving); 
+			    LC_FREE(lc);
+			 }
+		    }
+	       }
+	  }
+
+	if (!ok)
+	  {
+	     for (l = *list; (l) && (l->data != lc_moving); l = l->next);
+	     if (l && l->next)
 	       {
-		  if (bi->y <= 0)
+		  int end, new_pos;
+
+		  end = lc_moving->prev_pos + lc_moving->size;
+		  new_pos = lc_moving->pos + lc_moving->size;
+
+		  for (l2 = l->next; l2; l2 = l2->next)
 		    {
-		       bi->y = 0;
-		       bi->can_move = 0;
+		       lc = l2->data;
+		       if (lc->pos != end)
+			 break;
+
+		       end = lc->pos + lc->size;
+
+		       lc->pos = new_pos;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+
+		       new_pos = lc->pos + lc->size;
 		    }
 	       }
-	     if (!l->next)
+	  }
+
+     }
+   else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC)
+     {
+	for (l = *list; (l) && (l->data != lc_moving); l = l->next);
+
+	ok = 0;
+	if (l && l->next)
+	  { 
+	     lc = l->next->data; 
+	     if (LC_OVERLAP(lc_moving, lc)) 
+	       { 
+		  bi = lc_moving->items->data;
+		  if (bi->state_info.resist <= E_LAYOUT_ITEM_RESIST_LEVEL)
+		    {
+		       ok = 1;
+		       bi->state_info.resist ++;
+		       lc_moving->pos = lc_moving->prev_pos;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc_moving);
+		    }
+		  else
+		    { 
+		       bi->state_info.resist = 0;
+		       lc3 = _e_gadcon_layout_smart_position_containers(lc_moving, lc); 
+		       
+		       if (lc3) 
+			 { 
+			    ok = 1; 
+			    l->data = lc3; 
+			    *list = evas_list_remove_list(*list, l->next); 
+			    LC_FREE(lc_moving); 
+			    LC_FREE(lc); 
+			 } 
+		    }
+	       } 
+	  }
+	// need to move all lc <= l->prev to their possible positions. if possible
+	if (!ok) 
+	  { 
+	     for (l = *list; (l) && (l->data != lc_moving); l = l->next); 
+	     if (l && l->prev)
 	       {
-		  if ((bi->y + bi->h) >= h)
+		  int end, new_pos;
+
+		  end = lc_moving->prev_pos;
+		  new_pos = lc_moving->pos;
+
+		  for (l2 = l->prev; l2; l2 = l2->prev)
 		    {
-		       bi->y = h - bi->h;
-		       bi->can_move = 0;
+		       lc = l2->data;
+
+		       if ((lc->pos + lc->size) != end)
+			 break;
+
+		       end = lc->pos;
+
+		       lc->pos = new_pos - lc->size;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+
+		       new_pos = lc->pos;
 		    }
 	       }
 	  }
      }
-   if (sd->horizontal)
+   else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC)
      {
-	int overlap;
-	int count;
-	
-	overlap = 1;
-	count = 0;
-	while (overlap)
+
+	for (l = *list; (l) && (l->data != lc_moving); l = l->next);
+
+	if (l && l->prev)
 	  {
-	     overlap = 0;
-	     for (l = list; l; l = l->next)
+	     int old_pos = 0, new_pos = 0;
+
+	     lc = l->prev->data;
+	     if (LC_OVERLAP(lc, lc_moving))
 	       {
-		  E_Gadcon_Layout_Item *bi;
-		  Evas_Object *obj;
-		  
-		  obj = l->data;
-		  bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-		  if (!bi) continue;
-		  if (bi->can_move)
+		  old_pos = lc_moving->prev_pos;
+		  new_pos = lc_moving->pos;
+
+		  for (l2 = l->prev; l2; l2 = l2->prev)
 		    {
-		       for (l2 = l->next; l2; l2 = l2->next)
+		       lc = l2->data;
+		       if ((lc->pos + lc->size) != old_pos)
+			 break;
+
+		       old_pos = lc->pos;
+		       new_pos = new_pos - lc->size;
+		    }
+
+		  if (new_pos < 0)
+		    {
+		       lc_moving->pos = lc_moving->prev_pos;
+		       lc_moving->size = lc_moving->prev_size;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc_moving);
+		       bi = lc_moving->items->data;
+		       if (sd->horizontal) 
+			 bi->w = lc_moving->size;
+		       else
+			 bi->h = lc_moving->size;
+		    }
+		  else
+		    {
+		       old_pos = lc_moving->prev_pos;
+		       new_pos = lc_moving->pos;
+		       for (l2 = l->prev; l2; l2 = l2->prev)
 			 {
-			    E_Gadcon_Layout_Item *bi2;
+			    lc = l2->data;
+
+			    if ((lc->pos + lc->size) != old_pos)
+			      break; 
 			    
-			    obj = l2->data;
-			    bi2 = evas_object_data_get(obj, "e_gadcon_layout_data");
-			    if (!bi2) continue;
-			    if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w))
-			      {
-				 bi->x = bi2->x - bi->w;
-				 if (!bi2->can_move) bi->can_move = 0;
-				 if ((bi->x + bi->w) >= w) bi->x = w - bi->w;
-				 if (bi->x <= 0) bi->x = 0;
-				 overlap = 1;
-			      }
+			    old_pos = lc->pos; 
+			    lc->pos = new_pos - lc->size; 
+			    _e_gadcon_layout_smart_position_gadcons_inside_container(lc); 
+			    new_pos = lc->pos; 
 			 }
-		       for (l2 = l->prev; l2; l2 = l2->prev)
+		    }
+	       }
+	  }
+     }
+   else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC)
+     {
+	for (l = *list; (l) && (l->data != lc_moving); l = l->next);
+	if (l && l->prev)
+	  {
+	     int old_pos, new_pos;
+
+	     old_pos = lc_moving->prev_pos;
+	     new_pos = lc_moving->pos;
+
+	     for (l2 = l->prev; l2; l2 = l2->prev)
+	       {
+		  lc = l2->data;
+
+		  if ((lc->pos + lc->size) != old_pos)
+		    break;
+
+		  //FIXME: if lc is already at its wanted position do not move it.
+		  old_pos = lc->pos;
+
+		  lc->pos = new_pos - lc->size;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+		  new_pos = lc->pos;
+	       }
+	  }
+     }
+   else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC)
+     {
+	for (l = *list; (l) && (l->data != lc_moving); l = l->next);
+	if (l && l->next)
+	  {
+	     int old_pos = 0, new_pos = 0;
+	     lc = l->next->data;
+
+	     if (LC_OVERLAP(lc_moving, lc))
+	       {
+		  old_pos = lc_moving->prev_pos + lc_moving->prev_size;
+		  new_pos = lc_moving->pos + lc_moving->size;
+
+		  for (l2 = l->next; l2; l2 = l2->next)
+		    {
+		       lc = l2->data;
+		       if (lc->pos != old_pos)
+			 break;
+
+		       old_pos = lc->pos;
+		       new_pos += lc->size;
+		    }
+
+		  if (((sd->horizontal) && (new_pos > sd->w))||
+		      ((!sd->horizontal) && (new_pos > sd->h)))
+		    {
+		       lc_moving->pos = lc_moving->prev_pos;
+		       lc_moving->size = lc_moving->prev_size;
+		       _e_gadcon_layout_smart_position_gadcons_inside_container(lc_moving);
+		       bi = lc_moving->items->data;
+		       if (sd->horizontal)
+			 bi->w = lc_moving->size;
+		       else
+			 bi->h = lc_moving->size;
+		    }
+		  else
+		    {
+		       old_pos = lc_moving->prev_pos + lc_moving->prev_size;
+		       new_pos = lc_moving->pos + lc_moving->size;
+		       for (l2 = l->next; l2; l2 = l2->next)
 			 {
-			    E_Gadcon_Layout_Item *bi2;
-			    
-			    obj = l2->data;
-			    bi2 = evas_object_data_get(obj, "e_gadcon_layout_data");
-			    if (!bi2) continue;
-			    if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w))
+			    lc = l2->data;
+
+			    if (lc->pos != old_pos)
+			      break;
+
+			    for (l3 = lc->items; l3; l3 = l3->next)
 			      {
-				 bi->x = bi2->x + bi2->w;
-				 if (!bi2->can_move) bi->can_move = 0;
-				 if ((bi->x + bi->w) >= w) bi->x = w - bi->w;
-				 if (bi->x <= 0) bi->x = 0;
-				 overlap = 1;
+				 bi = l3->data; 
+				 bi->state_info.lock_flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
 			      }
+
+			    old_pos = lc->pos + lc->size;
+			    lc->pos = new_pos;
+			    _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+			    new_pos = lc->pos + lc->size;
 			 }
 		    }
 	       }
-	     count++;
-	     if (count > 200) break; // quick infinite loop fix
+	  }
+     }
+   else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC)
+     {
+	for (l = *list; (l) && (l->data != lc_moving); l = l->next);
+	if (l && l->next)
+	  {
+	     int old_pos, new_pos;
+
+	     old_pos = lc_moving->prev_pos + lc_moving->prev_size;
+	     new_pos = lc_moving->pos + lc_moving->size;
+
+	     for (l2 = l->next; l2; l2 = l2->next)
+	       {
+		  lc = l2->data;
+		  if (lc->pos != old_pos)
+		    break;
+
+		  old_pos = lc->pos + lc->size;
+		  lc->pos = new_pos;
+		  _e_gadcon_layout_smart_position_gadcons_inside_container(lc);
+		  new_pos = lc->pos + lc->size;
+	       }
+	  }
+     }
+
+   __finish:
+   //set ids and prev_pos;
+   {
+      int i;
+      for (l = *list, i = 0; l; l = l->next)
+	{
+	   lc = l->data;
+	   //lc->state_info.min_seq = i;
+	   //lc->state_info.max_seq = i;
+	   for (l2 = lc->items; l2; l2 = l2->next)
+	     {
+		bi = l2->data;
+		bi->state_info.seq = i;
+		if (sd->horizontal) 
+		  { 
+		     bi->ask.prev_pos = bi->x;
+		     bi->ask.prev_size = bi->w;
+		  }
+		else
+		  { 
+		     bi->ask.prev_pos = bi->y;
+		     bi->ask.prev_size = bi->h;
+		  }
+		if ((bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) &&
+		    (bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE))
+		  {
+		     if (((sd->horizontal) && (bi->x != bi->ask.pos)) ||
+			 ((!sd->horizontal) && (bi->y != bi->ask.pos))) 
+		       bi->state_info.lock_flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+		  }
+		i++;
+	     }
+	}
+   }
+}
+
+static void
+_e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
+{
+   Evas_List *l;
+   Evas_List *list = NULL;
+   E_Gadcon_Layout_Item_Container *lc;
+
+   Evas_Coord x, y, w, h; // the coords of the sd
+   int min, cur; // the minimum and the current width all the gadgets want.
+   int mino; // the minimum width/heiaght among all the objects.
+   int xx, yy;
+   int msize = 0;
+
+   E_Gadcon_Layout_Item *bi, *bi2;
+   Evas_Object *obj;
+
+   if (sd->frozen) return;
+   if (sd->doing_config)
+     {
+	sd->redo_config = 1;
+	return;
+     }
+
+   x = sd->x; y = sd->y; w = sd->w; h = sd->h;
+   min = cur = mino = 0;
+
+   _e_gadcon_layout_smart_gadcon_size_get(sd, &min, &cur, &mino);
+   /**/
+    if (sd->horizontal)
+     {
+	if ((sd->minw != min) || (sd->minh != mino))
+	  {
+	     sd->minw = min;
+	     sd->minh = mino;
+	     evas_object_smart_callback_call(sd->obj, "min_size_request", NULL);
 	  }
      }
    else
      {
-	/* FIXME: for how this is just a copy of the above but in the vertical
-	 *        so when the above is "fixeD" the below needs to mirror it
-	 */
-	int overlap;
-	int count;
-	
-	overlap = 1;
-	count = 0;
-	while (overlap)
+	if ((sd->minh != min) || (sd->minw != mino))
 	  {
-	     overlap = 0;
-	     for (l = list; l; l = l->next)
+	     sd->minw = mino;
+	     sd->minh = min;
+	     evas_object_smart_callback_call(sd->obj, "min_size_request", NULL);
+	  }
+     }
+   if (sd->req != cur)
+     {
+	if (((sd->horizontal) && (cur >= sd->minw)) ||
+	    ((!sd->horizontal) && (cur >= sd->minh)))
+	  {
+	     sd->req = cur;
+	     evas_object_smart_callback_call(sd->obj, "size_request", NULL);
+	  }
+     }
+     /**/ 
+   _e_gadcon_layout_smart_gadcons_width_adjust(sd, min, cur);
+
+   /************* this peace of code is just for shrinked mode *********/ 
+
+   if (((sd->horizontal) && (sd->w == sd->req)) || ((!sd->horizontal) && (sd->h == sd->req)))
+     {
+	int pos = 0; 
+	sd->items = evas_list_sort(sd->items, evas_list_count(sd->items),
+				   _e_gadcon_layout_smart_sort_by_seq_cb2);
+
+	for (l = sd->items; l; l = l->next)
+	  {
+	     bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); 
+	     if (bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC)
 	       {
-		  E_Gadcon_Layout_Item *bi;
-		  Evas_Object *obj;
-		  
-		  obj = l->data;
-		  bi = evas_object_data_get(obj, "e_gadcon_layout_data");
-		  if (!bi) continue;
-		  if (bi->can_move)
+		  if (bi->state_info.resist <= E_LAYOUT_ITEM_RESIST_LEVEL)
 		    {
-		       for (l2 = l->next; l2; l2 = l2->next)
+		       bi->state_info.resist++;
+		       bi->ask.pos = bi->ask.prev_pos;
+		    }
+		  else
+		    {
+		       bi->state_info.resist = 0;
+		       if (l->next)
 			 {
-			    E_Gadcon_Layout_Item *bi2;
-			    
-			    obj = l2->data;
-			    bi2 = evas_object_data_get(obj, "e_gadcon_layout_data");
-			    if (!bi2) continue;
-			    if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h))
-			      {
-				 bi->y = bi2->y - bi->h;
-				 if (!bi2->can_move) bi->can_move = 0;
-				 if ((bi->y + bi->h) >= h) bi->y = h - bi->h;
-				 if (bi->y <= 0) bi->y = 0;
-				 overlap = 1;
-			      }
+			    int t;
+			    bi2 = evas_object_data_get(l->next->data, "e_gadcon_layout_data");
+
+			    t = bi->state_info.seq;
+			    bi->state_info.seq = bi2->state_info.seq;
+			    bi2->state_info.seq = t;
+			    bi->ask.pos = bi2->ask.pos;
+			    bi2->state_info.lock_flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+			    sd->items = evas_list_sort(sd->items, evas_list_count(sd->items),
+						       _e_gadcon_layout_smart_sort_by_seq_cb2);
+			    break;
 			 }
-		       for (l2 = l->prev; l2; l2 = l2->prev)
+		       else 
+			 bi->ask.pos = bi->ask.prev_pos;
+		    }
+	       }
+	     else if (bi->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC)
+	       {
+		  if (bi->state_info.resist <= E_LAYOUT_ITEM_RESIST_LEVEL)
+		    {
+		       bi->state_info.resist++;
+		       bi->ask.pos = bi->ask.prev_pos;
+		    }
+		  else
+		    {
+		       bi->state_info.resist = 0;
+		       if (l->prev)
 			 {
-			    E_Gadcon_Layout_Item *bi2;
-			    
-			    obj = l2->data;
-			    bi2 = evas_object_data_get(obj, "e_gadcon_layout_data");
-			    if (!bi2) continue;
-			    if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h))
-			      {
-				 bi->y = bi2->y + bi2->h;
-				 if (!bi2->can_move) bi->can_move = 0;
-				 if ((bi->y + bi->h) >= h) bi->y = h - bi->h;
-				 if (bi->y <= 0) bi->y = 0;
-				 overlap = 1;
-			      }
+			    int t;
+			    bi2 = evas_object_data_get(l->prev->data, "e_gadcon_layout_data");
+
+			    t = bi->state_info.seq;
+			    bi->state_info.seq = bi2->state_info.seq;
+			    bi2->state_info.seq = t;
+			    bi->ask.pos = bi2->ask.pos;
+			    bi2->state_info.lock_flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE;
+			    sd->items = evas_list_sort(sd->items, evas_list_count(sd->items),
+						       _e_gadcon_layout_smart_sort_by_seq_cb2);
+			    break;
 			 }
+		       else
+			 bi->ask.pos = bi->ask.prev_pos;
 		    }
+	       } 
+	     /*else if ((bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) || 
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) || 
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) || 
+		      (bi->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC)) 
+	       { 
+		  //deny sizing in shrinked mode for a while 
+		  bi->ask.size2 = bi->ask.prev_size; 
+	       }*/
+	  }
+
+	for (l = sd->items; l; l = l->next)
+	  {
+	     bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
+	     if (sd->horizontal)
+	       {
+		  bi->x = pos;
+		  bi->w = bi->ask.size2;
+		  pos = bi->x + bi->w;
+	       }
+	     else
+	       {
+		  bi->y = pos;
+		  bi->h = bi->ask.size2;
+		  pos = bi->y + bi->h;
 	       }
-	     count++;
-	     if (count > 200) break; // quick infinite loop fix
 	  }
+
+	goto __finish_reconfigure;
      }
-   
-   evas_list_free(list_s);
-   evas_list_free(list_m);
-   evas_list_free(list_e);
-   evas_list_free(list);
-   
+   /*****************************/
+
    for (l = sd->items; l; l = l->next)
      {
-	E_Gadcon_Layout_Item *bi;
-	Evas_Object *obj;
-	
-	obj = l->data;
-	bi = evas_object_data_get(obj, "e_gadcon_layout_data");
+	bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
 	if (!bi) continue;
 	if (sd->horizontal)
 	  {
+	     xx = bi->ask.pos + (bi->ask.size / 2);
+	     if (xx < (bi->ask.res / 3))
+	       {  /* hooked to start */
+		  bi->x = bi->ask.pos;
+		  bi->w = bi->ask.size2;
+		  bi->hookp = 0;
+	       }
+	     else if (xx > ((2 * bi->ask.res) / 3))
+	       {  /* hooked to end */
+		  bi->x = (bi->ask.pos - bi->ask.res) + w;
+		  bi->w = bi->ask.size2;
+		  bi->hookp = bi->ask.res;
+	       }
+	     else
+	       {
+		  if ((bi->ask.pos <= (bi->ask.res / 2)) &&
+		      ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2)))
+		    {	/* straddles middle */
+		       if (bi->ask.res > 2)
+			 bi->x = (w / 2) +
+			    (((bi->ask.pos + (bi->ask.size2 / 2) -
+			       (bi->ask.res / 2)) *
+			      (bi->ask.res / 2)) / 
+			     (bi->ask.res / 2)) - (bi->ask.size2 / 2); 
+		       else
+			 bi->x = w / 2;
+		       bi->w = bi->ask.size2;
+		    }
+		  else
+		    {  /* either side of middle */
+		       bi->x = (bi->ask.pos - (bi->ask.res / 2)) + (w / 2);
+		       bi->w = bi->ask.size2;
+		    }
+		  bi->hookp = bi->ask.res / 2;
+	       }
+	     if (bi->x < 0) bi->x = 0;
+	     else if ((bi->x + bi->w) > w) bi->x = w - bi->w;
+	  }
+	else
+	  {
+	     yy = bi->ask.pos + (bi->ask.size / 2);
+	     if (yy < (bi->ask.res / 3))
+	       {
+		  bi->y = bi->ask.pos;
+		  bi->h = bi->ask.size2;
+		  bi->hookp = 0;
+	       }
+	     else if (yy > ((2 * bi->ask.res) / 3))
+	       {
+		  bi->y = (bi->ask.pos - bi->ask.res) + h;
+		  bi->h = bi->ask.size2;
+		  bi->hookp = bi->ask.res;
+	       }
+	     else
+	       {
+		  if ((bi->ask.pos <= (bi->ask.res / 2)) &&
+		      ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2)))
+		    {
+		       if (bi->ask.res > 2)
+			 bi->y = (h / 2) +
+			    (((bi->ask.pos + (bi->ask.size2 / 2) -
+			      (bi->ask.res / 2)) *
+			     (bi->ask.res / 2)) /
+			    (bi->ask.res / 2)) - (bi->ask.size2 / 2);
+		       else
+			 bi->y = h / 2;
+		       bi->h = bi->ask.size2;
+		    }
+		  else
+		    {
+		       bi->y = (bi->ask.pos - (bi->ask.res / 2)) + (h / 2);
+		       bi->h = bi->ask.size2;
+		    }
+		  bi->hookp = bi->ask.res / 2;
+	       }
+	     if (bi->y < 0) bi->y = 0;
+	     else if ((bi->y + bi->h) > h) bi->y = h - bi->h;
+	  }
+
+	lc = E_NEW(E_Gadcon_Layout_Item_Container, 1);
+
+	lc->state_info.min_seq = lc->state_info.max_seq = bi->state_info.seq;
+	lc->sd = sd;
+	if (sd->horizontal)
+	  {
+	     lc->pos = bi->x;
+	     lc->size = bi->w;
+	  } 
+	else
+	  {
+	     lc->pos = bi->y;
+	     lc->size = bi->h;
+	  }
+	lc->prev_pos = bi->ask.prev_pos;
+	lc->prev_size = bi->ask.prev_size;
+
+	E_LAYOUT_ITEM_CONTAINER_STATE_SET(lc->state, bi->state_info.state);
+
+	if ((bi->state_info.lock_flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) &&
+	    (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE))
+	  lc->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED;
+
+	lc->items = evas_list_append(lc->items, bi);
+	list = evas_list_append(list, lc);
+     }
+
+   _e_gadcon_layout_smart_position_gadcons(sd, &list);
+   //cleanup of list
+   for (l = list; l; l = l->next)
+     {
+	lc = l->data; 
+	LC_FREE(lc);
+     }
+   list = evas_list_free(list);
+
+   __finish_reconfigure:
+   for (l = sd->items; l; l = l->next)
+     {
+	bi = evas_object_data_get(l->data, "e_gadcon_layout_data");
+	if (sd->horizontal)
+	  {
 	     bi->h = h;
 	     xx = x + bi->x;
 	     yy = y + ((h - bi->h) / 2);
@@ -2703,8 +4117,8 @@
 	     xx = x + ((w - bi->w) / 2);
 	     yy = y + bi->y;
 	  }
-	evas_object_move(obj, xx, yy);
-	evas_object_resize(obj, bi->w, bi->h);
+	evas_object_move(l->data, xx, yy);
+	evas_object_resize(l->data, bi->w, bi->h);
      }
    sd->doing_config = 0;
    if (sd->redo_config)
@@ -2712,7 +4126,7 @@
 	_e_gadcon_layout_smart_reconfigure(sd);
 	sd->redo_config = 0;
      }
-   if (sd->horizontal)
+   /*if (sd->horizontal)
      {
 	if ((sd->minw != min) || (sd->minh != mino))
 	  {
@@ -2738,7 +4152,7 @@
 	     sd->req = cur;
 	     evas_object_smart_callback_call(sd->obj, "size_request", NULL);
 	  }
-     }
+     }*/
 }
 
 static void
Index: src/bin/e_gadcon.h
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.h,v
retrieving revision 1.24
diff -u -r1.24 e_gadcon.h
--- src/bin/e_gadcon.h	9 Aug 2006 06:08:36 -0000	1.24
+++ src/bin/e_gadcon.h	21 Aug 2006 17:58:01 -0000
@@ -114,6 +114,10 @@
    void                  *data;
    struct {
       int                 pos, size, res;
+      struct {
+	 int seq; // the sequence number of gc in the gadcon
+	 int flags; // used by positioning algo
+      } state_info;
    } config;
    struct {
       Evas_Coord          w, h;
Index: src/bin/e_int_config_keybindings.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_keybindings.c,v
retrieving revision 1.35
diff -u -r1.35 e_int_config_keybindings.c
--- src/bin/e_int_config_keybindings.c	14 Aug 2006 15:22:45 -0000	1.35
+++ src/bin/e_int_config_keybindings.c	21 Aug 2006 17:58:01 -0000
@@ -1,17 +1,14 @@
 #include "e.h"
 
-#define ACTION_LIST_ICON_W  24
-#define ACTION_LIST_ICON_H  24
+#define E_KEYBINDING_DLG_ACTION_LIST_ICON_SIZE 24
+#define E_KEYBINDING_DLG_BINDING_LIST_ICON_SIZE 16
 
-#define BINDING_LIST_ICON_W 16
-#define BINDING_LIST_ICON_H 16
+#define E_KEYBINDING_DLG_TEXT_CHOOSE_KEY _("Choose a Key")
+#define E_KEYBINDING_DLG_TEXT_ACTION _("Action")
+#define E_KEYBINDING_DLG_TEXT_NONE _("<None>")
 
-#define BTN_ASSIGN_KEYBINDING_TEXT _("Choose a Key")
-
-#define TEXT_ACTION _("Action")
-#define TEXT_NONE_ACTION_KEY _("<None>")
-#define TEXT_PRESS_KEY_SEQUENCE _("Please press key sequence,<br>" \
-				  "or <hilight>Escape</hilight> to abort")
+#define E_KEYBINDING_DLG_TEXT_PRESS_KEY_SEQUENCE _("Please press key sequence,<br>" \
+						   "or <hilight>Escape</hilight> to abort")
 
 #define ILIST_ICON_WITH_KEYBIND	    "enlightenment/keys"
 #define ILIST_ICON_WITHOUT_KEYBIND  ""
@@ -21,72 +18,71 @@
 
 #define E_BINDING_CONTEXT_NUMBER  10
 
-static void	    *_create_data(E_Config_Dialog *cfd);
-static void	    _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
-static int	    _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
-static Evas_Object  *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
-					   E_Config_Dialog_Data *cfdata);
-
+static void *_create_data(E_Config_Dialog *cfd);
+static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
+static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
+static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
 
 /*******************************************************************************************/
-static void	    _e_keybinding_action_ilist_cb_change(void *data, Evas_Object *obj);
-static void	    _e_keybinding_binding_ilist_cb_change(void *data, Evas_Object *obj);
-static void	    _e_keybinding_default_keybinding_settings(E_Config_Dialog_Data *cfdata);
-
-static void	    _e_keybinding_keybind_cb_del_keybinding(void *data, void *data2);
-//static void	    _e_keybinding_keybind_delete_keybinding(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_action_ilist_cb_change(void *data, Evas_Object *obj);
+static void _e_keybinding_binding_ilist_cb_change(void *data, Evas_Object *obj);
+static void _e_keybinding_default_keybinding_settings(E_Config_Dialog_Data *cfdata);
 
-static void	    _e_keybinding_keybind_cb_add_keybinding(void *data, void *data2);
+static void _e_keybinding_keybind_cb_del_keybinding(void *data, void *data2);
+static void _e_keybinding_keybind_cb_add_keybinding(void *data, void *data2);
 
-static void	    _e_keybinding_keybind_cb_new_shortcut(void *data, void *data2);
+static void _e_keybinding_keybind_cb_new_shortcut(void *data, void *data2);
 
-static void	    _e_keybinding_update_binding_list(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_update_binding_list(E_Config_Dialog_Data *cfdata);
 
-static void	    _e_keybinding_update_keybinding_button(E_Config_Dialog_Data *cfdata);
-static void	    _e_keybinding_update_add_delete_buttons(E_Config_Dialog_Data *cfdata);
-static void	    _e_keybinding_update_context_radios(E_Config_Dialog_Data *cfdata);
-static void	    _e_keybinding_update_action_param_entries(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_update_keybinding_button(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_update_add_delete_buttons(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_update_context_radios(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_update_action_param_entries(E_Config_Dialog_Data *cfdata);
 
-static void	    _e_keybinding_update_binding_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata);
-static void	    _e_keybinding_update_action_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_update_binding_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata);
+static void _e_keybinding_update_action_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata);
 
-static char	    *_e_keybinding_get_keybinding_text(E_Config_Binding_Key *bk);
+static char *_e_keybinding_get_keybinding_text(E_Config_Binding_Key *bk);
 
-static int	    _e_keybinding_cb_shortcut_key_down(void *data, int type, void *event);
-static int	    _e_keybinding_cb_mouse_handler_dumb(void *data, int type, void *event);
+static int _e_keybinding_cb_shortcut_key_down(void *data, int type, void *event);
+static int _e_keybinding_cb_mouse_handler_dumb(void *data, int type, void *event);
 
-static int	    _e_keybinding_keybind_cb_auto_apply(E_Config_Dialog_Data *cfdata);
+static int _e_keybinding_keybind_cb_auto_apply(E_Config_Dialog_Data *cfdata);
 
 
 static void _fill_data(E_Config_Dialog_Data *cfdata);
-static int  _action_group_list_sort_cb(void *e1, void *e2);
-static int  _action_group_actions_list_sort_cb(void *e1, void *e2);
+static int _action_group_list_sort_cb(void *e1, void *e2);
+static int _action_group_actions_list_sort_cb(void *e1, void *e2);
 /*******************************************************************************************/
 
-typedef struct _action2
-{
-   const char  *action_name;
-   const char  *action_cmd;
-   const char  *action_params;
+typedef struct _E_Keybinding_Action E_Keybinding_Action;
+typedef struct _E_Keybinding_Action_Group E_Keybinding_Action_Group;
+
+struct _E_Keybinding_Action
+{ 
+   const char *action_name;
+   const char *action_cmd;
+   const char *action_params;
    int	def_action;
    int	restrictions;
-   Evas_List   *key_bindings;
-} ACTION2;
+   Evas_List *key_bindings;
+};
 
-typedef struct _action_group
+struct _E_Keybinding_Action_Group
 {
-   const char  *action_group;
-   Evas_List   *actions; // Here ACTION2 structure is used.
-} ACTION_GROUP;
+   const char *action_group;
+   Evas_List *actions;
+};
 
 struct _E_Config_Dialog_Data
 {
   E_Config_Dialog *cfd;
 
-  ACTION2      *current_act;
-  int	       current_act_selector;
+  E_Keybinding_Action *current_act;
+  int current_act_selector;
 
-  Evas	*evas;
+  Evas *evas;
 
   int binding_context;
   char *key_action;
@@ -109,45 +105,39 @@
     } gui;
 
   struct {
-    Ecore_X_Window  keybind_win;
-    Evas_List	    *handlers;
-    E_Dialog	    *dia;
+    Ecore_X_Window keybind_win;
+    Evas_List *handlers;
+    E_Dialog *dia;
   }locals;
 
   int changed;
 };
 
 /*******************************************************************************/
-
-
 Evas_List   *action_group_list=NULL;
 
-int e_int_config_keybindings_register_action_predef_name(const char *action_group,
-							 const char *action_name,
-							 const char *action_cmd,
-							 const char *action_params,
-							 E_Keybindings_Restrict restrictions,
-							 int flag)
-{
-   ACTION_GROUP	  *actg = NULL;
-   ACTION2	  *act = NULL;
-   Evas_List	  *ll;
+int 
+e_int_config_keybindings_register_action_predef_name(const char *action_group, const char *action_name, const char *action_cmd, const char *action_params, E_Keybindings_Restrict restrictions, int flag)
+{
+   E_Keybinding_Action_Group *actg = NULL;
+   E_Keybinding_Action *act = NULL;
+   Evas_List *l;
 
-   if (!action_group || !action_name)
+   if ((!action_group) || (!action_name))
      return 0;
 
-   for (ll = action_group_list; ll; ll = ll->next)
+   for (l = action_group_list; l; l = l->next)
      {
-	actg = ll->data;
+	actg = l->data;
 
 	if (!strcmp(actg->action_group, action_group))
 	  break;
 	actg = NULL;
      }
 
-   if (actg == NULL)
-     {
-	actg = E_NEW(ACTION_GROUP, 1);
+   if (!actg)
+     { 
+	actg = E_NEW(E_Keybinding_Action_Group, 1);
 	if (!actg)
 	  return 0;
 
@@ -160,43 +150,34 @@
 					   _action_group_list_sort_cb);
      }
 
-   for (ll = actg->actions; ll; ll = ll->next)
+   for (l = actg->actions; l; l = l->next)
      {
-	act = ll->data;
-	if (!strcmp(act->action_name, action_name))
-	  break;
+	act = l->data;
+	if (!strcmp(act->action_name, action_name)) break;
 	act = NULL;
      }
 
-   if (act)
-     return 1;
+   if (act) return 1;
 
-
-   act = E_NEW(ACTION2, 1);
-   if (!act)
-     return 0;
+   act = E_NEW(E_Keybinding_Action, 1);
+   if (!act) return 0;
    
-   act->action_name    = evas_stringshare_add(action_name);
-   act->action_cmd     = action_cmd == NULL ? NULL : evas_stringshare_add(action_cmd);
-   act->action_params  = action_params == NULL ? NULL : evas_stringshare_add(action_params);
-   act->restrictions   = restrictions;
-   act->def_action     = flag;
-   act->key_bindings   = NULL;
+   act->action_name = evas_stringshare_add(action_name);
+   act->action_cmd = action_cmd == NULL ? NULL : evas_stringshare_add(action_cmd);
+   act->action_params = action_params == NULL ? NULL : evas_stringshare_add(action_params);
+   act->restrictions = restrictions;
+   act->def_action = flag;
+   act->key_bindings = NULL;
 
    actg->actions = evas_list_append(actg->actions, act);
-#if 0
-   actg->actions = evas_list_sort(actg->actions, evas_list_count(actg->actions),
-				  _action_group_actions_list_sort_cb);
-#endif
-
    return 1;
 }
 
-int e_int_config_keybindings_unregister_action_predef_name(const char *action_group,
-							   const char *action_name)
+int 
+e_int_config_keybindings_unregister_action_predef_name(const char *action_group, const char *action_name)
 {
-   ACTION_GROUP	  *actg;
-   ACTION2	  *act;
+   E_Keybinding_Action_Group *actg;
+   E_Keybinding_Action *act;
    Evas_List *l, *l2;
 
    for (l = action_group_list; l; l = l->next)
@@ -225,15 +206,14 @@
 
 			    act->key_bindings = evas_list_remove_list(act->key_bindings,
 								      act->key_bindings);
-
 			 }
 		       E_FREE(act);
 		       break;
 		    }
 	       }
 
-	     if (evas_list_count(actg->actions) == 0)
-	       {
+	     if (!evas_list_count(actg->actions))
+	       { 
 		  action_group_list = evas_list_remove_list(action_group_list, l);
 		  if (actg->action_group) evas_stringshare_del(actg->action_group);
 		  E_FREE(actg);
@@ -241,14 +221,14 @@
 	     break;
 	  }
      }
-
    return 1;
 }
 
-void e_int_config_keybindings_unregister_all_action_predef_names()
+void 
+e_int_config_keybindings_unregister_all_action_predef_names()
 {
-   ACTION_GROUP	  *actg;
-   ACTION2	  *act;
+   E_Keybinding_Action_Group *actg;
+   E_Keybinding_Action *act;
 
    while (action_group_list)
      {
@@ -273,15 +253,6 @@
 		  act->key_bindings = evas_list_remove_list(act->key_bindings,
 							    act->key_bindings);
 	       }
-	     /*for (l3 = act->key_bindings; l3; l3 = l3->next) 
-	       { 
-		  E_Config_Binding_Key   *eb = l3->data;
-		  if (eb->key) evas_stringshare_del(eb->key);
-		  if (eb->action) evas_stringshare_del(eb->action);
-		  if (eb->params) evas_stringshare_del(eb->params);
-		  E_FREE(eb); 
-	       }*/
-
 	     E_FREE(act);
 
 	     actg->actions = evas_list_remove_list(actg->actions, actg->actions);
@@ -292,11 +263,10 @@
 
 	action_group_list = evas_list_remove_list(action_group_list, action_group_list);
      }
-
    action_group_list = NULL;
 }
-/*******************************************************************************/
 
+/*******************************************************************************/
 
 EAPI E_Config_Dialog *
 e_int_config_keybindings(E_Container *con)
@@ -323,9 +293,9 @@
 _fill_data(E_Config_Dialog_Data *cfdata)
 {
    E_Config_Binding_Key	*eb, *t;
-   Evas_List   *l, *l2, *l3;
-   ACTION_GROUP	  *actg;
-   ACTION2	  *act;
+   Evas_List *l, *l2, *l3;
+   E_Keybinding_Action_Group *actg;
+   E_Keybinding_Action *act;
 
    e_int_config_keybindings_register_action_predef_name(AG_UNSORTED, AG_AN_UNKNOWN,
 						        NULL, NULL, 
@@ -346,18 +316,18 @@
 	       {
 		  act = l3->data;
 
-		  if (((!act->action_cmd || !act->action_cmd[0]) && (t->action && t->action[0])) ||
-		      ((!t->action || !t->action[0]) && (act->action_cmd && act->action_cmd[0])))
-			continue;
+		  if ((((!act->action_cmd) || (!act->action_cmd[0])) && 
+		       ((t->action) && (t->action[0]))) ||
+		      (((!t->action) || (!t->action[0])) &&
+		       ((act->action_cmd) && (act->action_cmd[0])))) continue;
 
-		  if (t->params && t->params[0]) // here we have that action has params
+		  if ((t->params) && (t->params[0])) // here we have that action has params
 		    {
-		       if (!act->action_params || !act->action_params[0])
-			 continue;
+		       if ((!act->action_params) || (!act->action_params[0])) continue;
 
-		       if (strcmp(!act->action_cmd ? "" : act->action_cmd,
-				  !t->action ? "" : t->action) == 0 &&
-			   strcmp(act->action_params, t->params) == 0)
+		       if ((!strcmp((!act->action_cmd) ? "" : act->action_cmd,
+				    (!t->action) ? "" : t->action)) &&
+			   (!strcmp(act->action_params, t->params)))
 			 {
 			    eb = E_NEW(E_Config_Binding_Key, 1);
 			    if (!eb) continue;
@@ -371,7 +341,6 @@
 			    eb->any_mod = t->any_mod;
 
 			    act->key_bindings = evas_list_append(act->key_bindings, eb);
-
 			    found = 1;
 			 }
 		    }
@@ -382,21 +351,19 @@
 	       {
 		  act = l3->data;
 
-		  if (act->action_params && act->action_params[0])
-		    continue;
+		  if ((act->action_params) && (act->action_params[0])) continue;
 
-		  if (!strcmp(actg->action_group, AG_UNSORTED) &&
-		      !strcmp(act->action_name, AG_AN_UNKNOWN))
+		  if ((!strcmp(actg->action_group, AG_UNSORTED)) &&
+		      (!strcmp(act->action_name, AG_AN_UNKNOWN)))
 		    {
 		       eb = E_NEW(E_Config_Binding_Key, 1);
 		       if (!eb) continue;
 
 		       eb->context = t->context;
 		       eb->modifiers = t->modifiers;
-		       eb->key = t->key == NULL ? evas_stringshare_add("") :
-						  evas_stringshare_add(t->key);
-		       eb->action = t->action == NULL ? NULL : evas_stringshare_add(t->action);
-		       eb->params = t->params == NULL ? NULL : evas_stringshare_add(t->params);
+		       eb->key = (!t->key) ? evas_stringshare_add("") : evas_stringshare_add(t->key);
+		       eb->action = (!t->action) ? NULL : evas_stringshare_add(t->action);
+		       eb->params = (t->params) ? NULL : evas_stringshare_add(t->params);
 		       eb->any_mod = t->any_mod;
 
 		       act->key_bindings = evas_list_append(act->key_bindings, eb);
@@ -404,12 +371,13 @@
 		       break;
 		    }
 
-		  if (((!act->action_cmd || !act->action_cmd[0]) && (t->action && t->action[0])) ||
-		      ((!t->action || !t->action[0]) && (act->action_cmd && act->action_cmd[0])))
-			continue;
+		  if ((((!act->action_cmd) || (!act->action_cmd[0])) &&
+		       ((t->action) && (t->action[0]))) ||
+		      (((!t->action) || (!t->action[0])) &&
+		       ((act->action_cmd) && (act->action_cmd[0])))) continue;
 
-		  if (strcmp(!act->action_cmd ? "" : act->action_cmd,
-			    !t->action ? "" : t->action) == 0)
+		  if (!strcmp(!act->action_cmd ? "" : act->action_cmd,
+			       !t->action ? "" : t->action))
 		    {
 		       eb = E_NEW(E_Config_Binding_Key, 1);
 		       if (!eb) continue;
@@ -423,7 +391,6 @@
 		       eb->any_mod = t->any_mod;
 
 		       act->key_bindings = evas_list_append(act->key_bindings, eb);
-
 		       found = 1;
 		    }
 	       }
@@ -434,6 +401,7 @@
    cfdata->locals.dia = NULL;
    cfdata->changed = 0;
 }
+
 static void *
 _create_data(E_Config_Dialog *cfd)
 {
@@ -447,23 +415,23 @@
    
    _fill_data(cfdata);
    cfdata->cfd = cfd;
-   
    return cfdata;
 }
 
 static void
 _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
-   Evas_List   *l, *l2;
+   Evas_List *l, *l2;
+
    E_FREE(cfdata->key_action);
    E_FREE(cfdata->key_params);
 
    for (l = action_group_list; l; l = l->next)
      {
-	ACTION_GROUP *actg = l->data;
+	E_Keybinding_Action_Group *actg = l->data;
 	for (l2 = actg->actions; l2; l2 = l2->next)
 	  {
-	     ACTION2 *act = l2->data;
+	     E_Keybinding_Action *act = l2->data;
 	     while (act->key_bindings)
 	       {
 		  E_Config_Binding_Key *eb = act->key_bindings->data;
@@ -486,6 +454,7 @@
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
    Evas_List *l, *l2, *l3;
+
    if (!cfdata) return 0;
 
    if (cfdata->current_act)
@@ -497,7 +466,7 @@
        }
 
    e_managers_keys_ungrab();
-   while(e_config->key_bindings)
+   while (e_config->key_bindings)
      {
 	E_Config_Binding_Key  *eb;
 
@@ -514,15 +483,15 @@
 
    for (l = action_group_list; l; l = l->next)
      {
-	ACTION_GROUP *actg = l->data;
+	E_Keybinding_Action_Group *actg = l->data;
 	for (l2 = actg->actions; l2; l2 = l2->next)
 	  {
-	     ACTION2 *act = l2->data;
+	     E_Keybinding_Action *act = l2->data;
 	     for (l3 = act->key_bindings; l3; l3 = l3->next)
 	       {
 		  E_Config_Binding_Key *eb, *eb2;
 		  eb = l3->data;
-		  if (!eb || !eb->key || !eb->key[0]) continue;
+		  if ((!eb) || (!eb->key) || (!eb->key[0])) continue;
 
 		  eb2 = E_NEW(E_Config_Binding_Key, 1);
 		  if (!eb2) continue;
@@ -531,9 +500,9 @@
 		  eb2->key = evas_stringshare_add(eb->key);
 		  eb2->modifiers = eb->modifiers;
 		  eb2->any_mod = eb->any_mod;
-		  eb2->action = !eb->action || !eb->action[0] ? NULL :
+		  eb2->action = ((!eb->action) || (!eb->action[0])) ? NULL :
 							        evas_stringshare_add(eb->action);
-		  eb2->params = !eb->params || !eb->params[0] ? NULL :
+		  eb2->params = ((!eb->params) || (!eb->params[0])) ? NULL :
 							        evas_stringshare_add(eb->params);
 		  e_config->key_bindings = evas_list_append(e_config->key_bindings, eb2);
 		  e_bindings_key_add(eb->context, eb->key, eb->modifiers, eb->any_mod,
@@ -546,6 +515,7 @@
    cfdata->changed = 0;
    return 1;
 }
+
 static Evas_Object *
 _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
 {
@@ -558,12 +528,12 @@
   {
     of = e_widget_framelist_add(evas, _("Action"), 0);
     {
-      cfdata->gui.action_ilist = e_widget_ilist_add(evas, ACTION_LIST_ICON_W,
-						    ACTION_LIST_ICON_H, NULL); 
+      cfdata->gui.action_ilist = e_widget_ilist_add(evas, E_KEYBINDING_DLG_ACTION_LIST_ICON_SIZE,
+						    E_KEYBINDING_DLG_ACTION_LIST_ICON_SIZE, NULL); 
       {
 	Evas_List *l, *l2;
-	ACTION_GROUP *actg = NULL;
-	ACTION2	     *act = NULL;
+	E_Keybinding_Action_Group *actg = NULL;
+	E_Keybinding_Action *act = NULL;
 
 	e_widget_on_change_hook_set(cfdata->gui.action_ilist, _e_keybinding_action_ilist_cb_change,
 				    cfdata);
@@ -600,8 +570,8 @@
     {
       Evas_Object *ot1;
       /* bindings list */
-      cfdata->gui.binding_ilist = e_widget_ilist_add(evas, BINDING_LIST_ICON_W,
-						     BINDING_LIST_ICON_H, NULL);
+      cfdata->gui.binding_ilist = e_widget_ilist_add(evas, E_KEYBINDING_DLG_BINDING_LIST_ICON_SIZE,
+						     E_KEYBINDING_DLG_BINDING_LIST_ICON_SIZE, NULL);
       e_widget_on_change_hook_set(cfdata->gui.binding_ilist, _e_keybinding_binding_ilist_cb_change,
 				  cfdata);
       e_widget_min_size_set(cfdata->gui.binding_ilist, 250, 200);
@@ -704,7 +674,7 @@
 	e_widget_frametable_object_append(ot1, ob, 1, 0, 1, 1, 1, 1, 1, 1);
 
 	/* assign keybinding button */
-	cfdata->gui.btn_keybind = e_widget_button_add(evas, BTN_ASSIGN_KEYBINDING_TEXT, NULL,
+	cfdata->gui.btn_keybind = e_widget_button_add(evas, E_KEYBINDING_DLG_TEXT_CHOOSE_KEY, NULL,
 						      _e_keybinding_keybind_cb_new_shortcut,
 						      cfdata, NULL);
 	e_widget_disabled_set(cfdata->gui.btn_keybind, 1);
@@ -783,9 +753,9 @@
 _e_keybinding_action_ilist_cb_change(void *data, Evas_Object *obj)
 {
    E_Config_Dialog_Data *cfdata;
-   Evas_List   *l, *l2;
-   ACTION_GROUP	  *actg = NULL;
-   ACTION2	  *act = NULL;
+   Evas_List *l, *l2;
+   E_Keybinding_Action_Group *actg = NULL;
+   E_Keybinding_Action *act = NULL;
    char *label;
    int done;
 
@@ -879,7 +849,7 @@
    if (!cfdata->current_act || cfdata->current_act_selector < 0)
      {
 	e_widget_disabled_set(cfdata->gui.btn_keybind, 1);
-	e_widget_button_label_set(cfdata->gui.btn_keybind, BTN_ASSIGN_KEYBINDING_TEXT);
+	e_widget_button_label_set(cfdata->gui.btn_keybind, E_KEYBINDING_DLG_TEXT_CHOOSE_KEY);
      }
    else
      {
@@ -893,7 +863,7 @@
 	     free(b);
 	  }
 	else
-	  e_widget_button_label_set(cfdata->gui.btn_keybind, BTN_ASSIGN_KEYBINDING_TEXT);
+	  e_widget_button_label_set(cfdata->gui.btn_keybind, E_KEYBINDING_DLG_TEXT_CHOOSE_KEY);
      }
 }
 static void
@@ -1173,7 +1143,7 @@
     }
 
   if (!b[0])
-    strcpy(b, TEXT_NONE_ACTION_KEY);
+    strcpy(b, E_KEYBINDING_DLG_TEXT_NONE);
   return strdup(b);
 }
 
@@ -1196,7 +1166,7 @@
 	if (!eb) continue;
 
 	b = _e_keybinding_get_keybinding_text(eb);
-	snprintf(buf, sizeof(buf), "%s %d : %s", TEXT_ACTION, i, b);
+	snprintf(buf, sizeof(buf), "%s %d : %s", E_KEYBINDING_DLG_TEXT_ACTION, i, b);
 	free(b);
 	e_widget_ilist_append(cfdata->gui.binding_ilist, NULL, buf, NULL, NULL, NULL);
      }
@@ -1290,7 +1260,7 @@
   if (!cfdata->locals.dia) return;
   e_dialog_title_set(cfdata->locals.dia, _("Binding Key Sequence"));
   e_dialog_icon_set(cfdata->locals.dia, "enlightenment/e", 64);
-  e_dialog_text_set(cfdata->locals.dia, TEXT_PRESS_KEY_SEQUENCE);
+  e_dialog_text_set(cfdata->locals.dia, E_KEYBINDING_DLG_TEXT_PRESS_KEY_SEQUENCE);
   e_win_centered_set(cfdata->locals.dia->win, 1);
 
   cfdata->locals.keybind_win = ecore_x_window_input_new(e_manager_current_get()->root,
@@ -1364,9 +1334,9 @@
 	  {
 	     if (cfdata && cfdata->current_act && cfdata->current_act_selector >= 0)
 	       {
-                  ACTION_GROUP *actg;
-                  ACTION2 *act;
-		  Evas_List   *l, *l2, *l3;
+                  E_Keybinding_Action_Group *actg;
+                  E_Keybinding_Action *act;
+		  Evas_List *l, *l2, *l3;
 		  int found;
 		  int mod = E_BINDING_MODIFIER_NONE;
 
@@ -1432,10 +1402,11 @@
 }
 
 /*******************/
-static int  _action_group_list_sort_cb(void *e1, void *e2)
+static int
+_action_group_list_sort_cb(void *e1, void *e2)
 {
-   ACTION_GROUP	  *actg1 = e1;
-   ACTION_GROUP	  *actg2 = e2;
+   E_Keybinding_Action_Group *actg1 = e1;
+   E_Keybinding_Action_Group *actg2 = e2;
 
    if (!e1) return 1;
    if (!e2) return -1;
@@ -1445,10 +1416,12 @@
 
    return strcmp(actg1->action_group, actg2->action_group);
 }
-static int  _action_group_actions_list_sort_cb(void *e1, void *e2)
+
+static int 
+_action_group_actions_list_sort_cb(void *e1, void *e2)
 {
-   ACTION2  *act1 = e1;
-   ACTION2  *act2 = e2;
+   E_Keybinding_Action *act1 = e1;
+   E_Keybinding_Action *act2 = e2;
 
    if (!e1) return 1;
    if (!e2) return -1;