forked from enlightenment/enlightenment
'everything' module: start of config dialog
- fix segv possible segv when popping a state from action-seletor SVN revision: 41254
This commit is contained in:
parent
00819897b6
commit
a0048ff897
|
@ -21,7 +21,8 @@ pkg_LTLIBRARIES = module.la
|
|||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h \
|
||||
evry.c \
|
||||
evry.h \
|
||||
evry.h \
|
||||
evry_config.c \
|
||||
evry_plug_config.c \
|
||||
evry_plug_dir_browse.c \
|
||||
evry_plug_apps.c \
|
||||
|
|
|
@ -10,7 +10,7 @@ static int _e_mod_run_defer_cb(void *data);
|
|||
static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _e_mod_menu_add(void *data, E_Menu *m);
|
||||
|
||||
static E_Module *conf_module = NULL;
|
||||
/* static E_Module *conf_module = NULL; */
|
||||
static E_Action *act = NULL;
|
||||
static E_Int_Menu_Augmentation *maug = NULL;
|
||||
|
||||
|
@ -67,7 +67,9 @@ e_modapi_init(E_Module *m)
|
|||
evry_conf->scroll_speed = 0.5;
|
||||
}
|
||||
|
||||
conf_module = m;
|
||||
evry_conf->scroll_speed = 0.08;
|
||||
|
||||
/* conf_module = m; */
|
||||
evry_init();
|
||||
|
||||
evry_plug_config_init();
|
||||
|
@ -89,6 +91,9 @@ e_modapi_init(E_Module *m)
|
|||
|
||||
maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL);
|
||||
|
||||
e_configure_registry_category_add("advanced", 80, _("Advanced"), NULL, "preferences-advanced");
|
||||
e_configure_registry_item_add("advanced/run_everything", 40, _("Run Everything"), NULL, "system-run", evry_config_dialog);
|
||||
|
||||
e_module_delayed_set(m, 1);
|
||||
|
||||
return m;
|
||||
|
@ -97,6 +102,8 @@ e_modapi_init(E_Module *m)
|
|||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
/* remove module-supplied menu additions */
|
||||
if (maug)
|
||||
{
|
||||
|
@ -120,7 +127,11 @@ e_modapi_shutdown(E_Module *m)
|
|||
evry_plug_calc_shutdown();
|
||||
|
||||
evry_shutdown();
|
||||
conf_module = NULL;
|
||||
/* conf_module = NULL; */
|
||||
|
||||
while ((cfd = e_config_dialog_get("E", "_config_everything_dialog"))) e_object_del(E_OBJECT(cfd));
|
||||
e_configure_registry_item_del("advanced/run_everything");
|
||||
e_configure_registry_category_del("advanced");
|
||||
|
||||
/* Clean EET */
|
||||
E_CONFIG_DD_FREE(conf_item_edd);
|
||||
|
|
|
@ -35,6 +35,8 @@ struct _Source_Config
|
|||
|
||||
/* minimum input chars to query this source */
|
||||
int min_query;
|
||||
|
||||
int priority;
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,6 +47,9 @@ EAPI void *e_modapi_init (E_Module *m);
|
|||
EAPI int e_modapi_shutdown (E_Module *m);
|
||||
EAPI int e_modapi_save (E_Module *m);
|
||||
|
||||
EAPI E_Config_Dialog *evry_config_dialog(E_Container *con, const char *params);
|
||||
|
||||
|
||||
EAPI int evry_plug_apps_init(void);
|
||||
EAPI int evry_plug_apps_shutdown(void);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ static void _evry_update(void);
|
|||
static void _evry_list_clear(void);
|
||||
static void _evry_show_items(Evry_Plugin *plugin);
|
||||
static int _evry_update_timer(void *data);
|
||||
static void _evry_matches_update(void);
|
||||
static void _evry_matches_update(Evry_Plugin *cur_plugin);
|
||||
static void _evry_clear(void);
|
||||
static void _evry_item_next(void);
|
||||
static void _evry_item_prev(void);
|
||||
|
@ -449,7 +449,7 @@ _evry_push_state(void)
|
|||
ev_last_is_mouse = 0;
|
||||
item_mouseover = NULL;
|
||||
|
||||
_evry_matches_update();
|
||||
_evry_matches_update(s->cur_plugin);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -457,12 +457,17 @@ _evry_push_state(void)
|
|||
static int
|
||||
_evry_pop_state(void)
|
||||
{
|
||||
Evry_State *s = cur_state;
|
||||
Evry_State *s, *last_state;
|
||||
Evry_Plugin *p;
|
||||
Eina_List *l;
|
||||
|
||||
if (!stack || !stack->next) return 0;
|
||||
|
||||
s = cur_state;
|
||||
|
||||
stack = eina_list_remove_list(stack, stack);
|
||||
last_state = stack->data;
|
||||
|
||||
_evry_list_clear();
|
||||
|
||||
free(s->input);
|
||||
|
@ -472,22 +477,14 @@ _evry_pop_state(void)
|
|||
|
||||
E_FREE(s);
|
||||
|
||||
stack = eina_list_remove_list(stack, stack);
|
||||
|
||||
if (stack)
|
||||
{
|
||||
Evry_Item *it = NULL;
|
||||
int i = 0;
|
||||
|
||||
s = stack->data;
|
||||
s = last_state;
|
||||
cur_state = s;
|
||||
|
||||
if (s->cur_plugin && s->cur_plugin == action_selector)
|
||||
{
|
||||
_evry_pop_state();
|
||||
return 0;
|
||||
}
|
||||
|
||||
edje_object_part_text_set(o_main, "e.text.label", s->input);
|
||||
|
||||
if (s->sel_item)
|
||||
|
@ -509,7 +506,9 @@ _evry_pop_state(void)
|
|||
if (p != s->cur_plugin && p->begin)
|
||||
p->begin(it);
|
||||
|
||||
_evry_matches_update();
|
||||
p = s->cur_plugin;
|
||||
s->cur_plugin = NULL;
|
||||
_evry_matches_update(p);
|
||||
|
||||
it = eina_list_nth(s->cur_plugin->items, i);
|
||||
|
||||
|
@ -784,7 +783,7 @@ _evry_update(void)
|
|||
static int
|
||||
_evry_update_timer(void *data)
|
||||
{
|
||||
_evry_matches_update();
|
||||
_evry_matches_update(cur_state->cur_plugin);
|
||||
update_timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -870,6 +869,19 @@ _evry_show_items(Evry_Plugin *p)
|
|||
s->cur_plugin = p;
|
||||
s->cur_items = p->items;
|
||||
|
||||
if (scroll_timer)
|
||||
{
|
||||
ecore_timer_del(scroll_timer);
|
||||
scroll_timer = NULL;
|
||||
}
|
||||
if (scroll_animator)
|
||||
{
|
||||
ecore_animator_del(scroll_animator);
|
||||
scroll_animator = NULL;
|
||||
}
|
||||
|
||||
scroll_align = 0;
|
||||
|
||||
evas_event_freeze(popup->evas);
|
||||
e_box_freeze(o_list);
|
||||
|
||||
|
@ -922,7 +934,7 @@ _evry_show_items(Evry_Plugin *p)
|
|||
}
|
||||
|
||||
static void
|
||||
_evry_matches_update(void)
|
||||
_evry_matches_update(Evry_Plugin *cur_plugin)
|
||||
{
|
||||
Evry_Plugin *p;
|
||||
Eina_List *l;
|
||||
|
@ -946,7 +958,11 @@ _evry_matches_update(void)
|
|||
{
|
||||
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
||||
}
|
||||
else if (p->tab)
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(plugins, l, p)
|
||||
{
|
||||
if (p->tab && !eina_list_data_find(s->cur_plugins, p))
|
||||
{
|
||||
evas_object_del(p->tab);
|
||||
p->tab = NULL;
|
||||
|
@ -958,8 +974,8 @@ _evry_matches_update(void)
|
|||
|
||||
if (s->cur_plugins)
|
||||
{
|
||||
if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin))
|
||||
_evry_show_items(s->cur_plugin);
|
||||
if (cur_plugin && eina_list_data_find(s->cur_plugins, cur_plugin))
|
||||
_evry_show_items(cur_plugin);
|
||||
else
|
||||
_evry_show_items(s->cur_plugins->data);
|
||||
}
|
||||
|
@ -1213,7 +1229,6 @@ _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;
|
||||
|
@ -1226,7 +1241,7 @@ static int
|
|||
_evry_animator(void *data)
|
||||
{
|
||||
double da;
|
||||
int scroll_to = 1;
|
||||
Eina_Bool scroll_to = 1;
|
||||
|
||||
da = scroll_align - scroll_align_to;
|
||||
if (da < 0.0) da = -da;
|
||||
|
@ -1333,6 +1348,8 @@ _evry_plug_act_select_fetch(const char *input)
|
|||
Evry_Action *act;
|
||||
Eina_List *l;
|
||||
|
||||
if (p->items) return 1;
|
||||
|
||||
EINA_LIST_FOREACH(actions, l, act)
|
||||
{
|
||||
Evry_Item *it;
|
||||
|
@ -1377,6 +1394,12 @@ _evry_plug_act_select_cleanup(void)
|
|||
cur_state->cur_actions = NULL;
|
||||
|
||||
p->items = NULL;
|
||||
|
||||
if (p->tab)
|
||||
{
|
||||
evas_object_del(p->tab);
|
||||
p->tab = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "e_mod_main.h"
|
||||
#include "evry.h"
|
||||
|
||||
/* typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data; */
|
||||
|
||||
static void *_create_data (E_Config_Dialog *cfd);
|
||||
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
|
@ -11,27 +12,14 @@ static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas,
|
|||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
/* Basic */
|
||||
int max_exe_list;
|
||||
int max_eap_list;
|
||||
int max_hist_list;
|
||||
int width, height;
|
||||
|
||||
int scroll_animate;
|
||||
/* Advanced */
|
||||
double scroll_speed;
|
||||
double pos_align_x;
|
||||
double pos_align_y;
|
||||
double pos_size_w;
|
||||
double pos_size_h;
|
||||
int pos_min_w;
|
||||
int pos_min_h;
|
||||
int pos_max_w;
|
||||
int pos_max_h;
|
||||
char *term_cmd;
|
||||
};
|
||||
|
||||
|
||||
E_Config_Dialog *
|
||||
e_int_config_exebuf(E_Container *con, const char *params __UNUSED__)
|
||||
EAPI E_Config_Dialog *
|
||||
evry_config_dialog(E_Container *con, const char *params __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
@ -55,23 +43,9 @@ e_int_config_exebuf(E_Container *con, const char *params __UNUSED__)
|
|||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
/* Basic */
|
||||
cfdata->max_exe_list = e_config->exebuf_max_exe_list;
|
||||
cfdata->max_eap_list = e_config->exebuf_max_eap_list;
|
||||
cfdata->max_hist_list = e_config->exebuf_max_hist_list;
|
||||
cfdata->scroll_animate = e_config->exebuf_scroll_animate;
|
||||
/* Advanced */
|
||||
cfdata->scroll_speed = e_config->exebuf_scroll_speed;
|
||||
cfdata->pos_align_x = e_config->exebuf_pos_align_x;
|
||||
cfdata->pos_align_y = e_config->exebuf_pos_align_y;
|
||||
cfdata->pos_size_w = e_config->exebuf_pos_size_w;
|
||||
cfdata->pos_size_h = e_config->exebuf_pos_size_h;
|
||||
cfdata->pos_min_w = e_config->exebuf_pos_min_w;
|
||||
cfdata->pos_min_h = e_config->exebuf_pos_min_h;
|
||||
cfdata->pos_max_w = e_config->exebuf_pos_max_w;
|
||||
cfdata->pos_max_h = e_config->exebuf_pos_max_h;
|
||||
if (e_config->exebuf_term_cmd)
|
||||
cfdata->term_cmd = strdup(e_config->exebuf_term_cmd);
|
||||
cfdata->scroll_animate = evry_conf->scroll_animate;
|
||||
cfdata->height = evry_conf->height;
|
||||
cfdata->width = evry_conf->width;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -87,19 +61,16 @@ _create_data(E_Config_Dialog *cfd)
|
|||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
scroll_list = eina_list_free(scroll_list);
|
||||
|
||||
E_FREE(cfdata->term_cmd);
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
e_config->exebuf_max_exe_list = cfdata->max_exe_list;
|
||||
e_config->exebuf_max_eap_list = cfdata->max_eap_list;
|
||||
e_config->exebuf_max_hist_list = cfdata->max_hist_list;
|
||||
e_config->exebuf_scroll_animate = cfdata->scroll_animate;
|
||||
evry_conf->width = cfdata->width;
|
||||
evry_conf->height = cfdata->height;
|
||||
evry_conf->scroll_animate = cfdata->scroll_animate;
|
||||
|
||||
e_config_save_queue();
|
||||
return 1;
|
||||
}
|
||||
|
@ -112,17 +83,14 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
o = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("General Settings"), 0);
|
||||
ob = e_widget_label_add(evas, _("Maximum Number of Matched Apps to List"));
|
||||
ob = e_widget_label_add(evas, _("Popup Width"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 50, 5, 0, NULL, &(cfdata->max_eap_list), 200);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 300, 800, 5, 0, NULL, &(cfdata->width), 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_label_add(evas, _("Maximum Number of Matched Exes to List"));
|
||||
|
||||
ob = e_widget_label_add(evas, _("Popup Height"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 50, 5, 0, NULL, &(cfdata->max_exe_list), 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_label_add(evas, _("Maximum History to List"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 200, 5, 0, NULL, &(cfdata->max_hist_list), 200);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 200, 800, 5, 0, NULL, &(cfdata->height), 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
|
|
Loading…
Reference in New Issue