forked from enlightenment/enlightenment
- use VERSION/EPOCH macros for config version
- fix segv in thumb_view SVN revision: 48797
This commit is contained in:
parent
ad8af1e54b
commit
6abe9464cf
|
@ -226,10 +226,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
Evry_Module *em;
|
||||
|
||||
EINA_LIST_FOREACH(e_datastore_get("everything_modules"), l, em)
|
||||
{
|
||||
printf("call shutdown\n");
|
||||
em->shutdown();
|
||||
}
|
||||
em->shutdown();
|
||||
|
||||
e_datastore_del("everything_loaded");
|
||||
E_FREE(_api);
|
||||
|
@ -288,6 +285,10 @@ e_modapi_save(E_Module *m __UNUSED__)
|
|||
static int
|
||||
_cleanup_history(void *data)
|
||||
{
|
||||
/* evrything is active */
|
||||
if (evry_hist)
|
||||
return 1;
|
||||
|
||||
/* cleanup old entries */
|
||||
evry_history_free();
|
||||
evry_history_init();
|
||||
|
@ -340,67 +341,39 @@ _config_init()
|
|||
#undef D
|
||||
evry_conf = e_config_domain_load("module.everything", conf_edd);
|
||||
|
||||
if (evry_conf)
|
||||
{
|
||||
if (evry_conf->version <= 7)
|
||||
{
|
||||
evry_conf->scroll_speed = 10.0;
|
||||
evry_conf->version = 8;
|
||||
}
|
||||
if (evry_conf && !e_util_module_config_check
|
||||
(_("Everything Files"), evry_conf->version,
|
||||
MOD_CONFIG_FILE_EPOCH, MOD_CONFIG_FILE_VERSION))
|
||||
_config_free();
|
||||
|
||||
if (evry_conf->version <= 8)
|
||||
{
|
||||
evry_conf->width = 445;
|
||||
evry_conf->height = 310;
|
||||
evry_conf->rel_y = 0.25;
|
||||
evry_conf->scroll_animate = 1;
|
||||
evry_conf->version = 9;
|
||||
}
|
||||
|
||||
if (evry_conf->version <= 9)
|
||||
{
|
||||
evry_conf->first_run = EINA_TRUE;
|
||||
evry_conf->version = 13;
|
||||
}
|
||||
|
||||
if (evry_conf->version <= 13)
|
||||
{
|
||||
evry_conf->hide_list = 0;
|
||||
evry_conf->version = 14;
|
||||
}
|
||||
|
||||
if (evry_conf->version <= 14)
|
||||
{
|
||||
_plugin_config_free();
|
||||
evry_conf->version = CONFIG_VERSION;
|
||||
}
|
||||
|
||||
if (evry_conf->version != CONFIG_VERSION)
|
||||
{
|
||||
_config_free();
|
||||
evry_conf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!evry_conf)
|
||||
{
|
||||
evry_conf = E_NEW(Evry_Config, 1);
|
||||
evry_conf->version = CONFIG_VERSION;
|
||||
evry_conf->rel_x = 0.5;
|
||||
evry_conf->rel_y = 0.25;
|
||||
evry_conf->width = 445;
|
||||
evry_conf->height = 310;
|
||||
evry_conf->scroll_animate = 1;
|
||||
evry_conf->scroll_speed = 10.0;
|
||||
evry_conf->hide_input = 0;
|
||||
evry_conf->hide_list = 0;
|
||||
evry_conf->quick_nav = 1;
|
||||
evry_conf->view_mode = VIEW_MODE_DETAIL;
|
||||
evry_conf->view_zoom = 0;
|
||||
evry_conf->cycle_mode = 0;
|
||||
evry_conf->history_sort_mode = 0;
|
||||
evry_conf->first_run = EINA_TRUE;
|
||||
evry_conf->version = (MOD_CONFIG_FILE_EPOCH << 16);
|
||||
}
|
||||
|
||||
#define IFMODCFG(v) if ((evry_conf->version & 0xffff) < v) {
|
||||
#define IFMODCFGEND }
|
||||
|
||||
/* setup defaults */
|
||||
IFMODCFG(0x0001);
|
||||
evry_conf->rel_x = 0.5;
|
||||
evry_conf->rel_y = 0.32;
|
||||
evry_conf->width = 445;
|
||||
evry_conf->height = 300;
|
||||
evry_conf->scroll_animate = 1;
|
||||
evry_conf->scroll_speed = 10.0;
|
||||
evry_conf->hide_input = 0;
|
||||
evry_conf->hide_list = 0;
|
||||
evry_conf->quick_nav = 1;
|
||||
evry_conf->view_mode = VIEW_MODE_DETAIL;
|
||||
evry_conf->view_zoom = 0;
|
||||
evry_conf->cycle_mode = 0;
|
||||
evry_conf->history_sort_mode = 0;
|
||||
evry_conf->first_run = EINA_TRUE;
|
||||
IFMODCFGEND;
|
||||
|
||||
evry_conf->version = MOD_CONFIG_FILE_VERSION;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -435,7 +408,6 @@ static void
|
|||
_config_free(void)
|
||||
{
|
||||
_plugin_config_free();
|
||||
|
||||
E_FREE(evry_conf);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
#ifndef E_MOD_MAIN_H
|
||||
#define E_MOD_MAIN_H
|
||||
|
||||
#define MOD_CONFIG_FILE_EPOCH 0x0001
|
||||
#define MOD_CONFIG_FILE_GENERATION 0x0001
|
||||
#define MOD_CONFIG_FILE_VERSION \
|
||||
((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION)
|
||||
|
||||
|
||||
typedef struct _Evry_Selector Evry_Selector;
|
||||
typedef struct _Tab_View Tab_View;
|
||||
|
|
|
@ -1375,6 +1375,8 @@ evry_browse_back(Evry_Selector *sel)
|
|||
{
|
||||
Evry_State *s = sel->state;
|
||||
|
||||
DBG("%p", sel);
|
||||
|
||||
if (!s || !sel->states->next)
|
||||
return 0;
|
||||
|
||||
|
@ -1450,6 +1452,83 @@ _evry_selectors_switch(int dir)
|
|||
_evry_selector_activate(selectors[1]);
|
||||
}
|
||||
}
|
||||
static int
|
||||
_evry_input_complete(Evry_State *s)
|
||||
{
|
||||
int action = 0;
|
||||
char *input = NULL;
|
||||
Evry_Item *it = s->cur_item;
|
||||
|
||||
evry_item_ref(it);
|
||||
|
||||
s->item_auto_selected = EINA_FALSE;
|
||||
|
||||
if (it->plugin->complete)
|
||||
action = it->plugin->complete(it->plugin, it, &input);
|
||||
else
|
||||
evry_browse_item(selector);
|
||||
|
||||
if (input && action == EVRY_COMPLETE_INPUT)
|
||||
{
|
||||
snprintf(s->input, INPUTLEN - 1, "%s", input);
|
||||
_evry_update_text_label(s);
|
||||
_evry_cb_update_timer(selector);
|
||||
evry_item_select(s, it);
|
||||
}
|
||||
|
||||
evry_item_free(it);
|
||||
E_FREE(input);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_evry_cheat_history(Evry_State *s, int promote, int delete)
|
||||
{
|
||||
|
||||
History_Entry *he;
|
||||
History_Item *hi;
|
||||
Eina_List *l, *ll;
|
||||
Evry_Item *it = s->cur_item;
|
||||
|
||||
if (!(he = eina_hash_find(evry_hist->subjects, (it->id ? it->id : it->label))))
|
||||
return 1;
|
||||
|
||||
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi)
|
||||
{
|
||||
if (hi->plugin != it->plugin->name)
|
||||
continue;
|
||||
|
||||
if (delete)
|
||||
{
|
||||
if (hi->input)
|
||||
eina_stringshare_del(hi->input);
|
||||
if (hi->plugin)
|
||||
eina_stringshare_del(hi->plugin);
|
||||
if (hi->context)
|
||||
eina_stringshare_del(hi->context);
|
||||
E_FREE(hi);
|
||||
|
||||
he->items = eina_list_remove_list(he->items, l);
|
||||
}
|
||||
else if (promote)
|
||||
{
|
||||
hi->count += 5;
|
||||
hi->last_used = ecore_time_get();
|
||||
}
|
||||
else /* demote */
|
||||
{
|
||||
hi->count -= 5;
|
||||
if (hi->count < 0) hi->count = 1;
|
||||
}
|
||||
}
|
||||
if (s->plugin == selector->aggregator)
|
||||
selector->aggregator->fetch(selector->aggregator, s->input);
|
||||
if (s->view)
|
||||
s->view->update(s->view, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
|
@ -1563,85 +1642,27 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
}
|
||||
|
||||
if (!list->visible && (!strcmp(key, "Down")))
|
||||
_evry_list_win_show();
|
||||
{
|
||||
_evry_list_win_show();
|
||||
}
|
||||
else if ((!strcmp(key, "ISO_Left_Tab") ||
|
||||
(((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) ||
|
||||
(ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) &&
|
||||
(!strcmp(key, "Tab")))))
|
||||
{
|
||||
int action = 0;
|
||||
char *input = NULL;
|
||||
Evry_Item *it = s->cur_item;
|
||||
|
||||
evry_item_ref(it);
|
||||
|
||||
s->item_auto_selected = EINA_FALSE;
|
||||
|
||||
if (it->plugin->complete)
|
||||
action = it->plugin->complete(it->plugin, it, &input);
|
||||
else
|
||||
evry_browse_item(selector);
|
||||
|
||||
if (input && action == EVRY_COMPLETE_INPUT)
|
||||
{
|
||||
snprintf(s->input, INPUTLEN - 1, "%s", input);
|
||||
_evry_update_text_label(s);
|
||||
_evry_cb_update_timer(selector);
|
||||
evry_item_select(s, it);
|
||||
}
|
||||
|
||||
E_FREE(input);
|
||||
|
||||
evry_item_free(it);
|
||||
_evry_input_complete(s);
|
||||
}
|
||||
else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
|
||||
(!strcmp(key, "Delete") || !strcmp(key, "Insert")))
|
||||
(!strcmp(key, "Delete") || !strcmp(key, "Insert")))
|
||||
{
|
||||
if (!s || !s->cur_item)
|
||||
goto end;
|
||||
if (!s->cur_item)
|
||||
goto end;
|
||||
|
||||
int delete = (!strcmp(key, "Delete") && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT));
|
||||
int promote = (!strcmp(key, "Insert"));
|
||||
History_Entry *he;
|
||||
History_Item *hi;
|
||||
Eina_List *l, *ll;
|
||||
Evry_Item *it = s->cur_item;
|
||||
int promote = (!strcmp(key, "Insert"));
|
||||
|
||||
if (!(he = eina_hash_find(evry_hist->subjects, (it->id ? it->id : it->label))))
|
||||
goto end;
|
||||
|
||||
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi)
|
||||
{
|
||||
if (hi->plugin != it->plugin->name)
|
||||
continue;
|
||||
|
||||
if (delete)
|
||||
{
|
||||
if (hi->input)
|
||||
eina_stringshare_del(hi->input);
|
||||
if (hi->plugin)
|
||||
eina_stringshare_del(hi->plugin);
|
||||
if (hi->context)
|
||||
eina_stringshare_del(hi->context);
|
||||
E_FREE(hi);
|
||||
|
||||
he->items = eina_list_remove_list(he->items, l);
|
||||
}
|
||||
else if (promote)
|
||||
{
|
||||
hi->count += 5;
|
||||
hi->last_used = ecore_time_get();
|
||||
}
|
||||
else
|
||||
{
|
||||
hi->count -= 5;
|
||||
if (hi->count < 0) hi->count = 1;
|
||||
}
|
||||
}
|
||||
if (s->plugin == selector->aggregator)
|
||||
selector->aggregator->fetch(selector->aggregator, s->input);
|
||||
if (s->view)
|
||||
s->view->update(s->view, 0);
|
||||
_evry_cheat_history(s, promote, delete);
|
||||
|
||||
}
|
||||
else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
||||
{
|
||||
|
@ -1649,6 +1670,7 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
{
|
||||
if (!_evry_clear(selector))
|
||||
evry_browse_back(selector);
|
||||
goto end;
|
||||
}
|
||||
else if (!strcmp(key, "1"))
|
||||
_evry_view_toggle(s, NULL);
|
||||
|
@ -1777,9 +1799,9 @@ _evry_update(Evry_Selector *sel, int fetch)
|
|||
if (sel->update_timer)
|
||||
ecore_timer_del(sel->update_timer);
|
||||
|
||||
sel->update_timer = ecore_timer_add(MATCH_LAG, _evry_cb_update_timer, sel);
|
||||
sel->update_timer =
|
||||
ecore_timer_add(MATCH_LAG, _evry_cb_update_timer, sel);
|
||||
|
||||
/* if (s->plugin && !s->plugin->trigger) */
|
||||
edje_object_signal_emit(list->o_main, "e,signal,update", "e");
|
||||
}
|
||||
}
|
||||
|
@ -1802,25 +1824,26 @@ _evry_clear(Evry_Selector *sel)
|
|||
{
|
||||
Evry_State *s = sel->state;
|
||||
|
||||
if (s->inp && s->inp[0] != 0)
|
||||
{
|
||||
if (s->trigger_active && s->inp[1] != 0)
|
||||
{
|
||||
s->inp[1] = 0;
|
||||
s->input = s->inp + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->inp[0] = 0;
|
||||
s->input = s->inp;
|
||||
}
|
||||
if (!(s->inp) || (s->inp[0] == 0))
|
||||
return 0;
|
||||
|
||||
_evry_update(sel, 1);
|
||||
if (!list->visible && evry_conf->hide_input)
|
||||
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
|
||||
return 1;
|
||||
if (s->trigger_active && s->inp[1] != 0)
|
||||
{
|
||||
s->inp[1] = 0;
|
||||
s->input = s->inp + 1;
|
||||
}
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
s->inp[0] = 0;
|
||||
s->input = s->inp;
|
||||
}
|
||||
|
||||
_evry_update(sel, 1);
|
||||
|
||||
if (!list->visible && evry_conf->hide_input)
|
||||
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2016,7 +2039,7 @@ _evry_view_toggle(Evry_State *s, const char *trigger)
|
|||
EINA_LIST_FOREACH(evry_conf->views, ll, view)
|
||||
{
|
||||
if (view->trigger && !strncmp(trigger, view->trigger, 1) &&
|
||||
(view->id != s->view->id) &&
|
||||
(!s->view || (view->id != s->view->id)) &&
|
||||
(v = view->create(view, s, list->o_main)))
|
||||
{
|
||||
triggered = EINA_TRUE;
|
||||
|
@ -2043,7 +2066,7 @@ _evry_view_toggle(Evry_State *s, const char *trigger)
|
|||
EINA_LIST_FOREACH(l, ll, view)
|
||||
{
|
||||
if ((!view->trigger) &&
|
||||
((view->id != s->view->id) &&
|
||||
((!s->view || (view->id != s->view->id)) &&
|
||||
(v = view->create(view, s, list->o_main))))
|
||||
goto found;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ struct _Evry_API
|
|||
|
||||
void (*plugin_free)(Evry_Plugin *p);
|
||||
/* when a new plugin config was created return val is 1. in this
|
||||
case you can set defaults of p->config otherwise zero */
|
||||
case you can set defaults of p->config */
|
||||
int (*plugin_register)(Evry_Plugin *p, int type, int priority);
|
||||
void (*plugin_unregister)(Evry_Plugin *p);
|
||||
void (*plugin_update)(Evry_Plugin *plugin, int state);
|
||||
|
|
|
@ -35,7 +35,7 @@ struct _Smart_Data
|
|||
Eina_List *items;
|
||||
Item *cur_item;
|
||||
Ecore_Idle_Enterer *idle_enter;
|
||||
Ecore_Timer *thumb_idler;
|
||||
Ecore_Idle_Enterer *thumb_idler;
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord cx, cy, cw, ch;
|
||||
Evas_Coord sx, sy;
|
||||
|
@ -394,7 +394,7 @@ _e_smart_reconfigure_do(void *data)
|
|||
evas_object_smart_callback_call(obj, "changed", NULL);
|
||||
|
||||
if (!sd->thumb_idler)
|
||||
sd->thumb_idler = ecore_timer_add(0.01, _thumb_idler, sd);
|
||||
sd->thumb_idler = ecore_idle_enterer_add(_thumb_idler, sd);
|
||||
|
||||
sd->idle_enter = NULL;
|
||||
|
||||
|
@ -429,7 +429,7 @@ _e_smart_del(Evas_Object *obj)
|
|||
if (sd->idle_enter)
|
||||
ecore_idle_enterer_del(sd->idle_enter);
|
||||
if (sd->thumb_idler)
|
||||
ecore_timer_del(sd->thumb_idler);
|
||||
ecore_idle_enterer_del(sd->thumb_idler);
|
||||
if (sd->animator)
|
||||
ecore_animator_del(sd->animator);
|
||||
|
||||
|
@ -844,7 +844,7 @@ _clear_items(Evas_Object *obj)
|
|||
sd->queue = NULL;
|
||||
|
||||
if (sd->thumb_idler)
|
||||
ecore_timer_del(sd->thumb_idler);
|
||||
ecore_idle_enterer_del(sd->thumb_idler);
|
||||
sd->thumb_idler = NULL;
|
||||
|
||||
if (sd->selector)
|
||||
|
@ -1097,10 +1097,10 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
|
|||
Smart_Data *sd = evas_object_smart_data_get(v->span);
|
||||
Eina_List *l = NULL, *ll;
|
||||
Item *it = NULL;
|
||||
const Evry_State *s = v->state;
|
||||
const Evry_State *s;
|
||||
int slide;
|
||||
|
||||
if (!s->plugin)
|
||||
if (!sd || !(s = v->state) || !(s->plugin))
|
||||
return 0;
|
||||
|
||||
const char *key = ev->key;
|
||||
|
@ -1382,7 +1382,7 @@ _cb_item_changed(void *data, int type, void *event)
|
|||
sd->queue = eina_list_append(sd->queue, it);
|
||||
|
||||
if (!sd->thumb_idler)
|
||||
sd->thumb_idler = ecore_timer_add(0.01,_thumb_idler, sd);
|
||||
sd->thumb_idler = ecore_idle_enterer_add(_thumb_idler, sd);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -116,7 +116,7 @@ _tabs_update(Tab_View *v)
|
|||
v->timer = ecore_timer_add(0.1, _timer_cb, v);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* remove tabs for not active plugins */
|
||||
e_box_freeze(v->o_tabs);
|
||||
|
||||
|
@ -170,7 +170,7 @@ _tabs_update(Tab_View *v)
|
|||
o = tab->o_tab;
|
||||
evas_object_show(o);
|
||||
e_box_pack_end(v->o_tabs, o);
|
||||
|
||||
w++;
|
||||
if (eina_list_count(s->cur_plugins) == 2)
|
||||
e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5,
|
||||
w/4, 10, w/3, 9999);
|
||||
|
|
Loading…
Reference in New Issue