forked from enlightenment/enlightenment
'everything' module:
- fix possible segv in evry_plug_config - enabled main menu augmentation - smooth scrolling is back SVN revision: 41007
This commit is contained in:
parent
c988a0b808
commit
6dfaaf5f10
|
@ -49,6 +49,8 @@ e_modapi_init(E_Module *m)
|
||||||
E_CONFIG_VAL(D, T, height, INT);
|
E_CONFIG_VAL(D, T, height, INT);
|
||||||
E_CONFIG_VAL(D, T, rel_x, DOUBLE);
|
E_CONFIG_VAL(D, T, rel_x, DOUBLE);
|
||||||
E_CONFIG_VAL(D, T, rel_y, DOUBLE);
|
E_CONFIG_VAL(D, T, rel_y, DOUBLE);
|
||||||
|
E_CONFIG_VAL(D, T, scroll_animate, INT);
|
||||||
|
E_CONFIG_VAL(D, T, scroll_speed, DOUBLE);
|
||||||
E_CONFIG_LIST(D, T, sources, conf_item_edd);
|
E_CONFIG_LIST(D, T, sources, conf_item_edd);
|
||||||
#undef T
|
#undef T
|
||||||
#undef D
|
#undef D
|
||||||
|
@ -61,6 +63,8 @@ e_modapi_init(E_Module *m)
|
||||||
evry_conf->rel_y = 50.0;
|
evry_conf->rel_y = 50.0;
|
||||||
evry_conf->width = 400;
|
evry_conf->width = 400;
|
||||||
evry_conf->height = 350;
|
evry_conf->height = 350;
|
||||||
|
evry_conf->scroll_animate = 1;
|
||||||
|
evry_conf->scroll_speed = 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf_module = m;
|
conf_module = m;
|
||||||
|
@ -78,8 +82,11 @@ e_modapi_init(E_Module *m)
|
||||||
e_action_predef_name_set(_("Launch"), _("Run Everything Dialog"), "everything",
|
e_action_predef_name_set(_("Launch"), _("Run Everything Dialog"), "everything",
|
||||||
NULL, NULL, 0);
|
NULL, NULL, 0);
|
||||||
}
|
}
|
||||||
/* maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL); */
|
|
||||||
|
maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL);
|
||||||
|
|
||||||
e_module_delayed_set(m, 1);
|
e_module_delayed_set(m, 1);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,11 +94,11 @@ EAPI int
|
||||||
e_modapi_shutdown(E_Module *m)
|
e_modapi_shutdown(E_Module *m)
|
||||||
{
|
{
|
||||||
/* remove module-supplied menu additions */
|
/* remove module-supplied menu additions */
|
||||||
/* if (maug)
|
if (maug)
|
||||||
* {
|
{
|
||||||
* e_int_menus_menu_augmentation_del("main/1", maug);
|
e_int_menus_menu_augmentation_del("main/1", maug);
|
||||||
* maug = NULL;
|
maug = NULL;
|
||||||
* } */
|
}
|
||||||
/* remove module-supplied action */
|
/* remove module-supplied action */
|
||||||
if (act)
|
if (act)
|
||||||
{
|
{
|
||||||
|
@ -159,13 +166,13 @@ _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* menu item add hook */
|
/* menu item add hook */
|
||||||
/* static void
|
static void
|
||||||
* _e_mod_menu_add(void *data, E_Menu *m)
|
_e_mod_menu_add(void *data, E_Menu *m)
|
||||||
* {
|
{
|
||||||
* E_Menu_Item *mi;
|
E_Menu_Item *mi;
|
||||||
*
|
|
||||||
* mi = e_menu_item_new(m);
|
mi = e_menu_item_new(m);
|
||||||
* e_menu_item_label_set(mi, _("Run Command"));
|
e_menu_item_label_set(mi, _("Run Everything"));
|
||||||
* e_util_menu_item_theme_icon_set(mi, "system-run");
|
e_util_menu_item_theme_icon_set(mi, "system-run");
|
||||||
* e_menu_item_callback_set(mi, _e_mod_run_cb, NULL);
|
e_menu_item_callback_set(mi, _e_mod_run_cb, NULL);
|
||||||
* } */
|
}
|
||||||
|
|
|
@ -22,6 +22,9 @@ struct _Config
|
||||||
|
|
||||||
/* generic plugin config */
|
/* generic plugin config */
|
||||||
Eina_List *sources;
|
Eina_List *sources;
|
||||||
|
|
||||||
|
int scroll_animate;
|
||||||
|
double scroll_speed;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Source_Config
|
struct _Source_Config
|
||||||
|
|
|
@ -31,6 +31,9 @@ static void _evry_item_sel(Evry_Item *it);
|
||||||
static void _evry_item_remove(Evry_Item *it);
|
static void _evry_item_remove(Evry_Item *it);
|
||||||
static void _evry_action(int finished);
|
static void _evry_action(int finished);
|
||||||
static void _evry_cb_plugin_sel(void *data1, void *data2);
|
static void _evry_cb_plugin_sel(void *data1, void *data2);
|
||||||
|
static int _evry_animator(void *data);
|
||||||
|
static int _evry_scroll_timer(void *data);
|
||||||
|
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static E_Popup *popup = NULL;
|
static E_Popup *popup = NULL;
|
||||||
|
@ -42,19 +45,20 @@ static Evas_Object *o_toolbar = NULL;
|
||||||
static char *cmd_buf = NULL;
|
static char *cmd_buf = NULL;
|
||||||
static Eina_List *handlers = NULL;
|
static Eina_List *handlers = NULL;
|
||||||
static Ecore_Timer *update_timer = NULL;
|
static Ecore_Timer *update_timer = NULL;
|
||||||
static Eina_List *plugins = NULL;
|
|
||||||
static int plugin_count;
|
static Eina_List *sources = NULL;
|
||||||
static Evry_Plugin *cur_source;
|
|
||||||
static Eina_List *cur_sources = NULL;
|
static Eina_List *cur_sources = NULL;
|
||||||
|
static Evry_Plugin *cur_source;
|
||||||
|
|
||||||
static Evry_Item *item_selected = NULL;
|
static Evry_Item *item_selected = NULL;
|
||||||
static Evry_Item *item_mouseover = NULL;
|
static Evry_Item *item_mouseover = NULL;
|
||||||
|
|
||||||
static int ev_last_is_mouse;
|
static Ecore_Animator *scroll_animator = NULL;
|
||||||
/* static Ecore_Animator *animator = NULL; */
|
static Ecore_Timer *scroll_timer = NULL;
|
||||||
static double scroll_align_to;
|
static double scroll_align_to;
|
||||||
static double scroll_align;
|
static double scroll_align;
|
||||||
|
|
||||||
|
static int ev_last_is_mouse;
|
||||||
|
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
|
@ -74,14 +78,14 @@ evry_shutdown(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
evry_plugin_add(Evry_Plugin *plugin)
|
evry_plugin_add(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
plugins = eina_list_append(plugins, plugin);
|
sources = eina_list_append(sources, plugin);
|
||||||
/* TODO sorting, initialization, etc */
|
/* TODO sorting, initialization, etc */
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evry_plugin_remove(Evry_Plugin *plugin)
|
evry_plugin_remove(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
plugins = eina_list_remove(plugins, plugin);
|
sources = eina_list_remove(sources, plugin);
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,13 +199,23 @@ evry_hide(void)
|
||||||
ecore_timer_del(update_timer);
|
ecore_timer_del(update_timer);
|
||||||
update_timer = NULL;
|
update_timer = NULL;
|
||||||
}
|
}
|
||||||
|
if (scroll_timer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(scroll_timer);
|
||||||
|
scroll_timer = NULL;
|
||||||
|
}
|
||||||
|
if (scroll_animator)
|
||||||
|
{
|
||||||
|
ecore_animator_del(scroll_animator);
|
||||||
|
scroll_animator = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
evas_event_freeze(popup->evas);
|
evas_event_freeze(popup->evas);
|
||||||
_evry_matches_clear();
|
_evry_matches_clear();
|
||||||
e_popup_hide(popup);
|
e_popup_hide(popup);
|
||||||
|
|
||||||
e_box_freeze(o_list);
|
e_box_freeze(o_list);
|
||||||
EINA_LIST_FOREACH(plugins, l, plugin)
|
EINA_LIST_FOREACH(sources, l, plugin)
|
||||||
{
|
{
|
||||||
plugin->cleanup();
|
plugin->cleanup();
|
||||||
}
|
}
|
||||||
|
@ -542,13 +556,14 @@ _evry_matches_update()
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
int candidates;
|
int candidates;
|
||||||
|
int plugin_count = 0;
|
||||||
|
|
||||||
_evry_matches_clear();
|
_evry_matches_clear();
|
||||||
plugin_count = 0;
|
|
||||||
eina_list_free(cur_sources);
|
eina_list_free(cur_sources);
|
||||||
cur_sources = NULL;
|
cur_sources = NULL;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(plugins, l, plugin)
|
EINA_LIST_FOREACH(sources, l, plugin)
|
||||||
{
|
{
|
||||||
if (strlen(cmd_buf) == 0)
|
if (strlen(cmd_buf) == 0)
|
||||||
{
|
{
|
||||||
|
@ -609,7 +624,7 @@ _evry_matches_clear(void)
|
||||||
|
|
||||||
_evry_list_clear();
|
_evry_list_clear();
|
||||||
|
|
||||||
EINA_LIST_FOREACH(plugins, l, plugin)
|
EINA_LIST_FOREACH(sources, l, plugin)
|
||||||
plugin->cleanup();
|
plugin->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,19 +662,18 @@ _evry_scroll_to(int i)
|
||||||
if (n > 1)
|
if (n > 1)
|
||||||
{
|
{
|
||||||
scroll_align_to = (double)i / (double)(n - 1);
|
scroll_align_to = (double)i / (double)(n - 1);
|
||||||
/* if (e_config->everything_scroll_animate)
|
if (evry_conf->scroll_animate)
|
||||||
* {
|
{
|
||||||
* eap_scroll_to = 1;
|
if (!scroll_timer)
|
||||||
* if (!eap_scroll_timer)
|
scroll_timer = ecore_timer_add(0.01, _evry_scroll_timer, NULL);
|
||||||
* eap_scroll_timer = ecore_timer_add(0.01, _evry_eap_scroll_timer, NULL);
|
if (!scroll_animator)
|
||||||
* if (!animator)
|
scroll_animator = ecore_animator_add(_evry_animator, NULL);
|
||||||
* animator = ecore_animator_add(_evry_animator, NULL);
|
}
|
||||||
* }
|
else
|
||||||
* else */
|
{
|
||||||
{
|
scroll_align = scroll_align_to;
|
||||||
scroll_align = scroll_align_to;
|
e_box_align_set(o_list, 0.5, 1.0 - scroll_align);
|
||||||
e_box_align_set(o_list, 0.5, 1.0 - scroll_align);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
e_box_align_set(o_list, 0.5, 1.0);
|
e_box_align_set(o_list, 0.5, 1.0);
|
||||||
|
@ -784,7 +798,7 @@ _evry_plugin_prev(void)
|
||||||
|
|
||||||
if (!cur_source) return;
|
if (!cur_source) return;
|
||||||
|
|
||||||
l = eina_list_data_find_list(plugins, cur_source);
|
l = eina_list_data_find_list(cur_sources, cur_source);
|
||||||
|
|
||||||
if (l && l->prev)
|
if (l && l->prev)
|
||||||
{
|
{
|
||||||
|
@ -801,3 +815,37 @@ _evry_plugin_prev(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_evry_scroll_timer(void *data)
|
||||||
|
{
|
||||||
|
if (scroll_animator)
|
||||||
|
{
|
||||||
|
double spd;
|
||||||
|
|
||||||
|
spd = evry_conf->scroll_speed;
|
||||||
|
scroll_align = (scroll_align * (1.0 - spd)) + (scroll_align_to * spd);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
scroll_timer = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_evry_animator(void *data)
|
||||||
|
{
|
||||||
|
double da;
|
||||||
|
int scroll_to = 1;
|
||||||
|
|
||||||
|
da = scroll_align - scroll_align_to;
|
||||||
|
if (da < 0.0) da = -da;
|
||||||
|
if (da < 0.01)
|
||||||
|
{
|
||||||
|
scroll_align = scroll_align_to;
|
||||||
|
scroll_to = 0;
|
||||||
|
}
|
||||||
|
e_box_align_set(o_list, 0.5, 1.0 - scroll_align);
|
||||||
|
if (scroll_to) return 1;
|
||||||
|
scroll_animator = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,6 @@ _evry_plug_config_action(Evry_Item *item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("path: %s\n", buf);
|
|
||||||
|
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
e_configure_registry_call(buf, con, NULL);
|
e_configure_registry_call(buf, con, NULL);
|
||||||
|
|
||||||
|
@ -140,7 +137,7 @@ static void
|
||||||
_evry_plug_config_item_icon_get(Evry_Item *it, Evas *e)
|
_evry_plug_config_item_icon_get(Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
E_Configure_It *eci = it->data;
|
E_Configure_It *eci = it->data;
|
||||||
Evas_Object *o;
|
Evas_Object *o = NULL;
|
||||||
|
|
||||||
if (eci->icon)
|
if (eci->icon)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue