const char *label;
const char *icon;
+ /* context provided by item. e.g. to remember which action
+ * was performed on a file with a specific mimetype */
+ const char *context;
+
/* item can be browsed, e.g. folders */
Eina_Bool browseable;
void evry_history_free(void);
void evry_history_load(void);
void evry_history_unload(void);
-void evry_history_add(Eina_Hash *hist, Evry_State *s);
-EAPI int evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input);
+void evry_history_add(Eina_Hash *hist, Evry_State *s, const char *ctxt);
+int evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, const char *ctxt);
EAPI int evry_browse_item(Evry_Selector *sel);
void evry_browse_back(Evry_Selector *sel);
if (it->label) eina_stringshare_del(it->label);
if (it->id) eina_stringshare_del(it->id);
-
+ if (it->context) eina_stringshare_del(it->context);
+
if (it->free)
it->free(it);
else
if (!plugins)
return 1;
- evry_history_add(sel->history, s);
+ evry_history_add(sel->history, s, NULL);
if (s->view)
{
}
else return;
- evry_history_add(evry_hist->subjects, s_subject);
- evry_history_add(evry_hist->actions, s_action);
- evry_history_add(evry_hist->subjects, s_object);
+ evry_history_add(evry_hist->subjects, s_subject, NULL);
+ evry_history_add(evry_hist->actions, s_action, s_subject->cur_item->context);
+ evry_history_add(evry_hist->subjects, s_object, s_action->cur_item->context);
/* let subject and object plugin know that an action was performed */
if (s_subject->plugin->action)
}
void
-evry_history_add(Eina_Hash *hist, Evry_State *s)
+evry_history_add(Eina_Hash *hist, Evry_State *s, const char *ctxt)
{
History_Entry *he;
History_Item *hi = NULL;
else
{
EINA_LIST_FOREACH(he->items, l, hi)
- if (hi->plugin == it->plugin->name) break;
+ if ((hi->plugin == it->plugin->name) &&
+ (ctxt == hi->context))
+ break;
}
if (!hi)
hi->usage += TIME_FACTOR(hi->last_used);
hi->transient = it->transient;
hi->count += (hi->transient ? 2:1);
-
+ if (ctxt && !hi->context)
+ hi->context = eina_stringshare_ref(ctxt);
+
if (s->input)
{
if (hi->input)
}
int
-evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input)
+evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, const char *ctxt)
{
History_Entry *he;
History_Item *hi;
if (!input || !hi->input)
{
- it->usage = hi->usage * hi->count;
+ it->usage += hi->usage * hi->count;
}
else
{
it->usage += hi->usage * hi->count;
}
}
+ if (hi->context && ctxt)
+ {
+ if (hi->context == ctxt)
+ it->usage += hi->usage * hi->count * 2;
+ }
}
if (it->usage > 0.0)
Evry_State *s;
Eina_List *l, *ll, *lp;
Evry_Item *it;
- int cnt = 0;
+ int i, cnt = 0;
Eina_List *items = NULL;
-
+ const char *context = NULL;
+
EVRY_PLUGIN_ITEMS_FREE(p);
s = p->selector->state;
+ for (i = 1; i < 3; i++)
+ {
+ Evry_Item *item;
+ if (p->selector == selectors[i])
+ {
+ item = selectors[i-1]->state->cur_item;
+ context = item->context;
+ }
+ }
+
+
/* first is aggregator itself */
lp = s->cur_plugins->next;
{
EINA_LIST_FOREACH(pp->items, ll, it)
{
- if (evry_history_item_usage_set(p->selector->history, it, input) &&
+ if (evry_history_item_usage_set(p->selector->history, it, input, context) &&
(!eina_list_data_find_list(items, it)))
{
evry_item_ref(it);
if ((mime = efreet_mime_type_get(file->uri)))
{
file->mime = eina_stringshare_add(mime);
-
+ EVRY_ITEM(file)->context = eina_stringshare_ref(file->mime);
+
if ((!strcmp(mime, "inode/directory")) ||
(!strcmp(mime, "inode/mount-point")))
EVRY_ITEM(file)->browseable = EINA_TRUE;
p->files = eina_list_append(p->files, file);
if (item->browseable)
- file->mime = eina_stringshare_ref(mime_folder);
-
+ {
+ file->mime = eina_stringshare_ref(mime_folder);
+ EVRY_ITEM(file)->context = eina_stringshare_ref(file->mime);
+ }
+
if (p->command || cnt >= MAX_ITEMS) continue;
cnt += _append_file(p, file);
}