forked from enlightenment/enlightenment
- added Action_Performed event to let plugins know when an action was performed :)
- step to next item in thumb-view when marking items - aggregator: better sorting of non-toplevel plugins, cleanups SVN revision: 48832
This commit is contained in:
parent
5c8f0b2675
commit
57a9bdc2ed
|
@ -34262,7 +34262,7 @@ collections {
|
||||||
}
|
}
|
||||||
rel2.offset: -2 -4;
|
rel2.offset: -2 -4;
|
||||||
color: 250 250 250 255;
|
color: 250 250 250 255;
|
||||||
color3: 20 20 20 40;
|
color3: 20 20 20 20;
|
||||||
text {
|
text {
|
||||||
font: "Sans";
|
font: "Sans";
|
||||||
size: 10;
|
size: 10;
|
||||||
|
|
|
@ -160,8 +160,6 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
{
|
{
|
||||||
GET_PLUGIN(p, plugin);
|
GET_PLUGIN(p, plugin);
|
||||||
|
|
||||||
DBG("begin %p %p\n", item, _act_open_with);
|
|
||||||
|
|
||||||
if (item && (item != _act_open_with))
|
if (item && (item != _act_open_with))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ typedef struct _Evry_State Evry_State;
|
||||||
typedef struct _Evry_View Evry_View;
|
typedef struct _Evry_View Evry_View;
|
||||||
typedef struct _History Evry_History;
|
typedef struct _History Evry_History;
|
||||||
typedef struct _Config Evry_Config;
|
typedef struct _Config Evry_Config;
|
||||||
typedef struct _Evry_Event_Item_Changed Evry_Event_Item_Changed;
|
|
||||||
|
|
||||||
#define EVRY_ITEM(_item) ((Evry_Item *)_item)
|
#define EVRY_ITEM(_item) ((Evry_Item *)_item)
|
||||||
#define EVRY_ACTN(_item) ((Evry_Action *) _item)
|
#define EVRY_ACTN(_item) ((Evry_Action *) _item)
|
||||||
|
@ -71,6 +70,7 @@ typedef struct _Evry_Event_Item_Changed Evry_Event_Item_Changed;
|
||||||
_label, _icon_get, _free)
|
_label, _icon_get, _free)
|
||||||
|
|
||||||
#define EVRY_ITEM_FREE(_item) evry_item_free((Evry_Item *)_item)
|
#define EVRY_ITEM_FREE(_item) evry_item_free((Evry_Item *)_item)
|
||||||
|
#define EVRY_ITEM_REF(_item) evry_item_ref((Evry_Item *)_item)
|
||||||
|
|
||||||
#define EVRY_PLUGIN_NEW(_base, _name, _icon, _item_type, _begin, _cleanup, _fetch, _free) \
|
#define EVRY_PLUGIN_NEW(_base, _name, _icon, _item_type, _begin, _cleanup, _fetch, _free) \
|
||||||
evry_plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _icon, _item_type, \
|
evry_plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _icon, _item_type, \
|
||||||
|
@ -167,13 +167,6 @@ struct _Evry_View
|
||||||
int priority;
|
int priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evry_Event_Item_Changed
|
|
||||||
{
|
|
||||||
Evry_Item *item;
|
|
||||||
int changed_selection;
|
|
||||||
int changed_icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* FIXME this should be exposed.
|
/* FIXME this should be exposed.
|
||||||
- add functions to retrieve this stuff */
|
- add functions to retrieve this stuff */
|
||||||
struct _Config
|
struct _Config
|
||||||
|
|
|
@ -46,6 +46,7 @@ EAPI Evry_Config *evry_conf = NULL;
|
||||||
EAPI int EVRY_EVENT_ITEM_SELECT;
|
EAPI int EVRY_EVENT_ITEM_SELECT;
|
||||||
EAPI int EVRY_EVENT_ITEM_CHANGED;
|
EAPI int EVRY_EVENT_ITEM_CHANGED;
|
||||||
EAPI int EVRY_EVENT_ITEMS_UPDATE;
|
EAPI int EVRY_EVENT_ITEMS_UPDATE;
|
||||||
|
EAPI int EVRY_EVENT_ACTION_PERFORMED;
|
||||||
|
|
||||||
EAPI Evry_Type EVRY_TYPE_FILE;
|
EAPI Evry_Type EVRY_TYPE_FILE;
|
||||||
EAPI Evry_Type EVRY_TYPE_DIR;
|
EAPI Evry_Type EVRY_TYPE_DIR;
|
||||||
|
@ -162,6 +163,8 @@ e_modapi_init(E_Module *m)
|
||||||
EVRY_EVENT_ITEM_SELECT = ecore_event_type_new();
|
EVRY_EVENT_ITEM_SELECT = ecore_event_type_new();
|
||||||
if (!EVRY_EVENT_ITEM_CHANGED)
|
if (!EVRY_EVENT_ITEM_CHANGED)
|
||||||
EVRY_EVENT_ITEM_CHANGED = ecore_event_type_new();
|
EVRY_EVENT_ITEM_CHANGED = ecore_event_type_new();
|
||||||
|
if (!EVRY_EVENT_ACTION_PERFORMED)
|
||||||
|
EVRY_EVENT_ACTION_PERFORMED = ecore_event_type_new();
|
||||||
|
|
||||||
e_module_delayed_set(m, 0);
|
e_module_delayed_set(m, 0);
|
||||||
|
|
||||||
|
|
|
@ -1842,6 +1842,46 @@ _evry_clear(Evry_Selector *sel)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evry_cb_free_action_performed(void *data, void *event)
|
||||||
|
{
|
||||||
|
Evry_Event_Action_Performed *ev = event;
|
||||||
|
|
||||||
|
if (ev->it1)
|
||||||
|
EVRY_ITEM_FREE(ev->it1);
|
||||||
|
if (ev->it2)
|
||||||
|
EVRY_ITEM_FREE(ev->it2);
|
||||||
|
|
||||||
|
IF_RELEASE(ev->action);
|
||||||
|
|
||||||
|
E_FREE(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_evry_action_do(Evry_Action *act)
|
||||||
|
{
|
||||||
|
Evry_Event_Action_Performed *ev;
|
||||||
|
|
||||||
|
if (act->action(act))
|
||||||
|
{
|
||||||
|
ev = E_NEW(Evry_Event_Action_Performed, 1);
|
||||||
|
ev->action = eina_stringshare_ref(act->name);
|
||||||
|
ev->it1 = act->it1.item;
|
||||||
|
ev->it2 = act->it2.item;
|
||||||
|
|
||||||
|
if (ev->it1)
|
||||||
|
EVRY_ITEM_REF(ev->it1);
|
||||||
|
if (ev->it2)
|
||||||
|
EVRY_ITEM_REF(ev->it2);
|
||||||
|
|
||||||
|
ecore_event_add(EVRY_EVENT_ACTION_PERFORMED, ev,
|
||||||
|
_evry_cb_free_action_performed, NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evry_plugin_action(Evry_Selector *sel, int finished)
|
_evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
{
|
{
|
||||||
|
@ -1912,7 +1952,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
if (it->type != act->it2.type)
|
if (it->type != act->it2.type)
|
||||||
continue;
|
continue;
|
||||||
act->it2.item = it;
|
act->it2.item = it;
|
||||||
act->action(act);
|
|
||||||
|
_evry_action_do(act);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s_subj->sel_items && !(act->it1.accept_list))
|
else if (s_subj->sel_items && !(act->it1.accept_list))
|
||||||
|
@ -1922,7 +1963,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
if (it->type != act->it1.type)
|
if (it->type != act->it1.type)
|
||||||
continue;
|
continue;
|
||||||
act->it1.item = it;
|
act->it1.item = it;
|
||||||
act->action(act);
|
|
||||||
|
_evry_action_do(act);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1933,7 +1975,7 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
if (s_obj)
|
if (s_obj)
|
||||||
act->it2.items = s_obj->sel_items;
|
act->it2.items = s_obj->sel_items;
|
||||||
|
|
||||||
if (!act->action(act))
|
if (!_evry_action_do(act))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,14 @@ EAPI extern Evry_Type EVRY_TYPE_TEXT;
|
||||||
EAPI extern int EVRY_EVENT_ITEM_SELECT;
|
EAPI extern int EVRY_EVENT_ITEM_SELECT;
|
||||||
EAPI extern int EVRY_EVENT_ITEM_CHANGED;
|
EAPI extern int EVRY_EVENT_ITEM_CHANGED;
|
||||||
EAPI extern int EVRY_EVENT_ITEMS_UPDATE;
|
EAPI extern int EVRY_EVENT_ITEMS_UPDATE;
|
||||||
|
EAPI extern int EVRY_EVENT_ACTION_PERFORMED;
|
||||||
|
|
||||||
typedef struct _Evry_API Evry_API;
|
typedef struct _Evry_API Evry_API;
|
||||||
typedef struct _Evry_Module Evry_Module;
|
typedef struct _Evry_Module Evry_Module;
|
||||||
|
|
||||||
|
typedef struct _Evry_Event_Item_Changed Evry_Event_Item_Changed;
|
||||||
|
typedef struct _Evry_Event_Action_Performed Evry_Event_Action_Performed;
|
||||||
|
|
||||||
/***************************************************
|
/***************************************************
|
||||||
|
|
||||||
static Evry_Module *evry_module;
|
static Evry_Module *evry_module;
|
||||||
|
@ -137,6 +141,20 @@ struct _Evry_API
|
||||||
int log_dom;
|
int log_dom;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _Evry_Event_Item_Changed
|
||||||
|
{
|
||||||
|
Evry_Item *item;
|
||||||
|
int changed_selection;
|
||||||
|
int changed_icon;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Evry_Event_Action_Performed
|
||||||
|
{
|
||||||
|
const char *action;
|
||||||
|
const Evry_Item *it1;
|
||||||
|
const Evry_Item *it2;
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef EVRY_H
|
#ifndef EVRY_H
|
||||||
|
|
||||||
/*** cast default types ***/
|
/*** cast default types ***/
|
||||||
|
|
|
@ -12,30 +12,6 @@ struct _Plugin
|
||||||
Evry_Item *warning;
|
Evry_Item *warning;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline Eina_List *
|
|
||||||
_add_item(Plugin *p, Eina_List *items, Evry_Item *it)
|
|
||||||
{
|
|
||||||
/* remove duplicates provided by different plugins */
|
|
||||||
if (it->id)
|
|
||||||
{
|
|
||||||
Eina_List *_l;
|
|
||||||
Evry_Item *_it;
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(p->base.items, _l, _it)
|
|
||||||
{
|
|
||||||
if ((it->plugin->name != _it->plugin->name) &&
|
|
||||||
(it->type == _it->type) &&
|
|
||||||
(it->id == _it->id))
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
items = eina_list_append(items, it);
|
|
||||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_fetch(Evry_Plugin *plugin, const char *input)
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +19,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
Evry_Plugin *pp;
|
Evry_Plugin *pp;
|
||||||
Evry_State *s;
|
Evry_State *s;
|
||||||
Eina_List *l, *ll, *lp = NULL;
|
Eina_List *l, *ll, *lp = NULL;
|
||||||
Evry_Item *it;
|
Evry_Item *it, *it2;
|
||||||
int i, cnt = 0;
|
int i, cnt = 0;
|
||||||
Eina_List *items = NULL;
|
Eina_List *items = NULL;
|
||||||
const char *context = NULL;
|
const char *context = NULL;
|
||||||
|
@ -109,8 +85,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
evry_history_item_usage_set(it, NULL, NULL);
|
evry_history_item_usage_set(it, NULL, NULL);
|
||||||
it->usage /= 2.0;
|
it->usage /= 100.0;
|
||||||
it->fuzzy_match = 5;
|
it->fuzzy_match = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items"));
|
snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items"));
|
||||||
|
@ -118,7 +94,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
eina_stringshare_del(it->detail);
|
eina_stringshare_del(it->detail);
|
||||||
it->detail = eina_stringshare_add(buf);
|
it->detail = eina_stringshare_add(buf);
|
||||||
|
|
||||||
items = _add_item(p, items, it);
|
items = eina_list_append(items, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +111,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
evry_history_item_usage_set(it, input, context);
|
evry_history_item_usage_set(it, input, context);
|
||||||
if (it->fuzzy_match == 0)
|
if (it->fuzzy_match == 0)
|
||||||
it->fuzzy_match = evry_fuzzy_match(it->label, input);
|
it->fuzzy_match = evry_fuzzy_match(it->label, input);
|
||||||
items = _add_item(p, items, it);
|
|
||||||
|
items = eina_list_append(items, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if there is input append all items that match or have
|
/* if there is input append all items that match or have
|
||||||
|
@ -154,7 +131,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if (it->usage >= 0)
|
if (it->usage >= 0)
|
||||||
evry_history_item_usage_set(it, input, context);
|
evry_history_item_usage_set(it, input, context);
|
||||||
|
|
||||||
items = _add_item(p, items, it);
|
items = eina_list_append(items, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +148,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if (it->usage >= 0)
|
if (it->usage >= 0)
|
||||||
evry_history_item_usage_set(it, NULL, context);
|
evry_history_item_usage_set(it, NULL, context);
|
||||||
it->fuzzy_match = 0;
|
it->fuzzy_match = 0;
|
||||||
items = _add_item(p, items, it);
|
|
||||||
|
items = eina_list_append(items, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +165,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
(!eina_list_data_find_list(items, it)))
|
(!eina_list_data_find_list(items, it)))
|
||||||
{
|
{
|
||||||
it->fuzzy_match = 0;
|
it->fuzzy_match = 0;
|
||||||
items = _add_item(p, items, it);
|
items = eina_list_append(items, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,32 +183,45 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if (it->fuzzy_match == 0)
|
if (it->fuzzy_match == 0)
|
||||||
it->fuzzy_match = evry_fuzzy_match(it->label, input);
|
it->fuzzy_match = evry_fuzzy_match(it->label, input);
|
||||||
|
|
||||||
items = _add_item(p, items, it);
|
items = eina_list_append(items, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EINA_LIST_FOREACH(items, l, it)
|
items = eina_list_sort(items, -1, evry_items_sort_func);
|
||||||
* {
|
|
||||||
* if(CHECK_TYPE(it, EVRY_TYPE_FILE))
|
EINA_LIST_FOREACH(items, l, it)
|
||||||
* printf("%d %1.20f %s\n", it->fuzzy_match, it->usage, it->label);
|
{
|
||||||
* } */
|
/* remove duplicates provided by different plugins */
|
||||||
|
if (it->id)
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(p->base.items, ll, it2)
|
||||||
|
{
|
||||||
|
if ((it->plugin->name != it2->plugin->name) &&
|
||||||
|
(it->type == it2->type) &&
|
||||||
|
(it->id == it2->id))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
evry_item_ref(it);
|
||||||
|
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||||
|
|
||||||
|
if (cnt++ > MAX_ITEMS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (items) eina_list_free(items);
|
if (items) eina_list_free(items);
|
||||||
if (lp) eina_list_free(lp);
|
if (lp) eina_list_free(lp);
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_SORT(p, evry_items_sort_func);
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH_SAFE(p->base.items, l, ll, it)
|
/* EINA_LIST_FOREACH(p->base.items, l, it)
|
||||||
{
|
* {
|
||||||
if (cnt++ < MAX_ITEMS)
|
* if(CHECK_TYPE(it, EVRY_TYPE_FILE))
|
||||||
{
|
* printf("%d %1.20f %s\n", it->fuzzy_match, it->usage, it->label);
|
||||||
evry_item_ref(it);
|
* } */
|
||||||
continue;
|
|
||||||
}
|
|
||||||
p->base.items = eina_list_remove_list(p->base.items, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1221,12 +1221,18 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
|
||||||
evry_item_mark(s, sd->cur_item->item, 0);
|
evry_item_mark(s, sd->cur_item->item, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strcmp(key, "comma"))
|
if (v->mode == VIEW_MODE_THUMB)
|
||||||
{
|
{
|
||||||
key = "Down";
|
if (!strcmp(key, "comma"))
|
||||||
|
key = "Right";
|
||||||
|
else
|
||||||
|
key = "Left";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!strcmp(key, "comma"))
|
||||||
|
key = "Down";
|
||||||
|
else
|
||||||
key = "Up";
|
key = "Up";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct _Evry_Item
|
||||||
Eina_List *items;
|
Eina_List *items;
|
||||||
|
|
||||||
Evas_Object *(*icon_get) (Evry_Item *it, Evas *e);
|
Evas_Object *(*icon_get) (Evry_Item *it, Evas *e);
|
||||||
void (*free) (Evry_Item *item);
|
void (*free) (Evry_Item *it);
|
||||||
|
|
||||||
/* do not set by plugin! */
|
/* do not set by plugin! */
|
||||||
Eina_Bool selected;
|
Eina_Bool selected;
|
||||||
|
|
|
@ -860,7 +860,6 @@ _cb_free_item_changed(void *data, void *event)
|
||||||
E_FREE(ev);
|
E_FREE(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evry_item_changed(Evry_Item *it, int icon, int selected)
|
evry_item_changed(Evry_Item *it, int icon, int selected)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue