work on fixing up the desktop code...... :)
authorCarsten Haitzler <raster@rasterman.com>
Thu, 12 Jul 2001 16:40:13 +0000 (16:40 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 12 Jul 2001 16:40:13 +0000 (16:40 +0000)
SVN revision: 4939

data/config/appearance/default/selections/file.bits.db
data/icons/archive/default.db [new file with mode: 0644]
data/icons/archive/gnu-zip-unix.db [moved from data/icons/application/gnu-zip-unix.db with 100% similarity]
data/icons/document/pdf.db [new file with mode: 0644]
src/config.c
src/e.h
src/fs.c
src/icons.c
src/shelf.c
src/util.c
src/view.c

index 0b065b0..18f5aee 100644 (file)
Binary files a/data/config/appearance/default/selections/file.bits.db and b/data/config/appearance/default/selections/file.bits.db differ
diff --git a/data/icons/archive/default.db b/data/icons/archive/default.db
new file mode 100644 (file)
index 0000000..255fc4d
Binary files /dev/null and b/data/icons/archive/default.db differ
diff --git a/data/icons/document/pdf.db b/data/icons/document/pdf.db
new file mode 100644 (file)
index 0000000..1335960
Binary files /dev/null and b/data/icons/document/pdf.db differ
index 04f81b6..814c4c8 100644 (file)
@@ -19,6 +19,7 @@ static char cfg_borders_db[4096] = "";
 static char cfg_apps_menu_db[4096] = "";
 static char cfg_menus_dir[4096] = "";
 static char cfg_entries_dir[4096] = "";
+static char cfg_selections_dir[4096] = "";
 static char cfg_user_dir[4096] = "";
 static char cfg_images_dir[4096] = "";
 static char cfg_fonts_dir[4096] = "";
@@ -55,6 +56,8 @@ e_config_get(char *type)
          PACKAGE_DATA_DIR"/data/config/appearance/default/menus/");
    E_CONF("entries", cfg_entries_dir,
          PACKAGE_DATA_DIR"/data/config/appearance/default/entries/");
+   E_CONF("selections", cfg_selections_dir,
+         PACKAGE_DATA_DIR"/data/config/appearance/default/selections/");
    E_CONF("images", cfg_images_dir,
          PACKAGE_DATA_DIR"/data/images/");
    E_CONF("fonts", cfg_fonts_dir,
diff --git a/src/e.h b/src/e.h
index 92fa2a7..cce9f2b 100644 (file)
--- a/src/e.h
+++ b/src/e.h
@@ -104,9 +104,8 @@ _e_obj->e_obj_free = (void *) _e_obj_free_func; \
 (y < (yy + hh)) && \
 ((x + w) > xx) && \
 ((y + h) > yy))
-
 #define SPANS_COMMON(x1, w1, x2, w2) \
-  (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
+(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
 #define UN(_blah) _blah = 0
 
 #define ACT_MOUSE_IN      0
@@ -328,22 +327,8 @@ struct _E_View
    struct {
       Evas_Render_Method  render_method;
       int                 back_pixmap;
-      struct {
-        int method;
-        struct {
-           int dir;
-           int w, h;
-           int next_pos;
-        } grid;
-      } arrange;
    } options;
    
-   struct {
-      struct {
-        int left, right, top, bottom;
-      } inset, icon, spacing;
-   } spacing;
-   
    Evas                   evas;
    struct {
       Window              base;
@@ -355,20 +340,66 @@ struct _E_View
    } size;
    struct {
       int                 x, y;
-   } viewport;
-   struct {
-      int                 x, y;
    } location;
    struct {
-      Evas_Object         obj_rect;
-      Evas_Object         obj_l1;
-      Evas_Object         obj_l2;
-      Evas_Object         obj_l3;
-      Evas_Object         obj_l4;
-      int                 on;
-      int                 start_x, start_y;
-      int                 x, y, w, h;
-   } selection;
+      /* +-----------------+
+       * |        Wt       |
+       * |  +-----------+  |
+       * |Wl|           |Wr|
+       * |  |    [I] Is |  |
+       * |  |    Ig     |  |
+       * |  |   [txt]   |  |
+       * |  |     Ib    |  |
+       * |  +-----------+  |
+       * |       Wb        |
+       * +-----------------+
+       */
+      struct {
+        int l, r, t, b;
+      } window;
+      struct {
+        int s, g, b;
+      } icon;
+   } spacing;
+   struct {
+      int on;
+      int x, y, w, h;
+      struct {
+        int x, y;
+      } down;
+      struct {
+        struct {
+           int r, g, b, a;
+        } 
+        edge_l, edge_r, edge_t, edge_b, 
+        middle, 
+        grad_l, grad_r, grad_t, grad_b;
+        struct {
+           int l, r, t, b;
+        } grad_size;
+      } config;
+      struct {
+        Evas_Object clip;
+        Evas_Object edge_l;
+        Evas_Object edge_r;
+        Evas_Object edge_t;
+        Evas_Object edge_b;
+        Evas_Object middle;
+        Evas_Object grad_l;
+        Evas_Object grad_r;
+        Evas_Object grad_t;
+        Evas_Object grad_b;
+      } obj;
+   } select;
+   struct {
+      int started;
+      Window win;
+      int x, y;
+      struct {
+        int x, y;
+      } offset;
+      int update;
+   } drag;
    
    Evas_Object            obj_bg;
    
@@ -380,7 +411,9 @@ struct _E_View
    E_FS_Restarter        *restarter;
    
    Evas_List              icons;
-   Evas_List              shelves;
+   
+   int                    have_resort_queued;
+   int                    sel_count;
    
    int                    changed;
 };
@@ -393,56 +426,49 @@ struct _E_Icon
    
    E_View *view;
    
-   char    *shelf_name;
-   E_Shelf *shelf;
-   
    struct {
-      struct {
-        char *base, *type;
-      } mime;
-      EfsdCmdId   link_get_id;
+      char *icon;
+      char *custom_icon;
       char *link;
-      int   is_exe;
-      int   is_dir;
-      struct {
-        char *normal;
-        char *selected;
-        char *clicked;
-      } icon;
       struct {
-        int have;
-        int x, y;
-      } coord;
-      int ready;
+        char *base;
+        char *type;
+      } mime;
    } info;
    
    struct {
-      int     x, y;
-      int     ix, iy, tx, ty, iw, ih, tw, th, w, h;
-      struct {
-        int text_location;
-        int show_text;
-        int show_icon;
-      } options;
+      Evas_Object icon;
+      Evas_Object text;
+      Evas_Object event1;
+      Evas_Object event2;
       struct {
-        int  clicked;
-        int  selected;
-        int  hilited;
-      } state;
-      char   *icon;
-      int     visible;
-      int     viewable;
-   } current, previous;
+        struct {
+           Ebits_Object icon;
+           Ebits_Object text;
+        } over, under;
+      } sel;
+   } obj;
    
    struct {
-      Evas_Object   icon;
-      Evas_Object   filename;
-      Evas_Object   sel1, sel2;
-      Ebits_Object  sel_icon;
-      Ebits_Object  sel_text;
-      Ebits_Object  base_icon;
-      Ebits_Object  base_text;
-   } obj;
+      int hilited;
+      int clicked;
+      int selected;
+      int running;
+      int disabled;
+      int visible;
+      int just_selected;
+   } state;
+   
+   struct {
+      int x, y, w, h;
+      struct {
+        int w, h;
+      } icon;
+      struct {
+        int w, h;
+      } text;
+   } geom;
+   
    int     changed;   
 };
 
index 1bf4b1a..7ce227a 100644 (file)
--- a/src/fs.c
+++ b/src/fs.c
@@ -79,7 +79,7 @@ static void
 _e_fs_restarter(int val, void *data)
 {
    if (ec) return;
-   printf("%i\n", efsd_pid);
+   printf("_e_fs_restarter %i\n", efsd_pid);
    if (val > 0)    
      {
        if (efsd_pid <= 0)
@@ -92,6 +92,7 @@ _e_fs_restarter(int val, void *data)
        Evas_List l;
        
        printf("connect!\n");
+       e_add_event_fd(efsd_get_connection_fd(ec), _e_fs_fd_handle);
        for (l = fs_restart_handlers; l; l = l->next)
          {
             E_FS_Restarter *rs;
@@ -146,18 +147,23 @@ e_fs_init(void)
 
    e_event_filter_handler_add(EV_CHILD, e_fs_child_handle);   
    /* already have an efsd around? */
+   printf("try efsd initial open...\n");
    ec = efsd_open();
    /* no - efsd around */
    if (!ec)
      {
        /* start efsd */
+       printf("start efsd...\n");
        efsd_pid = e_exec_run("efsd -f");
        if (efsd_pid > 0)
          {
-            for (i = 0; (!ec) && (i < 4); i++)
+            ec = efsd_open();
+            for (i = 0; (!ec) && (i < 15); i++)
               {
                  sleep(1);
+                 printf("try efsd open %i...\n", i, ec);
                  ec = efsd_open();
+                 printf("(connection ptr: %p)\n", ec);
               }
          }
      }
index e747079..1c816a6 100644 (file)
@@ -1,557 +1 @@
 #include "e.h"
-
-static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
-static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
-static void e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
-static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
-
-static void
-e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
-{
-   E_Icon *icon;
-   
-   icon = _data;
-   icon->current.state.hilited = 1;
-   icon->changed = 1;
-   icon->view->changed = 1;
-}
-
-static void
-e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
-{
-   E_Icon *icon;
-   
-   icon = _data;
-   icon->current.state.hilited = 0;
-   icon->changed = 1;
-   icon->view->changed = 1;
-}
-
-static void
-e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
-{
-   E_Icon *icon;
-   Ev_Mouse_Down          *ev;
-   Eevent                 *event;
-   
-   event = e_view_get_current_event();
-   ev = event->event;
-   icon = _data;
-   if (ev->triple_click)
-     {
-       printf("triple\n");
-     }
-   else if (ev->double_click)
-     {
-       printf("double\n");
-     }
-   else
-     {
-       printf("up\n");
-     }
-   if (icon->current.state.selected)
-     icon->current.state.selected = 0;
-   else
-     icon->current.state.selected = 1;
-   icon->current.state.clicked = 1;
-   icon->changed = 1;
-   icon->view->changed = 1;
-}
-
-static void
-e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
-{
-   E_Icon *icon;
-   Ev_Mouse_Up            *ev;
-   Eevent                 *event;
-   
-   event = e_view_get_current_event();
-   ev = event->event;   
-   icon = _data;
-   icon->current.state.clicked = 0;
-   icon->changed = 1;
-   icon->view->changed = 1;
-}
-
-void
-e_icon_free(E_Icon *icon)
-{
-   IF_FREE(icon->file);
-   IF_FREE(icon->info.icon.normal);
-   IF_FREE(icon->info.icon.selected);
-   IF_FREE(icon->info.icon.clicked);
-   IF_FREE(icon->info.link);
-   IF_FREE(icon->info.mime.base);
-   IF_FREE(icon->info.mime.type);
-   IF_FREE(icon->previous.icon);
-   FREE(icon);
-}
-
-E_Icon *
-e_icon_new(void)
-{
-   E_Icon *icon;
-
-   icon = NEW(E_Icon, 1);
-   ZERO(icon, E_Icon, 1);
-   OBJ_INIT(icon, e_icon_free);
-   icon->info.icon.normal = strdup(PACKAGE_DATA_DIR"/data/icons/unknown/default.db:/icon/normal");   
-   icon->previous.state.clicked = -1;
-   return icon;
-}
-
-void
-e_icon_apply_mime(E_Icon *icon, char *mime)
-{
-   char m1[4096], m2[4096], *p;
-   
-   strcpy(m1, mime);
-   p = strchr(m1, '/');
-   if (p) *p = 0;
-   p = strchr(mime, '/');
-   if (p) strcpy(m2, &(p[1]));
-   else m2[0] = 0;
-   IF_FREE(icon->info.mime.base);
-   IF_FREE(icon->info.mime.type);
-   icon->info.mime.base = strdup(m1);
-   icon->info.mime.type = strdup(m2);
-}
-
-void
-e_icon_get_icon(E_Icon *icon)
-{
-   char m1[4096], m2[4096], *p;
-   int found = 0;
-   
-   /* errr.. hmm do something useful if its a symlink */
-   if (icon->info.link)
-     {
-     }
-   sprintf(m1, "%s/data/icons/%s/%s.db",PACKAGE_DATA_DIR,
-          icon->info.mime.base, 
-          icon->info.mime.type);
-   if (e_file_exists(m1)) found = 1;
-   if (!found)
-     {
-       strcpy(m2, icon->info.mime.type);
-       p = strrchr(m2, '/');
-       while (p)
-         {
-            p[0] = 0;
-            sprintf(m1, "%s/data/icons/%s/%s.db",PACKAGE_DATA_DIR,
-                    icon->info.mime.base, m2);
-            if (e_file_exists(m1))
-              {
-                 found = 1;
-                 break;
-              }
-            p = strrchr(m2, '/');
-         }
-     }
-   if (!found)
-     {
-       sprintf(m1, "%s/data/icons/%s/default.db",PACKAGE_DATA_DIR,
-               icon->info.mime.base);
-       if (e_file_exists(m1)) found = 1;
-     }
-   if (!found)
-     {
-       sprintf(m1, "%s/data/icons/unknown/unknown.db",PACKAGE_DATA_DIR);
-       if (e_file_exists(m1)) found = 1;
-     }
-   if (!found)
-     {
-       sprintf(m1, "%s/data/icons/unknown/default.db",PACKAGE_DATA_DIR);
-       found = 1;
-     }
-   printf("%s/%s: %s\n", icon->info.mime.base, icon->info.mime.type, m1);
-   IF_FREE(icon->info.icon.normal);
-   IF_FREE(icon->info.icon.selected);
-   IF_FREE(icon->info.icon.clicked);
-   sprintf(m2, "%s:/icon/normal", m1);
-   icon->info.icon.normal = strdup(m2);
-   sprintf(m2, "%s:/icon/selected", m1);
-   icon->info.icon.selected = strdup(m2);
-   sprintf(m2, "%s:/icon/clicked", m1);
-   icon->info.icon.clicked = strdup(m2);
-   icon->changed = 1;
-   icon->view->changed = 1;
-}
-
-void
-e_icon_place_grid(E_Icon *icon)
-{
-   int x, y;
-   
-   if (icon->view->options.arrange.grid.dir == 0) /* h */
-     {
-       int gw;
-       int iw, ih;
-       
-       iw = icon->current.w + 
-         icon->view->spacing.icon.left +
-         icon->view->spacing.icon.right +
-         icon->view->spacing.spacing.left +
-         icon->view->spacing.spacing.right;
-       ih = icon->current.h + 
-         icon->view->spacing.icon.top +
-         icon->view->spacing.icon.bottom +
-         icon->view->spacing.spacing.top +
-         icon->view->spacing.spacing.bottom;
-       if (icon->view->options.arrange.grid.w > 0)
-         gw = (icon->view->size.w - 
-               icon->view->spacing.inset.left - 
-               icon->view->spacing.inset.right) / 
-         icon->view->options.arrange.grid.w;
-       else gw = 1;
-       y = icon->view->options.arrange.grid.next_pos / gw;
-       x = icon->view->options.arrange.grid.next_pos - (y * gw);
-       x *= icon->view->options.arrange.grid.w;
-       y *= icon->view->options.arrange.grid.h;
-       x += (icon->view->options.arrange.grid.w - 
-             icon->view->spacing.icon.left -
-             icon->view->spacing.icon.right -
-             icon->view->spacing.spacing.left -
-             icon->view->spacing.spacing.right - 
-             icon->current.w) / 2;
-       y += (icon->view->options.arrange.grid.h - 
-             icon->view->spacing.icon.top -
-             icon->view->spacing.icon.bottom -
-             icon->view->spacing.spacing.top -
-             icon->view->spacing.spacing.bottom - 
-             icon->current.h);
-       x -= icon->view->viewport.x;
-       y -= icon->view->viewport.y;
-       x += icon->view->spacing.inset.left;
-       y += icon->view->spacing.inset.top;
-       x += icon->view->spacing.icon.left + icon->view->spacing.spacing.left;
-       y += icon->view->spacing.icon.top + icon->view->spacing.spacing.top;
-       e_icon_set_xy(icon, x, y);
-       icon->view->options.arrange.grid.next_pos++;
-     }
-   else /* v */
-     {
-     }
-}
-
-void
-e_icon_pre_show(E_Icon *icon)
-{
-   int x, y;
-   
-   if (icon->info.ready) return;
-   e_icon_update(icon);
-   icon->info.ready = 1;
-   if (icon->info.coord.have)
-     {
-       x = icon->info.coord.x;
-       y = icon->info.coord.y;
-       e_icon_set_xy(icon, x, y);
-     }
-   else
-     {
-       if (icon->view->options.arrange.method == 0) /* grid */
-         {
-            int iw, ih;
-            
-            iw = icon->current.w + 
-              icon->view->spacing.icon.left +
-              icon->view->spacing.icon.right +
-              icon->view->spacing.spacing.left +
-              icon->view->spacing.spacing.right;
-            ih = icon->current.h + 
-              icon->view->spacing.icon.top +
-              icon->view->spacing.icon.bottom +
-              icon->view->spacing.spacing.top +
-              icon->view->spacing.spacing.bottom;
-            /* need to redo whole grid... ??? */
-            if ((iw > icon->view->options.arrange.grid.w) ||
-                (ih > icon->view->options.arrange.grid.h))
-              {                  
-                 Evas_List l;
-                 
-                 icon->view->options.arrange.grid.next_pos = 0;
-                 icon->view->options.arrange.grid.w = iw;
-                 icon->view->options.arrange.grid.h = ih;
-                 for (l = icon->view->icons; l; l = l->next)
-                   {
-                      E_Icon *ic;
-                      
-                      ic = l->data;
-                      if (ic->info.ready)
-                        e_icon_place_grid(ic);
-                   }
-              }
-            else
-              e_icon_place_grid(icon);
-         }
-     }
-   e_icon_show(icon);   
-}
-
-void
-e_icon_calulcate_geometry(E_Icon *icon)
-{
-   int iw, ih, tw, th;
-   double dtw, dth;
-   
-   if (!icon->view) return;
-   dtw = 0; dth = 0; iw = 0; ih = 0;
-   evas_get_geometry(icon->view->evas, icon->obj.filename, NULL, NULL, &dtw, &dth);
-   tw = (int)dtw; 
-   th = (int)dth;
-   evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
-   if (tw < iw)
-     {
-       icon->current.ix = icon->current.x;
-       icon->current.iy = icon->current.y;
-       icon->current.tx = icon->current.x + ((iw - tw) / 2);
-       icon->current.ty = icon->current.y + icon->view->spacing.icon.top + icon->view->spacing.icon.bottom + ih;
-       icon->current.w = iw;
-       icon->current.h = ih + th;
-       icon->current.iw = iw;
-       icon->current.ih = ih;
-       icon->current.tw = tw;
-       icon->current.th = th;
-     }
-   else
-     {
-       icon->current.ix = icon->current.x + ((tw - iw) / 2);
-       icon->current.iy = icon->current.y;
-       icon->current.tx = icon->current.x;
-       icon->current.ty = icon->current.y + icon->view->spacing.icon.top + icon->view->spacing.icon.bottom + ih;
-       icon->current.w = tw;
-       icon->current.h = ih + th;
-       icon->current.iw = iw;
-       icon->current.ih = ih;
-       icon->current.tw = tw;
-       icon->current.th = th;
-     }
-   if (INTERSECTS(0, 0, icon->view->size.w, icon->view->size.h,
-                 icon->current.x, icon->current.y, icon->current.w, icon->current.h))
-     icon->current.viewable = 1;
-   else
-     icon->current.viewable = 0;
-}
-
-void
-e_icon_realize(E_Icon *icon)
-{
-   icon->obj.sel1 = evas_add_rectangle(icon->view->evas);
-   icon->obj.sel2 = evas_add_rectangle(icon->view->evas);
-   evas_set_color(icon->view->evas, icon->obj.sel1, 0, 0, 0, 0);
-   evas_set_color(icon->view->evas, icon->obj.sel2, 0, 0, 0, 0);
-   evas_set_layer(icon->view->evas, icon->obj.sel1, 11);
-   evas_set_layer(icon->view->evas, icon->obj.sel2, 11);
-   evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_IN, e_icon_in_cb, icon);
-   evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_OUT, e_icon_out_cb, icon);
-   evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, icon);
-   evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_UP, e_icon_up_cb, icon);
-   evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_IN, e_icon_in_cb, icon);
-   evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_OUT, e_icon_out_cb, icon);
-   evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_DOWN, e_icon_down_cb, icon);
-   evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_UP, e_icon_up_cb, icon);
-}
-     
-void
-e_icon_unrealize(E_Icon *icon)
-{
-   if (icon->obj.icon) evas_del_object(icon->view->evas, icon->obj.icon);
-   if (icon->obj.filename) evas_del_object(icon->view->evas, icon->obj.filename);
-   if (icon->obj.sel1) evas_del_object(icon->view->evas, icon->obj.sel1);
-   if (icon->obj.sel2) evas_del_object(icon->view->evas, icon->obj.sel2);   
-   icon->obj.icon = NULL;
-   icon->obj.filename = NULL;
-   icon->obj.sel1 = NULL;
-   icon->obj.sel2 = NULL;
-   if (icon->view) icon->view->changed = 1;
-}
-
-void
-e_icon_set_icon(E_Icon *icon, char *file)
-{
-   IF_FREE(icon->current.icon);
-   icon->current.icon = strdup(file);
-   icon->changed = 1;
-   if (icon->view) icon->view->changed = 1;
-}
-
-void
-e_icon_show(E_Icon *icon)
-{
-   if (!icon->current.visible)
-     {
-       icon->current.visible = 1;
-       icon->changed = 1;
-       if (icon->view) icon->view->changed = 1;
-     }
-}
-
-void
-e_icon_hide(E_Icon *icon)
-{
-   if (icon->current.visible)
-     {
-       icon->current.visible = 0;
-       icon->changed = 1;
-       if (icon->view) icon->view->changed = 1;
-     }
-}
-
-void
-e_icon_set_xy(E_Icon *icon, int x, int y)
-{
-   icon->current.x = x;
-   icon->current.y = y;
-   icon->changed = 1;
-   if (icon->view) icon->view->changed = 1;
-}
-
-void
-e_icon_get_xy(E_Icon *icon, int *x, int *y)
-{
-   if (x) *x = icon->current.x;
-   if (y) *y = icon->current.y;
-}
-
-void
-e_icon_set_filename(E_Icon *icon, char *file)
-{
-   IF_FREE(icon->file);
-   icon->file = strdup(file);
-   icon->changed = 1;
-   if (icon->view) icon->view->changed = 1;
-}
-
-void
-e_icon_update(E_Icon *icon)
-{
-   int obj_new = 0;
-   
-   if (!icon->changed) return;
-   if (icon->current.state.clicked)
-     {
-       if (icon->info.icon.clicked)
-         icon->current.icon = icon->info.icon.clicked;
-       else if (icon->info.icon.selected)
-         icon->current.icon = icon->info.icon.selected;
-       else 
-         icon->current.icon = icon->info.icon.normal;
-     }
-   else if (icon->current.state.selected)
-     {
-            if (icon->info.icon.selected)
-         icon->current.icon = icon->info.icon.selected;
-       else 
-         icon->current.icon = icon->info.icon.normal;
-     }
-   else
-     {
-       icon->current.icon = icon->info.icon.normal;         
-     }
-   if ((!icon->current.state.selected) && (icon->obj.sel_icon))
-     {
-       ebits_hide(icon->obj.sel_icon);
-       ebits_free(icon->obj.sel_icon);
-       icon->obj.sel_icon = NULL;
-     }
-   if (!icon->obj.filename)
-     {
-       icon->obj.filename = evas_add_text(icon->view->evas, "borzoib", 8, icon->file);
-       evas_set_layer(icon->view->evas, icon->obj.filename, 10);
-       icon->previous.x = icon->current.x - 1;
-       icon->previous.visible = icon->current.visible - 1;
-       obj_new = 1;
-     }
-   if (((icon->previous.icon) && (icon->current.icon) && 
-       (strcmp(icon->current.icon, icon->previous.icon))) ||
-       ((!icon->previous.icon) && (icon->current.icon)))
-     {
-       int iw, ih;
-       
-       if (!icon->obj.icon)
-         {
-            icon->obj.icon = evas_add_image_from_file(icon->view->evas, icon->current.icon);
-            evas_set_layer(icon->view->evas, icon->obj.icon, 10);
-            obj_new = 1;
-         }
-       else
-         evas_set_image_file(icon->view->evas, icon->obj.icon, icon->current.icon);
-       evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
-       evas_set_image_fill(icon->view->evas, icon->obj.icon, 0, 0, iw, ih);
-       evas_resize(icon->view->evas, icon->obj.icon, iw, ih);
-       icon->previous.x = icon->current.x - 1;      
-     }
-   if ((!icon->obj.sel_icon) && (icon->current.state.selected))
-     {
-       icon->obj.sel_icon = ebits_load(PACKAGE_DATA_DIR"/data/config/appearance/default/selections/file.bits.db");
-       if (icon->obj.sel_icon)
-         {
-            ebits_add_to_evas(icon->obj.sel_icon, icon->view->evas);        
-            ebits_set_layer(icon->obj.sel_icon, 9);
-            ebits_set_color_class(icon->obj.sel_icon, "Selected BG", 100, 200, 255, 255);
-            obj_new = 1;
-         }
-     }
-   if (obj_new)
-     {
-       if (icon->shelf)
-         {
-            E_Shelf *sh;
-            
-            sh = icon->shelf;
-            e_shelf_del_icon(sh, icon);
-            e_shelf_add_icon(sh, icon);
-         }
-     }
-   if ((icon->previous.x != icon->current.x) ||
-       (icon->previous.y != icon->current.y) ||
-       (icon->current.visible != icon->previous.visible) ||
-       (obj_new))
-     {
-       e_icon_calulcate_geometry(icon);
-       if (icon->current.viewable)
-         {
-            evas_move(icon->view->evas, icon->obj.icon, icon->current.ix, icon->current.iy);
-            evas_move(icon->view->evas, icon->obj.filename, icon->current.tx, icon->current.ty);
-            evas_move(icon->view->evas, icon->obj.sel1, icon->current.ix, icon->current.iy);
-            evas_resize(icon->view->evas, icon->obj.sel1, icon->current.iw, icon->current.ih);
-            evas_move(icon->view->evas, icon->obj.sel2, icon->current.tx, icon->current.ty);
-            evas_resize(icon->view->evas, icon->obj.sel2, icon->current.tw, icon->current.th);
-            evas_set_color(icon->view->evas, icon->obj.filename, 0, 0, 0, 255);
-            if (icon->obj.sel_icon)
-              {
-                 int pl, pr, pt, pb;
-                 
-                 pl = pr = pt = pb = 0;
-                 ebits_get_insets(icon->obj.sel_icon, &pl, &pr, &pt, &pb);
-                 ebits_move(icon->obj.sel_icon, icon->current.ix - pl, icon->current.iy - pt);
-                 ebits_resize(icon->obj.sel_icon, icon->current.iw + pl + pr, icon->current.ih + pt + pb);
-              }
-         }     
-     }
-   if ((icon->current.visible != icon->previous.visible) || (obj_new) ||
-       (icon->current.viewable != icon->previous.viewable))
-     {
-       if ((icon->current.visible) && (icon->current.viewable))
-         {
-            evas_show(icon->view->evas, icon->obj.icon);
-            evas_show(icon->view->evas, icon->obj.filename);
-            evas_show(icon->view->evas, icon->obj.sel1);
-            evas_show(icon->view->evas, icon->obj.sel2);
-            if (icon->obj.sel_icon) ebits_show(icon->obj.sel_icon);
-         }
-       else
-         {
-            evas_hide(icon->view->evas, icon->obj.icon);
-            evas_hide(icon->view->evas, icon->obj.filename);
-            evas_hide(icon->view->evas, icon->obj.sel1);
-            evas_hide(icon->view->evas, icon->obj.sel2);
-            if (icon->obj.sel_icon) ebits_hide(icon->obj.sel_icon);
-         }
-     }
-   IF_FREE(icon->previous.icon);
-   icon->previous = icon->current;
-   icon->previous.icon = strdup(icon->current.icon);
-   icon->changed = 0;
-}
index b4754d9..1c816a6 100644 (file)
@@ -1,317 +1 @@
 #include "e.h"
-
-static void e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
-static void e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
-static void e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
-static void e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
-static void e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
-
-static int mv_prev_x, mv_prev_y;
-
-static void
-e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
-{
-   E_Shelf *sh;
-   
-   sh = data;
-   return;
-   UN(o);
-   UN(bt);
-   UN(ox);
-   UN(oy);
-   UN(ow);
-   UN(oh);
-}
-
-static void
-e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
-{
-   E_Shelf *sh;
-   
-   sh = data;
-   return;
-   UN(o);
-   UN(bt);
-   UN(ox);
-   UN(oy);
-   UN(ow);
-   UN(oh);
-}
-
-static void
-e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
-{
-   E_Shelf *sh;
-   
-   sh = data;
-   if (!strcmp(class, "Title_Bar"))
-     {
-       mv_prev_x = x;
-       mv_prev_y = y;
-       sh->state.moving = 1;
-     }
-   if (!strcmp(class, "Resize"))
-     {
-       mv_prev_x = x;
-       mv_prev_y = y;
-       sh->state.resizing = 1;
-     }
-   if (!strcmp(class, "Resize_Horizontal"))
-     {
-       mv_prev_x = x;
-       mv_prev_y = y;
-       sh->state.resizing = 1;
-     }
-   if (!strcmp(class, "Resize_Vertical"))
-     {
-       mv_prev_x = x;
-       mv_prev_y = y;
-       sh->state.resizing = 1;
-     }
-   if (!strcmp(class, "Menu"))
-     {
-     }
-   if (!strcmp(class, "Close"))
-     {
-     }
-   return;
-   UN(o);
-   UN(bt);
-   UN(ox);
-   UN(oy);
-   UN(ow);
-   UN(oh);
-}
-
-static void
-e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
-{
-   E_Shelf *sh;
-   
-   sh = data;
-   if (sh->state.moving) sh->state.moving = 0;
-   if (sh->state.resizing) sh->state.resizing = 0;
-   return;
-   UN(o);
-   UN(bt);
-   UN(ox);
-   UN(oy);
-   UN(ow);
-   UN(oh);
-}
-
-static void
-e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
-{
-   E_Shelf *sh;
-   
-   sh = data;
-   if (sh->state.moving)
-     {
-       e_shelf_move_by(sh, x - mv_prev_x, y - mv_prev_y);
-       mv_prev_x = x;
-       mv_prev_y = y;
-     }
-   if (sh->state.resizing)
-     {
-       if (sh->state.resizing == 1)
-         {
-            e_shelf_resize_by(sh, x - mv_prev_x, y - mv_prev_y);
-            mv_prev_x = x;
-            mv_prev_y = y;          
-         }
-     }
-   return;
-   UN(o);
-   UN(bt);
-   UN(ox);
-   UN(oy);
-   UN(ow);
-   UN(oh);
-}
-
-void
-e_shelf_free(E_Shelf *sh)
-{
-   IF_FREE(sh->name);
-   FREE(sh);
-}
-
-E_Shelf *
-e_shelf_new(void)
-{
-   E_Shelf *sh;
-
-   sh = NEW(E_Shelf, 1);
-   ZERO(sh, E_Shelf, 1);
-   OBJ_INIT(sh, e_shelf_free);
-   return sh;
-}
-
-void
-e_shelf_set_name(E_Shelf *sh, char *name)
-{
-   IF_FREE(sh->name);
-   sh->name = strdup(name);
-}
-
-void
-e_shelf_set_view(E_Shelf *sh, E_View *v)
-{
-   sh->view = v;
-}
-
-void
-e_shelf_realize(E_Shelf *sh)
-{
-   int pl, pr, pt, pb;
-   
-   sh->bit.border = ebits_load(PACKAGE_DATA_DIR"/data/config/appearance/default/shelves/default.bits.db");
-   if (sh->bit.border)
-     {
-       ebits_add_to_evas(sh->bit.border, sh->view->evas);
-       ebits_move(sh->bit.border, sh->x, sh->y);
-       ebits_resize(sh->bit.border, sh->w, sh->h);
-       ebits_set_layer(sh->bit.border, 5);
-       if (sh->visible)
-         ebits_show(sh->bit.border);
-
-#define HOOK_CB(_class)        \
-ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_IN, e_cb_mouse_in, sh); \
-ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_OUT, e_cb_mouse_out, sh); \
-ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_DOWN, e_cb_mouse_down, sh); \
-ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_UP, e_cb_mouse_up, sh); \
-ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_MOVE, e_cb_mouse_move, sh);
-       HOOK_CB("Title_Bar");
-       HOOK_CB("Resize");
-       HOOK_CB("Resize_Horizontal");
-       HOOK_CB("Resize_Vertical");
-       HOOK_CB("Close");
-       HOOK_CB("Iconify");
-       HOOK_CB("Max_Size");
-       HOOK_CB("Menu");
-     }
-   sh->obj.clipper = evas_add_rectangle(sh->view->evas);
-   evas_set_layer(sh->view->evas, sh->obj.clipper, 9);
-   evas_set_color(sh->view->evas, sh->obj.clipper, 255, 255, 255, 255);
-       
-   pl = pr = pt = pb = 0;
-   if (sh->bit.border) ebits_get_insets(sh->bit.border, &pl, &pr, &pt, &pb);
-   evas_move(sh->view->evas, sh->obj.clipper, sh->x + pl, sh->y + pt);
-   evas_resize(sh->view->evas, sh->obj.clipper, sh->w - pl - pr, sh->h - pt - pb);
-   
-   if ((sh->visible) && (sh->icon_count > 0))
-     evas_show(sh->view->evas, sh->obj.clipper);
-}
-
-void
-e_shelf_show(E_Shelf *sh)
-{
-   if (sh->visible) return;
-   
-   sh->visible = 1;
-}
-
-void
-e_shelf_hide(E_Shelf *sh)
-{
-   if (!sh->visible) return;
-
-   sh->visible = 0;
-}
-
-void
-e_shelf_move(E_Shelf *sh, int x, int y)
-{
-   int dx, dy;
-   
-   dx = x - sh->x;
-   dy = y - sh->y;
-   e_shelf_move_by(sh, dx, dy);
-}
-
-void
-e_shelf_move_by(E_Shelf *sh, int dx, int dy)
-{
-   Evas_List l;
-   
-   sh->x += dx;
-   sh->y += dy;
-   if (sh->bit.border) ebits_move(sh->bit.border, sh->x, sh->y);
-   if (sh->obj.clipper) 
-     {
-       int pl, pr, pt, pb;
-       
-       pl = pr = pt = pb = 0;
-       if (sh->bit.border) ebits_get_insets(sh->bit.border, &pl, &pr, &pt, &pb);
-       evas_move(sh->view->evas, sh->obj.clipper, sh->x + pl, sh->y + pt);
-       printf("move to %i %i\n", sh->x + pl, sh->y + pt);
-     }
-   for (l = sh->view->icons; l; l = l->next)
-     {
-       E_Icon *icon;
-       int x, y;
-       
-       icon = l->data;
-       if (icon->shelf == sh)
-         {
-            e_icon_get_xy(icon, &x, &y);
-            e_icon_set_xy(icon, x + dx, y + dy);
-         }
-     }
-}
-
-void
-e_shelf_resize(E_Shelf *sh, int w, int h)
-{
-   sh->w = w;
-   sh->h = h;
-   if (sh->bit.border) ebits_resize(sh->bit.border, sh->w, sh->h);
-   if (sh->obj.clipper) 
-     {
-       int pl, pr, pt, pb;
-       
-       pl = pr = pt = pb = 0;
-       if (sh->bit.border) ebits_get_insets(sh->bit.border, &pl, &pr, &pt, &pb);
-       evas_resize(sh->view->evas, sh->obj.clipper, sh->w - pl - pr, sh->h - pt - pb);
-       printf("resize to %i %i\n", sh->w - pl - pr, sh->h - pt - pb);
-     }   
-}
-
-void
-e_shelf_resize_by(E_Shelf *sh, int dw, int dh)
-{
-   e_shelf_resize(sh, sh->w + dw, sh->h + dh);
-}
-
-void
-e_shelf_add_icon(E_Shelf *sh, E_Icon *icon)
-{
-   if (icon->shelf)
-     e_shelf_del_icon(icon->shelf, icon);
-   icon->shelf = sh;
-   sh->icon_count++;
-   if (sh->icon_count > 0)
-     evas_show(sh->view->evas, sh->obj.clipper);
-   evas_set_clip(sh->view->evas, icon->obj.icon, sh->obj.clipper);
-   evas_set_clip(sh->view->evas, icon->obj.filename, sh->obj.clipper);
-   evas_set_clip(sh->view->evas, icon->obj.sel1, sh->obj.clipper);
-   evas_set_clip(sh->view->evas, icon->obj.sel2, sh->obj.clipper);
-   if (icon->obj.sel_icon)
-     ebits_set_clip(icon->obj.sel_icon, sh->obj.clipper);
-}
-
-void
-e_shelf_del_icon(E_Shelf *sh, E_Icon *icon)
-{
-   if (icon->shelf != sh) return;
-   icon->shelf = NULL;
-   if (sh->icon_count <= 0)
-     evas_hide(sh->view->evas, sh->obj.clipper);
-   evas_unset_clip(sh->view->evas, icon->obj.icon);
-   evas_unset_clip(sh->view->evas, icon->obj.filename);
-   evas_unset_clip(sh->view->evas, icon->obj.sel1);
-   evas_unset_clip(sh->view->evas, icon->obj.sel2);
-   if (icon->obj.sel_icon)
-     ebits_unset_clip(icon->obj.sel_icon);
-}
index 92a6574..ddedf60 100644 (file)
@@ -133,14 +133,16 @@ e_glob_matches(char *str, char *glob)
 int
 e_file_can_exec(struct stat *st)
 {
+   static int have_uid = 0;
    static uid_t uid = -1;
    static gid_t gid = -1;
    int ok;
    
    if (!st) return 0;
    ok = 0;
-   if (uid < 0) uid = getuid();
-   if (gid < 0) gid = getgid();
+   if (!have_uid) uid = getuid();
+   if (!have_uid) gid = getgid();
+   have_uid = 1;
    if (st->st_uid == uid)
      {
        if (st->st_mode & S_IXUSR) ok = 1;
index cef4ef1..d66951e 100644 (file)
@@ -3,8 +3,12 @@
 static Evas_List views = NULL;
 static Eevent *current_ev = NULL;
 
+static Ev_Key_Modifiers mulit_select_mod = EV_KEY_MODIFIER_SHIFT;
+static Ev_Key_Modifiers range_select_mod = EV_KEY_MODIFIER_CTRL;
+
 static void e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
 static void e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
+static void e_bg_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
 static void e_idle(void *data);
 static void e_wheel(Eevent * ev);
 static void e_key_down(Eevent * ev);
@@ -18,8 +22,173 @@ static void e_window_expose(Eevent * ev);
 static void e_view_handle_fs(EfsdEvent *ev);
 static void e_view_handle_fs_restart(void *data);
 
-/* FIXME: hack to test entry boxes */
-static E_Entry *entry = NULL;  
+void
+e_view_selection_update(E_View *v)
+{
+   if ((v->select.on) && (!v->select.obj.middle))
+     {
+       Evas_Gradient grad;
+       
+       /*create select objects */
+       v->select.obj.middle = evas_add_rectangle(v->evas);     
+       evas_set_color(v->evas, v->select.obj.middle,
+                      v->select.config.middle.r,
+                      v->select.config.middle.g,
+                      v->select.config.middle.b,
+                      v->select.config.middle.a);
+       evas_set_layer(v->evas, v->select.obj.middle, 300);
+       v->select.obj.edge_l = evas_add_rectangle(v->evas);     
+       evas_set_color(v->evas, v->select.obj.edge_l,
+                      v->select.config.edge_l.r,
+                      v->select.config.edge_l.g,
+                      v->select.config.edge_l.b,
+                      v->select.config.edge_l.a);
+       evas_set_layer(v->evas, v->select.obj.edge_l, 300);
+       v->select.obj.edge_r = evas_add_rectangle(v->evas);     
+       evas_set_color(v->evas, v->select.obj.edge_r,
+                      v->select.config.edge_r.r,
+                      v->select.config.edge_r.g,
+                      v->select.config.edge_r.b,
+                      v->select.config.edge_r.a);
+       evas_set_layer(v->evas, v->select.obj.edge_r, 300);
+       v->select.obj.edge_t = evas_add_rectangle(v->evas);     
+       evas_set_color(v->evas, v->select.obj.edge_t,
+                      v->select.config.edge_t.r,
+                      v->select.config.edge_t.g,
+                      v->select.config.edge_t.b,
+                      v->select.config.edge_t.a);
+       evas_set_layer(v->evas, v->select.obj.edge_t, 300);
+       v->select.obj.edge_b = evas_add_rectangle(v->evas);     
+       evas_set_color(v->evas, v->select.obj.edge_b,
+                      v->select.config.edge_b.r,
+                      v->select.config.edge_b.g,
+                      v->select.config.edge_b.b,
+                      v->select.config.edge_b.a);
+       evas_set_layer(v->evas, v->select.obj.edge_b, 300);
+       
+       v->select.obj.grad_l = evas_add_gradient_box(v->evas);  
+       evas_set_angle(v->evas, v->select.obj.grad_l, 270);
+       grad = evas_gradient_new();
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_l.r,
+                               v->select.config.grad_l.g,
+                               v->select.config.grad_l.b,
+                               v->select.config.grad_l.a, 8);
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_l.r,
+                               v->select.config.grad_l.g,
+                               v->select.config.grad_l.b,
+                               0, 8);
+       evas_set_gradient(v->evas, v->select.obj.grad_l, grad);
+       evas_gradient_free(grad);
+       evas_set_layer(v->evas, v->select.obj.grad_l, 300);
+       v->select.obj.grad_r = evas_add_gradient_box(v->evas);  
+       evas_set_angle(v->evas, v->select.obj.grad_r, 90);
+       grad = evas_gradient_new();
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_r.r,
+                               v->select.config.grad_r.g,
+                               v->select.config.grad_r.b,
+                               v->select.config.grad_r.a, 8);
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_r.r,
+                               v->select.config.grad_r.g,
+                               v->select.config.grad_r.b,
+                               0, 8);
+       evas_set_gradient(v->evas, v->select.obj.grad_r, grad);
+       evas_gradient_free(grad);
+       evas_set_layer(v->evas, v->select.obj.grad_r, 300);
+       v->select.obj.grad_t = evas_add_gradient_box(v->evas);  
+       evas_set_angle(v->evas, v->select.obj.grad_t, 0);
+       grad = evas_gradient_new();
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_t.r,
+                               v->select.config.grad_t.g,
+                               v->select.config.grad_t.b,
+                               v->select.config.grad_t.a, 8);
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_t.r,
+                               v->select.config.grad_t.g,
+                               v->select.config.grad_t.b,
+                               0, 8);
+       evas_set_gradient(v->evas, v->select.obj.grad_t, grad);
+       evas_gradient_free(grad);
+       evas_set_layer(v->evas, v->select.obj.grad_t, 300);
+       v->select.obj.grad_b = evas_add_gradient_box(v->evas);  
+       evas_set_angle(v->evas, v->select.obj.grad_b, 180);
+       grad = evas_gradient_new();
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_b.r,
+                               v->select.config.grad_b.g,
+                               v->select.config.grad_b.b,
+                               v->select.config.grad_b.a, 8);
+       evas_gradient_add_color(grad, 
+                               v->select.config.grad_b.r,
+                               v->select.config.grad_b.g,
+                               v->select.config.grad_b.b,
+                               0, 8);
+       evas_set_gradient(v->evas, v->select.obj.grad_b, grad);
+       evas_gradient_free(grad);
+       evas_set_layer(v->evas, v->select.obj.grad_b, 300);
+       v->select.obj.clip = evas_add_rectangle(v->evas);
+       evas_set_color(v->evas, v->select.obj.clip, 255, 255, 255, 255);
+       evas_set_clip(v->evas, v->select.obj.grad_l, v->select.obj.clip);
+       evas_set_clip(v->evas, v->select.obj.grad_r, v->select.obj.clip);
+       evas_set_clip(v->evas, v->select.obj.grad_t, v->select.obj.clip);
+       evas_set_clip(v->evas, v->select.obj.grad_b, v->select.obj.clip);
+     }
+   if ((!v->select.on) && (v->select.obj.middle))
+     {
+       /* destroy select objects */
+       evas_del_object(v->evas, v->select.obj.middle);
+       evas_del_object(v->evas, v->select.obj.edge_l);
+       evas_del_object(v->evas, v->select.obj.edge_r);
+       evas_del_object(v->evas, v->select.obj.edge_t);
+       evas_del_object(v->evas, v->select.obj.edge_b);
+       evas_del_object(v->evas, v->select.obj.grad_l);
+       evas_del_object(v->evas, v->select.obj.grad_r);
+       evas_del_object(v->evas, v->select.obj.grad_t);
+       evas_del_object(v->evas, v->select.obj.grad_b);
+       evas_del_object(v->evas, v->select.obj.clip);
+       v->select.obj.middle = NULL;
+       return;
+     }
+   if (!v->select.on) return;
+   /* move & resize select objects */
+     {
+       evas_move(v->evas, v->select.obj.edge_l, v->select.x, v->select.y + 1);
+       evas_resize(v->evas, v->select.obj.edge_l, 1, v->select.h - 1);
+       evas_move(v->evas, v->select.obj.edge_r, v->select.x + v->select.w - 1, v->select.y);
+       evas_resize(v->evas, v->select.obj.edge_r, 1, v->select.h - 1);
+       evas_move(v->evas, v->select.obj.edge_t, v->select.x, v->select.y);
+       evas_resize(v->evas, v->select.obj.edge_t, v->select.w - 1, 1);
+       evas_move(v->evas, v->select.obj.edge_b, v->select.x + 1, v->select.y + v->select.h - 1);
+       evas_resize(v->evas, v->select.obj.edge_b, v->select.w - 1, 1);
+       evas_move(v->evas, v->select.obj.middle, v->select.x + 1, v->select.y + 1);
+       evas_resize(v->evas, v->select.obj.middle, v->select.w - 1 - 1, v->select.h - 1 - 1);
+       evas_move(v->evas, v->select.obj.grad_l, v->select.x + 1, v->select.y + 1);
+       evas_resize(v->evas, v->select.obj.grad_l, v->select.config.grad_size.l, v->select.h - 1 - 1);
+       evas_move(v->evas, v->select.obj.grad_r, v->select.x + v->select.w - 1 - v->select.config.grad_size.r, v->select.y + 1);
+       evas_resize(v->evas, v->select.obj.grad_r, v->select.config.grad_size.r, v->select.h - 1 - 1);
+       evas_move(v->evas, v->select.obj.grad_t, v->select.x + 1, v->select.y + 1);
+       evas_resize(v->evas, v->select.obj.grad_t, v->select.w - 1 - 1, v->select.config.grad_size.t);
+       evas_move(v->evas, v->select.obj.grad_b, v->select.x + 1, v->select.y + v->select.h - 1 - v->select.config.grad_size.b);
+       evas_resize(v->evas, v->select.obj.grad_b, v->select.w - 1 - 1, v->select.config.grad_size.b);
+       evas_move(v->evas, v->select.obj.clip, v->select.x + 1, v->select.y + 1);
+       evas_resize(v->evas, v->select.obj.clip, v->select.w - 1 - 1, v->select.h - 1 - 1);
+     }
+   
+   evas_show(v->evas, v->select.obj.middle);
+   evas_show(v->evas, v->select.obj.edge_l);
+   evas_show(v->evas, v->select.obj.edge_r);
+   evas_show(v->evas, v->select.obj.edge_t);
+   evas_show(v->evas, v->select.obj.edge_b);
+   evas_show(v->evas, v->select.obj.grad_l);
+   evas_show(v->evas, v->select.obj.grad_r);
+   evas_show(v->evas, v->select.obj.grad_t);
+   evas_show(v->evas, v->select.obj.grad_b);
+   evas_show(v->evas, v->select.obj.clip);
+}
 
 static void
 e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
@@ -29,34 +198,36 @@ e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
    
    ev = current_ev->event;
    v = _data;
+   if (!(ev->mods & mulit_select_mod))
+     {
+       e_view_deselect_all();
+     }
    if (_b == 1)
      {
-       v->selection.on = 1;
-       v->selection.start_x = _x;
-       v->selection.start_y = _y;
-       v->selection.x = _x;
-       v->selection.y = _y;
-       v->selection.w = 1;
-       v->selection.h = 1;
-       if (!v->selection.obj_rect)
+       v->select.down.x = _x;
+       v->select.down.y = _y;
+       v->select.on = 1;
+       if (_x < v->select.down.x)
+         {
+            v->select.x = _x;
+            v->select.w = v->select.down.x - v->select.x + 1;
+         }
+       else
+         {
+            v->select.x = v->select.down.x;
+            v->select.w = _x - v->select.down.x + 1;
+         }
+       if (_y < v->select.down.y)
          {
-            v->selection.obj_rect = evas_add_rectangle(v->evas);
-            v->selection.obj_l1 = evas_add_line(v->evas);
-            v->selection.obj_l2 = evas_add_line(v->evas);
-            v->selection.obj_l3 = evas_add_line(v->evas);
-            v->selection.obj_l4 = evas_add_line(v->evas);
-            evas_set_color(v->evas, v->selection.obj_rect, 255, 255, 255, 100);
-            evas_set_color(v->evas, v->selection.obj_l1, 0, 0, 0, 200);
-            evas_set_color(v->evas, v->selection.obj_l2, 0, 0, 0, 200);
-            evas_set_color(v->evas, v->selection.obj_l3, 0, 0, 0, 200);
-            evas_set_color(v->evas, v->selection.obj_l4, 0, 0, 0, 200);
-            evas_set_layer(v->evas, v->selection.obj_rect, 100);
-            evas_set_layer(v->evas, v->selection.obj_l1, 100);
-            evas_set_layer(v->evas, v->selection.obj_l2, 100);
-            evas_set_layer(v->evas, v->selection.obj_l3, 100);
-            evas_set_layer(v->evas, v->selection.obj_l4, 100);
+            v->select.y = _y;
+            v->select.h = v->select.down.y - v->select.y + 1;
          }
-       e_view_update_selection(v, _x, _y);
+       else
+         {
+            v->select.y = v->select.down.y;
+            v->select.h = _y - v->select.down.y + 1;
+         }
+       e_view_selection_update(v);
      }
 }
 
@@ -65,29 +236,64 @@ e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
 {    
    Ev_Mouse_Up          *ev;
    E_View *v;
+   int dx, dy;
    
    ev = current_ev->event;
    v = _data;
-   if (((v->selection.w < 6) && (v->selection.h < 6)) ||
-       (!v->selection.on))
+   dx = 0;
+   dy = 0;
+   if (v->select.on)
      {
+       dx = v->select.down.x - _x;
+       dy = v->select.down.y - _y;
+       if (dx < 0) dx = -dx;
+       if (dy < 0) dy = -dy;
        if (_b == 1)
+         v->select.on = 0;
+       e_view_selection_update(v);
+     }
+   if ((_b == 1) && ((dx > 3) || (dy > 3)))
+     {
+       Evas_List l;
+       
+       for (l = v->icons; l; l = l->next)
          {
-            static E_Build_Menu *buildmenu = NULL;
+            E_Icon *ic;
             
-            if (!buildmenu)
+            ic = l->data;
+            if (INTERSECTS(v->select.x, v->select.y, v->select.w, v->select.h,
+                           ic->geom.x, ic->geom.y, ic->geom.w, ic->geom.h))
               {
-                 char *apps_menu_db;
-                 
-                 apps_menu_db = e_config_get("apps_menu");
-                 if (apps_menu_db) buildmenu = e_build_menu_new_from_db(apps_menu_db);
+                 if (ic->state.visible)
+                   {
+                      e_view_icon_invert_selection(ic);
+                   }
               }
-            if (buildmenu)
+         }
+       /* errr. select files in box */
+     }
+   else
+     {
+       if (_b == 1)
+         {
+            if (!(ev->mods & (mulit_select_mod | range_select_mod)))
               {
-                 static E_Menu *menu = NULL;
-                 menu = buildmenu->menu;
-                 if (menu)
-                   e_menu_show_at_mouse(menu, ev->rx, ev->ry, ev->time);
+                 static E_Build_Menu *buildmenu = NULL;
+                 
+                 if (!buildmenu)
+                   {
+                      char *apps_menu_db;
+                      
+                      apps_menu_db = e_config_get("apps_menu");
+                      if (apps_menu_db) buildmenu = e_build_menu_new_from_db(apps_menu_db);
+                   }
+                 if (buildmenu)
+                   {
+                      static E_Menu *menu = NULL;
+                      menu = buildmenu->menu;
+                      if (menu)
+                        e_menu_show_at_mouse(menu, ev->rx, ev->ry, ev->time);
+                   }
               }
          }
        else if (_b == 3)
@@ -105,29 +311,458 @@ e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
                  if (menu)
                    e_menu_show_at_mouse(menu, ev->rx, ev->ry, ev->time);
               }
-/*          
-            static E_Menu *menu = NULL;
+         }
+     }
+   if (_b == 1)
+     {
+       v->select.x = _x;
+       v->select.y = _y;
+     }
+}
+
+static void
+e_bg_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+{
+   Ev_Mouse_Down          *ev;
+   E_View *v;
+   
+   ev = current_ev->event;
+   v = _data;
+   if (v->select.on)
+     {
+       if (_x < v->select.down.x)
+         {
+            v->select.x = _x;
+            v->select.w = v->select.down.x - v->select.x + 1;
+         }
+       else
+         {
+            v->select.x = v->select.down.x;
+            v->select.w = _x - v->select.down.x + 1;
+         }
+       if (_y < v->select.down.y)
+         {
+            v->select.y = _y;
+            v->select.h = v->select.down.y - v->select.y + 1;
+         }
+       else
+         {
+            v->select.y = v->select.down.y;
+            v->select.h = _y - v->select.down.y + 1;
+         }
+       e_view_selection_update(v);
+     }
+}
+
+void
+e_view_icon_update_state(E_Icon *ic)
+{
+   char icon[4096];
+   int iw, ih;
+   int gw, gh;
+   
+   if (!ic->info.icon)
+     {
+       printf("EEEEEEEEEEK %s has no icon\n", ic->file);
+       return;
+     }
+   if (ic->state.clicked)
+     {
+       sprintf(icon, "%s:/icon/clicked", ic->info.icon);
+     }
+   else if (ic->state.selected)
+     {
+       sprintf(icon, "%s:/icon/selected", ic->info.icon);
+     }
+   else
+     {
+       sprintf(icon, "%s:/icon/normal", ic->info.icon);
+     }
+   if ((ic->state.selected) && (!ic->obj.sel.over.icon))
+     {
+       char file[4096];
+       
+       sprintf(file, "%s/file.bits.db", e_config_get("selections"));
+       ic->obj.sel.over.icon = ebits_load(file);
+       sprintf(file, "%s/text.bits.db", e_config_get("selections"));
+       ic->obj.sel.over.text = ebits_load(file);
+       if (ic->obj.sel.over.icon) 
+         {
+            ebits_add_to_evas(ic->obj.sel.over.icon, ic->view->evas);
+            ebits_set_layer(ic->obj.sel.over.icon, 205);
+         }
+       if (ic->obj.sel.over.text)
+         {
+            ebits_add_to_evas(ic->obj.sel.over.text, ic->view->evas);
+            ebits_set_layer(ic->obj.sel.over.text, 205);
+         }
+     }
+   else if ((!ic->state.selected) && (ic->obj.sel.over.icon))
+     {
+       if (ic->obj.sel.over.icon) ebits_free(ic->obj.sel.over.icon);
+       if (ic->obj.sel.over.text) ebits_free(ic->obj.sel.over.text);
+       ic->obj.sel.over.icon = NULL;
+       ic->obj.sel.over.text = NULL;
+     }
+   evas_set_image_file(ic->view->evas, ic->obj.icon, icon);
+   evas_get_image_size(ic->view->evas, ic->obj.icon, &iw, &ih);
+   gw = ic->geom.icon.w;
+   gh = ic->geom.icon.h;
+   e_view_icon_apply_xy(ic);
+   if ((iw == gw) && (ih == gh)) return;
+   e_view_queue_resort(ic->view);
+}
+
+void
+e_view_deselect_all(void)
+{
+   Evas_List ll;
+   
+   for (ll = views; ll; ll = ll->next)
+     {
+       Evas_List l;
+       E_View *v;
+       
+       v = ll->data;
+       for (l = v->icons; l; l = l->next)
+         {
+            E_Icon *ic;
+            
+            ic = l->data;
+            e_view_icon_deselect(ic);
+         }
+     }
+}
+
+void
+e_view_deselect_all_except(E_Icon *not_ic)
+{
+   Evas_List ll;
+   
+   for (ll = views; ll; ll = ll->next)
+     {
+       Evas_List l;
+       E_View *v;
+       
+       v = ll->data;
+       for (l = v->icons; l; l = l->next)
+         {
+            E_Icon *ic;
+            
+            ic = l->data;
+            if (ic != not_ic)
+              e_view_icon_deselect(ic);
+         }
+     }
+}
+
+void
+e_view_icon_invert_selection(E_Icon *ic)
+{
+   if (ic->state.selected) e_view_icon_deselect(ic);
+   else e_view_icon_select(ic);
+}
+
+void
+e_view_icon_select(E_Icon *ic)
+{
+   if (!ic->state.selected)
+     {
+       ic->state.selected = 1;
+       ic->view->sel_count++;
+       e_view_icon_update_state(ic);
+     }
+}
+
+void
+e_view_icon_deselect(E_Icon *ic)
+{
+   if (ic->state.selected)
+     {
+       ic->state.selected = 0;
+       ic->view->sel_count--;
+       e_view_icon_update_state(ic);
+     }
+}
+
+static void
+e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+{
+   E_Icon *ic;
+   Eevent *ev;
+   Ev_Mouse_Down *e;
+   
+   ev = e_view_get_current_event();
+   e = ev->event;
+   ic = _data;
+   ic->view->select.down.x = _x;
+   ic->view->select.down.y = _y;
+   ic->state.clicked = 1;
+   e_view_icon_update_state(ic);
+   if (_b == 1)
+     {
+       if (e->double_click)
+         {
+            
+         }
+       else
+         {
+            if (!ic->state.selected)
+              {
+                 if ((e->mods & mulit_select_mod))
+                   { 
+                      e_view_icon_select(ic);
+                   }
+                 else
+                   {
+                      e_view_deselect_all_except(ic);
+                      e_view_icon_select(ic);
+                   }
+                 ic->state.just_selected = 1;
+              }
+         }
+     }
+   else if (_b == 2)
+     {
+     }
+   else if (_b == 3)
+     {
+     }
+}
+
+static void
+e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+{
+   E_Icon *ic;
+   Eevent *ev;
+   Ev_Mouse_Up *e;
+   
+   ev = e_view_get_current_event();
+   e = ev->event;
+   ic = _data;
+   if (ic->view->drag.started)
+     {
+       ic->state.clicked = 0;
+       ic->state.just_selected = 0;
+       e_view_icon_update_state(ic);
+       e_window_destroy(ic->view->drag.win);
+       ic->view->drag.started = 0;
+       return; 
+     }
+   if (_b == 1)
+     {
+       if ((e->mods & mulit_select_mod))
+         {
+            if ((ic->state.selected) && (!ic->state.just_selected))
+              e_view_icon_deselect(ic);
+/*          e_view_icon_invert_selection(ic);*/
+         }
+       else
+         {
+            e_view_deselect_all_except(ic);
+            e_view_icon_select(ic);
+         }
+       ic->state.just_selected = 0;
+     }
+   ic->state.clicked = 0;
+   e_view_icon_update_state(ic);
+}
+
+static void
+e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+{
+   E_Icon *ic;
+   Eevent *ev;
+   Ev_Mouse_Move *e;
+   
+   ev = e_view_get_current_event();
+   e = ev->event;
+   ic = _data;
+   if (!ic->state.clicked) return;
+   if (!ic->view->drag.started)
+     {
+       int dx, dy;
+       
+       dx = ic->view->select.down.x - _x;
+       dy = ic->view->select.down.y - _y;
+       if (dx < 0) dx = -dx;
+       if (dy < 0) dy = -dy;
+       if ((dx > 3) || (dy > 3))
+         {
+            Pixmap pmap, mask;
+            Evas_List l;
+            int x, y, xx, yy, rw, rh, downx, downy, wx, wy, ww, wh;
+            
+            /* find extents of icons to be dragged */
+            x = 999999999;
+            y = 999999999;
+            xx = -999999999;
+            yy = -999999999;
+            for (l = views; l; l = l->next)
+              {
+                 E_View *v;
+                 Evas_List ll;
+                 
+                 v = l->data;
+                 printf("sel count %i\n", v->sel_count);
+                 if (v->sel_count > 0)
+                   {
+                      for (ll = v->icons; ll; ll = ll->next)
+                        {
+                           E_Icon *ic;
+                           
+                           ic = ll->data;
+                           if (ic->state.selected)
+                             {
+                                int ix, iy, iw, ih;
+                                
+                                ix = ic->geom.x + v->location.x;
+                                iy = ic->geom.y + v->location.y;
+                                iw = ic->geom.w;
+                                ih = ic->geom.h;
+                                if (ix < x) x = ix;
+                                if (iy < y) y = iy;
+                                if ((ix + iw) > xx) xx = ix + iw;
+                                if ((iy + ih) > yy) yy = iy + ih;
+                             }
+                        }
+                   }
+              }
+            e_window_get_geometry(0, NULL, NULL, &rw, &rh);
+            downx = ic->view->select.down.x + ic->view->location.x;
+            downy = ic->view->select.down.y + ic->view->location.y;
+
+            wx = x;
+            ww = xx - x;
+            if (wx < - (rw - downx)) 
+              {
+                 wx = - (rw - downx);
+                 ww -= (wx - x);
+              }
+            if ((wx + ww) > (rw + downx))
+              ww = (rw + downx) - wx;
+            wy = y;
+            wh = yy - y;
+            if (wy < - (rh - downy)) 
+              {
+                 wy = - (rh - downy);
+                 wh -= (wy - y);
+              }
+            if ((wy + wh) > (rh + downy))
+              wh = (rh + downy) - wy;
             
-            if (!menu)
+            ic->view->drag.x = wx;
+            ic->view->drag.y = wy;
+            ic->view->drag.offset.x = downx - wx;
+            ic->view->drag.offset.y = downy - wy;
+            
+            if ((ww < 1) || (wh < 1)) return;
+            ic->view->drag.win = e_window_override_new(0, wx, wy, ww, wh);
+            pmap = e_pixmap_new(ic->view->drag.win, ww, wh, 0);
+            mask = e_pixmap_new(ic->view->drag.win, ww, wh, 1);
               {
-                 E_Menu_Item *menuitem;
+                 Imlib_Image im;
                  
-                 menu = e_menu_new();
-                 e_menu_set_padding_icon(menu, 8);
-                 e_menu_set_padding_state(menu, 8);
-                 menuitem = e_menu_item_new("Enlightenment "VERSION);
-                 e_menu_item_set_icon(menuitem, PACKAGE_DATA_DIR"/data/images/e_logo.png");
-                 e_menu_add_item(menu, menuitem);
+                 im = imlib_create_image(ww, wh);
+                 imlib_context_set_image(im);
+                 imlib_image_set_has_alpha(1);
+                 imlib_context_set_blend(1);
+                 imlib_image_clear();
+                 for (l = views; l; l = l->next)
+                   {
+                      E_View *v;
+                      Evas_List ll;
+                      
+                      v = l->data;
+                      if (v->sel_count > 0)
+                        {
+                           for (ll = v->icons; ll; ll = ll->next)
+                             {
+                                E_Icon *ic;
+                                
+                                ic = ll->data;
+                                if (ic->state.selected)
+                                  {
+                                     double ix, iy;
+                                     int icx, icy;
+                                     Imlib_Image im2;
+                                     char icon[4096];
+                                     
+                                     evas_get_geometry(ic->view->evas,
+                                                       ic->obj.icon,
+                                                       &ix, &iy, NULL, NULL);
+                                     icx = ix + v->location.x - wx;
+                                     icy = iy + v->location.y - wy;
+                                     if (!ic->info.icon)
+                                       {
+                                          printf("EEEEEEEEEEK %s has no icon\n", ic->file);
+                                          return;
+                                       }
+                                     if (ic->state.clicked)
+                                       {
+                                          sprintf(icon, "%s:/icon/clicked", ic->info.icon);
+                                       }
+                                     else if (ic->state.selected)
+                                       {
+                                          sprintf(icon, "%s:/icon/selected", ic->info.icon);
+                                       }
+                                     else
+                                       {
+                                          sprintf(icon, "%s:/icon/normal", ic->info.icon);
+                                       }
+                                     im2 = imlib_load_image(icon);
+                                     if (im2)
+                                       {
+                                          int iw, ih;
+                                          
+                                          imlib_context_set_image(im2);
+                                          iw = imlib_image_get_width();
+                                          ih = imlib_image_get_height();
+                                          imlib_context_set_image(im);
+                                          imlib_blend_image_onto_image(im2, 1,
+                                                                       0, 0, iw, ih,
+                                                                       icx, icy, iw, ih);
+                                          imlib_context_set_image(im2);
+                                          imlib_free_image();
+                                          imlib_context_set_image(im);
+                                       }
+                                     else
+                                       {
+                                          printf("eek cant load\n");
+                                       }
+                                  }
+                             }
+                        }
+                   }
+                 imlib_context_set_image(im);
+                 imlib_context_set_dither_mask(0);
+                 imlib_context_set_dither(1);
+                 imlib_context_set_drawable(pmap);
+                 imlib_context_set_mask(mask);
+                 imlib_context_set_blend(0);
+                 imlib_render_image_on_drawable(0, 0);
+                 imlib_free_image();
               }
-            if (menu)
-              e_menu_show_at_mouse(menu, ev->rx, ev->ry, ev->time);
- */ 
+            e_window_set_background_pixmap(ic->view->drag.win, pmap);
+            e_window_set_shape_mask(ic->view->drag.win, mask);
+            e_window_ignore(ic->view->drag.win);
+            e_window_raise(ic->view->drag.win);
+            e_window_show(ic->view->drag.win);
+            e_pixmap_free(pmap);
+            e_pixmap_free(mask);
+            ic->view->drag.started = 1;
          }
      }
-   if (ev->button == 1)
+   if (ic->view->drag.started)
      {
-       v->selection.on = 0;
-       e_view_update_selection(v, _x, _y);
+       int x, y;
+       
+       x = _x - ic->view->drag.offset.x;
+       y = _y - ic->view->drag.offset.y;
+       ic->view->drag.x = x;
+       ic->view->drag.y = y;
+       ic->view->drag.update = 1;
+       ic->view->changed = 1;
      }
 }
 
@@ -161,7 +796,6 @@ e_wheel(Eevent * ev)
        v = l->data;
        if (e->win == v->win.main)
          {
-            e_view_scroll(v, 0, - (e->z * 10));
          }
      }
 }
@@ -181,8 +815,6 @@ e_key_down(Eevent * ev)
        if ((e->win == v->win.base) ||
            (e->win == v->win.main))
          {
-            /* FIXME: hack to test enty boxes */
-            if (entry) e_entry_handle_keypress(entry, e);
             if (!strcmp(e->key, "Up"))
               {
               }
@@ -281,6 +913,7 @@ e_mouse_move(Eevent * ev)
    Evas_List l;
    
    e = ev->event;
+   current_ev = ev;
    for (l = views; l; l = l->next)
      {
        E_View *v;
@@ -288,11 +921,11 @@ e_mouse_move(Eevent * ev)
        v = l->data;
        if (e->win == v->win.main)
          {
-            e_view_update_selection(v, e->x, e->y);
             evas_event_move(v->evas, e->x, e->y);
             return;
          }
      }
+   current_ev = NULL;
 }
 
 static void
@@ -391,7 +1024,7 @@ e_view_handle_fs_restart(void *data)
                                                     efsd_op_get_filetype()
                                                     )
                                        );
-   printf("restarted monior id (connection = %p), %i for %s\n", e_fs_get_connection(), v->monitor_id, v->dir);
+   printf("restarted monitor id (connection = %p), %i for %s\n", e_fs_get_connection(), v->monitor_id, v->dir);
    v->is_listing = 1;
 }
 
@@ -409,59 +1042,335 @@ e_view_filter_file(E_View *v, char *file)
 }
 
 void
-e_view_update_selection(E_View *v, int x, int y)
+e_view_icon_free(E_Icon *ic)
+{
+   FREE(ic);
+}
+
+E_Icon *
+e_view_icon_new(void)
+{
+   E_Icon *ic;
+   
+   ic = NEW(E_Icon, 1);
+   ZERO(ic, E_Icon, 1);
+   OBJ_INIT(ic, e_view_icon_free);
+   return ic;
+}
+
+E_Icon *
+e_view_find_icon_by_file(E_View *view, char *file)
 {
-   if (v->selection.on)
+   Evas_List l;
+   
+   for (l = view->icons; l; l = l->next)
      {
-       if (x < v->selection.start_x)
-         {
-            v->selection.w = (-(x - v->selection.start_x)) + 1;
-            v->selection.x = x;
-         }
-       else
-         {
-            v->selection.w = (x - v->selection.start_x) + 1;
-            v->selection.x = v->selection.start_x;                    
-         }
-       if (y < v->selection.start_y)
-         {
-            v->selection.h = (-(y - v->selection.start_y)) + 1;
-            v->selection.y = y;
-                   }
-       else
-         {
-            v->selection.h = (y - v->selection.start_y) + 1;
-            v->selection.y = v->selection.start_y;                    
-         }
-       evas_move(v->evas, v->selection.obj_rect, v->selection.x, v->selection.y);
-       evas_resize(v->evas, v->selection.obj_rect, v->selection.w, v->selection.h);
-       evas_set_line_xy(v->evas, v->selection.obj_l1, v->selection.x, v->selection.y, v->selection.x + v->selection.w - 1, v->selection.y);
-       evas_set_line_xy(v->evas, v->selection.obj_l2, v->selection.x, v->selection.y, v->selection.x, v->selection.y + v->selection.h - 1);
-       evas_set_line_xy(v->evas, v->selection.obj_l3, v->selection.x, v->selection.y + v->selection.h - 1, v->selection.x + v->selection.w - 1, v->selection.y + v->selection.h - 1);
-       evas_set_line_xy(v->evas, v->selection.obj_l4, v->selection.x + v->selection.w - 1, v->selection.y, v->selection.x + v->selection.w - 1, v->selection.y + v->selection.h - 1);
-       evas_show(v->evas, v->selection.obj_rect);
-       evas_show(v->evas, v->selection.obj_l1);
-       evas_show(v->evas, v->selection.obj_l2);
-       evas_show(v->evas, v->selection.obj_l3);
-       evas_show(v->evas, v->selection.obj_l4);
+       E_Icon *ic;
+       
+       ic = l->data;
+       if ((ic) && (ic->file) && (file) && (!strcmp(ic->file, file)))
+         return ic;
      }
-   else
+   return NULL;
+}
+
+void
+e_view_icon_show(E_Icon *ic)
+{
+   if (ic->state.visible) return;
+   ic->state.visible = 1;
+   if (!ic->obj.event1)
      {
-       evas_hide(v->evas, v->selection.obj_rect);
-       evas_hide(v->evas, v->selection.obj_l1);
-       evas_hide(v->evas, v->selection.obj_l2);
-       evas_hide(v->evas, v->selection.obj_l3);
-       evas_hide(v->evas, v->selection.obj_l4);
+       ic->obj.event1 = evas_add_rectangle(ic->view->evas);
+       ic->obj.event2 = evas_add_rectangle(ic->view->evas);
+       evas_set_color(ic->view->evas, ic->obj.event1, 0, 0, 0, 0);
+       evas_set_color(ic->view->evas, ic->obj.event2, 0, 0, 0, 0);
+       evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
+       evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
+       evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
+       evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
+       evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
+       evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
      }
+   evas_set_layer(ic->view->evas, ic->obj.icon, 200);
+   evas_set_layer(ic->view->evas, ic->obj.text, 200);
+   evas_set_layer(ic->view->evas, ic->obj.event1, 210);
+   evas_set_layer(ic->view->evas, ic->obj.event2, 210);
+   
+   evas_show(ic->view->evas, ic->obj.icon);
+   evas_show(ic->view->evas, ic->obj.text);
+   evas_show(ic->view->evas, ic->obj.event1);
+   evas_show(ic->view->evas, ic->obj.event2);
 }
 
 void
-e_view_file_added(int id, char *file)
+e_view_icon_hide(E_Icon *ic)
+{
+   if (!ic->state.visible) return;
+   ic->state.visible = 0;
+   evas_hide(ic->view->evas, ic->obj.icon);
+   evas_hide(ic->view->evas, ic->obj.text);
+   evas_hide(ic->view->evas, ic->obj.event1);
+   evas_hide(ic->view->evas, ic->obj.event2);
+}
+
+void
+e_view_icon_apply_xy(E_Icon *ic)
+{
+   /* threse calc icon extents for: */
+   /*  [I]  */
+   /*  Ig   */
+   /* [txt] */
+   if (ic->geom.text.w > ic->geom.icon.w) ic->geom.w = ic->geom.text.w;
+   else ic->geom.w = ic->geom.icon.w;
+   ic->geom.h = ic->geom.icon.h + ic->geom.text.h + ic->view->spacing.icon.g;
+   
+   evas_resize(ic->view->evas, ic->obj.event1, 
+              ic->geom.icon.w, ic->geom.icon.h);
+   evas_resize(ic->view->evas, ic->obj.event2, 
+              ic->geom.text.w, ic->geom.text.h);
+   evas_move(ic->view->evas, ic->obj.event1,
+            ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
+                         ic->geom.y);
+   evas_move(ic->view->evas, ic->obj.event2,
+            ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
+            ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);       
+   evas_move(ic->view->evas, ic->obj.icon, 
+            ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2), 
+            ic->geom.y);
+   evas_move(ic->view->evas, ic->obj.text,
+            ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2), 
+            ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
+   if (ic->obj.sel.over.icon)
+     {
+       int pl, pr, pt, pb;
+       
+       ebits_get_insets(ic->obj.sel.over.icon, &pl, &pr, &pt, &pb);
+       ebits_move(ic->obj.sel.over.icon, 
+                  ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl,
+                  ic->geom.y - pt);
+       ebits_resize(ic->obj.sel.over.icon,
+                    ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
+       ebits_show(ic->obj.sel.over.icon);
+     }
+   if (ic->obj.sel.over.text)
+     {
+       int pl, pr, pt, pb;
+       
+       ebits_get_insets(ic->obj.sel.over.text, &pl, &pr, &pt, &pb);
+       ebits_move(ic->obj.sel.over.text, 
+                  ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl, 
+                  ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt);
+       ebits_resize(ic->obj.sel.over.text,
+                    ic->geom.text.w + pl  + pr, ic->geom.text.h + pt + pb);
+       ebits_show(ic->obj.sel.over.text);
+     }
+}
+
+static int
+e_view_restart_alphabetical_qsort_cb(void *data1, void *data2)
+{
+   E_Icon *ic, *ic2;
+   
+   ic = *((E_Icon **)data1);
+   ic2 = *((E_Icon **)data2);
+   return (strcmp(ic->file, ic2->file));
+}
+
+void
+e_view_resort_alphabetical(E_View *v)
+{
+   Evas_List icons = NULL, l;
+   E_Icon **array;
+   int i, count;
+   
+   if (!v->icons) return;
+   for (count = 0, l = v->icons; l; l = l->next) count++;
+   array = malloc(sizeof(E_Icon *) * count);
+   for (i = 0, l = v->icons; l; l = l->next) array[i++] = l->data;
+   printf("qsort %i elements...\n", count);
+   qsort(array, count, sizeof(E_Icon *), 
+        e_view_restart_alphabetical_qsort_cb);
+   for (i = 0; i < count; i++) icons = evas_list_append(icons, array[i]);
+   free(array);
+   
+   evas_list_free(v->icons);
+   v->icons = icons;
+   
+   printf("done...\n");
+}
+
+void
+e_view_arrange(E_View *v)
+{
+   Evas_List l;
+   int x, y;
+   
+   x = v->spacing.window.l;
+   y = v->spacing.window.t;
+   for (l = v->icons; l; l = l->next)
+     {
+       E_Icon *ic;
+       
+       ic = l->data;
+       if ((x != v->spacing.window.l) && ((x + ic->geom.w) > v->size.w))
+         {
+            x = v->spacing.window.l;
+            y += ic->geom.h + v->spacing.icon.b;
+         }
+       ic->geom.x = x;
+       ic->geom.y = y;
+       e_view_icon_apply_xy(ic);
+       x += ic->geom.w + v->spacing.icon.s;
+     }
+}
+
+void
+e_view_resort(E_View *v)
+{
+   e_view_resort_alphabetical(v);
+   e_view_arrange(v);
+}
+
+static void
+e_view_resort_timeout(int val, void *data)
+{
+   E_View *v;
+   
+   v = data;
+   e_view_resort(v);
+   v->have_resort_queued = 0;
+}
+
+void
+e_view_queue_resort(E_View *v)
+{
+   char name[4096];
+   
+   if (v->have_resort_queued) return;
+   v->have_resort_queued = 1;
+   sprintf(name, "resort_timer.%s", v->dir);
+   e_add_event_timer(name, 1.0, e_view_resort_timeout, 0, v);
+}
+
+void
+e_view_icon_initial_show(E_Icon *ic)
+{
+   /* check if we have enuf info and we havent been shown yet */
+   if (!ic->info.icon) return;
+   if (ic->state.visible) return;
+   
+   /* first. lets figure out the size of the icon */
+   evas_get_image_size(ic->view->evas, ic->obj.icon, 
+                      &(ic->geom.icon.w), &(ic->geom.icon.h));
+   ic->geom.text.w = (int)evas_get_text_width(ic->view->evas, ic->obj.text);
+   ic->geom.text.h = (int)evas_get_text_height(ic->view->evas, ic->obj.text);
+   
+   /* now lets allocate space for it if we need to */
+   ic->geom.x = 999999;
+   ic->geom.y = 999999;
+   
+   /* if needed queue a tiemout for a resort */
+   e_view_queue_resort(ic->view);
+   
+   /* actually show the icon */
+   e_view_icon_apply_xy(ic);
+   e_view_icon_show(ic);
+}
+
+void
+e_view_icon_set_mime(E_Icon *ic, char *base, char *mime)
+{
+   int diff = 0;
+   
+   if (!ic->info.mime.base) diff = 1;
+   if (!ic->info.mime.type) diff = 1;
+   if ((ic->info.mime.base) && (strcmp(ic->info.mime.base, base))) diff = 1;
+   if ((ic->info.mime.type) && (strcmp(ic->info.mime.base, mime))) diff = 1;
+   if (!diff) return;
+   if (ic->info.mime.base) free(ic->info.mime.base);
+   if (ic->info.mime.type) free(ic->info.mime.type);
+   ic->info.mime.base = NULL;
+   ic->info.mime.type = NULL;
+   ic->info.mime.base = strdup(base);
+   ic->info.mime.type = strdup(mime);
+   
+   printf("%40s: %s/%s\n", ic->file, base, mime);
+   
+   /* effect changes here */
+   if (ic->info.custom_icon) 
+     {
+       if (ic->info.icon) free(ic->info.icon);
+       ic->info.icon = NULL;
+       ic->info.icon = strdup(ic->info.custom_icon);
+       evas_set_image_file(ic->view->evas, ic->obj.icon, ic->info.custom_icon);
+       e_view_queue_resort(ic->view);  
+       return;
+     }
+   /* find an icon */
+     {
+       char icon[4096];
+       char type[4096];        
+       char *p;
+       int done = 0;
+       
+       strcpy(type, ic->info.mime.type);
+       for (p = type; *p; p++) 
+         {
+            if (*p == '/') *p = '-';
+         }
+       do 
+         {
+            sprintf(icon, "%s/data/icons/%s/%s.db", PACKAGE_DATA_DIR,
+                    ic->info.mime.base, type);
+            if (e_file_exists(icon))
+              {
+                 done = 1;
+                 break;
+              }
+            p = strrchr(type, '-');
+            if (p) *p = 0;
+         }
+       while (p);
+       if (!done)
+         {
+            if (!e_file_exists(icon))
+              {
+                 sprintf(icon, "%s/data/icons/%s/default.db", PACKAGE_DATA_DIR,
+                         ic->info.mime.base);
+                 if (!e_file_exists(icon))
+                   sprintf(icon, "%s/data/icons/unknown/default.db", PACKAGE_DATA_DIR);
+              }
+         }
+       ic->info.icon = strdup(icon);
+     }
+   e_view_icon_update_state(ic);
+}
+
+void
+e_view_icon_set_link(E_Icon *ic, char *link)
+{
+   if ((!link) && (ic->info.link))
+     {
+       free(ic->info.link);
+       ic->info.link = NULL;
+       /* effect changes here */
+     }
+   else if (link)
+     {
+       if ((ic->info.link) && (!strcmp(ic->info.link, link)))
+         {
+            free(ic->info.link);
+            ic->info.link = strdup(link);
+            /* effect changes here */
+         }
+     }
+}
+
+void
+e_view_file_added(int id, char *file)
 {
-   E_Icon *icon;
    E_View *v;
-   /* char *realfile; */
-   /* char buf[4096]; */
 
    /* if we get a path - ignore it - its not a file in the a dir */
    if (!file) return;
@@ -470,257 +1379,85 @@ e_view_file_added(int id, char *file)
    if (!v) return;
    /* filter files here */
    if (!e_view_filter_file(v, file)) return;
-   printf("e_view_file_added(%i, \"%s\");\n", id, file);
-   icon = e_icon_new();
-   e_icon_set_filename(icon, file);
-   e_view_add_icon(v, icon);
-
-   v->changed = 1;
+   if (!e_view_find_icon_by_file(v, file))
+     {
+       E_Icon *ic;
+       
+       ic = e_view_icon_new();
+       ic->view = v;
+       ic->file = strdup(file);
+       ic->changed = 1;
+       ic->obj.icon = evas_add_image_from_file(ic->view->evas, NULL);
+       ic->obj.text = evas_add_text(ic->view->evas, "borzoib", 8, ic->file);
+       evas_set_color(ic->view->evas, ic->obj.text, 0, 0, 0, 255);
+       v->icons = evas_list_append(v->icons, ic);
+     }
 }
 
 void
 e_view_file_deleted(int id, char *file)
 {
-   E_Icon *icon;
    E_View *v;
-   /* char *realfile; */
 
+   if (!file) return;
+   if (file[0] == '/') return;
    v = e_view_find_by_monitor_id(id);
    if (!v) return;
-   icon = e_view_find_icon_by_file(v, file);
-   printf("%p %s\n", icon, file);
-   if (icon) 
-     {
-       e_view_del_icon(v, icon);
-       printf("e_view_file_deleted(%i, \"%s\");\n", id, file);
-     }
-}
-
-E_Icon *
-e_view_find_icon_by_file(E_View *v, char *file)
-{
-   Evas_List l;
    
-   for (l = v->icons; l; l = l->next)
      {
-       E_Icon *icon;
+       E_Icon *ic;
        
-       icon = l->data;
-       if (!strcmp(file, icon->file)) return icon;
+       ic = e_view_find_icon_by_file(v, file);
+       if (ic)
+         {
+            e_view_icon_hide(ic);
+            OBJ_UNREF(ic);
+            v->icons = evas_list_remove(v->icons, ic);
+            v->changed = 1;
+            e_view_queue_resort(v);
+         }
      }
-   return NULL;
 }
 
-E_Icon *
-e_view_find_icon_by_path(char *path)
+void
+e_view_file_changed(int id, char *file)
 {
-   char *dir;
-   char *file;
-   Evas_List l;
-   
-   dir = e_file_get_dir(path);
-   file = e_file_get_file(path);
-   
-   for (l = views; l; l = l->next)
+   E_View *v;
+
+   if (!file) return;
+   if (file[0] == '/') return;
+   v = e_view_find_by_monitor_id(id);
+   if (!v) return;
+
      {
-       Evas_List ll;
+       E_Icon *ic;
        
-       E_View *v;
-       v = l->data;
-       if (!strcmp(v->dir, dir))
+       ic = e_view_find_icon_by_file(v, file);
+       if (ic)
          {
-            for (ll = v->icons; ll; ll = ll->next)
-              {
-                 E_Icon *icon;
-                 
-                 icon = ll->data;
-                 if (!strcmp(file, icon->file)) 
-                   {
-                      IF_FREE(dir);
-                      IF_FREE(file);
-                      return icon;
-                   }
-              }
          }
      }
-   IF_FREE(dir);
-   IF_FREE(file);
-   return NULL;
 }
 
-static void
-e_view_handle_fs(EfsdEvent *ev)
+void
+e_view_file_moved(int id, char *file)
 {
-   switch (ev->type)
+   E_View *v;
+
+   /* never gets called ? */
+   if (!file) return;
+   printf(".!WOW!. e_view_file_moved(%i, %s);\n", id, file);
+   if (file[0] == '/') return;
+   v = e_view_find_by_monitor_id(id);
+   if (!v) return;
+   
      {
-      case EFSD_EVENT_FILECHANGE:
-       switch (ev->efsd_filechange_event.changetype)
-         {
-          case EFSD_FILE_CREATED:
-            e_view_file_added(efsd_reply_id(ev), efsd_reply_filename(ev));
-            break;
-          case EFSD_FILE_EXISTS:
-            e_view_file_added(efsd_reply_id(ev), efsd_reply_filename(ev));
-            break;
-          case EFSD_FILE_DELETED:
-            e_view_file_deleted(efsd_reply_id(ev), efsd_reply_filename(ev));
-            break;
-          case EFSD_FILE_CHANGED:
-/*          printf("EFSD_CHANGE_CHANGED: %i %s\n",
-                   ev->efsd_filechange_event.id,
-                   ev->efsd_filechange_event.file);         
-*/          break;
-          case EFSD_FILE_MOVED:
-/*          printf("EFSD_CHANGE_MOVED: %i %s\n",
-                   ev->efsd_filechange_event.id,
-                   ev->efsd_filechange_event.file);         
-*/          break;
-          case EFSD_FILE_END_EXISTS:
-              {
-                 E_View *v;
-                 
-                 v = e_view_find_by_monitor_id(efsd_reply_id(ev));
-                 if (v) v->is_listing = 0;
-                 printf("EFSD_CHANGE_END_EXISTS: %i %s\n",
-                        efsd_reply_id(ev), efsd_reply_filename(ev));
-              }
-            break;
-          default:
-            break;
-         }
-       break;
-      case EFSD_EVENT_REPLY:
-       switch (ev->efsd_reply_event.command.type)
+       E_Icon *ic;
+       
+       ic = e_view_find_icon_by_file(v, file);
+       if (ic)
          {
-          case EFSD_CMD_REMOVE:
-            break;
-          case EFSD_CMD_MOVE:
-            break;
-          case EFSD_CMD_SYMLINK:
-            break;
-          case EFSD_CMD_LISTDIR:
-            break;
-          case EFSD_CMD_MAKEDIR:
-            break;
-          case EFSD_CMD_CHMOD:
-            break;
-          case EFSD_CMD_GETFILETYPE:
-/*          printf("Getmime event %i\n",
-                   ev->efsd_reply_event.command.efsd_file_cmd.id);
-*/          if (ev->efsd_reply_event.status == SUCCESS)
-              {
-                 E_Icon *icon;
-                 
-                 icon = e_view_find_icon_by_path(efsd_reply_filename(ev));
-                 if (icon)
-                   {
-                      /* figure out icons to use */
-                      e_icon_apply_mime(icon, (char*)ev->efsd_reply_event.data);
-                      e_icon_get_icon(icon);
-                      e_icon_pre_show(icon);
-                   }
-              }
-            break;
-          case EFSD_CMD_STAT:
-/*          printf("Stat event %i stating file %s\n",
-                   ev->efsd_reply_event.command.efsd_file_cmd.id,
-                   ev->efsd_reply_event.command.efsd_file_cmd.file);
-*/            {
-                 struct stat *st;
-                 E_Icon *icon;
-                 
-                 st = (struct stat*) ev->efsd_reply_event.data;
-                 
-                 icon = e_view_find_icon_by_path(efsd_reply_filename(ev));
-                 if (icon)
-                   {
-                      char f[4096];
-
-/*                    
-                 if (S_ISREG(st->st_mode))
-                   printf("%s is a regular file.\n",
-                          ev->efsd_reply_event.command.efsd_file_cmd.file);
-                 if (S_ISLNK(st->st_mode))
-                   printf("%s is a symlink.\n",
-                          ev->efsd_reply_event.command.efsd_file_cmd.file);
-                 if (S_ISDIR(st->st_mode))
-                   printf("%s is a directory.\n",
-                          ev->efsd_reply_event.command.efsd_file_cmd.file);
-*/                    sprintf(f, "%s/%s", icon->view->dir, icon->file);
-                      /* should get mime type here */
-                      /* perhaps this flag should be part of the mime? */
-                      if (S_ISDIR(st->st_mode)) icon->info.is_dir = 1;
-                      /* this should be able to be returned by efsd */
-                      if (S_ISLNK(st->st_mode)) 
-                        {
-                           icon->info.link_get_id = 
-                             efsd_readlink(e_fs_get_connection(), f);
-                        }
-                      if ((!icon->info.link_get_id) && (!icon->info.is_dir))
-                        icon->info.is_exe = e_file_can_exec(st);
-                      icon->changed = 1;
-                      icon->view->changed = 1;
-/*                    if (!icon->info.link_get_id) 
-                        e_icon_pre_show(icon);*/
-                   }
-              }
-            break;
-          case EFSD_CMD_READLINK:
-            if (ev->efsd_reply_event.status == SUCCESS)
-              {
-                 Evas_List l;
-                 
-                 for (l = views; l; l = l->next)
-                   {
-                      E_View *v;
-                      Evas_List ll;
-                      
-                      v = l->data;
-                      for (ll = v->icons; ll; ll = ll->next)
-                        {
-                           E_Icon *icon;
-                           
-                           icon = ll->data;
-                           
-                           if (icon->info.link_get_id == efsd_reply_id(ev))
-                             {
-                                IF_FREE(icon->info.link);
-                                icon->info.link = malloc(ev->efsd_reply_event.data_len + 1);
-                                memcpy(icon->info.link, (char*)ev->efsd_reply_event.data, ev->efsd_reply_event.data_len);
-                                icon->info.link[ev->efsd_reply_event.data_len] = 0;
-                                icon->info.link_get_id = 0;
-                                if (!icon->info.link_get_id) 
-                                  e_icon_pre_show(icon);
-                                icon->changed = 1;
-                                icon->view->changed = 1;
-                                printf("link_to = %s\n", icon->info.link);
-                                goto done_readlink;
-                             }
-                        }
-                   }
-                 done_readlink:
-              }
-            break;
-          case EFSD_CMD_CLOSE:
-            break;
-          case EFSD_CMD_SETMETA:
-            break;
-          case EFSD_CMD_GETMETA:
-            break;
-          case EFSD_CMD_STARTMON_DIR:
-            printf("Startmon event %i\n", efsd_reply_id(ev));
-            break;
-          case EFSD_CMD_STARTMON_FILE:
-            printf("Startmon file event %i\n", efsd_reply_id(ev));
-            break;
-          case EFSD_CMD_STOPMON:
-            break;
-          default:
-            break;
          }
-       break;
-      default:
-       break;
      }
 }
 
@@ -742,6 +1479,11 @@ e_view_find_by_monitor_id(int id)
 void
 e_view_free(E_View *v)
 {
+   char name[4096];
+   
+   sprintf(name, "resort_timer.%s", v->dir);
+   e_del_event_timer(name);
+   
    views = evas_list_remove(views, v);
    if (v->restarter)
      e_fs_del_restart_handler(v->restarter);
@@ -774,45 +1516,30 @@ e_view_new(void)
    v->options.back_pixmap = 0;
 #endif   
 #endif
-     {
-       Ebits_Object obj;
-       int pl, pr, pt, pb;
-       
-       pl = pr = pt = pb = 0;
-       v->spacing.inset.left   = 2;
-       v->spacing.inset.right  = 2;
-       v->spacing.inset.top    = 2;
-       v->spacing.inset.bottom = 2;
-       obj = ebits_load(PACKAGE_DATA_DIR"/data/config/appearance/default/selections/file.bits.db");
-       if (obj) 
-         {
-            ebits_get_insets(obj, &pl, &pr, &pt, &pb);
-            ebits_free(obj);
-         }
-       v->spacing.icon.left   = pl;
-       v->spacing.icon.right  = pr;
-       v->spacing.icon.top    = pt;
-       v->spacing.icon.bottom = pb;
-       v->spacing.spacing.left   = 1;
-       v->spacing.spacing.right  = 1;
-       v->spacing.spacing.top    = 1;
-       v->spacing.spacing.bottom = 1;
-     }
-   views = evas_list_append(views, v);
+   v->select.config.grad_size.l = 8;
+   v->select.config.grad_size.r = 8;
+   v->select.config.grad_size.t = 8;
+   v->select.config.grad_size.b = 8;
+#define SETCOL(_member, _r, _g, _b, _a) \
+_member.r = _r; _member.g = _g; _member.b = _b; _member.a = _a;
+   SETCOL(v->select.config.edge_l, 0, 0, 0, 255);
+   SETCOL(v->select.config.edge_r, 0, 0, 0, 255);
+   SETCOL(v->select.config.edge_t, 0, 0, 0, 255);
+   SETCOL(v->select.config.edge_b, 0, 0, 0, 255);
+   SETCOL(v->select.config.middle, 255, 255, 255, 100);
+   SETCOL(v->select.config.grad_l, 255, 255, 255, 100);
+   SETCOL(v->select.config.grad_r, 255, 255, 255, 100);
+   SETCOL(v->select.config.grad_t, 255, 255, 255, 100);
+   SETCOL(v->select.config.grad_b, 255, 255, 255, 100);
 
-   /*
-     {
-       E_Shelf *sh;
-       
-       sh = e_shelf_new();
-       e_shelf_set_name(sh, "Test Shelf");
-       e_shelf_set_view(sh, v);
-       e_shelf_show(sh);
-       e_shelf_move(sh, 10, 10);
-       e_shelf_resize(sh, 500, 350);
-       v->shelves = evas_list_append(v->shelves, sh);
-     }
-   */
+   v->spacing.window.l = 3;
+   v->spacing.window.r = 3;
+   v->spacing.window.t = 3;
+   v->spacing.window.b = 3;
+   v->spacing.icon.s = 5;
+   v->spacing.icon.g = 5;
+   v->spacing.icon.b = 5;
+   views = evas_list_append(views, v);
    return v;   
 }
 
@@ -845,55 +1572,6 @@ e_view_set_dir(E_View *v, char *dir)
 }
 
 void
-e_view_scroll(E_View *v, int dx, int dy)
-{
-   Evas_List l;
-   
-   v->viewport.x -= dx;
-   v->viewport.y -= dy;
-   for (l = v->icons; l; l = l->next)
-     {
-       E_Icon *icon;
-       int x, y;
-       
-       icon = l->data;
-       e_icon_get_xy(icon, &x, &y);
-       e_icon_set_xy(icon, x + dx, y + dy);
-     }
-   v->changed = 1;
-}
-
-void
-e_view_scroll_to(E_View *v, int x, int y)
-{
-   e_view_scroll(v, v->viewport.x - x, v->viewport.y - y);
-}
-
-void
-e_view_add_icon(E_View *v, E_Icon *icon)
-{
-   if (icon->view) return;
-   icon->view = v;
-   e_icon_realize(icon);
-   v->changed = 1;
-   v->icons = evas_list_append(v->icons, icon);
-/*   e_shelf_add_icon(v->shelves->data, icon); */
-}
-
-void
-e_view_del_icon(E_View *v, E_Icon *icon)
-{
-   if (!icon->view) return;
-/*   e_shelf_del_icon(v->shelves->data, icon); */
-   e_icon_unrealize(icon);
-   OBJ_UNREF(icon);
-   icon->view = NULL;
-   icon->changed = 1;
-   v->changed = 1;
-   v->icons = evas_list_remove(v->icons, icon);
-}
-
-void
 e_view_realize(E_View *v)
 {
    int max_colors = 216;
@@ -934,7 +1612,8 @@ e_view_realize(E_View *v)
    v->obj_bg = evas_add_rectangle(v->evas);
    evas_callback_add(v->evas, v->obj_bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v);
    evas_callback_add(v->evas, v->obj_bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v);
-   evas_set_layer(v->evas, v->obj_bg, 1);
+   evas_callback_add(v->evas, v->obj_bg, CALLBACK_MOUSE_MOVE, e_bg_move_cb, v);
+   evas_set_layer(v->evas, v->obj_bg, 100);
    evas_move(v->evas, v->obj_bg, 0, 0);
    evas_resize(v->evas, v->obj_bg, 999999, 999999);
    evas_set_color(v->evas, v->obj_bg, 0, 0, 0, 0);
@@ -944,6 +1623,7 @@ e_view_realize(E_View *v)
                       XEV_EXPOSE | XEV_MOUSE_MOVE | 
                       XEV_BUTTON | XEV_IN_OUT | XEV_KEY);
    e_window_show(v->win.main);
+   
      {
        char *dir;
        
@@ -953,48 +1633,10 @@ e_view_realize(E_View *v)
        IF_FREE(dir);
      }
    
-   if (v->shelves)
-     {
-       Evas_List l;
-       
-       for (l = v->shelves; l; l = l->next)
-         {
-            E_Shelf *sh;
-            
-            sh = l->data;
-            e_shelf_realize(sh);
-         }
-     }
-   
-  /* FIXME: hack to test entry boxes */
-/*   
-     {
-       entry = e_entry_new();
-       e_entry_set_evas(entry, v->evas);
-       e_entry_set_layer(entry, 100);
-       e_entry_move(entry, 100, 100);
-       e_entry_resize(entry, 100, 24);
-       e_entry_set_focus(entry, 1);
-       e_entry_show(entry);
-       e_entry_set_text(entry, "Some Test Entry Text... Play with me!");
-         {
-            int ew, eh;
-            
-            e_entry_query_max_size(entry, &ew, &eh);
-            e_entry_resize(entry, ew, eh);
-         }
-     }
-*/   
    v->changed = 1;
 }
 
 void
-e_view_unrealize(E_View *v)
-{
-   if (!v->evas) return;
-}
-
-void
 e_view_update(E_View *v)
 {
    Evas_List l;
@@ -1006,7 +1648,11 @@ e_view_update(E_View *v)
             E_Icon *icon;
             
             icon = l->data;
-            e_icon_update(icon);
+         }
+       if (v->drag.update)
+         {
+            e_window_move(v->drag.win, v->drag.x, v->drag.y);
+            v->drag.update = 0;
          }
      }
    if (v->options.back_pixmap)
@@ -1014,6 +1660,8 @@ e_view_update(E_View *v)
        Imlib_Updates up;
        
        up = evas_render_updates(v->evas);
+       /* special code to handle if we are double buffering to a pixmap */
+       /* and clear sections of the window if they got updated */
        if (up)
          {
             Imlib_Updates u;
@@ -1033,6 +1681,186 @@ e_view_update(E_View *v)
    v->changed = 0;
 }
 
+
+static void
+e_view_handle_fs(EfsdEvent *ev)
+{
+   switch (ev->type)
+     {
+      case EFSD_EVENT_FILECHANGE:
+       switch (ev->efsd_filechange_event.changetype)
+         {
+          case EFSD_FILE_CREATED:
+/*          printf("EFSD_FILE_CREATED: %i %s\n",
+                   ev->efsd_filechange_event.id,
+                   ev->efsd_filechange_event.file);         
+*/          e_view_file_added(ev->efsd_filechange_event.id, 
+                              ev->efsd_filechange_event.file);
+            break;
+          case EFSD_FILE_EXISTS:
+/*          printf("EFSD_FILE_EXISTS: %i %s\n",
+                   ev->efsd_filechange_event.id,
+                   ev->efsd_filechange_event.file);         
+*/          e_view_file_added(ev->efsd_filechange_event.id, 
+                              ev->efsd_filechange_event.file);
+            break;
+          case EFSD_FILE_DELETED:
+/*          printf("EFSD_FILE_DELETED: %i %s\n",
+                   ev->efsd_filechange_event.id,
+                   ev->efsd_filechange_event.file);         
+*/          e_view_file_deleted(ev->efsd_filechange_event.id, 
+                                ev->efsd_filechange_event.file);
+            break;
+          case EFSD_FILE_CHANGED:
+/*          printf("EFSD_CHANGE_CHANGED: %i %s\n",
+                   ev->efsd_filechange_event.id,
+                   ev->efsd_filechange_event.file);         
+*/          e_view_file_changed(ev->efsd_filechange_event.id, 
+                                ev->efsd_filechange_event.file);
+            break;
+          case EFSD_FILE_MOVED:
+/*          printf("EFSD_CHANGE_MOVED: %i %s\n",
+                   ev->efsd_filechange_event.id,
+                   ev->efsd_filechange_event.file);         
+*/          e_view_file_moved(ev->efsd_filechange_event.id, 
+                              ev->efsd_filechange_event.file);
+            break;
+          case EFSD_FILE_END_EXISTS:
+              {
+                 E_View *v;
+                 
+                 v = e_view_find_by_monitor_id(ev->efsd_filechange_event.id);
+                 if (v) v->is_listing = 0;
+/*               printf("EFSD_CHANGE_END_EXISTS: %i %s\n",
+                        ev->efsd_filechange_event.id,
+                        ev->efsd_filechange_event.file);            
+*/            }
+            break;
+          default:
+            break;
+         }
+       break;
+      case EFSD_EVENT_REPLY:
+       switch (ev->efsd_reply_event.command.type)
+         {
+          case EFSD_CMD_REMOVE:
+            break;
+          case EFSD_CMD_MOVE:
+            break;
+          case EFSD_CMD_SYMLINK:
+            break;
+          case EFSD_CMD_LISTDIR:
+            break;
+          case EFSD_CMD_MAKEDIR:
+            break;
+          case EFSD_CMD_CHMOD:
+            break;
+          case EFSD_CMD_GETFILETYPE:
+/*          printf("Getmime event %i\n",
+                   ev->efsd_reply_event.command.efsd_file_cmd.id);
+*/          if (ev->efsd_reply_event.status == SUCCESS)
+              {
+                 E_Icon *ic;
+                 E_View *v;
+                 char *file, *file2;
+                 
+                 file = NULL;
+                 if (ev->efsd_reply_event.command.efsd_file_cmd.files)
+                   file = ev->efsd_reply_event.command.efsd_file_cmd.files[0];
+                 if (file) 
+                   {
+                      file2 = strrchr(file, '/');
+                      if (file2) file = file2 + 1;
+                   }
+                 v = e_view_find_by_monitor_id(ev->efsd_reply_event.command.efsd_file_cmd.id);
+                 if ((v) && (file))
+                   {
+                      ic = e_view_find_icon_by_file(v, file);
+                      if ((ic) &&
+                          (ev->efsd_reply_event.data))
+                        {
+                           char *m, *p;
+                           char mime[4096], base[4096];
+                           
+                           m = ev->efsd_reply_event.data;
+                           p = strchr(m, '/');
+                           if (p)
+                             {
+                                strcpy(base, m);
+                                strcpy(mime, p + 1);
+                                p = strchr(base, '/');
+                                *p = 0;
+                             }
+                           else
+                             {
+                                strcpy(base, m);
+                                strcpy(mime, "unknown");
+                             }
+/*                         printf("MIME: %s\n", m);
+*/                         e_view_icon_set_mime(ic, base, mime);
+                           e_view_icon_initial_show(ic);
+                        }
+                   }
+              }
+            break;
+          case EFSD_CMD_STAT:
+/*          printf("Stat event %i\n",
+                   ev->efsd_reply_event.command.efsd_file_cmd.id);
+*/            {
+              }
+            break;
+          case EFSD_CMD_READLINK:
+            if (ev->efsd_reply_event.status == SUCCESS)
+              {
+                 E_Icon *ic;
+                 E_View *v;
+                 
+                 char *file, *file2;
+                 
+                 file = NULL;
+                 if (ev->efsd_reply_event.command.efsd_file_cmd.files)
+                   file = ev->efsd_reply_event.command.efsd_file_cmd.files[0];
+                 if (file) 
+                   {
+                      file2 = strrchr(file, '/');
+                      if (file2) file = file2 + 1;
+                   }
+                 v = e_view_find_by_monitor_id(ev->efsd_reply_event.command.efsd_file_cmd.id);
+                 if ((v) && (file))
+                   {
+                      ic = e_view_find_icon_by_file(v, file);
+                      if ((ic) &&
+                          (ev->efsd_reply_event.data))
+                        e_view_icon_set_link(ic, (char*)ev->efsd_reply_event.data);
+                      e_view_icon_initial_show(ic);
+                   }
+              }
+            break;
+          case EFSD_CMD_CLOSE:
+            break;
+          case EFSD_CMD_SETMETA:
+            break;
+          case EFSD_CMD_GETMETA:
+            break;
+          case EFSD_CMD_STARTMON_DIR:
+/*          printf("Startmon event %i\n",
+                   ev->efsd_reply_event.command.efsd_file_cmd.id);          
+*/          break;
+          case EFSD_CMD_STARTMON_FILE:
+/*          printf("Startmon file event %i\n",
+                   ev->efsd_reply_event.command.efsd_file_cmd.id);          
+*/          break;
+          case EFSD_CMD_STOPMON:
+            break;
+          default:
+            break;
+         }
+       break;
+      default:
+       break;
+     }
+}
+
 void
 e_view_init(void)
 {