From 4b51ec0c2092e947155163fda025ad15b9a12ba6 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Thu, 29 Apr 2010 00:00:08 +0000 Subject: [PATCH] - match action also against subtype - helper to get the path from an url - added keybindings, SVN revision: 48411 --- src/modules/everything/Evry.h | 9 +++++-- src/modules/everything/evry_plug_actions.c | 10 +++----- src/modules/everything/evry_plug_view_thumb.c | 8 +++--- src/modules/everything/evry_util.c | 24 ++++++++++++++++++ .../everything/evry_view_plugin_tabs.c | 25 ++++++++++--------- 5 files changed, 52 insertions(+), 24 deletions(-) diff --git a/src/modules/everything/Evry.h b/src/modules/everything/Evry.h index 2d2c3e0b5..e92b0b8ff 100644 --- a/src/modules/everything/Evry.h +++ b/src/modules/everything/Evry.h @@ -64,9 +64,13 @@ typedef int Evry_Type; #define EVRY_ACTN(_item) ((Evry_Action *) _item) #define EVRY_PLUGIN(_plugin) ((Evry_Plugin *) _plugin) #define EVRY_VIEW(_view) ((Evry_View *) _view) +#define EVRY_FILE(_it) ((Evry_Item_File *) _it) -#define CHECK_TYPE(_item, _type) (((Evry_Item *)_item)->type == _type) -#define CHECK_SUBTYPE(_item, _type) (((Evry_Item *)_item)->subtype == _type) +#define CHECK_TYPE(_item, _type) \ + (((Evry_Item *)_item)->type && ((Evry_Item *)_item)->type == _type) + +#define CHECK_SUBTYPE(_item, _type) \ + (((Evry_Item *)_item)->subtype && ((Evry_Item *)_item)->subtype == _type) #define GET_APP(_app, _item) Evry_Item_App *_app = (Evry_Item_App *) _item #define GET_FILE(_file, _item) Evry_Item_File *_file = (Evry_Item_File *) _item @@ -435,6 +439,7 @@ EAPI char *evry_util_unescape(const char *string, int length); EAPI void evry_util_file_detail_set(Evry_Item_File *file); EAPI Eina_Bool evry_util_module_config_check(const char *module_name, int conf, int epoch, int version); EAPI Evas_Object *evry_util_icon_get(Evry_Item *it, Evas *e); +EAPI const char *evry_file_path_get(Evry_Item *it); /* e_mod_main.c */ /* set plugin trigger and view mode first before register !*/ diff --git a/src/modules/everything/evry_plug_actions.c b/src/modules/everything/evry_plug_actions.c index 846919a1a..6b00a083e 100644 --- a/src/modules/everything/evry_plug_actions.c +++ b/src/modules/everything/evry_plug_actions.c @@ -39,12 +39,9 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) GET_PLUGIN(p, plugin); Evry_Action *act; Eina_List *l; - Evry_Type type; if (!it || !it->type) return NULL; - type = it->type; - if (it->browseable) { EINA_LIST_FOREACH(evry_conf->actions, l, act) @@ -64,9 +61,10 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) EINA_LIST_FOREACH(evry_conf->actions, l, act) { - if ((!act->it1.type) || - ((act->it1.type == type) && - (!act->check_item || act->check_item(act, it)))) + if (((!act->it1.type) || + (CHECK_TYPE(it, act->it1.type)) || + (CHECK_SUBTYPE(it, act->it1.type))) && + (!act->check_item || act->check_item(act, it))) { act->base.plugin = plugin; diff --git a/src/modules/everything/evry_plug_view_thumb.c b/src/modules/everything/evry_plug_view_thumb.c index 60d7507e6..debcc9995 100644 --- a/src/modules/everything/evry_plug_view_thumb.c +++ b/src/modules/everything/evry_plug_view_thumb.c @@ -1140,8 +1140,8 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) if (s->plugin->view_mode == VIEW_MODE_NONE) { - if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && - (!strcmp(key, "2"))) + if (((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && + (!strcmp(key, "2"))) || !strcmp(key, "XF86Back")) { if (v->mode == VIEW_MODE_LIST) v->mode = VIEW_MODE_DETAIL; @@ -1153,8 +1153,8 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) _update_frame(v->span); goto end; } - else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && - (!strcmp(key, "3"))) + else if (((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && + (!strcmp(key, "3"))) || !strcmp(key, "XF86Forward")) { if (v->mode != VIEW_MODE_THUMB) { diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c index 63fb3bcf0..a9245f1ab 100644 --- a/src/modules/everything/evry_util.c +++ b/src/modules/everything/evry_util.c @@ -658,3 +658,27 @@ evry_util_url_escape(const char *string, int inlength) ns[strindex]=0; /* terminate it */ return ns; } + +EAPI const char* +evry_file_path_get(Evry_Item *it) +{ + const char *tmp; + char *path; + + GET_FILE(file, it); + + if (file->path) + return file->path; + + if (!strncmp(file->url, "file://", 7)) + tmp = file->url + 7; + else return NULL; + + if (!(path = evry_util_unescape(tmp, 0))) + return NULL; + file->path = eina_stringshare_add(path); + + E_FREE(path); + + return file->path; +} diff --git a/src/modules/everything/evry_view_plugin_tabs.c b/src/modules/everything/evry_view_plugin_tabs.c index 272c04ce6..952599261 100644 --- a/src/modules/everything/evry_view_plugin_tabs.c +++ b/src/modules/everything/evry_view_plugin_tabs.c @@ -20,7 +20,7 @@ _animator(void *data) Tab_View *v = data; double da; - double spd = (8.0 / (double)e_config->framerate); + double spd = (15.0 / (double)e_config->framerate); if (spd > 0.9) spd = 0.9; int wait = 0; @@ -288,17 +288,18 @@ _tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev) if (!v->state || !v->state->cur_plugins) return 0; - if (!strcmp(key, "Next")) - { - _plugin_next(v); - return 1; - } - else if (!strcmp(key, "Prior")) - { - _plugin_prev(v); - return -1; - } - else if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) + /* if (!strcmp(key, "Next")) + * { + * _plugin_next(v); + * return 1; + * } + * else if (!strcmp(key, "Prior")) + * { + * _plugin_prev(v); + * return -1; + * } + * else */ + if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) { if (!strcmp(key, "Left")) {