forked from enlightenment/enlightenment
allow multiple mimes and actions on files in efm
This commit is contained in:
parent
db3ea64dd3
commit
bea94314bd
|
@ -272,55 +272,75 @@ static Eina_List *_e_fwin_mime_all_handlers_list = NULL;
|
||||||
static int
|
static int
|
||||||
_e_fwin_cb_dir_mime_handler_test(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path)
|
_e_fwin_cb_dir_mime_handler_test(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path)
|
||||||
{
|
{
|
||||||
if (ecore_file_is_dir(path)) return 1;
|
const char *rp;
|
||||||
if (e_fm2_real_path_get(obj))
|
|
||||||
{
|
rp = e_fm2_real_path_get(obj);
|
||||||
evas_object_data_set(obj, "fileman_terminal_realpath", (void*)1);
|
if ((rp) && (!strcmp(path, rp))) return 1;
|
||||||
return 1;
|
if (rp) return 1;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_fwin_cb_dir_mime_handler(void *data, Evas_Object *obj EINA_UNUSED, const char *path)
|
_e_fwin_cb_dir_mime_handler(void *data, Evas_Object *obj, const char *path)
|
||||||
{
|
{
|
||||||
E_Fwin_Mime_Handler *h = data;
|
E_Fwin_Mime_Handler *h = data;
|
||||||
Eina_Stringshare *rp;
|
Eina_Stringshare *rp;
|
||||||
Eina_List *files = NULL;
|
Eina_List *files = NULL;
|
||||||
|
const char *f;
|
||||||
|
|
||||||
rp = e_fm2_real_path_get(obj);
|
rp = e_fm2_real_path_get(obj);
|
||||||
if (rp && (rp != path) && (evas_object_data_del(obj, "fileman_terminal_realpath"))) //icon menu; use rp
|
if ((rp) && (rp == path) &&
|
||||||
path = rp;
|
(!evas_object_data_del(obj, "fileman_terminal_realpath")))
|
||||||
files = eina_list_append(files, path);
|
{
|
||||||
|
files = eina_list_append(files, eina_stringshare_add(rp));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Eina_List *selected;
|
||||||
|
E_Fm2_Icon_Info *ici;
|
||||||
|
|
||||||
|
selected = e_fm2_selected_list_get(obj);
|
||||||
|
EINA_LIST_FREE(selected, ici)
|
||||||
|
{
|
||||||
|
files = eina_list_append(files, eina_stringshare_add(ici->file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e_exec(e_zone_current_get(), h->desktop, NULL, files, "fileman");
|
e_exec(e_zone_current_get(), h->desktop, NULL, files, "fileman");
|
||||||
eina_list_free(files);
|
EINA_LIST_FREE(files, f) eina_stringshare_del(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_fwin_mime_all_handlers_fill(void)
|
_e_fwin_mime_all_handlers_fill(void)
|
||||||
{
|
{
|
||||||
E_Fwin_Mime_Handler *h;
|
E_Fwin_Mime_Handler *h;
|
||||||
Eina_List *desktops;
|
Eina_List *desktops, *mimes;
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
|
|
||||||
desktops = efreet_util_desktop_name_glob_list("*");
|
desktops = efreet_util_desktop_name_glob_list("*");
|
||||||
EINA_LIST_FREE(desktops, desktop)
|
EINA_LIST_FREE(desktops, desktop)
|
||||||
{
|
{
|
||||||
const char *mime = eina_hash_find
|
const char *m, *mime = eina_hash_find
|
||||||
(desktop->x, "X-Enlightenment-Action-Mime");
|
(desktop->x, "X-Enlightenment-Action-Mime");
|
||||||
if (!mime) continue;
|
if (!mime) continue;
|
||||||
h = calloc(1, sizeof(E_Fwin_Mime_Handler));
|
|
||||||
if (!h) continue;
|
mimes = efreet_desktop_string_list_parse(mime);
|
||||||
h->mime = eina_stringshare_add(mime);
|
EINA_LIST_FREE(mimes, m)
|
||||||
h->desktop = desktop;
|
{
|
||||||
efreet_desktop_ref(desktop);
|
h = calloc(1, sizeof(E_Fwin_Mime_Handler));
|
||||||
h->handler = e_fm2_mime_handler_new
|
if (!h) continue;
|
||||||
(desktop->name, desktop->icon,
|
h->mime = eina_stringshare_add(m);
|
||||||
_e_fwin_cb_dir_mime_handler, h,
|
h->desktop = desktop;
|
||||||
_e_fwin_cb_dir_mime_handler_test, h);
|
efreet_desktop_ref(desktop);
|
||||||
e_fm2_mime_handler_mime_add(h->handler, h->mime);
|
h->handler = e_fm2_mime_handler_new
|
||||||
_e_fwin_mime_all_handlers_list =
|
(desktop->name, desktop->icon,
|
||||||
eina_list_append(_e_fwin_mime_all_handlers_list, h);
|
_e_fwin_cb_dir_mime_handler, h,
|
||||||
|
_e_fwin_cb_dir_mime_handler_test, h);
|
||||||
|
e_fm2_mime_handler_mime_add(h->handler, h->mime);
|
||||||
|
_e_fwin_mime_all_handlers_list =
|
||||||
|
eina_list_append(_e_fwin_mime_all_handlers_list, h);
|
||||||
|
eina_stringshare_del(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue