forked from enlightenment/edi
Add option to delete file in browser
Reviewers: ajwillia.ms Reviewed By: ajwillia.ms Differential Revision: https://phab.enlightenment.org/D4742
This commit is contained in:
parent
2c2fca6d82
commit
629a293a66
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "edi_filepanel.h"
|
||||
#include "edi_content_provider.h"
|
||||
#include "mainview/edi_mainview.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
|
||||
|
@ -117,6 +118,17 @@ _item_menu_open_as_image_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED
|
|||
_open_cb(_menu_cb_path, "image", EINA_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_menu_del_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
const char *filename = _menu_cb_path;
|
||||
|
||||
edi_mainview_item_close_path(filename);
|
||||
|
||||
ecore_file_unlink(filename);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_menu_dismissed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *ev EINA_UNUSED)
|
||||
|
@ -155,6 +167,7 @@ _item_menu_create(Evas_Object *win)
|
|||
_item_menu_filetype_create(menu, menu_it, "text", _item_menu_open_as_text_cb);
|
||||
_item_menu_filetype_create(menu, menu_it, "code", _item_menu_open_as_code_cb);
|
||||
_item_menu_filetype_create(menu, menu_it, "image", _item_menu_open_as_image_cb);
|
||||
menu_it = elm_menu_item_add(menu, NULL, "edit-delete", "delete", _item_menu_del_cb, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -511,6 +511,22 @@ edi_mainview_open_window(Edi_Path_Options *options)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
edi_mainview_item_close_path(const char *path)
|
||||
{
|
||||
Eina_List *item;
|
||||
Edi_Mainview_Item *it;
|
||||
|
||||
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
||||
{
|
||||
if (it && !strcmp(it->path, path))
|
||||
{
|
||||
_edi_mainview_item_close(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edi_mainview_save()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,15 @@ extern "C" {
|
|||
*/
|
||||
void edi_mainview_add(Evas_Object *parent, Evas_Object *win);
|
||||
|
||||
/**
|
||||
* Delete a mainview by its path
|
||||
* @param parh The path of the file associated with tab to close.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
void edi_mainview_item_close_path(const char *path);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue