Enlightenment CVS committal Author : handyande Project : e17 Module : apps/e_utils
Dir : e17/apps/e_utils/src/bin/eapp_edit Modified Files: Makefile.am eapp_edit_main.c Log Message: Make the icon in eapp_edit a drag source for .eapp s - try dragging this icon over the latest engage module :) :) =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/eapp_edit/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- Makefile.am 22 Dec 2004 21:35:19 -0000 1.2 +++ Makefile.am 24 Mar 2005 23:35:32 -0000 1.3 @@ -6,6 +6,7 @@ -I$(top_srcdir)/lib \ @ewl_cflags@ \ @eet_cflags@ \ [EMAIL PROTECTED]@ \ @engrave_cflags@ bin_PROGRAMS = e_util_eapp_edit @@ -13,5 +14,5 @@ e_util_eapp_edit_SOURCES = \ eapp_edit_main.c -e_util_eapp_edit_LDADD = @ewl_libs@ @eet_libs@ @engrave_libs@ +e_util_eapp_edit_LDADD = @ewl_libs@ @eet_libs@ @ecore_libs@ @engrave_libs@ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/eapp_edit/eapp_edit_main.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- eapp_edit_main.c 13 Mar 2005 18:51:13 -0000 1.13 +++ eapp_edit_main.c 24 Mar 2005 23:35:32 -0000 1.14 @@ -1,6 +1,7 @@ #include <Eet.h> #include <Ewl.h> #include <Engrave.h> +#include <Ecore_X.h> #include <sys/types.h> #include <sys/stat.h> @@ -12,8 +13,12 @@ static void _eapp_edit_write(Eet_File *ef, char *key, char *lang, Ewl_Widget *source, int checkbox); +static void _eapp_edit_window_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data); +static void _eapp_edit_drag_start(Ewl_Widget * w, void *ev_data, void *user_data); +static void _eapp_edit_drag_end(Ewl_Widget * w, void *ev_data, void *user_data); + Ewl_Widget *name, *info, *comments, *exe, *wname, *wclass, *start, *wait; -Ewl_Widget *icon, *dialog, *dialog_win; +Ewl_Widget *icon, *dialog, *dialog_win, *main_win; char *file, *lang, *icon_file; char *new_win_class; @@ -129,6 +134,7 @@ if (ef) free(ret_buf); + return part; } @@ -227,7 +233,7 @@ Eet_File *ef; struct stat st; - Ewl_Widget *main_win, *main_box, *grid, *cell, *content; + Ewl_Widget *main_box, *grid, *cell, *content; icon_file = NULL; dialog_win = NULL; @@ -261,6 +267,7 @@ _eapp_edit_help(); exit(0); } + ecore_init(); eet_init(); if (stat(file, &st) < 0) printf("file %s not found, will create when you save\n", file); @@ -278,6 +285,7 @@ ewl_window_class_set(EWL_WINDOW(main_win), "Eapp Editor"); ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW, _eapp_edit_quit, NULL); + ewl_callback_append(main_win, EWL_CALLBACK_CONFIGURE, _eapp_edit_window_configure_cb, NULL); ewl_object_size_request(EWL_OBJECT(main_win), 210, 200); ewl_widget_show(main_win); @@ -320,6 +328,9 @@ ewl_widget_show(cell); ewl_grid_add(EWL_GRID(grid), cell, 1, 1, 1, 2); + ewl_callback_append(icon, EWL_CALLBACK_MOUSE_DOWN, _eapp_edit_drag_start, NULL); + ewl_callback_append(icon, EWL_CALLBACK_MOUSE_UP, _eapp_edit_drag_end, NULL); + grid = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(main_box), grid); ewl_object_fill_policy_set(EWL_OBJECT(grid), EWL_FLAG_FILL_HFILL); @@ -339,6 +350,7 @@ ewl_shutdown(); eet_shutdown(); + ecore_shutdown(); /* just return 0 to keep the compiler quiet */ return 0; } @@ -353,3 +365,25 @@ " -l --lang [str] Set laguage for meta data\n" " -c --win-class [str] Set the window class to use (used by window managers\n"); } + +static void +_eapp_edit_window_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data) { + ecore_x_dnd_aware_set((Ecore_X_Window) EWL_WINDOW(w)->window, 1); +} + +static void +_eapp_edit_drag_start(Ewl_Widget * w, void *ev_data, void *user_data) { + char *name; + + if (!file) + return; + ecore_x_dnd_type_set((Ecore_X_Window) EWL_WINDOW(main_win)->window, + "text/uri-list", 1); + ecore_x_dnd_begin((Ecore_X_Window) EWL_WINDOW(main_win)->window, file, + strlen(file) * sizeof(char)); +} + +static void +_eapp_edit_drag_end(Ewl_Widget * w, void *ev_data, void *user_data) { + ecore_x_dnd_drop(); +} ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs