Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_exehist.c e_exehist.h e_fwin.c e_int_config_desklock.c Log Message: desklock title was wrongish (comapred to control panel) fwin now stores what app is used to launch for what mimetype and uses it by default. dialog only comes up when it can't for sure knwo what you last used (more than 1 mime type being loaded and thus possibly not the same app, can handle all mime types, or it just doesn't know what u last used (if you ever did). =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_exehist.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- e_exehist.c 14 Oct 2006 10:57:18 -0000 1.5 +++ e_exehist.c 29 Oct 2006 04:44:50 -0000 1.6 @@ -12,6 +12,7 @@ struct _E_Exehist { Evas_List *history; + Evas_List *mimes; }; struct _E_Exehist_Item @@ -53,6 +54,7 @@ #define T E_Exehist #define D _e_exehist_config_edd E_CONFIG_LIST(D, T, history, _e_exehist_config_item_edd); + E_CONFIG_LIST(D, T, mimes, _e_exehist_config_item_edd); return 1; } @@ -73,7 +75,11 @@ _e_exehist_load(); if (!_e_exehist) return; ei = E_NEW(E_Exehist_Item, 1); - if (!ei) return; + if (!ei) + { + _e_exehist_unload_queue(); + return; + } ei->launch_method = evas_stringshare_add(launch_method); ei->exe = evas_stringshare_add(exe); ei->exetime = ecore_time_get(); @@ -156,15 +162,85 @@ break; } } - if (!(bad)) { + if (!(bad)) + { list = evas_list_append(list, ei->exe); count++; - } + } if (count > max) break; } return list; } +EAPI void +e_exehist_mime_app_add(const char *mime, E_App *a) +{ + const char *f; + E_Exehist_Item *ei; + Evas_List *l; + + if ((!mime) || (!a)) return; + _e_exehist_load(); + if (!_e_exehist) return; + + f = ecore_file_get_file(a->path); + for (l = _e_exehist->mimes; l; l = l->next) + { + ei = l->data; + if ((ei->launch_method) && (!strcmp(mime, ei->launch_method))) + { + if ((ei->exe) && (!strcmp(f, ei->exe))) + { + _e_exehist_unload_queue(); + return; + } + if (ei->exe) evas_stringshare_del(ei->exe); + if (ei->launch_method) evas_stringshare_del(ei->launch_method); + free(ei); + _e_exehist->mimes = evas_list_remove_list(_e_exehist->mimes, l); + break; + } + } + ei = E_NEW(E_Exehist_Item, 1); + if (!ei) + { + _e_exehist_unload_queue(); + return; + } + ei->launch_method = evas_stringshare_add(mime); + ei->exe = evas_stringshare_add(f); + ei->exetime = ecore_time_get(); + _e_exehist->mimes = evas_list_append(_e_exehist->mimes, ei); + _e_exehist_limit(); + e_config_domain_save("exehist", _e_exehist_config_edd, _e_exehist); + _e_exehist_unload_queue(); +} + +EAPI E_App * +e_exehist_mime_app_get(const char *mime) +{ + E_App *a; + E_Exehist_Item *ei; + Evas_List *l; + + if (!mime) return NULL; + _e_exehist_load(); + if (!_e_exehist) return; + for (l = _e_exehist->mimes; l; l = l->next) + { + ei = l->data; + if ((ei->launch_method) && (!strcmp(mime, ei->launch_method))) + { + a = NULL; + if (ei->exe) a = e_app_file_find(ei->exe); + _e_exehist_unload_queue(); + return a; + } + } + _e_exehist_unload_queue(); + return NULL; +} + /* local subsystem functions */ static void _e_exehist_unload_queue(void) @@ -196,6 +272,16 @@ if (ei->launch_method) evas_stringshare_del(ei->launch_method); free(ei); _e_exehist->history = evas_list_remove_list(_e_exehist->history, _e_exehist->history); + } + while (_e_exehist->mimes) + { + E_Exehist_Item *ei; + + ei = _e_exehist->mimes->data; + if (ei->exe) evas_stringshare_del(ei->exe); + if (ei->launch_method) evas_stringshare_del(ei->launch_method); + free(ei); + _e_exehist->mimes = evas_list_remove_list(_e_exehist->mimes, _e_exehist->mimes); } } } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_exehist.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_exehist.h 14 Oct 2006 10:57:18 -0000 1.2 +++ e_exehist.h 29 Oct 2006 04:44:50 -0000 1.3 @@ -15,9 +15,8 @@ EAPI int e_exehist_popularity_get(const char *exe); EAPI double e_exehist_newest_run_get(const char *exe); EAPI Evas_List *e_exehist_list_get(void); - /* -EAPI double e_exehist_last_run_get(const char *exe); -*/ +EAPI void e_exehist_mime_app_add(const char *mime, E_App *a); +EAPI E_App *e_exehist_mime_app_get(const char *mime); #endif #endif =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fwin.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- e_fwin.c 28 Oct 2006 03:53:22 -0000 1.12 +++ e_fwin.c 29 Oct 2006 04:44:50 -0000 1.13 @@ -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_cb_menu_extend_start(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info); +static void _e_fwin_cb_menu_open(void *data, E_Menu *m); static void _e_fwin_file_open_app(E_Fwin *fwin, E_App *a, const char *file); static void _e_fwin_cb_ilist_change(void *data); @@ -27,7 +29,7 @@ static void _e_fwin_cb_close(void *data, E_Dialog *dia); static void _e_fwin_cb_dialog_free(void *obj); static Evas_Bool _e_fwin_cb_hash_foreach(Evas_Hash *hash, const char *key, void *data, void *fdata); -static void _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files); +static void _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always); /* local subsystem globals */ static Evas_List *fwins = NULL; @@ -102,6 +104,7 @@ _e_fwin_deleted, fwin); evas_object_smart_callback_add(o, "selected", _e_fwin_selected, fwin); + e_fm2_icon_menu_start_extend_callback_set(o, _e_fwin_cb_menu_extend_start, fwin); e_fm2_path_set(o, dev, path); e_fm2_icon_menu_end_extend_callback_set(o, _e_fwin_menu_extend, fwin); evas_object_show(o); @@ -209,7 +212,7 @@ fwin = data; selected = e_fm2_selected_list_get(fwin->fm_obj); if (!selected) return; - _e_fwin_file_open_dialog(fwin, selected); + _e_fwin_file_open_dialog(fwin, selected, 0); evas_list_free(selected); } @@ -241,6 +244,35 @@ e_fm2_parent_go(data); } +static void +_e_fwin_cb_menu_extend_start(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info) +{ + E_Menu_Item *mi; + E_Fwin *fwin; + + fwin = data; + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Open")); + e_menu_item_icon_edje_set(mi, + e_theme_edje_file_get("base/theme/fileman", + "e/fileman/button/open"), + "e/fileman/button/open"); + e_menu_item_callback_set(mi, _e_fwin_cb_menu_open, fwin); +} + +static void +_e_fwin_cb_menu_open(void *data, E_Menu *m) +{ + E_Fwin *fwin; + Evas_List *selected; + + fwin = data; + selected = e_fm2_selected_list_get(fwin->fm_obj); + if (!selected) return; + _e_fwin_file_open_dialog(fwin, selected, 1); + evas_list_free(selected); +} + /* KILL: this func will die as soon as ecore_desktops's cmd thing works * perfectly */ static void @@ -373,6 +405,7 @@ /* FIXME: save desktop file as most recently used for the mime * types of the selected files so it can be used as a default */ + e_exehist_add(buf, cmd); selected = e_fm2_selected_list_get(fad->fwin->fm_obj); if (selected) { @@ -401,6 +434,8 @@ } if (buf[0] != 0) { + if (ici->mime) + e_exehist_mime_app_add(ici->mime, a); // /* FIXME: use ecore_desktop_get_command() */ // printf("a->exe = %s, ici->file = %s\n", a->exe, ici->file); // _e_fwin_file_open_app(fad->fwin, a, ici->file); @@ -413,7 +448,10 @@ { ecore_list_goto_first(cmds); while ((cmd = ecore_list_next(cmds))) - e_zone_exec(fad->fwin->win->border->zone, cmd); + { + e_zone_exec(fad->fwin->win->border->zone, cmd); + e_exehist_add("fwin", cmd); + } ecore_list_destroy(cmds); } ecore_list_destroy(files); @@ -457,7 +495,7 @@ } static void -_e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files) +_e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always) { E_Dialog *dia; Evas_Coord mw, mh; @@ -479,29 +517,33 @@ e_object_del(E_OBJECT(fwin->fad->dia)); fwin->fad = NULL; } - for (l = files; l; l = l->next) + if (!always) { - ici = l->data; - if ((ici->link) && (ici->mount)) - e_fwin_new(fwin->win->container, ici->link, "/"); - else if (ici->link) + for (l = files; l; l = l->next) { - if (S_ISDIR(ici->statinfo.st_mode)) - e_fwin_new(fwin->win->container, NULL, ici->link); - else - need_dia = 1; - } - 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); + ici = l->data; + if ((ici->link) && (ici->mount)) + e_fwin_new(fwin->win->container, ici->link, "/"); + else if (ici->link) + { + if (S_ISDIR(ici->statinfo.st_mode)) + e_fwin_new(fwin->win->container, NULL, ici->link); + else + need_dia = 1; + } else - need_dia = 1; + { + 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 + need_dia = 1; + } } + if (!need_dia) return; + need_dia = 0; } - if (!need_dia) return; /* 1. build hash of mimetypes */ for (l = files; l; l = l->next) @@ -540,7 +582,6 @@ evas_list_free(al); } } - evas_list_free(mlist); } /* FIXME: check all the mimes - if there is only 1 mime - then open with @@ -548,6 +589,48 @@ * are multiple or no previously used app for this mime - then open * dialog */ + if (!always) + { + if (evas_list_count(mlist) == 1) + { + a = e_exehist_mime_app_get(mlist->data); + if (a) + { + char pcwd[4096], buf[4096], *cmd; + Ecore_List *files_list = NULL, *cmds = NULL; + + getcwd(pcwd, sizeof(pcwd)); + chdir(e_fm2_real_path_get(fwin->fm_obj)); + + files_list = ecore_list_new(); + ecore_list_set_free_cb(files_list, free); + for (l = files; l; l = l->next) + { + ici = l->data; + ecore_list_append(files_list, strdup(ici->file)); + } + cmds = ecore_desktop_get_command(a->desktop, files_list, 1); + if (cmds) + { + ecore_list_goto_first(cmds); + while ((cmd = ecore_list_next(cmds))) + { + e_zone_exec(fwin->win->border->zone, cmd); + e_exehist_add("fwin", cmd); + } + ecore_list_destroy(cmds); + } + ecore_list_destroy(files_list); + + if (apps) evas_list_free(apps); + + chdir(pcwd); + evas_list_free(mlist); + return; + } + } + } + evas_list_free(mlist); fad = E_NEW(E_Fwin_Apps_Dialog, 1); dia = e_dialog_new(fwin->win->border->zone->container, =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_desklock.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- e_int_config_desklock.c 21 Oct 2006 02:32:13 -0000 1.39 +++ e_int_config_desklock.c 29 Oct 2006 04:44:50 -0000 1.40 @@ -111,7 +111,7 @@ v->override_auto_apply = 1; cfd = e_config_dialog_new(con, - _("Desktop Lock Settings"), + _("Screen Lock Settings"), "E", "_config_desklock_dialog", "enlightenment/desklock", 0, v, NULL); return cfd; ------------------------------------------------------------------------- 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