'everything'
- theme: allow smaller popup size, cleanups - free items from history. needs some more testing to let the history not grow too large SVN revision: 42119
This commit is contained in:
parent
e09444abd0
commit
25b3f68249
|
@ -26598,11 +26598,11 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
|
||||||
type: RECT;
|
type: RECT;
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
visible: 0;
|
visible: 0;
|
||||||
min: 436 118;
|
min: 386 118;
|
||||||
}
|
}
|
||||||
description { state: "composite" 0.0;
|
description { state: "composite" 0.0;
|
||||||
visible: 0;
|
visible: 0;
|
||||||
min: 536 218;
|
min: 486 218;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "frame";
|
part { name: "frame";
|
||||||
|
@ -26661,23 +26661,8 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* part { name: "clip";
|
|
||||||
* type: RECT;
|
|
||||||
* description { state: "default" 0.0;
|
|
||||||
* color: 255 255 255 255;
|
|
||||||
* rel1 {
|
|
||||||
* offset: 8 1;
|
|
||||||
* to: "bg";
|
|
||||||
* }
|
|
||||||
* rel2 {
|
|
||||||
* offset: -9 -2;
|
|
||||||
* to: "bg";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* } */
|
|
||||||
part { name: "selector_frame";
|
part { name: "selector_frame";
|
||||||
type: RECT;
|
type: RECT;
|
||||||
/* clip_to: "clip"; */
|
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
color: 255 255 255 255;
|
color: 255 255 255 255;
|
||||||
rel1 {
|
rel1 {
|
||||||
|
@ -27057,9 +27042,9 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
|
||||||
}
|
}
|
||||||
/* offset to main popup */
|
/* offset to main popup */
|
||||||
data.item: "offset_y" "-2";
|
data.item: "offset_y" "-2";
|
||||||
data.item: "offset_x" "20";
|
data.item: "offset_x" "16";
|
||||||
data.item: "offset_composite_y" "-52";
|
data.item: "offset_composite_y" "-52";
|
||||||
data.item: "offset_composite_x" "20";
|
data.item: "offset_composite_x" "16";
|
||||||
data.item: "shaped" "1";
|
data.item: "shaped" "1";
|
||||||
|
|
||||||
parts {
|
parts {
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
#define HISTORY_VERSION 1
|
#define HISTORY_VERSION 2
|
||||||
|
#define SEVEN_DAYS 604800.0
|
||||||
|
#define THIRTY_DAYS 2592000.0
|
||||||
|
|
||||||
|
typedef struct _Cleanup_Data Cleanup_Data;
|
||||||
|
|
||||||
|
struct _Cleanup_Data
|
||||||
|
{
|
||||||
|
double time;
|
||||||
|
Eina_List *keys;
|
||||||
|
};
|
||||||
|
|
||||||
static E_Config_DD *hist_entry_edd = NULL;
|
static E_Config_DD *hist_entry_edd = NULL;
|
||||||
static E_Config_DD *hist_item_edd = NULL;
|
static E_Config_DD *hist_item_edd = NULL;
|
||||||
|
@ -64,13 +74,15 @@ static Eina_Bool
|
||||||
_hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
_hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||||
{
|
{
|
||||||
History_Entry *he = data;
|
History_Entry *he = data;
|
||||||
|
Cleanup_Data *d = fdata;
|
||||||
History_Item *hi;
|
History_Item *hi;
|
||||||
Eina_List *l, *ll, **keys = fdata;
|
Eina_List *l, *ll;
|
||||||
|
|
||||||
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi)
|
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi)
|
||||||
{
|
{
|
||||||
/* item is transient */
|
/* item is transient or too old */
|
||||||
if (!hi->count)
|
if ((!hi->count) ||
|
||||||
|
(hi->last_used + (SEVEN_DAYS * (hi->count - 1)) < d->time))
|
||||||
{
|
{
|
||||||
if (hi->input)
|
if (hi->input)
|
||||||
eina_stringshare_del(hi->input);
|
eina_stringshare_del(hi->input);
|
||||||
|
@ -87,7 +99,7 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata
|
||||||
if (!he->items)
|
if (!he->items)
|
||||||
{
|
{
|
||||||
E_FREE(he);
|
E_FREE(he);
|
||||||
*keys = eina_list_append(*keys, key);
|
d->keys = eina_list_append(d->keys, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -96,20 +108,30 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata
|
||||||
void
|
void
|
||||||
evry_history_free(void)
|
evry_history_free(void)
|
||||||
{
|
{
|
||||||
Eina_List *keys = NULL;
|
Cleanup_Data *d;
|
||||||
char *key;
|
char *key;
|
||||||
|
|
||||||
evry_hist = e_config_domain_load("module.everything.history", hist_edd);
|
evry_hist = e_config_domain_load("module.everything.history", hist_edd);
|
||||||
if (evry_hist)
|
if (evry_hist)
|
||||||
{
|
{
|
||||||
eina_hash_foreach(evry_hist->subjects, _hist_cleanup_cb, &keys);
|
d = E_NEW(Cleanup_Data, 1);
|
||||||
EINA_LIST_FREE(keys, key)
|
d->time = ecore_time_get() - THIRTY_DAYS;
|
||||||
eina_hash_del_by_key(evry_hist->subjects, key);
|
|
||||||
|
|
||||||
eina_hash_foreach(evry_hist->actions, _hist_cleanup_cb, &keys);
|
if (evry_hist->subjects)
|
||||||
EINA_LIST_FREE(keys, key)
|
{
|
||||||
eina_hash_del_by_key(evry_hist->actions, key);
|
eina_hash_foreach(evry_hist->subjects, _hist_cleanup_cb, d);
|
||||||
|
EINA_LIST_FREE(d->keys, key)
|
||||||
|
eina_hash_del_by_key(evry_hist->subjects, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evry_hist->subjects)
|
||||||
|
{
|
||||||
|
eina_hash_foreach(evry_hist->actions, _hist_cleanup_cb, d);
|
||||||
|
EINA_LIST_FREE(d->keys, key)
|
||||||
|
eina_hash_del_by_key(evry_hist->actions, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
E_FREE(d);
|
||||||
evry_history_unload();
|
evry_history_unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,9 +222,9 @@ evry_history_add(Eina_Hash *hist, Evry_State *s)
|
||||||
if (!s->input || !strncmp (hi->input, s->input, strlen(s->input)))
|
if (!s->input || !strncmp (hi->input, s->input, strlen(s->input)))
|
||||||
{
|
{
|
||||||
/* s->input matches hi->input and is equal or shorter */
|
/* s->input matches hi->input and is equal or shorter */
|
||||||
hi->count++;
|
hi->last_used = ecore_time_get();
|
||||||
hi->last_used /= 4.0;
|
if (!it->transient)
|
||||||
hi->last_used += ecore_time_get();
|
hi->count++;
|
||||||
}
|
}
|
||||||
else if (s->input)
|
else if (s->input)
|
||||||
{
|
{
|
||||||
|
@ -239,8 +261,10 @@ evry_history_add(Eina_Hash *hist, Evry_State *s)
|
||||||
hi = E_NEW(History_Item, 1);
|
hi = E_NEW(History_Item, 1);
|
||||||
hi->plugin = eina_stringshare_ref(it->plugin->name);
|
hi->plugin = eina_stringshare_ref(it->plugin->name);
|
||||||
hi->last_used = ecore_time_get();
|
hi->last_used = ecore_time_get();
|
||||||
|
|
||||||
if (!it->transient)
|
if (!it->transient)
|
||||||
hi->count = 1;
|
hi->count = 1;
|
||||||
|
|
||||||
if (s->input)
|
if (s->input)
|
||||||
hi->input = eina_stringshare_add(s->input);
|
hi->input = eina_stringshare_add(s->input);
|
||||||
|
|
||||||
|
@ -257,6 +281,7 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input)
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
int cnt = 1;
|
int cnt = 1;
|
||||||
int matched;
|
int matched;
|
||||||
|
double now = ecore_time_get();
|
||||||
|
|
||||||
if (it->id)
|
if (it->id)
|
||||||
id = it->id;
|
id = it->id;
|
||||||
|
@ -274,10 +299,11 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input)
|
||||||
if ((!input[0]) || (!input[0] && !hi->input))
|
if ((!input[0]) || (!input[0] && !hi->input))
|
||||||
{
|
{
|
||||||
cnt++;
|
cnt++;
|
||||||
it->usage += hi->last_used;
|
it->usage = hi->last_used;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* double priority for exact matches */
|
||||||
matched = 0;
|
matched = 0;
|
||||||
if (!strncmp(input, hi->input, strlen(input)))
|
if (!strncmp(input, hi->input, strlen(input)))
|
||||||
{
|
{
|
||||||
|
@ -289,13 +315,16 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input)
|
||||||
matched = 1;
|
matched = 1;
|
||||||
it->usage += hi->last_used;
|
it->usage += hi->last_used;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matched) cnt++;
|
if (matched) cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it->usage += (double) hi->count * (hi->last_used / now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (it->usage)
|
if (it->usage)
|
||||||
{
|
{
|
||||||
it->usage /= (double)cnt;
|
it->usage /= (double) cnt;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ _cb_border_remove(void *data, int type, void *event)
|
||||||
if (it->data == ev->border)
|
if (it->data == ev->border)
|
||||||
{
|
{
|
||||||
p->items = eina_list_remove(p->items, it);
|
p->items = eina_list_remove(p->items, it);
|
||||||
eina_hash_del_by_key(border_hash, ev->border);
|
if (border_hash)
|
||||||
|
eina_hash_del_by_key(border_hash, ev->border);
|
||||||
evry_item_free(it);
|
evry_item_free(it);
|
||||||
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
|
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
|
||||||
break;
|
break;
|
||||||
|
@ -52,15 +53,14 @@ static void
|
||||||
_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Ecore_Event_Handler *h;
|
Ecore_Event_Handler *h;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(handlers, h)
|
||||||
|
ecore_event_handler_del(h);
|
||||||
|
|
||||||
if (border_hash) eina_hash_free(border_hash);
|
if (border_hash) eina_hash_free(border_hash);
|
||||||
border_hash = NULL;
|
border_hash = NULL;
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
EINA_LIST_FREE(handlers, h)
|
|
||||||
ecore_event_handler_del(h);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue