icons on the desktop... a work in progress. you will need ~/Desktop to exist

with stuff in it. i suggest copying some of the favorites files over
(home.desktop etc.)


SVN revision: 29975
This commit is contained in:
Carsten Haitzler 2007-05-13 09:12:30 +00:00
parent c19205a09a
commit 935bed067e
8 changed files with 581 additions and 63 deletions

View File

@ -537,6 +537,10 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
px = ((E_Win *)(h->obj))->x;
py = ((E_Win *)(h->obj))->y;
break;
case E_ZONE_TYPE:
px = ((E_Zone *)(h->obj))->x;
py = ((E_Zone *)(h->obj))->y;
break;
case E_BORDER_TYPE:
px = ((E_Border *)(h->obj))->x + ((E_Border *)(h->obj))->fx.x;
py = ((E_Border *)(h->obj))->y + ((E_Border *)(h->obj))->fx.y;
@ -572,6 +576,9 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
case E_WIN_TYPE:
hwin = ((E_Win *)(h->obj))->evas_win;
break;
case E_ZONE_TYPE:
hwin = ((E_Zone *)(h->obj))->container->event_win;
break;
case E_BORDER_TYPE:
hwin = ((E_Border *)(h->obj))->event_win;
break;

View File

@ -131,6 +131,7 @@ struct _E_Fm2_Icon
Evas_Coord x, y;
unsigned char start : 1;
unsigned char dnd : 1;
unsigned char src : 1;
} drag;
unsigned char realized : 1;
@ -176,6 +177,10 @@ static void _e_fm2_icons_free(Evas_Object *obj);
static void _e_fm2_regions_eval(Evas_Object *obj);
static void _e_fm2_config_free(E_Fm2_Config *cfg);
static Evas_Object *_e_fm2_file_fm2_find(const char *file);
static E_Fm2_Icon *_e_fm2_icon_find(Evas_Object *obj, const char *file);
static Evas_List *_e_fm2_uri_icon_list_get(Evas_List *uri);
static E_Fm2_Icon *_e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file, E_Fm2_Finfo *finf);
static void _e_fm2_icon_unfill(E_Fm2_Icon *ic);
static int _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf);
@ -1326,6 +1331,29 @@ _e_fm2_client_file_move(int id, const char *path, const char *dest, const char *
id, 0, 0,
(void *)d, l);
cl->req++;
if ((x != -9999) && (y != -9999))
{
E_Fm2_Custom_File *cf, cf0;
cf = e_fm2_custom_file_get(dest);
printf("CUSTOM SAVE %s %i %i\n", ecore_file_get_file(dest), x, y);
if (cf)
{
cf->geom.x = x;
cf->geom.y = y;
cf->geom.valid = 1;
}
else
{
memset(&cf0, 0, sizeof(E_Fm2_Custom_File));
cf = &cf0;
cf->geom.x = x;
cf->geom.y = y;
cf->geom.valid = 1;
}
e_fm2_custom_file_set(dest, cf);
e_fm2_custom_file_flush();
}
}
static void
@ -1353,6 +1381,9 @@ _e_fm2_client_file_symlink(int id, const char *path, const char *dest, const cha
id, 0, 0,
(void *)d, l);
cl->req++;
if ((x != -9999) && (y != -9999))
{
}
}
static void
@ -1380,6 +1411,9 @@ _e_fm2_client_file_copy(int id, const char *path, const char *dest, const char *
id, 0, 0,
(void *)d, l);
cl->req++;
if ((x != -9999) && (y != -9999))
{
}
}
static void
@ -1641,6 +1675,22 @@ _e_fm2_dev_path_map(const char *dev, const char *path)
s = (char *)e_user_homedir_get();
PRT("%s/.e/e/fileman/favorites", s);
}
else if (CMP("desktop")) {
/* this is a virtual device - it's where your favorites list is
* stored - a dir with
.desktop files or symlinks (in fact anything
* you like
*/
s = (char *)e_user_homedir_get();
if (!strcmp(path, "/"))
{
PRT("%s/Desktop", s);
}
else
{
PRT("%s/Desktop-%s", s, path);
}
}
else if (CMP("dvd") || CMP("dvd-*")) {
/* FIXME: find dvd mountpoint optionally for dvd no. X */
/* maybe make part of the device mappings config? */
@ -2052,6 +2102,87 @@ _e_fm2_icons_place_grid_icons(E_Fm2_Smart_Data *sd)
}
}
static int
_e_fm2_icons_icon_overlaps(E_Fm2_Icon *ic)
{
Evas_List *l;
E_Fm2_Icon *ic2;
for (l = ic->sd->icons; l; l = l->next)
{
ic2 = l->data;
if ((ic2 != ic) && (ic2->saved_pos))
{
if (E_INTERSECTS(ic2->x, ic2->y, ic2->w, ic2->h,
ic->x, ic->y, ic->w, ic->h))
return 1;
}
}
return 0;
}
static int
_e_fm2_icons_icon_row_ok(E_Fm2_Icon *ic)
{
if (ic->x + ic->w > ic->sd->w) return 0;
if (ic->x < 0) return 0;
if (ic->y < 0) return 0;
return 1;
}
static void
_e_fm2_icon_place_relative(E_Fm2_Icon *ic, E_Fm2_Icon *icr, int xrel, int yrel, int xa, int ya)
{
ic->x = icr->x;
ic->y = icr->y;
if (xrel > 0) ic->x += icr->w;
else if (xrel < 0) ic->x -= ic->w;
else if (xa == 1) ic->x += icr->w - ic->w;
if (yrel > 0) ic->y += icr->h;
else if (yrel < 0) ic->y -= ic->h;
else if (ya == 1) ic->y += icr->h - ic->h;
}
static void
_e_fm2_icons_place_icon(E_Fm2_Icon *ic)
{
Evas_List *l;
E_Fm2_Icon *ic2;
ic->x = 0;
ic->y = 0;
ic->saved_pos = 1;
if (!_e_fm2_icons_icon_overlaps(ic)) return;
for (l = ic->sd->icons; l; l = l->next)
{
ic2 = l->data;
if (ic2->saved_pos)
{
int x, y;
_e_fm2_icon_place_relative(ic, ic2, -1, 0, 0, 0);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
_e_fm2_icon_place_relative(ic, ic2, -1, 0, 0, 1);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
_e_fm2_icon_place_relative(ic, ic2, 0, -1, 0, 0);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
_e_fm2_icon_place_relative(ic, ic2, 0, -1, 1, 0);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
_e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 0);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
_e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 1);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
_e_fm2_icon_place_relative(ic, ic2, 0, 1, 0, 0);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
_e_fm2_icon_place_relative(ic, ic2, 0, 1, 1, 0);
if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return;
}
}
}
static void
_e_fm2_icons_place_custom_icons(E_Fm2_Smart_Data *sd)
{
@ -2065,8 +2196,9 @@ _e_fm2_icons_place_custom_icons(E_Fm2_Smart_Data *sd)
if (!ic->saved_pos)
{
/* FIXME: place using smart place fn */
ic->x = rand() % 200;
ic->y = rand() % 200;
// ic->x = rand() % 200;
// ic->y = rand() % 200;
_e_fm2_icons_place_icon(ic);
}
if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
@ -2238,6 +2370,72 @@ _e_fm2_config_free(E_Fm2_Config *cfg)
free(cfg);
}
static Evas_Object *
_e_fm2_file_fm2_find(const char *file)
{
char *dir;
Evas_List *l;
dir = ecore_file_get_dir(file);
if (!dir) return NULL;
for (l = _e_fm2_list; l; l = l->next)
{
if (!strcmp(e_fm2_real_path_get(l->data), dir))
{
free(dir);
return l->data;
}
}
free(dir);
return NULL;
}
static E_Fm2_Icon *
_e_fm2_icon_find(Evas_Object *obj, const char *file)
{
E_Fm2_Smart_Data *sd;
Evas_List *l;
E_Fm2_Icon *ic;
sd = evas_object_smart_data_get(obj);
if (!sd) return NULL;
for (l = sd->icons; l; l = l->next)
{
ic = l->data;
if (!strcmp(ic->info.file, file)) return ic;
}
return NULL;
}
static Evas_List *
_e_fm2_uri_icon_list_get(Evas_List *uri)
{
Evas_List *icons = NULL;
Evas_List *l;
for (l = uri; l; l = l->next)
{
const char *u, *path, *file;
Evas_Object *fm;
E_Fm2_Icon *ic;
u = l->data;
ic = NULL;
if (strlen(u) > 7)
{
path = u + 7;
fm = _e_fm2_file_fm2_find(path);
if (fm)
{
file = ecore_file_get_file(path);
ic = _e_fm2_icon_find(fm, file);
}
}
icons = evas_list_append(icons, ic);
}
return icons;
}
/**************************/
static E_Fm2_Icon *
@ -2248,6 +2446,7 @@ _e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file, E_Fm2_Finfo *finf)
/* create icon */
ic = E_NEW(E_Fm2_Icon, 1);
ic->info.fm = sd->obj;
ic->info.ic = ic;
ic->info.file = evas_stringshare_add(file);
ic->sd = sd;
if (!_e_fm2_icon_fill(ic, finf))
@ -2363,6 +2562,16 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf)
}
ic->info.icon_type = cf->icon.type;
}
if (cf->geom.valid)
{
ic->saved_pos = 1;
ic->x = cf->geom.x;
ic->y = cf->geom.y;
printf("CUSTOM %s - %i %i - %ix%i\n",
ic->info.file, ic->x, ic->y, ic->w, ic->h);
if (cf->geom.w > 0) ic->w = cf->geom.w;
if (cf->geom.h > 0) ic->w = cf->geom.h;
}
}
evas_event_freeze(evas_object_evas_get(ic->sd->obj));
@ -3333,6 +3542,9 @@ _e_fm2_dnd_finish(Evas_Object *obj, int refresh)
{
ic = l->data;
ic->drag.dnd = 0;
ic->drag.src = 0;
if (ic->obj) evas_object_show(ic->obj);
if (ic->obj_icon) evas_object_show(ic->obj_icon);
}
if (refresh) e_fm2_refresh(obj);
}
@ -3369,7 +3581,7 @@ _e_fm2_cb_dnd_move(void *data, const char *type, void *event)
if (E_INSIDE(ev->x, ev->y, ic->x - ic->sd->pos.x, ic->y - ic->sd->pos.y, ic->w, ic->h))
{
printf("OVER %s\n", ic->info.file);
if (ic->drag.dnd) return;
if (ic->drag.dnd) continue;
/* if list view */
if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
{
@ -3483,21 +3695,38 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
{
E_Fm2_Smart_Data *sd;
E_Event_Dnd_Drop *ev;
Evas_List *fsel, *l, *ll;
E_Fm2_Icon *ic;
Evas_List *fsel, *l, *ll, *il, *isel;
char buf[4096], *fl;
const char *fp;
Evas_Coord dx, dy;
int adjust_icons = 0;
sd = data;
if (!type) return;
if (strcmp(type, "text/uri-list")) return;
ev = (E_Event_Dnd_Drop *)event;
fsel = ev->data;
printf("DROP: %i %i\n", ev->x, ev->y);
isel = _e_fm2_uri_icon_list_get(fsel);
if (!isel) return;
for (l = fsel; l; l = l->next)
{
fl = l->data;
printf(" %s\n", fl);
}
dx = 0; dy = 0;
for (l = isel; l; l = l->next)
{
ic = l->data;
if (ic->drag.src)
{
dx = ev->x - ic->drag.x - ic->x + ic->sd->pos.x;
dy = ev->y - ic->drag.y - ic->y + ic->sd->pos.y;
printf("DND offset %i %i\n", dx, dy);
break;
}
}
/* note - logic.
* if drop file prefix path matches extra_file_source then it can be
* and indirect link - dont MOVE the file just add filename to list.
@ -3509,22 +3738,45 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
{
printf("drop all\n");
/* move file into this fm dir */
for (ll = fsel; ll; ll = ll->next)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{
ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data);
if (!fp) continue;
snprintf(buf, sizeof(buf), "%s/%s",
sd->realpath, ecore_file_get_file(fp));
printf("mv %s %s\n", (char *)fp, buf);
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, ev->x, ev->y);
if (sd->config->view.mode == E_FM2_VIEW_MODE_CUSTOM_ICONS)
if ((ic) && (sd->config->view.mode == E_FM2_VIEW_MODE_CUSTOM_ICONS))
{
/* dnd doesnt tell me all the co-ords of the icons being dragged so i can't place them accurately.
* need to fix this. ev->data probably needs to become more compelx than a list of url's
*/
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, ic->x + dx, ic->y + dy);
if (ic->sd == sd)
{
ic->x += dx;
ic->y += dy;
ic->saved_pos = 1;
adjust_icons = 1;
}
}
else
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, -9999, -9999);
evas_stringshare_del(fp);
}
if (adjust_icons)
{
sd->max.w = 0;
sd->max.h = 0;
for (l = sd->icons; l; l = l->next)
{
ic = l->data;
if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h;
}
_e_fm2_obj_icons_place(sd);
evas_object_smart_callback_call(sd->obj, "changed", NULL);
}
}
else if (sd->drop_icon) /* inot or before/after an icon */
{
@ -3532,8 +3784,9 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
if (sd->drop_after == -1) /* put into subdir in icon */
{
/* move file into dir that this icon is for */
for (ll = fsel; ll; ll = ll->next)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{
ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data);
if (!fp) continue;
/* move the file into the subdir */
@ -3552,8 +3805,9 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
{
if (sd->drop_after)
{
for (ll = evas_list_last(fsel); ll; ll = ll->prev)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{
ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data);
if (!fp) continue;
snprintf(buf, sizeof(buf), "%s/%s",
@ -3561,20 +3815,21 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
if (sd->config->view.link_drop)
{
printf("ln -s %s %s\n", (char *)fp, buf);
_e_fm2_client_file_symlink(sd->id, buf, fp, sd->drop_icon->info.file, sd->drop_after, ev->x, ev->y);
_e_fm2_client_file_symlink(sd->id, buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999);
}
else
{
printf("mv %s %s\n", (char *)fp, buf);
_e_fm2_client_file_move(sd->id, fp, buf, sd->drop_icon->info.file, sd->drop_after, ev->x, ev->y);
_e_fm2_client_file_move(sd->id, fp, buf, sd->drop_icon->info.file, sd->drop_after, -9999, -9999);
}
evas_stringshare_del(fp);
}
}
else
{
for (ll = fsel; ll; ll = ll->next)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{
ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data);
if (!fp) continue;
snprintf(buf, sizeof(buf), "%s/%s",
@ -3582,12 +3837,12 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
if (sd->config->view.link_drop)
{
printf("ln -s %s %s\n", (char *)fp, buf);
_e_fm2_client_file_symlink(sd->id, buf, fp, sd->drop_icon->info.file, sd->drop_after, ev->x, ev->y);
_e_fm2_client_file_symlink(sd->id, buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999);
}
else
{
printf("mv %s %s\n", (char *)fp, buf);
_e_fm2_client_file_move(sd->id, fp, buf, sd->drop_icon->info.file, sd->drop_after, ev->x, ev->y);
_e_fm2_client_file_move(sd->id, fp, buf, sd->drop_icon->info.file, sd->drop_after, -9999, -9999);
}
evas_stringshare_del(fp);
}
@ -3595,30 +3850,40 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
}
else /* no order file */
{
for (ll = fsel; ll; ll = ll->next)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{
ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data);
if (!fp) continue;
/* move the file into the subdir */
snprintf(buf, sizeof(buf), "%s/%s",
sd->realpath, ecore_file_get_file(fp));
printf("mv %s %s\n", (char *)fp, buf);
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, ev->x, ev->y);
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, -9999, -9999);
evas_stringshare_del(fp);
}
}
}
else
{
for (ll = fsel; ll; ll = ll->next)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{
ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data);
if (!fp) continue;
/* move the file into the subdir */
snprintf(buf, sizeof(buf), "%s/%s",
sd->realpath, ecore_file_get_file(fp));
printf("mv %s %s\n", (char *)fp, buf);
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, ev->x, ev->y);
if ((ic) && (sd->config->view.mode == E_FM2_VIEW_MODE_CUSTOM_ICONS))
{
/* dnd doesnt tell me all the co-ords of the icons being dragged so i can't place them accurately.
* need to fix this. ev->data probably needs to become more compelx than a list of url's
*/
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, ic->x + dx, ic->y + dy);
}
else
_e_fm2_client_file_move(sd->id, fp, buf, "", 0, ev->x, ev->y);
evas_stringshare_del(fp);
}
}
@ -3628,6 +3893,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
_e_fm2_dnd_drop_all_hide(sd->obj);
for (l = _e_fm2_list; l; l = l->next)
_e_fm2_dnd_finish(l->data, 0);
evas_list_free(isel);
}
/* FIXME: prototype */
@ -3791,10 +4057,12 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
{
if ((ic->sd->eobj))
{
ic->drag.x = ev->output.x;
ic->drag.y = ev->output.y;
ic->drag.x = ev->output.x - ic->x - ic->sd->x + ic->sd->pos.x;
ic->drag.y = ev->output.y - ic->y - ic->sd->y + ic->sd->pos.y;
printf("DX: %i %i\n", ic->drag.x, ic->drag.y);
ic->drag.start = 1;
ic->drag.dnd = 0;
ic->drag.src = 1;
}
_e_fm2_mouse_1_handler(ic, 0, ev->modifiers);
}
@ -3820,6 +4088,7 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
_e_fm2_mouse_1_handler(ic, 1, ev->modifiers);
ic->drag.start = 0;
ic->drag.dnd = 0;
ic->drag.src = 0;
}
ic->down_sel = 0;
}
@ -3852,8 +4121,8 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
{
int dx, dy;
dx = ev->cur.output.x - ic->drag.x;
dy = ev->cur.output.y - ic->drag.y;
dx = ev->cur.output.x - (ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x);
dy = ev->cur.output.y - (ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y);
if (((dx * dx) + (dy * dy)) >
(e_config->drag_resist * e_config->drag_resist))
{
@ -3874,6 +4143,9 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
case E_WIN_TYPE:
con = ((E_Win *)(ic->sd->eobj))->container;
break;
case E_ZONE_TYPE:
con = ((E_Zone *)(ic->sd->eobj))->container;
break;
case E_BORDER_TYPE:
con = ((E_Border *)(ic->sd->eobj))->zone->container;
break;
@ -3887,6 +4159,8 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
if (!con) return;
ic->sd->drag = 1;
ic->drag.dnd = 1;
if (ic->obj) evas_object_hide(ic->obj);
if (ic->obj_icon) evas_object_hide(ic->obj_icon);
ic->drag.start = 0;
evas_object_geometry_get(ic->obj, &x, &y, &w, &h);
realpath = e_fm2_real_path_get(ic->sd->obj);
@ -3900,6 +4174,9 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
else
snprintf(buf, sizeof(buf), "file://%s/%s", realpath, ici->file);
fsel = evas_list_append(fsel, strdup(buf));
ici->ic->drag.dnd = 1;
if (ici->ic->obj) evas_object_hide(ici->ic->obj);
if (ici->ic->obj_icon) evas_object_hide(ici->ic->obj_icon);
}
evas_list_free(sl);
d = e_drag_new(con,
@ -3944,7 +4221,9 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
edje_object_signal_emit(o2, "e,state,selected", "e");
e_drag_object_set(d, o);
e_drag_resize(d, w, h);
e_drag_start(d, ic->drag.x, ic->drag.y);
e_drag_start(d,
ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x,
ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y);
e_util_evas_fake_mouse_up_later(evas_object_evas_get(ic->sd->obj),
1);
}

View File

@ -112,6 +112,7 @@ struct _E_Fm2_Config
struct _E_Fm2_Icon_Info
{
Evas_Object *fm;
E_Fm2_Icon *ic;
const char *file;
const char *mime;
const char *label;

View File

@ -105,9 +105,6 @@ e_fwin_new(E_Container *con, const char *dev, const char *path)
e_win_resize_callback_set(fwin->win, _e_fwin_cb_resize);
fwin->win->data = fwin;
/* fm issues: */
/* FIXME: if file executable - run it */
o = edje_object_add(e_win_evas_get(fwin->win));
e_theme_edje_object_set(o, "base/theme/fileman",
"e/fileman/window/main");
@ -117,7 +114,7 @@ e_fwin_new(E_Container *con, const char *dev, const char *path)
o = e_fm2_add(e_win_evas_get(fwin->win));
fwin->fm_obj = o;
memset(&fmc, 0, sizeof(E_Fm2_Config));
#if 1
#if 0
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
fmc.icon.list.w = 24;
fmc.icon.list.h = 24;
@ -212,6 +209,134 @@ e_fwin_new(E_Container *con, const char *dev, const char *path)
return fwin;
}
EAPI E_Fwin *
e_fwin_zone_new(E_Zone *zone, const char *dev, const char *path)
{
E_Fwin *fwin;
char buf[4096];
const char *file;
Evas_Object *o;
E_Fm2_Config fmc;
fwin = E_OBJECT_ALLOC(E_Fwin, E_FWIN_TYPE, _e_fwin_free);
if (!fwin) return NULL;
fwin->zone = zone;
fwins = evas_list_append(fwins, fwin);
/*
e_win_resize_callback_set(fwin->win, _e_fwin_cb_resize);
fwin->win->data = fwin;
o = edje_object_add(e_win_evas_get(fwin->win));
e_theme_edje_object_set(o, "base/theme/fileman",
"e/fileman/window/main");
evas_object_show(o);
fwin->bg_obj = o;
*/
o = e_fm2_add(zone->container->bg_evas);
fwin->fm_obj = o;
memset(&fmc, 0, sizeof(E_Fm2_Config));
#if 0
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
fmc.icon.list.w = 24;
fmc.icon.list.h = 24;
fmc.icon.fixed.w = 1;
fmc.icon.fixed.h = 1;
#else
fmc.view.mode = E_FM2_VIEW_MODE_CUSTOM_ICONS;
fmc.icon.icon.w = 48;
fmc.icon.icon.h = 48;
fmc.icon.fixed.w = 0;
fmc.icon.fixed.h = 0;
#endif
fmc.view.open_dirs_in_place = 0;
fmc.view.selector = 0;
fmc.view.single_click = 0;
fmc.view.no_subdir_jump = 0;
fmc.icon.extension.show = 1;
fmc.list.sort.no_case = 1;
fmc.list.sort.dirs.first = 1;
fmc.list.sort.dirs.last = 0;
fmc.selection.single = 0;
fmc.selection.windows_modifiers = 0;
e_fm2_config_set(o, &fmc);
evas_object_smart_callback_add(o, "dir_changed",
_e_fwin_changed, fwin);
evas_object_smart_callback_add(o, "dir_deleted",
_e_fwin_deleted, fwin);
evas_object_smart_callback_add(o, "selected",
_e_fwin_selected, fwin);
e_fm2_icon_menu_start_extend_callback_set(o, _e_fwin_cb_menu_extend_start, fwin);
e_fm2_icon_menu_end_extend_callback_set(o, _e_fwin_menu_extend, fwin);
evas_object_show(o);
o = e_scrollframe_add(zone->container->bg_evas);
/* FIXME: this theme object will have more versions and options later
* for things like swallowing widgets/buttons ot providing them - a
* gadcon for starters for fm widgets. need to register the owning
* e_object of the gadcon so gadcon clients can get it and thus do
* things like find out what dirs/path the fwin is for etc. this will
* probably be how you add optional gadgets to fwin views like empty/full
* meters for disk usage, and other dir info/stats or controls. also it
* might be possible that we can have custom frames per dir later so need
* a way to set an edje file directly
*/
/* FIXME: allow specialised scrollframe obj per dir - get from e config,
* then look in the dir itself for a magic dot-file, if not - use theme.
* same as currently done for bg & overlay. also add to fm2 the ability
* to specify the .edj files to get the list and icon theme stuff from
*/
e_scrollframe_custom_theme_set(o, "base/theme/fileman",
"e/fileman/scrollframe/default");
evas_object_data_set(fwin->fm_obj, "fwin", fwin);
e_scrollframe_extern_pan_set(o, fwin->fm_obj,
_e_fwin_pan_set,
_e_fwin_pan_get,
_e_fwin_pan_max_get,
_e_fwin_pan_child_size_get);
evas_object_propagate_events_set(fwin->fm_obj, 0);
fwin->scrollframe_obj = o;
evas_object_move(o, fwin->zone->x, fwin->zone->y);
evas_object_resize(fwin->scrollframe_obj, fwin->zone->w, fwin->zone->h);
evas_object_show(o);
/*
o = edje_object_add(e_win_evas_get(fwin->win));
edje_object_part_swallow(fwin->bg_obj, "e.swallow.bg", o);
evas_object_pass_events_set(o, 1);
fwin->under_obj = o;
o = edje_object_add(e_win_evas_get(fwin->win));
edje_object_part_swallow(e_scrollframe_edje_object_get(fwin->scrollframe_obj), "e.swallow.overlay", o);
evas_object_pass_events_set(o, 1);
fwin->over_obj = o;
*/
e_fm2_window_object_set(fwin->fm_obj, E_OBJECT(fwin->zone));
evas_object_focus_set(fwin->fm_obj, 1);
e_fm2_path_set(fwin->fm_obj, dev, path);
/*
snprintf(buf, sizeof(buf), "_fwin::/%s", e_fm2_real_path_get(fwin->fm_obj));
e_win_name_class_set(fwin->win, "E", buf);
*/
file = ecore_file_get_file(e_fm2_real_path_get(fwin->fm_obj));
if (file)
snprintf(buf, sizeof(buf), "%s", file);
else
snprintf(buf, sizeof(buf), "%s", e_fm2_real_path_get(fwin->fm_obj));
/*
e_win_title_set(fwin->win, buf);
e_win_size_min_set(fwin->win, 24, 24);
e_win_resize(fwin->win, 280, 200);
e_win_show(fwin->win);
*/
return fwin;
}
/* local subsystem functions */
static void
_e_fwin_free(E_Fwin *fwin)
@ -221,7 +346,7 @@ _e_fwin_free(E_Fwin *fwin)
e_object_del(E_OBJECT(fwin->fad->dia));
fwin->fad = NULL;
}
e_object_del(E_OBJECT(fwin->win));
if (fwin->win) e_object_del(E_OBJECT(fwin->win));
fwins = evas_list_remove(fwins, fwin);
if (fwin->wallpaper_file) evas_stringshare_del(fwin->wallpaper_file);
if (fwin->overlay_file) evas_stringshare_del(fwin->overlay_file);
@ -245,8 +370,17 @@ _e_fwin_cb_resize(E_Win *win)
E_Fwin *fwin;
fwin = win->data;
evas_object_resize(fwin->bg_obj, fwin->win->w, fwin->win->h);
evas_object_resize(fwin->scrollframe_obj, fwin->win->w, fwin->win->h);
if (fwin->bg_obj)
{
if (fwin->win)
evas_object_resize(fwin->bg_obj, fwin->win->w, fwin->win->h);
else if (fwin->zone)
evas_object_resize(fwin->bg_obj, fwin->zone->w, fwin->zone->h);
}
if (fwin->win)
evas_object_resize(fwin->scrollframe_obj, fwin->win->w, fwin->win->h);
else if (fwin->zone)
evas_object_resize(fwin->scrollframe_obj, fwin->zone->w, fwin->zone->h);
}
static void
@ -540,7 +674,10 @@ _e_fwin_cb_open(void *data, E_Dialog *dia)
}
}
evas_list_free(selected);
e_exec(fad->fwin->win->border->zone, desktop, NULL, files, "fwin");
if (fad->fwin->win)
e_exec(fad->fwin->win->border->zone, desktop, NULL, files, "fwin");
else if (fad->fwin->zone)
e_exec(fad->fwin->zone, desktop, NULL, files, "fwin");
ecore_list_destroy(files);
}
chdir(pcwd);
@ -670,24 +807,42 @@ _e_fwin_file_exec(E_Fwin *fwin, E_Fm2_Icon_Info *ici, E_Fwin_Exec_Type ext)
case E_FWIN_EXEC_NONE:
break;
case E_FWIN_EXEC_DIRECT:
e_exec(fwin->win->border->zone, NULL, ici->file, NULL, "fwin");
if (fwin->win)
e_exec(fwin->win->border->zone, NULL, ici->file, NULL, "fwin");
else if (fwin->zone)
e_exec(fwin->zone, NULL, ici->file, NULL, "fwin");
break;
case E_FWIN_EXEC_SH:
snprintf(buf, sizeof(buf), "/bin/sh %s", e_util_filename_escape(ici->file));
e_exec(fwin->win->border->zone, NULL, buf, NULL, NULL);
if (fwin->win)
e_exec(fwin->win->border->zone, NULL, buf, NULL, NULL);
else if (fwin->zone)
e_exec(fwin->zone, NULL, buf, NULL, NULL);
break;
case E_FWIN_EXEC_TERMINAL_DIRECT:
snprintf(buf, sizeof(buf), "%s %s", e_config->exebuf_term_cmd, e_util_filename_escape(ici->file));
e_exec(fwin->win->border->zone, NULL, buf, NULL, NULL);
if (fwin->win)
e_exec(fwin->win->border->zone, NULL, buf, NULL, NULL);
else if (fwin->zone)
e_exec(fwin->zone, NULL, buf, NULL, NULL);
break;
case E_FWIN_EXEC_TERMINAL_SH:
snprintf(buf, sizeof(buf), "%s /bin/sh %s", e_config->exebuf_term_cmd, e_util_filename_escape(ici->file));
e_exec(fwin->win->border->zone, NULL, buf, NULL, NULL);
if (fwin->win)
e_exec(fwin->win->border->zone, NULL, buf, NULL, NULL);
else if (fwin->zone)
e_exec(fwin->zone, NULL, buf, NULL, NULL);
break;
case E_FWIN_EXEC_DESKTOP:
snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->fm_obj), ici->file);
desktop = efreet_desktop_get(buf);
if (desktop) e_exec(fwin->win->border->zone, desktop, NULL, NULL, NULL);
if (desktop)
{
if (fwin->win)
e_exec(fwin->win->border->zone, desktop, NULL, NULL, NULL);
else if (fwin->zone)
e_exec(fwin->zone, desktop, NULL, NULL, NULL);
}
break;
default:
break;
@ -723,13 +878,28 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
{
ici = l->data;
if ((ici->link) && (ici->mount))
e_fwin_new(fwin->win->container, ici->link, "/");
{
if (fwin->win)
e_fwin_new(fwin->win->container, ici->link, "/");
else if (fwin->zone)
e_fwin_new(fwin->zone->container, ici->link, "/");
}
else if ((ici->link) && (ici->removable))
e_fwin_new(fwin->win->container, ici->link, "/");
{
if (fwin->win)
e_fwin_new(fwin->win->container, ici->link, "/");
else if (fwin->zone)
e_fwin_new(fwin->zone->container, ici->link, "/");
}
else if (ici->real_link)
{
if (S_ISDIR(ici->statinfo.st_mode))
e_fwin_new(fwin->win->container, NULL, ici->real_link);
{
if (fwin->win)
e_fwin_new(fwin->win->container, NULL, ici->real_link);
else if (fwin->zone)
e_fwin_new(fwin->zone->container, NULL, ici->real_link);
}
else
need_dia = 1;
}
@ -738,7 +908,12 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
snprintf(buf, sizeof(buf), "%s/%s",
e_fm2_real_path_get(fwin->fm_obj), ici->file);
if (S_ISDIR(ici->statinfo.st_mode))
e_fwin_new(fwin->win->container, NULL, buf);
{
if (fwin->win)
e_fwin_new(fwin->win->container, NULL, buf);
else
e_fwin_new(fwin->zone->container, NULL, buf);
}
else
need_dia = 1;
}
@ -852,8 +1027,16 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
}
if (desktop)
{
if (e_exec(fwin->win->border->zone, desktop, NULL, files_list, "fwin"))
need_dia = 0;
if (fwin->win)
{
if (e_exec(fwin->win->border->zone, desktop, NULL, files_list, "fwin"))
need_dia = 0;
}
else if (fwin->zone)
{
if (e_exec(fwin->zone, desktop, NULL, files_list, "fwin"))
need_dia = 0;
}
}
ecore_list_destroy(files_list);
@ -869,8 +1052,12 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
evas_list_free(mlist);
fad = E_NEW(E_Fwin_Apps_Dialog, 1);
dia = e_dialog_new(fwin->win->border->zone->container,
"E", "_fwin_open_apps");
if (fwin->win)
dia = e_dialog_new(fwin->win->border->zone->container,
"E", "_fwin_open_apps");
else if (fwin->zone)
dia = e_dialog_new(fwin->zone->container,
"E", "_fwin_open_apps");
e_dialog_title_set(dia, _("Open with..."));
e_dialog_border_icon_set(dia, "enlightenment/applications");
e_dialog_button_add(dia, _("Open"), "enlightenment/open",

View File

@ -17,6 +17,7 @@ struct _E_Fwin
E_Object e_obj_inherit;
E_Win *win;
E_Zone *zone;
Evas_Object *scrollframe_obj;
Evas_Object *fm_obj;
Evas_Object *bg_obj;
@ -45,6 +46,7 @@ struct _E_Fwin_Apps_Dialog
EAPI int e_fwin_init (void);
EAPI int e_fwin_shutdown (void);
EAPI E_Fwin *e_fwin_new (E_Container *con, const char *dev, const char *path);
EAPI E_Fwin *e_fwin_zone_new (E_Zone *zone, const char *dev, const char *path);
#endif
#endif

View File

@ -384,24 +384,6 @@ main(int argc, char **argv)
exit(-1);
}
TS("xinerama");
if (!e_xinerama_init())
{
e_error_message_show(_("Enlightenment cannot setup xinerama wrapping.\n"
"This should not happen."));
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_xinerama_shutdown);
/* ecore_x_grab(); */
ecore_x_io_error_handler_set(_e_main_cb_x_fatal, NULL);
TS("x hints");
/* Init window manager hints */
e_hints_init();
TS("x hints done");
TS("ecore_con");
/* init generic communications */
if (!ecore_con_init())
@ -420,6 +402,24 @@ main(int argc, char **argv)
}
_e_main_shutdown_push(ecore_ipc_shutdown);
TS("xinerama");
if (!e_xinerama_init())
{
e_error_message_show(_("Enlightenment cannot setup xinerama wrapping.\n"
"This should not happen."));
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_xinerama_shutdown);
/* ecore_x_grab(); */
ecore_x_io_error_handler_set(_e_main_cb_x_fatal, NULL);
TS("x hints");
/* Init window manager hints */
e_hints_init();
TS("x hints done");
TS("efreet");
/* init FDO desktop */
if (!efreet_init())

View File

@ -8,6 +8,7 @@
*/
static void _e_zone_free(E_Zone *zone);
static void _e_zone_fm_add(E_Zone *zone, const char *dev, const char *path);
static void _e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_zone_cb_bg_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info);
@ -17,6 +18,7 @@ static int _e_zone_cb_mouse_out(void *data, int type, void *event);
static int _e_zone_cb_timer(void *data);
static int _e_zone_cb_desk_show(void *data, int type, void *event);
static void _e_zone_update_flip(E_Zone *zone);
static int _e_zone_fm_deferred(void *data);
EAPI int E_EVENT_ZONE_DESK_COUNT_SET = 0;
EAPI int E_EVENT_POINTER_WARP = 0;
@ -123,6 +125,8 @@ e_zone_new(E_Container *con, int num, int x, int y, int w, int h)
e_zone_desk_count_set(zone,
e_config->zone_desks_x_count,
e_config->zone_desks_y_count);
zone->deferred_fm_timer = ecore_timer_add(2.0, _e_zone_fm_deferred, zone);
_e_zone_update_flip(zone);
return zone;
@ -601,6 +605,16 @@ _e_zone_free(E_Zone *zone)
Evas_List *l;
int x, y;
if (zone->deferred_fm_timer)
{
ecore_timer_del(zone->deferred_fm_timer);
zone->deferred_fm_timer = NULL;
}
if (zone->bg_fwin)
{
e_object_del(E_OBJECT(zone->bg_fwin));
zone->bg_fwin = NULL;
}
if (zone->black_ecore_evas)
{
e_canvas_del(zone->black_ecore_evas);
@ -642,6 +656,12 @@ _e_zone_free(E_Zone *zone)
free(zone);
}
static void
_e_zone_fm_add(E_Zone *zone, const char *dev, const char *path)
{
zone->bg_fwin = e_fwin_zone_new(zone, dev, path);
}
static void
_e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
@ -948,3 +968,22 @@ _e_zone_update_flip(E_Zone *zone)
ecore_x_window_hide(zone->flip.bottom);
}
}
static int
_e_zone_fm_deferred(void *data)
{
E_Zone *zone;
zone = data;
if ((zone->container->num == 0) && (zone->num == 0))
_e_zone_fm_add(zone, "desktop", "/");
else
{
char buf[256];
snprintf(buf, sizeof(buf), "%i", zone->container->num + zone->num);
_e_zone_fm_add(zone, "desktop", buf);
}
zone->deferred_fm_timer = NULL;
return 0;
}

View File

@ -33,6 +33,8 @@ struct _E_Zone
Evas_Object *prev_bg_object;
Evas_Object *transition_object;
E_Fwin *bg_fwin;
int desk_x_count, desk_y_count;
int desk_x_current, desk_y_current;
E_Desk **desks;
@ -51,6 +53,7 @@ struct _E_Zone
Ecore_Evas *black_ecore_evas;
Evas *black_evas;
Ecore_X_Window black_win;
Ecore_Timer *deferred_fm_timer;
};
struct _E_Event_Zone_Desk_Count_Set