Enlightenment CVS committal Author : codewarrior Project : misc Module : engage
Dir : misc/engage/src/module Modified Files: e_mod_main.c e_mod_main.h Log Message: Added context switching to Engage. This means that you can have something like: ~/.e/e/applications/engage/.Applications/.order ~/.e/e/applications/engage/.Backgrounds/.order ~/.e/e/applications/engage/.SomethingElse/.order and when you right click engage, you will see a menu that allows you to switch between contexts. You can see a sample here: http://www.uk.get-e.org/Screenshots/User_Submitted_previews/2005.04.26.desky.jpg.html This turns Engage into an E17 backgrounds selection tool. The following limitations apply: 1) dir names need to start with a "." 2) an initial ~/.e/e/applications/engage/.order file needs to be there If an icon list is too large for the screen, it will not scroll at the moment. This is to be fixed later. Currently, also, there is no way to filter out the appearence of icons for running apps in a certain state. This might be fixed at some stage. =================================================================== RCS file: /cvsroot/enlightenment/misc/engage/src/module/e_mod_main.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -3 -r1.42 -r1.43 --- e_mod_main.c 20 Apr 2005 20:10:24 -0000 1.42 +++ e_mod_main.c 26 Apr 2005 23:07:58 -0000 1.43 @@ -4,6 +4,7 @@ #include <e.h> #include "e_mod_main.h" #include "math.h" +#include <unistd.h> #include "config.h" @@ -124,6 +125,8 @@ static int _engage_zoom_function(double d, double *zoom, double *disp, Engage_Bar *eb); static int _engage_border_ignore(E_Border *bd); +static void _engage_bar_cb_menu_context_change(void *data, E_Menu *m, E_Menu_Item *mi); + E_App *_engage_unmatched_app; /* public module routines. all modules must have these */ @@ -348,7 +351,7 @@ { Engage *e; Evas_List *l, *ll; - + printf("CHANGE: %d",ch); e = data; for (l = e->bars; l; l = l->next) { @@ -457,7 +460,7 @@ if (homedir) { snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s/.order", homedir, - e->conf->appdir); + e->conf->appdir); free(homedir); return strdup(buf); } @@ -505,7 +508,9 @@ eb->con = con; e_object_ref(E_OBJECT(con)); eb->evas = con->bg_evas; - + + eb->contexts = NULL; + eb->x = eb->y = eb->w = eb->h = -1; eb->zoom = 1.0; eb->zooming = 0; @@ -592,6 +597,37 @@ ecore_event_handler_add(ECORE_X_EVENT_XDND_DROP, _engage_cb_event_dnd_drop , eb); ecore_event_handler_add(ECORE_X_EVENT_XDND_POSITION, _engage_cb_event_dnd_position, eb); ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, _engage_cb_event_dnd_selection, eb); + + /* search for available contexts to switch to */ + if(e->conf->appdir) + { + Ecore_List *cons = NULL; + char buf[4096]; + char *homedir; + char *dir; + + homedir = e_user_homedir_get(); + if (homedir) + { + snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s", homedir, e->conf->appdir); + free(homedir); + } + cons = ecore_file_ls(buf); + while((dir = ecore_list_next(cons))) + { + char context[4096]; + snprintf(context, sizeof(context), "%s/%s", buf, dir); + if(ecore_file_is_dir(context)) + { + char dotorder[4096]; + snprintf(dotorder, sizeof(dotorder), "%s/%s", context, ".order"); + if(ecore_file_exists(dotorder)) + { + eb->contexts = evas_list_append(eb->contexts, dir); + } + } + } + } return eb; } @@ -632,7 +668,8 @@ { E_Menu *mn; E_Menu_Item *mi; - + Evas_List *l; + mn = e_menu_new(); eb->zoom_menu = mn; @@ -651,7 +688,7 @@ mi = e_menu_item_new(mn); e_menu_item_label_set(mi, "Huge"); e_menu_item_callback_set(mi, _engage_bar_cb_menu_zoom_huge, eb); - + mn = e_menu_new(); eb->menu = mn; @@ -679,6 +716,33 @@ mi = e_menu_item_new(mn); e_menu_item_label_set(mi, "Edit Mode"); e_menu_item_callback_set(mi, _engage_bar_cb_menu_edit, eb); + + + l = eb->contexts; + if(l) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + + eb->context_menu = e_menu_new(); + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, "Context"); + e_menu_item_submenu_set(mi, eb->context_menu); + + + while(l) + { + char *context; + context = l->data; + if(context[0] == '.') + context = &context[1]; + mi = e_menu_item_new(eb->context_menu); + e_menu_item_label_set(mi, context); + e_menu_item_callback_set(mi, _engage_bar_cb_menu_context_change, eb); + l = l->next; + } + } + } static void @@ -2068,6 +2132,30 @@ } static void +_engage_bar_cb_menu_context_change(void *data, E_Menu *m, E_Menu_Item *mi) +{ + Engage_Bar *eb; + char *homedir; + char buf[4096]; + char dotorder[4096]; + char context[4096]; + + eb = data; + homedir = e_user_homedir_get(); + if (homedir) + { + snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s", homedir, + eb->engage->conf->appdir); + free(homedir); + } + + snprintf(dotorder, sizeof(dotorder), "%s/.order", buf); + snprintf(context, sizeof(context), "%s/.%s/.order", buf, mi->label); + unlink(dotorder); + link(context, dotorder); +} + +static void _engage_bar_cb_menu_zoom_small(void *data, E_Menu *m, E_Menu_Item *mi) { Engage_Bar *eb; =================================================================== RCS file: /cvsroot/enlightenment/misc/engage/src/module/e_mod_main.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- e_mod_main.h 12 Apr 2005 03:37:41 -0000 1.9 +++ e_mod_main.h 26 Apr 2005 23:07:58 -0000 1.10 @@ -46,13 +46,15 @@ Evas *evas; E_Menu *menu; E_Menu *zoom_menu; + E_Menu *context_menu; Evas_Object *bar_object; Evas_Object *box_object; Evas_Object *event_object; Evas_Coord mouse_out; - Evas_List *icons; + Evas_List *icons; + Evas_List *contexts; double align, align_req; ------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs