Custom filelist focus improvements, now can delete files.
This commit is contained in:
parent
79c1b8e4d8
commit
540b6bd188
@ -242,6 +242,9 @@ ecdb_burn_data_page_show(void)
|
|||||||
evas_object_move(b, x, y);
|
evas_object_move(b, x, y);
|
||||||
evas_object_resize(b, w, h);
|
evas_object_resize(b, w, h);
|
||||||
edje_object_part_swallow(swallow, "ecdb/burn_data/filelist", b);
|
edje_object_part_swallow(swallow, "ecdb/burn_data/filelist", b);
|
||||||
|
|
||||||
|
b = edje_object_part_swallow_get(swallow, "ecdb/burn_data/filelist");
|
||||||
|
ecdb_widget_focus_callback_add(b, "ecdb/burn_data/filelist");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)
|
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
static void free_file(void *data);
|
static void free_file(void *data);
|
||||||
static void ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev,
|
static void ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev,
|
||||||
void *data);
|
void *data);
|
||||||
|
static void ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev,
|
||||||
|
void *data);
|
||||||
static Ewl_Widget *ecdb_custom_filelist_view_widget_fetch(void *data,
|
static Ewl_Widget *ecdb_custom_filelist_view_widget_fetch(void *data,
|
||||||
unsigned int row, unsigned int column,
|
unsigned int row, unsigned int column,
|
||||||
void *private_data);
|
void *private_data);
|
||||||
@ -35,6 +37,8 @@ ecdb_custom_filelist_new(void)
|
|||||||
ewl_callback_del_type(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED);
|
ewl_callback_del_type(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED);
|
||||||
ewl_callback_prepend(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED,
|
ewl_callback_prepend(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED,
|
||||||
ecdb_custom_filelist_cb_clicked, ret);
|
ecdb_custom_filelist_cb_clicked, ret);
|
||||||
|
ewl_callback_append(EWL_FILELIST(ret)->controller, EWL_CALLBACK_KEY_DOWN,
|
||||||
|
ecdb_custom_filelist_cb_key_down, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,48 +279,58 @@ ecdb_custom_filelist_model_data_fetch(void *data, unsigned int row,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev, void *data)
|
||||||
|
{
|
||||||
|
Ewl_Event_Key_Down *kd;
|
||||||
|
Ewl_Filelist *fl;
|
||||||
|
char *file;
|
||||||
|
int i;
|
||||||
|
Ecdb_Source *parent, *child;
|
||||||
|
|
||||||
|
kd = ev;
|
||||||
|
fl = data;
|
||||||
|
|
||||||
|
if (!ewl_mvc_selected_count_get(EWL_MVC(w)))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(kd->base.keyname, "Delete"))
|
||||||
|
{
|
||||||
|
file = ecdb_custom_filelist_selected_file_get(fl);
|
||||||
|
parent = ewl_widget_data_get(EWL_WIDGET(fl), "source");
|
||||||
|
|
||||||
|
for (i = 0; (child = parent->children[i]); i++)
|
||||||
|
{
|
||||||
|
if (!strcmp(child->dst, file))
|
||||||
|
{
|
||||||
|
ecdb_source_child_remove(parent, child);
|
||||||
|
ecdb_custom_filelist_directory_set(fl, parent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev, void *data)
|
ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev, void *data)
|
||||||
{
|
{
|
||||||
Ewl_Event_Mouse_Down *md;
|
Ewl_Event_Mouse_Down *md;
|
||||||
char *file;
|
char *file;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Ewl_Widget *c;
|
|
||||||
Ewl_Filelist *fl;
|
Ewl_Filelist *fl;
|
||||||
Ecdb_Source *parent, *child;
|
Ecdb_Source *parent, *child;
|
||||||
|
|
||||||
md = ev;
|
md = ev;
|
||||||
fl = data;
|
fl = data;
|
||||||
|
|
||||||
if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
|
if ((!ewl_mvc_selected_count_get(EWL_MVC(w))) || (md->clicks != 2))
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (md->clicks != 2)
|
|
||||||
{
|
{
|
||||||
ewl_filelist_selected_files_change_notify(fl);
|
ewl_filelist_selected_files_change_notify(fl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = ewl_container_child_at_recursive_get(EWL_CONTAINER(fl), md->base.x,
|
|
||||||
md->base.y);
|
|
||||||
|
|
||||||
while (c && c->parent)
|
|
||||||
{
|
|
||||||
if (!ewl_widget_internal_is(c))
|
|
||||||
{
|
|
||||||
i = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
c = c->parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!i)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = ecdb_custom_filelist_selected_file_get(fl);
|
file = ecdb_custom_filelist_selected_file_get(fl);
|
||||||
|
|
||||||
parent = ewl_widget_data_get(EWL_WIDGET(fl), "source");
|
parent = ewl_widget_data_get(EWL_WIDGET(fl), "source");
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
#include "ecdb.h"
|
#include "ecdb.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_widget_focus_handle(void *data, Evas_Object *o, const char *emission,
|
_widget_focus_handle(void *data, Evas_Object *o)
|
||||||
const char *source)
|
|
||||||
{
|
{
|
||||||
static char *old_source;
|
static char *old_source;
|
||||||
const char *name;
|
const char *name;
|
||||||
Evas_Object *eo;
|
Evas_Object *eo;
|
||||||
|
|
||||||
name = data;
|
name = data;
|
||||||
|
printf("part name: %s\n", name);
|
||||||
// Some widgets aren't named (such as when in combo), so check
|
// Some widgets aren't named (such as when in combo), so check
|
||||||
if (!name)
|
if (!name)
|
||||||
return;
|
return;
|
||||||
@ -27,8 +27,28 @@ _widget_focus_handle(void *data, Evas_Object *o, const char *emission,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send focus to the freshly clicked widget
|
// Send focus to the freshly clicked widget
|
||||||
eo = evas_object_name_find(ecore_evas_get(em->main_win_ee), name);
|
evas_object_focus_set(o, 1);
|
||||||
evas_object_focus_set(eo, 1);
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mouse_down_edje(void *data, Evas_Object *o, const char *emission,
|
||||||
|
const char *source)
|
||||||
|
{
|
||||||
|
_widget_focus_handle(data, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mouse_down_evas(void *data, Evas *e __UNUSED__, Evas_Object *eo,
|
||||||
|
void *ev_data __UNUSED__)
|
||||||
|
{
|
||||||
|
_widget_focus_handle(data, eo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecdb_widget_focus_callback_add(Evas_Object *o, const char *name)
|
||||||
|
{
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
|
_mouse_down_evas, (void *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
@ -39,7 +59,7 @@ ecdb_widget_add(Evas_Object *parent, const char *name)
|
|||||||
|
|
||||||
o = edje_object_add(evas_object_evas_get(parent));
|
o = edje_object_add(evas_object_evas_get(parent));
|
||||||
edje_object_signal_callback_add(o, "mouse,down,*", "*",
|
edje_object_signal_callback_add(o, "mouse,down,*", "*",
|
||||||
_widget_focus_handle,
|
_mouse_down_edje,
|
||||||
(void *)name);
|
(void *)name);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#ifndef ECDB_WIDGETS_H
|
#ifndef ECDB_WIDGETS_H
|
||||||
#define ECDB_WIDGETS_H
|
#define ECDB_WIDGETS_H
|
||||||
|
|
||||||
|
void ecdb_widget_focus_callback_add(Evas_Object *o, const char *name);
|
||||||
|
|
||||||
Evas_Object *ecdb_button_add(Evas_Object *parent, const char *name);
|
Evas_Object *ecdb_button_add(Evas_Object *parent, const char *name);
|
||||||
void ecdb_button_label_set(Evas_Object *b, const char *label);
|
void ecdb_button_label_set(Evas_Object *b, const char *label);
|
||||||
void ecdb_button_icon_set(Evas_Object *b, const char *group);
|
void ecdb_button_icon_set(Evas_Object *b, const char *group);
|
||||||
|
Loading…
Reference in New Issue
Block a user