menus for fm2 can be replaced by callbacks - and selected entries turned off.


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 16 years ago
parent bc7dde9700
commit 622f36da0a
  1. 2
      TODO
  2. 26
      src/bin/e_config.c
  3. 385
      src/bin/e_fm.c
  4. 11
      src/bin/e_fm.h
  5. 16
      src/bin/e_int_config_mousebindings.c

@ -27,8 +27,6 @@ Some of the things (in very short form) that need to be done to E17...
* fm2 needs a way to use custom icons per dir/file
* fm2 needs a way to bypass thumb gen anim on just a unrealize/realize as well
as change state instantly if it already was selected
* fm2 needs way to replace or modify the default right click menu contents
(disable/enable rename/delete/refresh etc.)
* fm2 needs a mime filter
* dnd needs to do xdnd properly.
* fwin: multi-mime open is too simplisitc. fix in fwin.c line 590 or so.

@ -1072,31 +1072,7 @@ e_config_init(void)
//FIXME: If new wheel binding are added/changed/modified, then do not
//forget to reflect those changes in e_int_config_mousebinding.c in
//_restore_defaults_cb function
CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 0, -1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 1, -1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 0, 1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 1, 1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 0, -1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 1, -1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 0, 1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 1, 1,
E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 0, -1,
E_BINDING_MODIFIER_ALT, 0,
"desk_linear_flip_by", "-1");

@ -53,7 +53,8 @@ struct _E_Fm2_Smart_Data
struct {
void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info);
void *data;
} start, end;
} start, end, replace;
E_Fm2_Menu_Flags flags;
} icon_menu;
Evas_List *icons;
@ -576,6 +577,19 @@ e_fm2_file_show(Evas_Object *obj, const char *file)
}
}
EAPI void
e_fm2_icon_menu_replace_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info), void *data)
{
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
sd->icon_menu.replace.func = func;
sd->icon_menu.replace.data = data;
}
EAPI void
e_fm2_icon_menu_start_extend_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info), void *data)
{
@ -4130,61 +4144,80 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp)
mn = e_menu_new();
e_menu_category_set(mn, "e/fileman/action");
if (sd->icon_menu.start.func)
{
sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL);
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
}
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Refresh View"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/refresh"),
"e/fileman/button/refresh");
e_menu_item_callback_set(mi, _e_fm2_refresh, sd);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Show Hidden Files"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/hidden_files"),
"e/fileman/button/hidden_files");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->show_hidden_files);
e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Remember Ordering"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/ordering"),
"e/fileman/button/ordering");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->order_file);
e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd);
if (ecore_file_can_write(sd->realpath))
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("New Directory"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/new_dir"),
"e/fileman/button/new_dir");
e_menu_item_callback_set(mi, _e_fm2_new_directory, sd);
if (sd->icon_menu.replace.func)
{
sd->icon_menu.replace.func(sd->icon_menu.replace.data, sd->obj, mn, NULL);
}
if (sd->icon_menu.end.func)
else
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, NULL);
if (sd->icon_menu.start.func)
{
sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL);
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_REFRESH)
{
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Refresh View"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/refresh"),
"e/fileman/button/refresh");
e_menu_item_callback_set(mi, _e_fm2_refresh, sd);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_SHOW_HIDDEN)
{
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Show Hidden Files"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/hidden_files"),
"e/fileman/button/hidden_files");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->show_hidden_files);
e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_REMEMBER_ORDERING)
{
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Remember Ordering"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/ordering"),
"e/fileman/button/ordering");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->order_file);
e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)
{
if (ecore_file_can_write(sd->realpath))
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("New Directory"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/new_dir"),
"e/fileman/button/new_dir");
e_menu_item_callback_set(mi, _e_fm2_new_directory, sd);
}
}
if (sd->icon_menu.end.func)
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, NULL);
}
}
man = e_manager_current_get();
@ -4240,130 +4273,154 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp)
mn = e_menu_new();
e_menu_category_set(mn, "e/fileman/action");
if (sd->icon_menu.start.func)
{
sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, &(ic->info));
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
}
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Refresh View"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/refresh"),
"e/fileman/button/refresh");
e_menu_item_callback_set(mi, _e_fm2_refresh, ic->sd);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Show Hidden Files"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/hidden_files"),
"e/fileman/button/hidden_files");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->show_hidden_files);
e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Remember Ordering"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/ordering"),
"e/fileman/button/ordering");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->order_file);
e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd);
if (ecore_file_can_write(sd->realpath))
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("New Directory"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/new_dir"),
"e/fileman/button/new_dir");
e_menu_item_callback_set(mi, _e_fm2_new_directory, ic->sd);
}
can_w = 0;
can_w2 = 1;
if (ic->sd->order_file)
if (sd->icon_menu.replace.func)
{
snprintf(buf, sizeof(buf), "%s/.order", sd->realpath);
can_w2 = ecore_file_can_write(buf);
sd->icon_menu.replace.func(sd->icon_menu.replace.data, sd->obj, mn, NULL);
}
if (ic->info.pseudo_link)
snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file);
else
snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ic->info.file);
if ((ic->info.link) && (!ic->info.pseudo_link))
{
struct stat st;
if (sd->icon_menu.start.func)
{
sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL);
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_REFRESH)
{
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Refresh View"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/refresh"),
"e/fileman/button/refresh");
e_menu_item_callback_set(mi, _e_fm2_refresh, sd);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_SHOW_HIDDEN)
{
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Show Hidden Files"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/hidden_files"),
"e/fileman/button/hidden_files");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->show_hidden_files);
e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd);
}
if (lstat(buf, &st) == 0)
if (!sd->icon_menu.flags & E_FM2_MENU_NO_REMEMBER_ORDERING)
{
if (st.st_uid == getuid())
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Remember Ordering"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/ordering"),
"e/fileman/button/ordering");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, sd->order_file);
e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)
{
if (ecore_file_can_write(sd->realpath))
{
if (st.st_mode & S_IWUSR) can_w = 1;
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("New Directory"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/new_dir"),
"e/fileman/button/new_dir");
e_menu_item_callback_set(mi, _e_fm2_new_directory, sd);
}
else if (st.st_gid == getgid())
}
can_w = 0;
can_w2 = 1;
if (ic->sd->order_file)
{
snprintf(buf, sizeof(buf), "%s/.order", sd->realpath);
can_w2 = ecore_file_can_write(buf);
}
if (ic->info.pseudo_link)
snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file);
else
snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ic->info.file);
if ((ic->info.link) && (!ic->info.pseudo_link))
{
struct stat st;
if (lstat(buf, &st) == 0)
{
if (st.st_mode & S_IWGRP) can_w = 1;
if (st.st_uid == getuid())
{
if (st.st_mode & S_IWUSR) can_w = 1;
}
else if (st.st_gid == getgid())
{
if (st.st_mode & S_IWGRP) can_w = 1;
}
else
{
if (st.st_mode & S_IWOTH) can_w = 1;
}
}
else
}
else
{
if (ic->info.pseudo_link)
snprintf(buf, sizeof(buf), "%s/.order", sd->realpath);
if (ecore_file_can_write(buf)) can_w = 1;
}
sel = e_fm2_selected_list_get(ic->sd->obj);
if ((!sel) || evas_list_count(sel) == 1)
{
snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ic->info.file);
protected = e_filereg_file_protected(buf);
}
else
protected = 0;
if ((can_w) && (can_w2) && !(protected))
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
if (!sd->icon_menu.flags & E_FM2_MENU_NO_DELETE)
{
if (st.st_mode & S_IWOTH) can_w = 1;
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Delete"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/delete"),
"e/fileman/button/delete");
e_menu_item_callback_set(mi, _e_fm2_file_delete, ic);
}
if (!sd->icon_menu.flags & E_FM2_MENU_NO_RENAME)
{
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Rename"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/rename"),
"e/fileman/button/rename");
e_menu_item_callback_set(mi, _e_fm2_file_rename, ic);
}
}
}
else
{
if (ic->info.pseudo_link)
snprintf(buf, sizeof(buf), "%s/.order", sd->realpath);
if (ecore_file_can_write(buf)) can_w = 1;
}
sel = e_fm2_selected_list_get(ic->sd->obj);
if ((!sel) || evas_list_count(sel) == 1)
{
snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ic->info.file);
protected = e_filereg_file_protected(buf);
}
else
protected = 0;
if ((can_w) && (can_w2) && !(protected))
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Delete"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/delete"),
"e/fileman/button/delete");
e_menu_item_callback_set(mi, _e_fm2_file_delete, ic);
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Rename"));
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/fileman",
"e/fileman/button/rename"),
"e/fileman/button/rename");
e_menu_item_callback_set(mi, _e_fm2_file_rename, ic);
}
if (sd->icon_menu.end.func)
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info));
if (sd->icon_menu.end.func)
{
mi = e_menu_item_new(mn);
e_menu_item_separator_set(mi, 1);
sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info));
}
}
man = e_manager_current_get();

@ -14,7 +14,15 @@ typedef enum _E_Fm2_View_Mode
E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS, /* icons go anywhere u drop them but try align to icons nearby */
E_FM2_VIEW_MODE_LIST /* vertical fileselector list */
} E_Fm2_View_Mode;
typedef enum _E_Fm2_Menu_Flags
{
E_FM2_MENU_NO_REFRESH = (1 << 0),
E_FM2_MENU_NO_SHOW_HIDDEN = (1 << 1),
E_FM2_MENU_NO_REMEMBER_ORDERING = (1 << 2),
E_FM2_MENU_NO_NEW_DIRECTORY = (1 << 3),
E_FM2_MENU_NO_DELETE = (1 << 4),
E_FM2_MENU_NO_RENAME = (1 << 5)
} E_Fm2_Menu_Flags;
typedef struct _E_Fm2_Config E_Fm2_Config;
typedef struct _E_Fm2_Icon_Info E_Fm2_Icon_Info;
@ -118,6 +126,7 @@ EAPI Evas_List *e_fm2_selected_list_get(Evas_Object *obj);
EAPI Evas_List *e_fm2_all_list_get(Evas_Object *obj);
EAPI void e_fm2_select_set(Evas_Object *obj, const char *file, int select);
EAPI void e_fm2_file_show(Evas_Object *obj, const char *file);
EAPI void e_fm2_icon_menu_replace_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info), void *data);
EAPI void e_fm2_icon_menu_start_extend_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info), void *data);
EAPI void e_fm2_icon_menu_end_extend_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info), void *data);
EAPI void e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj);

@ -665,22 +665,6 @@ _restore_mouse_binding_defaults_cb(void *data, void *data2)
bw->params = _params == NULL ? NULL : evas_stringshare_add(_params); \
cfdata->binding.wheel = evas_list_append(cfdata->binding.wheel, bw)
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_CONTAINER, 0, -1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_CONTAINER, 1, -1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_CONTAINER, 0, 1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_CONTAINER, 1, 1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_POPUP, 0, -1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_POPUP, 1, -1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_POPUP, 0, 1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_POPUP, 1, 1, E_BINDING_MODIFIER_NONE, 1,
"desk_linear_flip_by", "1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_CONTAINER, 0, -1, E_BINDING_MODIFIER_ALT, 0,
"desk_linear_flip_by", "-1");
CFG_WHEELBIND_DFLT(E_BINDING_CONTEXT_CONTAINER, 1, -1, E_BINDING_MODIFIER_ALT, 0,

Loading…
Cancel
Save