Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_apps.c e_apps.h e_fwin.c e_main.c Log Message: working on mime typeopening off apps on files and startup instrumentation is complete =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v retrieving revision 1.235 retrieving revision 1.236 diff -u -3 -r1.235 -r1.236 --- e_apps.c 20 Oct 2006 21:31:21 -0000 1.235 +++ e_apps.c 22 Oct 2006 02:14:08 -0000 1.236 @@ -1723,6 +1723,34 @@ return list; } +/* Used e_fm2. */ +EAPI Evas_List * +e_app_mime_list(const char *mime) +{ + Evas_List *l, *list = NULL; + + if (!mime) return NULL; + + for (l = _e_apps_all->subapps; l; l = l->next) + { + E_App *a; + + a = l->data; + E_OBJECT_CHECK_RETURN(a, NULL); + E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL); + if ((!a->idle_fill) && (!a->filled)) + e_app_fields_fill(a, a->path); + if (!a->filled) + continue; + if ((a->desktop) && (a->desktop->MimeTypes)) + { + if (ecore_hash_get(a->desktop->MimeTypes, mime)) + list = evas_list_append(list, a); + } + } + return list; +} + EAPI void e_app_fields_fill(E_App *a, const char *path) =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.h,v retrieving revision 1.49 retrieving revision 1.50 diff -u -3 -r1.49 -r1.50 --- e_apps.h 3 Oct 2006 15:51:58 -0000 1.49 +++ e_apps.h 22 Oct 2006 02:14:08 -0000 1.50 @@ -154,6 +154,7 @@ EAPI Evas_List *e_app_generic_glob_list (const char *generic); EAPI Evas_List *e_app_exe_glob_list (const char *exe); EAPI Evas_List *e_app_comment_glob_list (const char *comment); +EAPI Evas_List *e_app_mime_list (const char *mime); EAPI void e_app_fields_fill (E_App *a, const char *path); EAPI void e_app_fields_save (E_App *a); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fwin.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_fwin.c 16 Oct 2006 14:26:02 -0000 1.4 +++ e_fwin.c 22 Oct 2006 02:14:08 -0000 1.5 @@ -17,6 +17,8 @@ static void _e_fwin_selected(void *data, Evas_Object *obj, void *event_info); static void _e_fwin_menu_extend(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info); static void _e_fwin_parent(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fwin_file_open(E_Fwin *fwin, const char *file, const char *mime); +static void _e_fwin_file_open_app(E_Fwin *fwin, E_App *a, const char *file); /* local subsystem globals */ static Evas_List *fwins = NULL; @@ -187,35 +189,33 @@ _e_fwin_selected(void *data, Evas_Object *obj, void *event_info) { E_Fwin *fwin; - Evas_List *selected; + Evas_List *selected, *l; E_Fm2_Icon_Info *ici; char buf[4096]; - const *rp; fwin = data; selected = e_fm2_selected_list_get(fwin->fm_obj); if (!selected) return; - ici = selected->data; - if ((ici->link) && (ici->mount)) - e_fwin_new(fwin->win->container, ici->link, "/"); - else if (ici->link) + for (l = selected; l; l = l->next) { - if (S_ISDIR(ici->statinfo.st_mode)) - e_fwin_new(fwin->win->container, NULL, ici->link); - else + ici = l->data; + if ((ici->link) && (ici->mount)) + e_fwin_new(fwin->win->container, ici->link, "/"); + else if (ici->link) { - /* FIXME: link to file - open file */ + if (S_ISDIR(ici->statinfo.st_mode)) + e_fwin_new(fwin->win->container, NULL, ici->link); + else + _e_fwin_file_open(fwin, ici->link, e_fm_mime_filename_get(ici->link)); } - } - else - { - 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); else { - /* FIXME: file - open file */ + 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); + else + _e_fwin_file_open(fwin, buf, ici->mime); } } evas_list_free(selected); @@ -249,3 +249,109 @@ e_fm2_parent_go(data); } +static void +_e_fwin_file_open(E_Fwin *fwin, const char *file, const char *mime) +{ + Evas_List *apps, *l; + E_App *a; + char pcwd[4096]; + + /* 1. find previously used launcher */ + /* if found - is there still an app for it? */ + /* a = e_app_file_find(prev_launcher); */ + /* if (a) - run it */ + /* return; */ + /* 2. list possible apps */ + /* if list == 1 element - run it */ + /* return; */ + /* 3. create dialog */ + /* if (list) add apps in list */ + /* dialog should have optin to show all apps */ + getcwd(pcwd, sizeof(pcwd)); + chdir(e_fm2_real_path_get(fwin->fm_obj)); + /* 1. */ + /* FIXME: implement the above # 1. */ + /* 2. */ + apps = e_app_mime_list(e_fm_mime_filename_get(file)); + if (apps) + { + if (evas_list_count(apps) == 1) + { + a = apps->data; + _e_fwin_file_open_app(fwin, a, ecore_file_get_file(file)); + } + else + { + /* FIXME: hack. do dialog as above in # 3. */ + a = apps->data; + _e_fwin_file_open_app(fwin, a, ecore_file_get_file(file)); + /* FIXME: register app a as handling mime type if app doesnt */ + /* say it can already in a separate info blob so in future */ + /* e will list it as an option */ + for (l = apps; l; l = l->next) + { + a = l->data; + } + } + evas_list_free(apps); + } + chdir(pcwd); +} + +static void +_e_fwin_file_open_app(E_Fwin *fwin, E_App *a, const char *file) +{ + char buf[4096], *p, *e, *s; + + if (!a->exe) return; + if (a->exe_params) + { + /* cmd is "a->exe a->exe_params" where a->exe_params will */ + /* have replaced %[uU] or %[fF] or %[mM] with the filename */ + /* in question. also replace %[cC] and %[iI] with blanks */ + e = buf + sizeof(buf) - 1; + if ((strlen(a->exe) + strlen(file)) >= (sizeof(buf) - 10)) return; + strcpy(buf, a->exe); + strcat(buf, " "); + p = buf + strlen(buf); + s = (char *)a->exe_params; + while ((*s) && (p < e)) + { + if (*s != '%') + { + *p = *s; + p++; + } + else + { + s++; + if (*s == '%') + { + *p = '%'; + p++; + } + else + { + if ((*s == 'u') || (*s == 'U') || + (*s == 'f') || (*s == 'F') || + (*s == 'm') || (*s == 'M')) + { + if ((e - p) > (strlen(file) + 1)) + { + strcpy(p, file); + p += strlen(file); + } + } + } + } + s++; + } + *p = 0; + } + else + { + /* cmd is "a->exe filename" */ + snprintf(buf, sizeof(buf), "%s %s", a->exe, file); + } + e_zone_exec(fwin->win->border->zone, buf); +} =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_main.c,v retrieving revision 1.194 retrieving revision 1.195 diff -u -3 -r1.194 -r1.195 --- e_main.c 21 Oct 2006 10:52:43 -0000 1.194 +++ e_main.c 22 Oct 2006 02:14:08 -0000 1.195 @@ -782,9 +782,6 @@ /* add in a handler that just before we go idle we flush x */ _e_main_idle_enterer_flusher = ecore_idle_enterer_add(_e_main_cb_x_flusher, NULL); - /* an idle enterer to be called after all others */ - _e_main_idle_enterer_after = ecore_idle_enterer_add(_e_main_cb_idler_after, NULL); - e_managers_keys_grab(); /* ecore_x_ungrab(); */ @@ -816,6 +813,9 @@ TS("shelf config init"); e_shelf_config_init(); + /* an idle enterer to be called after all others */ + _e_main_idle_enterer_after = ecore_idle_enterer_add(_e_main_cb_idler_after, NULL); + TS("MAIN LOOP AT LAST"); /* no longer starting up */ starting = 0; @@ -1397,6 +1397,15 @@ edje_freeze(); _e_cacheburst++; /* eet_cacheburst(_e_cacheburst); */ + { + static int first_idle = 1; + + if (first_idle) + { + TS("SLEEP"); + first_idle = 0; + } + } return 1; } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs