Hello, All. This is patch for issue: fm2 "open with..." dialog needs to go down to 1 list, not 2. ilist needs to be fixed to handle such big lists of stuff. This single list would list at top applications to handle that mime type and then a separator/header followed by all available applications.
And also this patch includes my previous changes for: fm2 "favorites" doesn't remember window geometry, because it's not included in trunk now. e_fwin.c | 140 ++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 76 insertions(+), 64 deletions(-) Index: e/src/modules/fileman/e_fwin.c =================================================================== --- e/src/modules/fileman/e_fwin.c (revision 39836) +++ e/src/modules/fileman/e_fwin.c (working copy) @@ -53,8 +53,8 @@ struct _E_Fwin_Apps_Dialog { E_Dialog *dia; E_Fwin *fwin; - const char *app1, *app2; - Evas_Object *o_specific, *o_all; + const char *app2; + Evas_Object *o_all; Evas_Object *o_entry; char *exec_cmd; }; @@ -87,7 +87,6 @@ static void _e_fwin_cb_menu_extend_start(void *dat static void _e_fwin_cb_menu_open(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_fwin_cb_menu_open_with(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_fwin_cb_all_change(void *data, Evas_Object *obj); -static void _e_fwin_cb_specific_change(void *data, Evas_Object *obj); static void _e_fwin_cb_exec_cmd_changed(void *data, void *data2); static void _e_fwin_cb_open(void *data, E_Dialog *dia); static void _e_fwin_cb_close(void *data, E_Dialog *dia); @@ -149,8 +148,54 @@ EAPI void e_fwin_new(E_Container *con, const char *dev, const char *path) { E_Fwin *fwin; + E_Fm2_Custom_File *cf; + char buf[PATH_MAX]; + int x, y, w, h; fwin = _e_fwin_new(con, dev, path); + + if (fwin) + { + snprintf(buf, sizeof(buf), "dir::%s", e_fm2_real_path_get(fwin->fm_obj)); + cf = e_fm2_custom_file_get(buf); + if ((cf) && (cf->geom.valid)) + { + x = cf->geom.x; + y = cf->geom.y; + w = cf->geom.w; + h = cf->geom.h; + + /* checking width and height */ + if (w < 24) + w = 280 * e_scale; + else if (w > fwin->win->border->zone->w) + w = fwin->win->border->zone->w; + if (h < 24) + h = 200 * e_scale; + else if (h > fwin->win->border->zone->h) + h = fwin->win->border->zone->h; + + /* checking left-top corner */ + if (x < fwin->win->border->zone->x) + x = fwin->win->border->zone->x + fwin->win->border->client_inset.l; + if (y < fwin->win->border->zone->y) + y = fwin->win->border->zone->y + fwin->win->border->client_inset.t; + + /* checking right-bottom corner */ + if ((fwin->win->border->zone->x + fwin->win->border->zone->w) < (x + w)) + x = fwin->win->border->zone->x + fwin->win->border->zone->w - w - fwin->win->border->client_inset.l; + if ((fwin->win->border->zone->y + fwin->win->border->zone->h) < (y + h)) + y = fwin->win->border->zone->y + fwin->win->border->zone->h - h - fwin->win->border->client_inset.t; + + e_win_move_resize + (fwin->win, + x - fwin->win->border->client_inset.l, + y - fwin->win->border->client_inset.t, + w, h); + } + + fwin->geom_save_ready = 1; + } } EAPI void @@ -893,47 +938,26 @@ _e_fwin_cb_all_change(void *data, Evas_Object *obj Efreet_Desktop *desktop = NULL; fad = data; - eina_stringshare_del(fad->app1); - if (fad->o_specific) e_widget_ilist_unselect(fad->o_specific); desktop = efreet_util_desktop_file_id_find(fad->app2); if ((desktop) && (desktop->exec)) e_widget_entry_text_set(fad->o_entry, desktop->exec); } static void -_e_fwin_cb_specific_change(void *data, Evas_Object *obj) -{ - E_Fwin_Apps_Dialog *fad; - Efreet_Desktop *desktop = NULL; - - fad = data; - eina_stringshare_del(fad->app2); - if (fad->o_all) e_widget_ilist_unselect(fad->o_all); - desktop = efreet_util_desktop_file_id_find(fad->app1); - if ((desktop) && (desktop->exec)) - e_widget_entry_text_set(fad->o_entry, desktop->exec); -} - -static void _e_fwin_cb_exec_cmd_changed(void *data, void *data2) { E_Fwin_Apps_Dialog *fad = NULL; Efreet_Desktop *desktop = NULL; if (!(fad = data)) return; - if ((!fad->app1) && (!fad->app2)) return; - if (fad->app1) - desktop = efreet_util_desktop_file_id_find(fad->app1); - else if (fad->app2) + if (fad->app2) desktop = efreet_util_desktop_file_id_find(fad->app2); if (!desktop) return; if (!strcmp(desktop->exec, fad->exec_cmd)) return; - eina_stringshare_del(fad->app1); eina_stringshare_del(fad->app2); - if (fad->o_specific) e_widget_ilist_unselect(fad->o_specific); if (fad->o_all) e_widget_ilist_unselect(fad->o_all); } @@ -949,9 +973,7 @@ _e_fwin_cb_open(void *data, E_Dialog *dia) char *file; fad = data; - if (fad->app1) - desktop = efreet_util_desktop_file_id_find(fad->app1); - else if (fad->app2) + if (fad->app2) desktop = efreet_util_desktop_file_id_find(fad->app2); if ((!desktop) && (!fad->exec_cmd)) return; @@ -1060,7 +1082,6 @@ _e_fwin_cb_dialog_free(void *obj) dia = (E_Dialog *)obj; fad = dia->data; - eina_stringshare_del(fad->app1); eina_stringshare_del(fad->app2); E_FREE(fad->exec_cmd); fad->fwin->fad = NULL; @@ -1206,7 +1227,7 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Eina_List * E_Fwin *fwin2 = NULL; E_Dialog *dia; Evas_Coord mw, mh; - Evas_Object *o, *of, *oi, *ot; + Evas_Object *o, *of, *ot; Evas *evas; Eina_List *l = NULL, *ll, *apps = NULL, *mlist = NULL; Eina_List *ml; @@ -1556,47 +1577,42 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Eina_List * evas = e_win_evas_get(dia->win); ot = e_widget_table_add(evas, 0); - if (apps) - { - of = e_widget_framelist_add(evas, _("Specific Applications"), 0); - o = e_widget_ilist_add(evas, 24, 24, &(fad->app1)); - e_widget_on_change_hook_set(o, _e_fwin_cb_specific_change, fad); - evas_event_freeze(evas); - edje_freeze(); - e_widget_ilist_freeze(o); - fad->o_specific = o; - for (l = apps; l; l = l->next) - { - desk = l->data; - oi = e_util_desktop_icon_add(desk, 24, evas); - e_widget_ilist_append(o, oi, desk->name, NULL, NULL, - efreet_util_path_to_file_id(desk->orig_path)); - } - e_widget_ilist_go(o); - e_widget_ilist_thaw(o); - edje_thaw(); - evas_event_thaw(evas); - e_widget_min_size_set(o, 160, 240); - e_widget_framelist_object_append(of, o); - e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1); - } - + l = eina_list_free(l); - of = e_widget_framelist_add(evas, _("All Applications"), 0); + // Make frame with list of applications + of = e_widget_framelist_add(evas, _("Known Applications"), 0); o = e_widget_ilist_add(evas, 24, 24, &(fad->app2)); e_widget_on_change_hook_set(o, _e_fwin_cb_all_change, fad); fad->o_all = o; evas_event_freeze(evas); edje_freeze(); e_widget_ilist_freeze(o); + + // Adding Specific Applications list into widget + if(apps) + e_widget_ilist_header_append(o, NULL, _("Specific Applications")); + EINA_LIST_FOREACH(apps, l, desk) + { + Evas_Object *icon = NULL; + + if (!desk) continue; + icon = e_util_desktop_icon_add(desk, 24, evas); + e_widget_ilist_append(o, icon, desk->name, NULL, NULL, + efreet_util_path_to_file_id(desk->orig_path)); + } + + // Building All Applications list cats = efreet_util_desktop_name_glob_list("*"); cats = eina_list_sort(cats, 0, _e_fwin_dlg_cb_desk_sort); EINA_LIST_FREE(cats, desk) - if (!eina_list_data_find(l, desk)) + if (!eina_list_data_find(l, desk) && !eina_list_data_find(apps, desk)) l = eina_list_append(l, desk); l = eina_list_sort(l, -1, _e_fwin_dlg_cb_desk_list_sort); + // Adding All Applications list into widget + if(l) + e_widget_ilist_header_append(o, NULL, _("All Applications")); EINA_LIST_FREE(l, desk) { Evas_Object *icon = NULL; @@ -1607,19 +1623,15 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Eina_List * efreet_util_path_to_file_id(desk->orig_path)); } + eina_list_free(apps); + e_widget_ilist_go(o); e_widget_ilist_thaw(o); edje_thaw(); evas_event_thaw(evas); e_widget_min_size_set(o, 160, 240); e_widget_framelist_object_append(of, o); - if (apps) - { - e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1); - eina_list_free(apps); - } - else - e_widget_table_object_append(ot, of, 0, 0, 2, 1, 1, 1, 1, 1); + e_widget_table_object_append(ot, of, 0, 0, 2, 1, 1, 1, 1, 1); o = e_widget_label_add(evas, _("Custom Command")); e_widget_table_object_append(ot, o, 0, 1, 1, 1, 1, 1, 1, 0); Sincerely yours, Sergey. -- Jabber/XMPP: sergey.semer...@gmail.com Cellular: +7-909-206-5992
Index: e/src/modules/fileman/e_fwin.c =================================================================== --- e/src/modules/fileman/e_fwin.c (revision 39836) +++ e/src/modules/fileman/e_fwin.c (working copy) @@ -53,8 +53,8 @@ struct _E_Fwin_Apps_Dialog { E_Dialog *dia; E_Fwin *fwin; - const char *app1, *app2; - Evas_Object *o_specific, *o_all; + const char *app2; + Evas_Object *o_all; Evas_Object *o_entry; char *exec_cmd; }; @@ -87,7 +87,6 @@ static void _e_fwin_cb_menu_extend_start(void *dat static void _e_fwin_cb_menu_open(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_fwin_cb_menu_open_with(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_fwin_cb_all_change(void *data, Evas_Object *obj); -static void _e_fwin_cb_specific_change(void *data, Evas_Object *obj); static void _e_fwin_cb_exec_cmd_changed(void *data, void *data2); static void _e_fwin_cb_open(void *data, E_Dialog *dia); static void _e_fwin_cb_close(void *data, E_Dialog *dia); @@ -149,8 +148,54 @@ EAPI void e_fwin_new(E_Container *con, const char *dev, const char *path) { E_Fwin *fwin; + E_Fm2_Custom_File *cf; + char buf[PATH_MAX]; + int x, y, w, h; fwin = _e_fwin_new(con, dev, path); + + if (fwin) + { + snprintf(buf, sizeof(buf), "dir::%s", e_fm2_real_path_get(fwin->fm_obj)); + cf = e_fm2_custom_file_get(buf); + if ((cf) && (cf->geom.valid)) + { + x = cf->geom.x; + y = cf->geom.y; + w = cf->geom.w; + h = cf->geom.h; + + /* checking width and height */ + if (w < 24) + w = 280 * e_scale; + else if (w > fwin->win->border->zone->w) + w = fwin->win->border->zone->w; + if (h < 24) + h = 200 * e_scale; + else if (h > fwin->win->border->zone->h) + h = fwin->win->border->zone->h; + + /* checking left-top corner */ + if (x < fwin->win->border->zone->x) + x = fwin->win->border->zone->x + fwin->win->border->client_inset.l; + if (y < fwin->win->border->zone->y) + y = fwin->win->border->zone->y + fwin->win->border->client_inset.t; + + /* checking right-bottom corner */ + if ((fwin->win->border->zone->x + fwin->win->border->zone->w) < (x + w)) + x = fwin->win->border->zone->x + fwin->win->border->zone->w - w - fwin->win->border->client_inset.l; + if ((fwin->win->border->zone->y + fwin->win->border->zone->h) < (y + h)) + y = fwin->win->border->zone->y + fwin->win->border->zone->h - h - fwin->win->border->client_inset.t; + + e_win_move_resize + (fwin->win, + x - fwin->win->border->client_inset.l, + y - fwin->win->border->client_inset.t, + w, h); + } + + fwin->geom_save_ready = 1; + } } EAPI void @@ -893,47 +938,26 @@ _e_fwin_cb_all_change(void *data, Evas_Object *obj Efreet_Desktop *desktop = NULL; fad = data; - eina_stringshare_del(fad->app1); - if (fad->o_specific) e_widget_ilist_unselect(fad->o_specific); desktop = efreet_util_desktop_file_id_find(fad->app2); if ((desktop) && (desktop->exec)) e_widget_entry_text_set(fad->o_entry, desktop->exec); } static void -_e_fwin_cb_specific_change(void *data, Evas_Object *obj) -{ - E_Fwin_Apps_Dialog *fad; - Efreet_Desktop *desktop = NULL; - - fad = data; - eina_stringshare_del(fad->app2); - if (fad->o_all) e_widget_ilist_unselect(fad->o_all); - desktop = efreet_util_desktop_file_id_find(fad->app1); - if ((desktop) && (desktop->exec)) - e_widget_entry_text_set(fad->o_entry, desktop->exec); -} - -static void _e_fwin_cb_exec_cmd_changed(void *data, void *data2) { E_Fwin_Apps_Dialog *fad = NULL; Efreet_Desktop *desktop = NULL; if (!(fad = data)) return; - if ((!fad->app1) && (!fad->app2)) return; - if (fad->app1) - desktop = efreet_util_desktop_file_id_find(fad->app1); - else if (fad->app2) + if (fad->app2) desktop = efreet_util_desktop_file_id_find(fad->app2); if (!desktop) return; if (!strcmp(desktop->exec, fad->exec_cmd)) return; - eina_stringshare_del(fad->app1); eina_stringshare_del(fad->app2); - if (fad->o_specific) e_widget_ilist_unselect(fad->o_specific); if (fad->o_all) e_widget_ilist_unselect(fad->o_all); } @@ -949,9 +973,7 @@ _e_fwin_cb_open(void *data, E_Dialog *dia) char *file; fad = data; - if (fad->app1) - desktop = efreet_util_desktop_file_id_find(fad->app1); - else if (fad->app2) + if (fad->app2) desktop = efreet_util_desktop_file_id_find(fad->app2); if ((!desktop) && (!fad->exec_cmd)) return; @@ -1060,7 +1082,6 @@ _e_fwin_cb_dialog_free(void *obj) dia = (E_Dialog *)obj; fad = dia->data; - eina_stringshare_del(fad->app1); eina_stringshare_del(fad->app2); E_FREE(fad->exec_cmd); fad->fwin->fad = NULL; @@ -1206,7 +1227,7 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Eina_List * E_Fwin *fwin2 = NULL; E_Dialog *dia; Evas_Coord mw, mh; - Evas_Object *o, *of, *oi, *ot; + Evas_Object *o, *of, *ot; Evas *evas; Eina_List *l = NULL, *ll, *apps = NULL, *mlist = NULL; Eina_List *ml; @@ -1556,47 +1577,42 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Eina_List * evas = e_win_evas_get(dia->win); ot = e_widget_table_add(evas, 0); - if (apps) - { - of = e_widget_framelist_add(evas, _("Specific Applications"), 0); - o = e_widget_ilist_add(evas, 24, 24, &(fad->app1)); - e_widget_on_change_hook_set(o, _e_fwin_cb_specific_change, fad); - evas_event_freeze(evas); - edje_freeze(); - e_widget_ilist_freeze(o); - fad->o_specific = o; - for (l = apps; l; l = l->next) - { - desk = l->data; - oi = e_util_desktop_icon_add(desk, 24, evas); - e_widget_ilist_append(o, oi, desk->name, NULL, NULL, - efreet_util_path_to_file_id(desk->orig_path)); - } - e_widget_ilist_go(o); - e_widget_ilist_thaw(o); - edje_thaw(); - evas_event_thaw(evas); - e_widget_min_size_set(o, 160, 240); - e_widget_framelist_object_append(of, o); - e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1); - } - + l = eina_list_free(l); - of = e_widget_framelist_add(evas, _("All Applications"), 0); + // Make frame with list of applications + of = e_widget_framelist_add(evas, _("Known Applications"), 0); o = e_widget_ilist_add(evas, 24, 24, &(fad->app2)); e_widget_on_change_hook_set(o, _e_fwin_cb_all_change, fad); fad->o_all = o; evas_event_freeze(evas); edje_freeze(); e_widget_ilist_freeze(o); + + // Adding Specific Applications list into widget + if(apps) + e_widget_ilist_header_append(o, NULL, _("Specific Applications")); + EINA_LIST_FOREACH(apps, l, desk) + { + Evas_Object *icon = NULL; + + if (!desk) continue; + icon = e_util_desktop_icon_add(desk, 24, evas); + e_widget_ilist_append(o, icon, desk->name, NULL, NULL, + efreet_util_path_to_file_id(desk->orig_path)); + } + + // Building All Applications list cats = efreet_util_desktop_name_glob_list("*"); cats = eina_list_sort(cats, 0, _e_fwin_dlg_cb_desk_sort); EINA_LIST_FREE(cats, desk) - if (!eina_list_data_find(l, desk)) + if (!eina_list_data_find(l, desk) && !eina_list_data_find(apps, desk)) l = eina_list_append(l, desk); l = eina_list_sort(l, -1, _e_fwin_dlg_cb_desk_list_sort); + // Adding All Applications list into widget + if(l) + e_widget_ilist_header_append(o, NULL, _("All Applications")); EINA_LIST_FREE(l, desk) { Evas_Object *icon = NULL; @@ -1607,19 +1623,15 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Eina_List * efreet_util_path_to_file_id(desk->orig_path)); } + eina_list_free(apps); + e_widget_ilist_go(o); e_widget_ilist_thaw(o); edje_thaw(); evas_event_thaw(evas); e_widget_min_size_set(o, 160, 240); e_widget_framelist_object_append(of, o); - if (apps) - { - e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1); - eina_list_free(apps); - } - else - e_widget_table_object_append(ot, of, 0, 0, 2, 1, 1, 1, 1, 1); + e_widget_table_object_append(ot, of, 0, 0, 2, 1, 1, 1, 1, 1); o = e_widget_label_add(evas, _("Custom Command")); e_widget_table_object_append(ot, o, 0, 1, 1, 1, 1, 1, 1, 0);
------------------------------------------------------------------------------
_______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel