Dragging icons on the ibar should work. If an icon is dropped outside the

ibar it is removed (but only from the .order file).


SVN revision: 14597
This commit is contained in:
sebastid 2005-05-04 11:04:08 +00:00 committed by sebastid
parent 07a635bcad
commit 0e1a615b84
5 changed files with 30 additions and 7 deletions

View File

@ -279,6 +279,7 @@ e_app_prepend_relative(E_App *add, E_App *before)
{
/* FIXME:
* - fix the path for add
* - if eapp is in trash, move it to the right place
*/
if (!before->parent) return;
@ -296,6 +297,7 @@ e_app_append(E_App *add, E_App *parent)
{
/* FIXME:
* - fix the path for add
* - if eapp is in trash, move it to the right place
*/
parent->subapps = evas_list_append(parent->subapps, add);
add->parent = parent;
@ -309,14 +311,15 @@ e_app_remove(E_App *remove)
{
/* FIXME:
* - check if this file exists, if it does, move it to trash
* - update path to eapp
*/
if (!remove->parent) return;
remove->parent->subapps = evas_list_remove(remove->parent->subapps, remove);
_e_app_save_order(remove->parent);
remove->parent = NULL;
_e_app_change(remove, E_APP_DEL);
remove->parent = NULL;
}
void

View File

@ -2454,7 +2454,8 @@ _e_border_cb_mouse_move(void *data, int type, void *event)
bd->client.icccm.class);
if (a)
{
e_drag_start(bd->zone->container, "enlightenment/border", bd,
e_drag_start(bd->zone->container,
"enlightenment/border", bd, NULL,
a->path, "icon");
evas_event_feed_mouse_up(bd->bg_evas, 1,
EVAS_BUTTON_NONE, NULL);

View File

@ -14,6 +14,7 @@ static int visible = 0;
static char *drag_type;
static void *drag_data;
static void (*drag_finished)(void *data, const char *type, int dropped);
static int _e_dnd_cb_mouse_up(void *data, int type, void *event);
static int _e_dnd_cb_mouse_move(void *data, int type, void *event);
@ -103,6 +104,7 @@ e_dnd_active(void)
void
e_drag_start(E_Container *con, const char *type, void *data,
void (*finished_cb)(void *data, const char *type, int dropped),
const char *icon_path, const char *icon)
{
Evas_List *l;
@ -140,6 +142,7 @@ e_drag_start(E_Container *con, const char *type, void *data,
drag_type = strdup(type);
drag_data = data;
drag_finished = finished_cb;
for (l = drop_handlers; l; l = l->next)
{
@ -226,6 +229,7 @@ e_drag_end(int x, int y)
{
Evas_List *l;
E_Drop_Event *ev;
int dropped;
if (drag_obj)
{
@ -251,6 +255,7 @@ e_drag_end(int x, int y)
ev->x = x;
ev->y = y;
dropped = 0;
for (l = drop_handlers; l; l = l->next)
{
E_Drop_Handler *h;
@ -264,14 +269,17 @@ e_drag_end(int x, int y)
&& E_INSIDE(x, y, h->x, h->y, h->w, h->h))
{
h->cb.drop(h->data, drag_type, ev);
dropped = 1;
}
}
(*drag_finished)(drag_data, drag_type, dropped);
free(ev);
end:
free(drag_type);
drag_type = NULL;
drag_data = NULL;
drag_finished = NULL;
}
E_Drop_Handler *

View File

@ -56,6 +56,7 @@ EAPI int e_dnd_shutdown(void);
EAPI int e_dnd_active(void);
EAPI void e_drag_start(E_Container *con, const char *type, void *data,
void (*finished_cb)(void *data, const char *type, int dropped),
const char *icon_path, const char *icon);
EAPI void e_drag_update(int x, int y);
EAPI void e_drag_end(int x, int y);

View File

@ -69,10 +69,12 @@ static void _ibar_bar_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void
static void _ibar_bar_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static int _ibar_bar_cb_timer(void *data);
static int _ibar_bar_cb_animator(void *data);
static void _ibar_bar_cb_enter(void *data, const char *type, void *event);
static void _ibar_bar_cb_move(void *data, const char *type, void *event);
static void _ibar_bar_cb_leave(void *data, const char *type, void *event);
static void _ibar_bar_cb_drop(void *data, const char *type, void *event);
static void _ibar_bar_cb_finished(void *data, const char *type, int dropped);
static void _ibar_icon_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
static void _ibar_icon_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
@ -1235,7 +1237,6 @@ _ibar_icon_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info
ev = event_info;
ic = data;
#if 0
if (drag_start)
{
double dist;
@ -1245,12 +1246,13 @@ _ibar_icon_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info
{
drag = 1;
drag_start = 0;
e_drag_start(ic->ibb->con, "enlightenment/eapp", ic->app, ic->app->path, "icon");
e_drag_start(ic->ibb->con,
"enlightenment/eapp", ic->app, _ibar_bar_cb_finished,
ic->app->path, "icon");
evas_event_feed_mouse_up(ic->ibb->evas, 1, EVAS_BUTTON_NONE, NULL);
e_app_remove(ic->app);
}
}
#endif
}
static void
@ -1516,17 +1518,25 @@ _ibar_bar_cb_drop(void *data, const char *type, void *event)
if (ic)
{
/* Add new eapp before this icon */
printf("add before: %s %s\n", app->path, ic->app->path);
e_app_prepend_relative(app, ic->app);
}
else
{
/* Add at the end */
printf("add at end: %s %s\n", app->path, ibb->ibar->apps->path);
e_app_append(app, ibb->ibar->apps);
}
}
static void
_ibar_bar_cb_finished(void *data, const char *type, int dropped)
{
/* Someone took over the eapp. */
if (dropped) return;
/* Unref the object so it will be deleted. */
e_object_unref(E_OBJECT(data));
}
static void
_ibar_bar_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change)
{