e17: add efm navigation and pathbar to fileman module

SVN revision: 62261
This commit is contained in:
Hannes Janetzek 2011-08-09 15:47:22 +00:00
parent f64603d630
commit 54ed3c6349
9 changed files with 1163 additions and 14 deletions

View File

@ -1782,6 +1782,29 @@ group "E_Config" struct {
}
}
}
group "E_Config_Gadcon" struct {
group "clients" list {
group "E_Config_Gadcon_Client" struct {
value "name" string: "efm_navigation";
value "id" string: "efm_navigation.1";
value "geom.pos" int: 720;
value "geom.size" int: 80;
value "geom.res" int: 800;
value "geom.pos_x" double: 0.0000000000000000000000000;
value "geom.pos_y" double: 0.0000000000000000000000000;
value "geom.size_w" double: 0.0000000000000000000000000;
value "geom.size_h" double: 0.0000000000000000000000000;
value "state_info.seq" int: 2;
value "state_info.flags" int: 0;
value "orient" int: 0;
value "autoscroll" uchar: 0;
value "resizable" uchar: 0;
}
}
value "name" string: "toolbar";
value "id" int: 1;
value "zone" int: 0;
}
}
group "gadcons" list {
group "E_Config_Gadcon" struct {

View File

@ -39066,4 +39066,518 @@ collections {
}
}
*/
group {
name: "modules/efm_navigation/main";
images {
image: "bt_base1.png" COMP;
image: "bt_base2.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_hilight.png" COMP;
image: "bt_shine.png" COMP;
image: "bt_dis_hilight.png" COMP;
image: "bt_dis_shine.png" COMP;
image: "icon_left_arrow.png" COMP;
image: "icon_right_arrow.png" COMP;
image: "icon_up_arrow.png" COMP;
image: "refresh.png" COMP;
image: "favorites.png" COMP;
}
parts {
part {
name: "base";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
part {
name: "begin";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
max: 1 1;
align: 0.0 0.0;
color: 0 0 0 0;
}
}
#define NAV_BUTTON(NAME, ICON, REL_TO, OFF_X) \
part { \
name: NAME"_bg"; \
mouse_events: 1; \
repeat_events: 1; \
type: IMAGE; \
description { \
state: "default" 0.0; \
min: 28 28; \
max: 28 28; \
aspect: 1.0 1.0; \
aspect_preference: VERTICAL; \
align: 0.0 0.5; \
rel1 { \
to_x: REL_TO; \
relative: 1.0 0.0; \
offset: OFF_X 0; \
} \
image { \
normal: "bt_base2.png"; \
border: 7 7 7 7; \
} \
} \
description { \
state: "down" 0.0; \
inherit: "default" 0.0; \
image.normal: "bt_base1.png"; \
} \
description { \
state: "disabled" 0.0; \
inherit: "default" 0.0; \
image.normal: "bt_dis_base.png"; \
image.border: 4 4 4 4; \
} \
} \
part { \
name: NAME"_img"; \
mouse_events: 0; \
type: IMAGE; \
description { \
state: "default" 0.0; \
min: 16 16; \
max: 16 16; \
rel1 { \
offset: 7 7; \
to: NAME"_bg"; \
} \
rel2 { \
offset: -8 -8; \
to: NAME"_bg"; \
} \
image.normal: ICON".png"; \
} \
} \
part { \
name: NAME"_fg1"; \
type: IMAGE; \
mouse_events: 1; \
repeat_events: 1; \
description { \
state: "default" 0.0; \
rel1.to: NAME"_bg"; \
rel2.to: NAME"_bg"; \
rel2.relative: 1.0 0.5; \
image { \
normal: "bt_hilight.png"; \
border: 7 7 7 0; \
} \
} \
description { \
state: "disabled" 0.0; \
inherit: "default" 0.0; \
image.normal: "bt_dis_hilight.png"; \
image.border: 4 4 4 0; \
} \
} \
part { \
name: NAME"_fg2"; \
type: IMAGE; \
mouse_events: 1; \
repeat_events: 1; \
description { \
state: "default" 0.0; \
rel1.to: NAME"_bg"; \
rel2.to: NAME"_bg"; \
image { \
normal: "bt_shine.png"; \
border: 7 7 7 7; \
} \
} \
description { \
state: "disabled" 0.0; \
inherit: "default" 0.0; \
image.normal: "bt_dis_shine.png"; \
} \
} \
part { \
name: NAME"_event_eater"; \
type: RECT; \
mouse_events: 1; \
repeat_events: 0; \
description { \
state: "default" 0.0; \
visible: 0; \
color: 255 255 255 0; \
rel1.to: NAME"_bg"; \
rel2.to: NAME"_bg"; \
} \
description { \
state: "disabled" 0.0; \
inherit: "default" 0.0; \
visible: 1; \
} \
} \
NAV_BUTTON("back", "icon_left_arrow", "begin", 5);
NAV_BUTTON("forward", "icon_right_arrow", "back_bg", 1);
NAV_BUTTON("up", "icon_up_arrow", "forward_bg", 10);
NAV_BUTTON("refresh", "refresh", "up_bg", 1);
NAV_BUTTON("favorites", "favorites", "refresh_bg", 1);
part {
name: "e.swallow.pathbar";
type: SWALLOW;
description {
state: "default" 0.0;
align: 0.0 0.5;
/* rel1.to_x: "favorites_base"; */
rel1.to_x: "favorites_bg";
rel1.relative: 1.0 0.0;
rel1.offset: 10 0;
rel2.offset: -40 -1;
color: 200 0 0 200;
}
}
}
programs {
#define NAV_BUTTON_PROG(NAME) \
program { \
name: NAME"_click"; \
signal: "mouse,down,1"; \
source: "bg"; \
action: STATE_SET "down" 0.0; \
target: NAME"_bg"; \
} \
program { \
name: NAME"_unclick"; \
signal: "mouse,up,1"; \
source: "bg"; \
action: STATE_SET "default" 0.0; \
target: NAME"_bg"; \
} \
program { \
name: NAME"_send"; \
signal: "mouse,clicked,1"; \
source: NAME"_bg"; \
action: SIGNAL_EMIT "e,action,"NAME",click" ""; \
} \
program { \
name: NAME"_disable"; \
signal: "e,state,"NAME",disabled"; \
source: "e"; \
action: STATE_SET "disabled" 0.0; \
target: NAME"_bg"; \
target: NAME"_fg1"; \
target: NAME"_fg2"; \
target: NAME"_event_eater"; \
} \
program { \
name: NAME"_enable"; \
signal: "e,state,"NAME",enabled"; \
source: "e"; \
action: STATE_SET "default" 0.0; \
target: NAME"_bg"; \
target: NAME"_fg1"; \
target: NAME"_fg2"; \
target: NAME"_event_eater"; \
} \
NAV_BUTTON_PROG("back");
NAV_BUTTON_PROG("forward");
NAV_BUTTON_PROG("up");
NAV_BUTTON_PROG("refresh");
NAV_BUTTON_PROG("favorites");
}
}
group {
name: "modules/efm_navigation/pathbar_scrollframe";
images {
image: "icon_left_arrow.png" COMP;
image: "icon_right_arrow.png" COMP;
}
parts {
part {
name: "base";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
rel1 {
to_x: "left_arrow";
relative: 1.0 0.0;
}
rel2 {
to_x: "right_arrow";
relative: 0.0 1.0;
}
color: 0 0 0 0;
}
}
part {
name: "clipper";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "base";
rel2.to: "base";
}
}
part {
name: "e.swallow.content";
type: SWALLOW;
clip_to: "clipper";
description {
state: "default" 0.0;
rel1.to: "clipper";
rel2.to: "clipper";
}
}
part {
name: "left_arrow";
type: IMAGE;
mouse_events: 1;
scale: 1;
description {
state: "default" 0.0;
/* aspect: 1.0 1.0;
* aspect_preference: VERTICAL; */
align: 0.0 0.5;
min: 16 16;
max: 16 16;
image.normal: "icon_left_arrow.png";
}
}
part {
name: "right_arrow";
type: IMAGE;
mouse_events: 1;
scale: 1;
description {
state: "default" 0.0;
align: 1.0 0.5;
min: 16 16;
max: 16 16;
image.normal: "icon_right_arrow.png";
}
}
part {
name: "e.dragable.hbar";
mouse_events: 0;
dragable {
x: 1 1 0;
y: 0 0 0;
confine: "base";
}
description {
state: "default" 0.0;
visible: 0;
rel1.to: "base";
rel2.to: "base";
}
}
part {
name: "event";
mouse_events: 1;
repeat_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
}
program {
name: "sb_left";
signal: "mouse,down,1";
source: "left_arrow";
action: DRAG_VAL_STEP -5.0 0.0;
target: "e.dragable.hbar";
}
program {
name: "sb_right";
signal: "mouse,down,1";
source: "right_arrow";
action: DRAG_VAL_STEP 5.0 0.0;
target: "e.dragable.hbar";
}
}
group {
name: "modules/efm_navigation/pathbar_button";
images {
image: "bt_base1.png" COMP;
image: "bt_base2.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_hilight.png" COMP;
image: "bt_shine.png" COMP;
image: "bt_dis_hilight.png" COMP;
image: "bt_dis_shine.png" COMP;
}
parts {
part {
name: "bg";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
min: 28 28;
image {
normal: "bt_base2.png";
border: 7 7 7 7;
}
}
description {
state: "down" 0.0;
inherit: "default" 0.0;
image.normal: "bt_base1.png";
}
}
part {
name: "label2";
type: TEXT;
mouse_events: 0;
scale: 1;
description {
state: "default" 0.0;
max: 150 32;
rel1.to: "e.text.label";
rel2.to: "e.text.label";
color: 224 224 224 255;
text {
font: "Sans";
text_source: "e.text.label";
size: 10;
min: 1 1;
align: 0.5 0.5;
elipsis: 0.0;
}
}
description {
state: "selected" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
part {
name: "e.text.label";
type: TEXT;
mouse_events: 0;
scale: 1;
description {
state: "default" 0.0;
max: 150 32;
rel1.offset: 7 0;
rel2.offset: -8 -1;
visible: 0;
color: 255 255 255 255;
text {
font: "Sans:style=Bold";
size: 10;
min: 1 1;
align: 0.5 0.5;
elipsis: 0.0;
}
}
description {
state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part {
name: "fg1";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "bg";
rel2 {
to: "bg";
relative: 1.0 0.5;
}
image {
normal: "bt_hilight.png";
border: 7 7 7 0;
}
}
}
part {
name: "fg2";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "bg";
rel2.to: "bg";
image {
normal: "bt_shine.png";
border: 7 7 7 7;
}
}
}
part {
name: "event";
type: RECT;
mouse_events: 1;
ignore_flags: ON_HOLD;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program {
name: "click";
signal: "mouse,down,1";
source: "event";
action: STATE_SET "down" 0.0;
target: "bg";
}
program {
name: "unclick";
signal: "mouse,up,1";
source: "event";
action: STATE_SET "default" 0.0;
target: "bg";
}
program {
name: "send";
signal: "mouse,clicked,1";
source: "event";
action: SIGNAL_EMIT "e,action,click" "";
}
program {
name: "select";
signal: "e,state,selected";
source: "e";
action: STATE_SET "selected" 0.0;
target: "e.text.label";
target: "label2";
}
program {
name: "normal";
signal: "e,state,default";
source: "e";
action: STATE_SET "default" 0.0;
target: "e.text.label";
target: "label2";
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -29,7 +29,8 @@ module_la_SOURCES = e_mod_main.c \
e_int_config_mime.c \
e_int_config_mime.h \
e_int_config_mime_edit.c \
e_int_config_mime_edit.h
e_int_config_mime_edit.h \
e_fwin_nav.c
module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version

View File

@ -11,6 +11,10 @@
* multi-selecting)
*/
#define DEFAULT_WIDTH 600
#define DEFAULT_HEIGHT 350
typedef struct _E_Fwin E_Fwin;
typedef struct _E_Fwin_Page E_Fwin_Page;
typedef struct _E_Fwin_Apps_Dialog E_Fwin_Apps_Dialog;
@ -440,8 +444,8 @@ _e_fwin_new(E_Container *con,
E_Fwin *fwin;
E_Fwin_Page *page;
Evas_Object *o;
char buf[PATH_MAX];
E_Zone *zone;
fwin = E_OBJECT_ALLOC(E_Fwin, E_FWIN_TYPE, _e_fwin_free);
if (!fwin) return NULL;
fwin->win = e_win_new(con);
@ -482,11 +486,19 @@ _e_fwin_new(E_Container *con,
e_fm2_path_set(page->fm_obj, dev, path);
_e_fwin_window_title_set(page);
snprintf(buf, sizeof(buf), "e_fwin::%s", e_fm2_real_path_get(fwin->cur_page->fm_obj));
e_win_name_class_set(fwin->win, "E", buf);
e_win_size_min_set(fwin->win, 24, 24);
e_win_resize(fwin->win, 280 * e_scale, 200 * e_scale);
zone = e_util_zone_current_get(e_manager_current_get());
if ((zone) && (zone->w < DEFAULT_WIDTH))
{
int w, h;
e_zone_useful_geometry_get(zone, NULL, NULL, &w, &h);
e_win_resize(fwin->win, w, h);
}
else
e_win_resize(fwin->win, DEFAULT_WIDTH, DEFAULT_HEIGHT);
e_win_show(fwin->win);
if (fwin->win->evas_win)
e_drop_xdnd_register_set(fwin->win->evas_win, 1);
@ -1029,7 +1041,7 @@ _e_fwin_config_set(E_Fwin_Page *page)
static void
_e_fwin_window_title_set(E_Fwin_Page *page)
{
char buf[4096];
char buf[PATH_MAX];
const char *file;
if (!page) return;
@ -1045,6 +1057,9 @@ _e_fwin_window_title_set(E_Fwin_Page *page)
eina_strlcpy(buf, file, sizeof(buf));
e_win_title_set(page->fwin->win, buf);
}
snprintf(buf, sizeof(buf), "e_fwin::%s", e_fm2_real_path_get(page->fm_obj));
e_win_name_class_set(page->fwin->win, "E", buf);
}
static void
@ -1496,7 +1511,7 @@ _e_fwin_cb_page_obj_del(void *data,
E_Fwin_Page *page;
page = data;
printf("------ page obj del %p %p\n", page, page->fm_obj);
evas_object_smart_callback_del(page->fm_obj, "dir_changed",
_e_fwin_changed);
evas_object_smart_callback_del(page->fm_obj, "dir_deleted",
@ -1891,14 +1906,14 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page,
/* TODO add config for preffered
initial size? */
w = 5 * iw * e_scale;
if (w > 400)
w = 400;
if (w > DEFAULT_WIDTH)
w = DEFAULT_WIDTH;
if (w > zw)
w = zw;
h = 4 * ih * e_scale;
if (h > 300)
h = 300;
if (h > DEFAULT_HEIGHT)
h = DEFAULT_HEIGHT;
if (h > zh)
h = zh;

View File

@ -13,5 +13,9 @@ void e_fwin_all_unsel (void *data);
void e_fwin_reload_all (void);
int e_fwin_zone_find (E_Zone *zone);
Eina_Bool e_fwin_nav_init(void);
Eina_Bool e_fwin_nav_shutdown(void);
#endif
#endif

View File

@ -0,0 +1,587 @@
#include <e.h>
#include "e_mod_main.h"
typedef struct _Instance Instance;
struct _Instance
{
E_Gadcon_Client *gcc;
E_Toolbar *tbar;
Evas_Object *o_base, *o_box, *o_fm, *o_scroll;
// buttons
Eina_List *l_buttons;
Eina_List *history, *current;
int ignore_dir;
const char *theme;
Ecore_Idle_Enterer *idler;
};
/* local function protos */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc);
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
static char *_gc_label(E_Gadcon_Client_Class *client_class);
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
static void _cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _cb_back_click(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _cb_forward_click(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _cb_up_click(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _cb_refresh_click(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _cb_favorites_click(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _cb_changed(void *data, Evas_Object *obj, void *event_info);
static void _cb_dir_changed(void *data, Evas_Object *obj, void *event_info);
static void _cb_button_click(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _box_button_append(Instance *inst, const char *label, void (*func)(void *data, Evas_Object *obj, const char *emission, const char *source));
static Eina_List *instances = NULL;
static const char *_nav_mod_dir = NULL;
/* local gadcon functions */
static const E_Gadcon_Client_Class _gc_class =
{
GADCON_CLIENT_CLASS_VERSION, "efm_navigation",
{
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
e_gadcon_site_is_efm_toolbar
}, E_GADCON_CLIENT_STYLE_PLAIN
};
Eina_Bool
e_fwin_nav_init(void)
{
e_gadcon_provider_register(&_gc_class);
return EINA_TRUE;
}
Eina_Bool
e_fwin_nav_shutdown(void)
{
e_gadcon_provider_unregister(&_gc_class);
return EINA_TRUE;
}
static void _cb_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Instance *inst;
int w, h;
inst = data;
evas_object_geometry_get(inst->gcc->gadcon->o_container, 0, 0, &w, &h);
e_gadcon_client_min_size_set(inst->gcc, w, h);
e_gadcon_client_aspect_set(inst->gcc, w, h);
}
static Eina_Bool
_cb_initial_dir(void *data)
{
Instance *inst = data;
_cb_dir_changed(inst, NULL, NULL);
return ECORE_CALLBACK_CANCEL;
}
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
Instance *inst = NULL;
char buf[PATH_MAX];
int w, h;
E_Toolbar *tbar;
Eina_List *l;
Evas_Object *o_fm;
tbar = e_gadcon_toolbar_get(gc);
if (!tbar) return NULL;
o_fm = e_toolbar_fm2_get(tbar);
if (!o_fm) return NULL;
/* make sure only one instance exists in toolbar */
EINA_LIST_FOREACH(instances, l, inst)
if (inst->tbar == tbar) return NULL;
inst = E_NEW(Instance, 1);
if (!inst) return NULL;
inst->tbar = tbar;
inst->o_fm = o_fm;
snprintf(buf, sizeof(buf), "%s/e-module-efm_nav.edj", _nav_mod_dir);
inst->theme = eina_stringshare_add(buf);
inst->o_base = edje_object_add(gc->evas);
e_theme_edje_object_set(inst->o_base, "base/theme/modules/efm_navigation",
"modules/efm_navigation/main");
edje_object_signal_callback_add(inst->o_base, "e,action,back,click", "",
_cb_back_click, inst);
edje_object_signal_callback_add(inst->o_base, "e,action,forward,click", "",
_cb_forward_click, inst);
edje_object_signal_callback_add(inst->o_base, "e,action,up,click", "",
_cb_up_click, inst);
edje_object_signal_callback_add(inst->o_base, "e,action,refresh,click", "",
_cb_refresh_click, inst);
edje_object_signal_callback_add(inst->o_base, "e,action,favorites,click", "",
_cb_favorites_click, inst);
evas_object_show(inst->o_base);
inst->o_scroll = e_scrollframe_add(gc->evas);
e_scrollframe_custom_theme_set(inst->o_scroll,
"base/theme/modules/efm_navigation",
"modules/efm_navigation/pathbar_scrollframe");
e_scrollframe_single_dir_set(inst->o_scroll, 1);
e_scrollframe_policy_set(inst->o_scroll, E_SCROLLFRAME_POLICY_AUTO,
E_SCROLLFRAME_POLICY_OFF);
e_scrollframe_thumbscroll_force(inst->o_scroll, 1);
evas_object_show(inst->o_scroll);
inst->o_box = e_box_add(gc->evas);
e_box_orientation_set(inst->o_box, 1);
e_box_homogenous_set(inst->o_box, 0);
e_scrollframe_child_set(inst->o_scroll, inst->o_box);
evas_object_show(inst->o_box);
edje_object_part_swallow(inst->o_base, "e.swallow.pathbar", inst->o_scroll);
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_base);
inst->gcc->data = inst;
/* add the hooks to get signals from efm */
evas_object_event_callback_add(inst->o_fm, EVAS_CALLBACK_KEY_DOWN,
_cb_key_down, inst);
evas_object_smart_callback_add(inst->o_fm, "changed",
_cb_changed, inst);
evas_object_smart_callback_add(inst->o_fm, "dir_changed",
_cb_dir_changed, inst);
evas_object_event_callback_add(inst->o_base,
EVAS_CALLBACK_MOUSE_DOWN,
_cb_mouse_down, inst);
if (!inst->gcc->resizable)
{
evas_object_geometry_get(inst->gcc->gadcon->o_container, 0, 0, &w, &h);
e_gadcon_client_min_size_set(inst->gcc, w, h);
e_gadcon_client_aspect_set(inst->gcc, w, h);
evas_object_event_callback_add(inst->gcc->gadcon->o_container,
EVAS_CALLBACK_RESIZE,
_cb_resize, inst);
}
edje_object_signal_emit(inst->o_base, "e,state,back,disabled", "e");
edje_object_signal_emit(inst->o_base, "e,state,forward,disabled", "e");
edje_object_message_signal_process(inst->o_base);
instances = eina_list_append(instances, inst);
inst->idler = ecore_idle_enterer_add(_cb_initial_dir, inst);
return inst->gcc;
}
static void
_gc_shutdown(E_Gadcon_Client *gcc)
{
Instance *inst = NULL;
const char *s;
Evas_Object *btn;
inst = gcc->data;
if (!inst) return;
instances = eina_list_remove(instances, inst);
evas_object_event_callback_del_full(inst->o_fm,
EVAS_CALLBACK_KEY_DOWN,
_cb_key_down, inst);
evas_object_smart_callback_del(inst->o_fm, "changed", _cb_changed);
evas_object_smart_callback_del(inst->o_fm, "dir_changed", _cb_dir_changed);
EINA_LIST_FREE(inst->history, s)
eina_stringshare_del(s);
if (gcc->gadcon->o_container)
evas_object_event_callback_del_full(gcc->gadcon->o_container,
EVAS_CALLBACK_RESIZE,
_cb_resize, inst);
EINA_LIST_FREE(inst->l_buttons, btn)
{
e_box_unpack(btn);
evas_object_del(btn);
}
if (inst->o_base) evas_object_del(inst->o_base);
if (inst->o_box) evas_object_del(inst->o_box);
if (inst->o_scroll) evas_object_del(inst->o_scroll);
eina_stringshare_del(inst->theme);
E_FREE(inst);
}
static void
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
{
Instance *inst;
inst = gcc->data;
switch (orient)
{
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_BOTTOM:
/* e_gadcon_client_aspect_set(gcc, 16 * 4, 16); */
break;
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_RIGHT:
/* e_gadcon_client_aspect_set(gcc, 16, 16 * 4); */
break;
default:
break;
}
/* e_gadcon_client_min_size_set(gcc, 16, 16); */
}
static char *
_gc_label(E_Gadcon_Client_Class *client_class)
{
return _("EFM Navigation");
}
static Evas_Object *
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas)
{
return e_util_icon_theme_icon_add("system-file-manager", 48, evas);
}
static const char *
_gc_id_new(E_Gadcon_Client_Class *client_class)
{
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name,
(eina_list_count(instances) + 1));
return strdup(buf);
}
/* local functions */
static void
_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Instance *inst;
Evas_Event_Key_Down *ev;
inst = data;
ev = event_info;
if (evas_key_modifier_is_set(ev->modifiers, "Alt"))
{
if (!strcmp(ev->key, "Left"))
_cb_back_click(inst, obj, "e,action,click", "e");
else if (!strcmp(ev->key, "Right"))
_cb_forward_click(inst, obj, "e,action,click", "e");
else if (!strcmp(ev->key, "Up"))
_cb_up_click(inst, obj, "e,action,click", "e");
}
else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
{
if (!strcmp(ev->key, "r"))
_cb_refresh_click(inst, obj, "e,action,click", "e");
}
}
static void
_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Instance *inst;
Evas_Event_Mouse_Down *ev;
E_Menu *m;
E_Zone *zone;
int x, y;
inst = data;
ev = event_info;
if ((ev->button != 3) || (inst->gcc->menu)) return;
zone = e_util_zone_current_get(e_manager_current_get());
m = e_menu_new();
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
ecore_x_pointer_xy_get(zone->container->win, &x, &y);
e_menu_activate_mouse(m, zone, x, y, 1, 1,
E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
}
static void
_cb_back_click(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Instance *inst;
inst = data;
if ((!inst->current) || (inst->current == eina_list_last(inst->history))) return;
inst->current = eina_list_next(inst->current);
inst->ignore_dir = 1;
e_fm2_path_set(inst->o_fm, eina_list_data_get(inst->current), "/");
}
static void
_cb_forward_click(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Instance *inst;
const char *hist;
inst = data;
if ((!inst->current) || (inst->current == inst->history)) return;
inst->current = eina_list_prev(inst->current);
inst->ignore_dir = 1;
e_fm2_path_set(inst->o_fm, eina_list_data_get(inst->current), "/");
}
static void
_cb_refresh_click(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Instance *inst;
inst = data;
// Don't destroy forward history when refreshing
inst->ignore_dir = 1;
e_fm2_path_set(inst->o_fm, NULL, e_fm2_real_path_get(inst->o_fm));
}
static void
_cb_up_click(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Instance *inst;
char *p, *t;
inst = data;
t = strdup(e_fm2_real_path_get(inst->o_fm));
p = strrchr(t, '/');
if (p)
{
*p = 0;
p = t;
if (p[0] == 0) p = "/";
e_fm2_path_set(inst->o_fm, NULL, p);
}
else
{
edje_object_signal_emit(inst->o_base, "e,state,up,disabled", "e");
}
free(t);
}
static void
_cb_favorites_click(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Instance *inst;
inst = data;
e_fm2_path_set(inst->o_fm, "favorites", "/");
}
static void
_cb_changed(void *data, Evas_Object *obj, void *event_info)
{
Instance *inst;
inst = data;
inst->tbar = event_info;
}
static void
_cb_button_click(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Instance *inst = data;
Eina_List *l;
Evas_Object *o_fm, *btn;
char path[PATH_MAX] = "";
EINA_LIST_FOREACH(inst->l_buttons, l, btn)
{
strcat(path, edje_object_part_text_get(btn, "e.text.label"));
if (btn == obj) break;
strcat(path, "/");
}
e_fm2_path_set(inst->o_fm, "/", path);
}
static void
_box_button_append(Instance *inst, const char *label, void (*func)(void *data, Evas_Object *obj, const char *emission, const char *source))
{
Evas_Object *o;
Evas_Coord mw = 0, mh = 0;
if (!inst || !label || !*label || !func)
return;
o = edje_object_add(evas_object_evas_get(inst->o_box));
e_theme_edje_object_set(o, "base/theme/modules/efm_navigation",
"modules/efm_navigation/pathbar_button");
edje_object_signal_callback_add(o, "e,action,click", "", func, inst);
edje_object_part_text_set(o, "e.text.label", label);
edje_object_size_min_calc(o, &mw, &mh);
e_box_pack_end(inst->o_box, o);
evas_object_show(o);
e_box_pack_options_set(o, 1, 0, 0, 0, 0.5, 0.5, mw, mh, 9999, 9999);
e_box_size_min_get(inst->o_box, &mw, NULL);
evas_object_geometry_get(inst->o_scroll, NULL, NULL, NULL, &mh);
evas_object_resize(inst->o_box, mw, mh);
inst->l_buttons = eina_list_append(inst->l_buttons, o);
}
static void
_cb_dir_changed(void *data, Evas_Object *obj, void *event_info)
{
Instance *inst;
const char *realpath, *t;
char *path, *dir, *p;
char buf[PATH_MAX];
Eina_List *l, *ll, *sel = NULL;
Evas_Object *btn;
int mw, sw, changed = 0;
inst = data;
if (!(realpath = e_fm2_real_path_get(inst->o_fm))) return;
/* update pathbar */
if (!inst->l_buttons)
_box_button_append(inst, "/", _cb_button_click);
sel = inst->l_buttons;
l = eina_list_next(sel);
p = path = ecore_file_realpath(realpath);
while (p)
{
dir = strsep(&p, "/");
if (!(*dir)) continue;
if (l && (btn = eina_list_data_get(l)))
{
if (strcmp(dir, edje_object_part_text_get(btn, "e.text.label")))
{
changed = 1;
while (l)
{
e_box_unpack(btn);
evas_object_del(btn);
ll = l;
l = eina_list_next(l);
btn = eina_list_data_get(l);
inst->l_buttons =
eina_list_remove_list(inst->l_buttons, ll);
}
}
else
{
if (!p) sel = l;
l = eina_list_next(l);
continue;
}
}
_box_button_append(inst, dir, _cb_button_click);
if (!p) sel = eina_list_last(inst->l_buttons);
changed = 1;
}
free(path);
if (changed)
{
evas_object_geometry_get(inst->o_box, NULL, NULL, &mw, NULL);
edje_object_size_min_calc(e_scrollframe_edje_object_get(inst->o_scroll), &sw, NULL);
evas_object_size_hint_max_set(inst->o_scroll, mw + sw, 32);
}
EINA_LIST_FOREACH(inst->l_buttons, l, btn)
if (l == sel)
edje_object_signal_emit(btn, "e,state,selected", "e");
else
edje_object_signal_emit(btn, "e,state,default", "e");
/* scroll to selected button */
if (sel)
{
Evas_Coord x, y, w, h, xx, yy, ww = 1;
btn = eina_list_data_get(sel);
evas_object_geometry_get(btn, &x, &y, &w, &h);
/* show buttons around selected */
if (sel->next)
{
btn = eina_list_data_get(sel->next);
evas_object_geometry_get(btn, NULL, NULL, &ww, NULL);
w += ww;
}
if (sel->prev)
{
btn = eina_list_data_get(sel->prev);
evas_object_geometry_get(btn, NULL, NULL, &ww, NULL);
x -= ww;
w += ww;
}
evas_object_geometry_get(inst->o_box, &xx, &yy, NULL, NULL);
e_scrollframe_child_region_show(inst->o_scroll, x - xx, y - yy, w, h);
}
/* update history */
if ((!inst->ignore_dir) && (eina_list_data_get(inst->current) != realpath))
{
if (inst->current)
{
while (inst->history != inst->current)
{
eina_stringshare_del(eina_list_data_get(inst->history));
inst->history =
eina_list_remove_list(inst->history, inst->history);
}
}
inst->history =
eina_list_prepend(inst->history, eina_stringshare_ref(realpath));
inst->current = inst->history;
}
inst->ignore_dir = 0;
if (!strcmp(realpath, "/"))
edje_object_signal_emit(inst->o_base, "e,state,up,disabled", "e");
else
edje_object_signal_emit(inst->o_base, "e,state,up,enabled", "e");
if ((!inst->history) || (eina_list_last(inst->history) == inst->current))
edje_object_signal_emit(inst->o_base, "e,state,back,disabled", "e");
else
edje_object_signal_emit(inst->o_base, "e,state,back,enabled", "e");
if ((!inst->history) || (inst->history == inst->current))
edje_object_signal_emit(inst->o_base, "e,state,forward,disabled", "e");
else
edje_object_signal_emit(inst->o_base, "e,state,forward,enabled", "e");
}

View File

@ -111,6 +111,8 @@ e_modapi_init(E_Module *m)
e_fileman_dbus_init();
e_fwin_nav_init();
return m;
}
@ -144,6 +146,8 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
}
}
e_fwin_nav_shutdown();
/* remove module-supplied menu additions */
if (maug)
{
@ -518,8 +522,9 @@ _e_mod_fileman_config_load(void)
fileman_config->selection.windows_modifiers = 0;
IFMODCFGEND;
IFMODCFG(0x0101);
fileman_config->view.show_toolbar = 0;
IFMODCFG(0x0103);
fileman_config->view.show_toolbar = 1;
fileman_config->view.open_dirs_in_place = 1;
IFMODCFGEND;
fileman_config->config_version = MOD_CONFIG_FILE_VERSION;