Enlightenment CVS committal
Author : sebastid
Project : e17
Module : apps/e
Dir : e17/apps/e/src/modules/ibar
Modified Files:
e_mod_main.c e_mod_main.h
Log Message:
It's possible to add several types for one drop handler.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_main.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -3 -r1.80 -r1.81
--- e_mod_main.c 29 Sep 2005 15:01:04 -0000 1.80
+++ e_mod_main.c 5 Oct 2005 17:56:35 -0000 1.81
@@ -72,9 +72,7 @@
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_eapp(void *data, const char *type, void
*event);
-static void _ibar_bar_cb_drop_border(void *data, const char *type, void
*event);
-static void _ibar_bar_cb_drop_file(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(E_Drag *drag, int dropped);
static void _ibar_icon_cb_intercept_move(void *data, Evas_Object *o,
Evas_Coord x, Evas_Coord y);
@@ -463,6 +461,7 @@
Evas_Object *o;
E_Gadman_Policy policy;
Evas_Coord x, y, w, h;
+ const char *drop[] = { "enlightenment/eapp", "enlightenment/border",
"text/uri-list" };
ibb = E_NEW(IBar_Bar, 1);
if (!ibb) return NULL;
@@ -552,27 +551,13 @@
ibb->icon_inset.b = 100 - (y + h);
evas_object_del(o);
- ibb->drop_eapp = e_drop_handler_add(ibb,
- _ibar_bar_cb_enter, _ibar_bar_cb_move,
- _ibar_bar_cb_leave,
_ibar_bar_cb_drop_eapp,
- "enlightenment/eapp",
- ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
- ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
- ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
- ibb->drop_border = e_drop_handler_add(ibb,
- _ibar_bar_cb_enter, _ibar_bar_cb_move,
- _ibar_bar_cb_leave,
_ibar_bar_cb_drop_border,
- "enlightenment/border",
- ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
- ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
- ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
- ibb->drop_file = e_drop_handler_add(ibb,
- _ibar_bar_cb_enter, _ibar_bar_cb_move,
- _ibar_bar_cb_leave,
_ibar_bar_cb_drop_file,
- "enlightenment/x-file",
- ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
- ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
- ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
+ ibb->drop_handler = e_drop_handler_add(ibb,
+ _ibar_bar_cb_enter, _ibar_bar_cb_move,
+ _ibar_bar_cb_leave, _ibar_bar_cb_drop,
+ drop, 3,
+ ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
+ ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
+ ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
ibb->gmc = e_gadman_client_new(ibb->con->gadman);
e_gadman_client_domain_set(ibb->gmc, "module.ibar", bar_count++);
@@ -613,9 +598,7 @@
while (ibb->icons)
_ibar_icon_free(ibb->icons->data);
- e_drop_handler_del(ibb->drop_eapp);
- e_drop_handler_del(ibb->drop_border);
- e_drop_handler_del(ibb->drop_file);
+ e_drop_handler_del(ibb->drop_handler);
if (ibb->timer) ecore_timer_del(ibb->timer);
if (ibb->animator) ecore_animator_del(ibb->animator);
@@ -1634,122 +1617,62 @@
}
static void
-_ibar_bar_cb_drop_eapp(void *data, const char *type, void *event)
+_ibar_bar_cb_drop(void *data, const char *type, void *event)
{
E_Event_Dnd_Drop *ev;
- E_App *app;
+ E_App *app = NULL;
+ Evas_List *l = NULL;
IBar_Bar *ibb;
IBar_Icon *ic;
ev = event;
ibb = data;
- app = ev->data;
-
- /* add dropped element */
- ic = _ibar_icon_pos_find(ibb, ev->x, ev->y);
-
- /* remove drag marker */
- e_box_freeze(ibb->box_object);
- e_box_unpack(ibb->drag_object);
- evas_object_del(ibb->drag_object);
- ibb->drag_object = NULL;
- evas_object_del(ibb->drag_object_overlay);
- ibb->drag_object_overlay = NULL;
- e_box_thaw(ibb->box_object);
-
- _ibar_bar_frame_resize(ibb);
-
- if (ic)
+ if (!strcmp(type, "enlightenment/eapp"))
{
- /* Add new eapp before this icon */
- e_app_prepend_relative(app, ic->app);
+ app = ev->data;
}
- else
+ else if (!strcmp(type, "enlightenment/border"))
{
- /* Add at the end */
- e_app_append(app, ibb->ibar->apps);
- }
-}
-
-static void
-_ibar_bar_cb_drop_border(void *data, const char *type, void *event)
-{
- E_Event_Dnd_Drop *ev;
- E_App *app;
- IBar_Bar *ibb;
- IBar_Icon *ic;
+ E_Border *bd;
- E_Border *bd;
- const char *title;
+ bd = ev->data;
+ app = bd->app;
- ev = event;
- ibb = data;
- bd = ev->data;
- title = e_border_name_get(bd);
- app = e_app_window_name_class_title_role_find(bd->client.icccm.name,
- bd->client.icccm.class,
- title,
bd->client.icccm.window_role);
- if (!app)
- {
- app = e_app_launch_id_pid_find(bd->client.netwm.startup_id,
- bd->client.netwm.pid);
- }
- if (!app)
- {
- E_Dialog *dia;
-
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()));
- e_dialog_title_set(dia, _("Cannot add icon"));
- e_dialog_text_set(dia,
- _("You tried to drop an icon of an application
that<br>"
- "does not have a matching application file.<br>"
- "<br>"
- "The icon cannot be added to IBar."
- ));
- e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
- e_dialog_button_focus_num(dia, 1);
- e_win_centered_set(dia->win, 1);
- e_dialog_show(dia);
- return;
- }
- /* add dropped element */
- ic = _ibar_icon_pos_find(ibb, ev->x, ev->y);
- if (!ic) return;
-
- /* remove drag marker */
- e_box_freeze(ibb->box_object);
- e_box_unpack(ibb->drag_object);
- evas_object_del(ibb->drag_object);
- ibb->drag_object = NULL;
- evas_object_del(ibb->drag_object_overlay);
- ibb->drag_object_overlay = NULL;
- e_box_thaw(ibb->box_object);
-
- _ibar_bar_frame_resize(ibb);
+ if (!app)
+ {
+ app =
e_app_window_name_class_title_role_find(bd->client.icccm.name,
+
bd->client.icccm.class,
+
e_border_name_get(bd),
+
bd->client.icccm.window_role);
+ }
+ if (!app)
+ {
+ app = e_app_launch_id_pid_find(bd->client.netwm.startup_id,
+ bd->client.netwm.pid);
+ }
+ if (!app)
+ {
+ E_Dialog *dia;
- if (ic)
- {
- /* Add new eapp before this icon */
- e_app_prepend_relative(app, ic->app);
+ dia =
e_dialog_new(e_container_current_get(e_manager_current_get()));
+ e_dialog_title_set(dia, _("Cannot add icon"));
+ e_dialog_text_set(dia,
+ _("You tried to drop an icon of an application
that<br>"
+ "does not have a matching application
file.<br>"
+ "<br>"
+ "The icon cannot be added to IBar."
+ ));
+ e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
+ e_dialog_button_focus_num(dia, 1);
+ e_win_centered_set(dia->win, 1);
+ e_dialog_show(dia);
+ return;
+ }
}
- else
+ else if (!strcmp(type, "text/uri-list"))
{
- /* Add at the end */
- e_app_append(app, ibb->ibar->apps);
+ l = ev->data;
}
-}
-
-static void
-_ibar_bar_cb_drop_file(void *data, const char *type, void *event)
-{
- E_Event_Dnd_Drop *ev;
- IBar_Bar *ibb;
- IBar_Icon *ic;
- Evas_List *l;
-
- ev = event;
- ibb = data;
- l = ev->data;
/* add dropped element */
ic = _ibar_icon_pos_find(ibb, ev->x, ev->y);
@@ -1768,12 +1691,18 @@
if (ic)
{
/* Add new eapp before this icon */
- e_app_files_prepend_relative(l, ic->app);
+ if (app)
+ e_app_prepend_relative(app, ic->app);
+ else if (l)
+ e_app_files_prepend_relative(l, ic->app);
}
else
{
/* Add at the end */
- e_app_files_append(l, ibb->ibar->apps);
+ if (app)
+ e_app_append(app, ibb->ibar->apps);
+ else if (l)
+ e_app_files_append(l, ibb->ibar->apps);
}
}
@@ -1809,15 +1738,7 @@
_ibar_bar_follower_reset(ibb);
_ibar_bar_timer_handle(ibb);
- e_drop_handler_geometry_set(ibb->drop_eapp,
- ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
- ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
- ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
- e_drop_handler_geometry_set(ibb->drop_border,
- ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
- ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
- ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
- e_drop_handler_geometry_set(ibb->drop_file,
+ e_drop_handler_geometry_set(ibb->drop_handler,
ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_main.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- e_mod_main.h 24 Sep 2005 13:42:05 -0000 1.22
+++ e_mod_main.h 5 Oct 2005 17:56:35 -0000 1.23
@@ -73,9 +73,7 @@
Config_Bar *conf;
- E_Drop_Handler *drop_eapp;
- E_Drop_Handler *drop_border;
- E_Drop_Handler *drop_file;
+ E_Drop_Handler *drop_handler;
};
struct _IBar_Icon
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs