parent
630899ecb9
commit
eba3d64663
|
@ -185,22 +185,28 @@ e_fm2_path_set(Evas_Object *obj, char *dev, char *path)
|
|||
if (sd->config) _e_fm2_config_free(sd->config);
|
||||
sd->config = E_NEW(E_Fm2_Config, 1);
|
||||
if (!sd->config) return;
|
||||
sd->config->view.mode = E_FM2_VIEW_MODE_ICONS;
|
||||
// sd->config->view.mode = E_FM2_VIEW_MODE_LIST;
|
||||
// sd->config->view.mode = E_FM2_VIEW_MODE_ICONS;
|
||||
sd->config->view.mode = E_FM2_VIEW_MODE_LIST;
|
||||
sd->config->view.open_dirs_in_place = 1;
|
||||
sd->config->view.selector = 1;
|
||||
sd->config->view.single_click = 0;
|
||||
sd->config->view.no_subdir_jump = 0;
|
||||
sd->config->icon.icon.w = 64;
|
||||
sd->config->icon.icon.h = 64;
|
||||
sd->config->icon.list.w = 24;
|
||||
sd->config->icon.list.h = 24;
|
||||
sd->config->icon.fixed.w = 0;
|
||||
sd->config->icon.fixed.w = 1;
|
||||
sd->config->icon.fixed.h = 1;
|
||||
sd->config->list.sort.no_case = 1;
|
||||
sd->config->icon.extension.show = 0;
|
||||
sd->config->list.sort.no_case = 1;
|
||||
sd->config->list.sort.dirs.first = 1;
|
||||
sd->config->list.sort.dirs.last = 1;
|
||||
sd->config->selection.single = 0;
|
||||
sd->config->selection.windows_modifiers = 0;
|
||||
sd->config->view.open_dirs_in_place = 0;
|
||||
sd->config->view.selector = 0;
|
||||
sd->config->theme.background = NULL;
|
||||
sd->config->theme.frame = NULL;
|
||||
sd->config->theme.icons = NULL;
|
||||
sd->config->theme.fixed = 0;
|
||||
|
||||
_e_fm2_scan_stop(obj);
|
||||
_e_fm2_queue_free(obj);
|
||||
|
@ -215,6 +221,7 @@ e_fm2_path_set(Evas_Object *obj, char *dev, char *path)
|
|||
sd->realpath = _e_fm2_dev_path_map(sd->dev, sd->path);
|
||||
printf("FM: %s\n", sd->realpath);
|
||||
_e_fm2_scan_start(obj);
|
||||
evas_object_smart_callback_call(obj, "changed", NULL);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -232,29 +239,41 @@ e_fm2_path_get(Evas_Object *obj, const char **dev, const char **path)
|
|||
if (path) *path = sd->path;
|
||||
}
|
||||
|
||||
/*
|
||||
EAPI int
|
||||
e_fm2_parent_go(Evas_Object *obj)
|
||||
{
|
||||
E_Fm2_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return; // safety
|
||||
if (!evas_object_type_get(obj)) return; // safety
|
||||
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_fm2_has_parent_get(Evas_Object *obj)
|
||||
{
|
||||
E_Fm2_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return 0; // safety
|
||||
if (!evas_object_type_get(obj)) return 0; // safety
|
||||
if (strcmp(evas_object_type_get(obj), "e_fm")) return 0; // safety
|
||||
if (!sd->path) return 0;
|
||||
if ((sd->path[0] == 0) || (!strcmp(sd->path, "/"))) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_fm2_parent_go(Evas_Object *obj)
|
||||
{
|
||||
E_Fm2_Smart_Data *sd;
|
||||
char *path, *dev = NULL, *p;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return; // safety
|
||||
if (!evas_object_type_get(obj)) return; // safety
|
||||
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
||||
if (!sd->path) return;
|
||||
path = strdup(sd->path);
|
||||
if (sd->dev) dev = strdup(sd->dev);
|
||||
p = strrchr(path, '/');
|
||||
if (p) *p = 0;
|
||||
e_fm2_path_set(obj, dev, path);
|
||||
E_FREE(dev);
|
||||
E_FREE(path);
|
||||
}
|
||||
|
||||
/*
|
||||
EAPI void
|
||||
e_fm2_config_set(Evas_Object *obj, E_Fm2_Config *cfg)
|
||||
{
|
||||
|
@ -1242,6 +1261,23 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
|
|||
{
|
||||
/* if its a directory && open dirs in-place is set then change the dir
|
||||
* to be the dir + file */
|
||||
if ((S_ISDIR(ic->st.st_mode)) &&
|
||||
(ic->sd->config->view.open_dirs_in_place) &&
|
||||
(!ic->sd->config->view.no_subdir_jump) &&
|
||||
(!ic->sd->config->view.single_click)
|
||||
)
|
||||
{
|
||||
char buf[4096], *dev = NULL;
|
||||
|
||||
if (ic->sd->dev) dev = strdup(ic->sd->dev);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->file);
|
||||
e_fm2_path_set(ic->sd->obj, dev, buf);
|
||||
E_FREE(dev);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_smart_callback_call(ic->sd->obj, "selected", NULL);
|
||||
}
|
||||
/* if its in file selector mode then signal that a selection has
|
||||
* taken place and dont do anything more */
|
||||
|
||||
|
@ -1328,6 +1364,12 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
|
|||
_e_fm2_icon_deselect(ic);
|
||||
else
|
||||
_e_fm2_icon_select(ic);
|
||||
if (!(S_ISDIR(ic->st.st_mode)) &&
|
||||
(ic->sd->config->view.single_click)
|
||||
)
|
||||
{
|
||||
evas_object_smart_callback_call(ic->sd->obj, "selected", NULL);
|
||||
}
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,8 @@ struct _E_Fm2_Config
|
|||
E_Fm2_View_Mode mode;
|
||||
unsigned char open_dirs_in_place;
|
||||
unsigned char selector;
|
||||
unsigned char single_click;
|
||||
unsigned char no_subdir_jump;
|
||||
} view;
|
||||
/* display of icons */
|
||||
struct {
|
||||
|
@ -84,6 +86,8 @@ EAPI int e_fm2_shutdown(void);
|
|||
EAPI Evas_Object *e_fm2_add(Evas *evas);
|
||||
EAPI void e_fm2_path_set(Evas_Object *obj, char *dev, char *path);
|
||||
EAPI void e_fm2_path_get(Evas_Object *obj, const char **dev, const char **path);
|
||||
EAPI int e_fm2_has_parent_get(Evas_Object *obj);
|
||||
EAPI void e_fm2_parent_go(Evas_Object *obj);
|
||||
|
||||
EAPI void e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
EAPI void e_fm2_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
|
|
|
@ -585,25 +585,56 @@ _e_test_internal(E_Container *con)
|
|||
evas_object_focus_set(o, 1);
|
||||
}
|
||||
#elif 0
|
||||
static void
|
||||
_e_test_cb_button(void *data1, void *data2)
|
||||
{
|
||||
e_fm2_parent_go(data1);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_test_cb_changed(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
if (!e_fm2_has_parent_get(obj)) e_widget_disabled_set(data, 1);
|
||||
else e_widget_disabled_set(data, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_test_cb_selected(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
printf("SELECTED!\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_e_test_internal(E_Container *con)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
Evas_Object *o, *o2;
|
||||
Evas_Object *o, *o2, *o3;
|
||||
|
||||
dia = e_dialog_new(con);
|
||||
e_dialog_title_set(dia, "A Test Dialog");
|
||||
|
||||
o = e_fm2_add(dia->win->evas);
|
||||
e_fm2_path_set(o, "~/", "/pix/bg");
|
||||
evas_object_show(o);
|
||||
|
||||
o3 = e_widget_list_add(dia->win->evas, 0, 0);
|
||||
|
||||
o2 = e_widget_button_add(dia->win->evas, "Up a directory", NULL,
|
||||
_e_test_cb_button, o, NULL);
|
||||
evas_object_show(o2);
|
||||
e_widget_list_object_append(o3, o2, 1, 0, 0.5);
|
||||
|
||||
evas_object_smart_callback_add(o, "changed", _e_test_cb_changed, o2);
|
||||
evas_object_smart_callback_add(o, "selected", _e_test_cb_selected, NULL);
|
||||
|
||||
evas_object_show(o);
|
||||
o2 = e_scrollframe_add(dia->win->evas);
|
||||
evas_object_show(o2);
|
||||
e_scrollframe_extern_pan_set(o2, o,
|
||||
e_fm2_pan_set, e_fm2_pan_get,
|
||||
e_fm2_pan_max_get, e_fm2_pan_child_size_get);
|
||||
e_dialog_content_set(dia, o2, 64, 64);
|
||||
e_widget_list_object_append(o3, o2, 1, 1, 0.5);
|
||||
|
||||
e_dialog_content_set(dia, o3, 128, 128);
|
||||
|
||||
e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
|
||||
e_dialog_resizable_set(dia, 1);
|
||||
|
|
|
@ -46,6 +46,7 @@ e_widget_list_object_append(Evas_Object *obj, Evas_Object *sobj, int fill, int e
|
|||
wd = e_widget_data_get(obj);
|
||||
|
||||
e_box_pack_end(wd->o_box, sobj);
|
||||
mw = mh = 0;
|
||||
e_widget_min_size_get(sobj, &mw, &mh);
|
||||
if (e_box_orientation_get(wd->o_box) == 1)
|
||||
e_box_pack_options_set(sobj,
|
||||
|
|
Loading…
Reference in New Issue